-
Notifications
You must be signed in to change notification settings - Fork 208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for the verification with class hash #2906
base: master
Are you sure you want to change the base?
Support for the verification with class hash #2906
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add tests for new logic
Hi @kkawula, thanks for your comments! I have addressed them. Additionally, I have removed the "Verify contract" section from sncast/README.md due to a failed test (changing the --network parameter to --url "http://127.0.0.1:5055"), as Walnut does not support the --url parameter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an entry in CHANGELOG.md
Hey @kkawula, thanks for your comments. I added entry to the |
Hey @kkawula, I’ve updated my changes with the latest changes from the master branch. Let me know if there’s anything else needed. |
@@ -45,7 +45,7 @@ $ sncast \ | |||
Are you sure you want to proceed? (Y/n): Y | |||
|
|||
command: verify | |||
message: Contract verification has started. You can check the verification status at the following link: https://api.walnut.dev/v1/verification/77f1d905-fdb4-4280-b7d6-57cd029d1259/status. | |||
message: Contract verification has started. You can check the verification status at the following link: https://app.walnut.dev/verification/status/77f1d905-fdb4-4280-b7d6-57cd029d1259. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit but maybe let's update the link so it shows the verification of the class hash 0x0227f52a4d2138816edf8231980d5f9e6e0c8a3deab45b601a1fcee3d4427b02
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/// Class hash of a contract to be verified | ||
#[clap(short = 'g', long)] | ||
pub class_hash: Option<Felt>, | ||
|
||
/// Address of a contract to be verified | ||
#[clap(short = 'd', long)] | ||
pub contract_address: Felt, | ||
pub contract_address: Option<Felt>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of these being required should be handled on clap level, please change class_hash
and contract_address
to an ArgGroup with required = true
, see this
#[group(required = false, multiple = false)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I have added ArgGroup!
impl Verify { | ||
pub fn validate(&self) -> Result<()> { | ||
if self.class_hash.is_none() && self.contract_address.is_none() { | ||
return Err(anyhow!( | ||
"You must provide either --class-hash or --contract-address." | ||
)); | ||
} | ||
Ok(()) | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be removed after ArgGroup
is correctly used
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have removed this one!
class_hash: Option<String>, | ||
contract_address: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have an api reference for these somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
class_hash: Option<Felt>, | ||
contract_address: Option<Felt>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we represent this as an enum?
enum ContractIdentifier {
ClassHash(Felt),
Address(Felt)
}
This way compiler ensures this function is called with value that isn't None
and you can simply match
in the logic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, added enum!
Hi @cptartur , thanks for your comments! I have addressed them and update my branch so it's up to date with master. |
Closes #2668
Introduced changes
This PR adds support for
sncast verify --verifier walnut
to use class hash.Checklist
CHANGELOG.md