You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.
When I call declare on an implementation contract to be used with a proxy, if it was previously declared, register_class_hash currently raises an exception containing the hash in the message string.
To improve usability, I want a way to get the existing declaration's class hash (without having to parse the error message) so that it can be used afterwards.
Consider one of the following: 1. Use a custom error that contains the hash in a field, so that the caller of declare can catch the error and retrieve the hash
2. In declare, suppress the error if a class hash already exists, and just proceed to return with the existing class hash
3. In declare, suppress the error if a class hash already exists, and update the entry in the declaration file (e.g. if a different alias is provided)
4. In declare, have an optional flag such as update which allows it to do (3) only if the flag is set.
5. Provide a function similar to get_declaration, but takes a contract (rather than an alias) and returns the corresponding class hash.
The text was updated successfully, but these errors were encountered:
ericglau
changed the title
Raise custom exception when registering an existing class hash
Improve how declare handles an existing class hash
Sep 22, 2022
I prefer option (4) above, since an update flag would make declare easier to use in this scenario, and still retain the original error if an update is not desired.
When I call
declare
on an implementation contract to be used with a proxy, if it was previously declared,register_class_hash
currently raises an exception containing the hash in the message string.To improve usability, I want a way to get the existing declaration's class hash (without having to parse the error message) so that it can be used afterwards.
Consider one of the following:
1. Use a custom error that contains the hash in a field, so that the caller ofdeclare
can catch the error and retrieve the hash2. In
declare
, suppress the error if a class hash already exists, and just proceed to return with the existing class hash3. In
declare
, suppress the error if a class hash already exists, and update the entry in the declaration file (e.g. if a different alias is provided)4. In
declare
, have an optional flag such asupdate
which allows it to do (3) only if the flag is set.5. Provide a function similar to
get_declaration
, but takes a contract (rather than an alias) and returns the corresponding class hash.The text was updated successfully, but these errors were encountered: