diff --git a/crates/sncast/src/main.rs b/crates/sncast/src/main.rs index f7ec869b92..b958b09e8b 100644 --- a/crates/sncast/src/main.rs +++ b/crates/sncast/src/main.rs @@ -31,8 +31,8 @@ use starknet::core::types::ContractClass; use starknet::core::utils::get_selector_from_name; use starknet::providers::Provider; use starknet_commands::account::list::print_account_list; -use starknet_types_core::felt::Felt; use starknet_commands::verify::Verify; +use starknet_types_core::felt::Felt; use tokio::runtime::Runtime; mod starknet_commands; @@ -625,7 +625,7 @@ async fn run_async_command( let result = starknet_commands::verify::verify( verify.contract_address_or_class_hash.contract_address, verify.contract_address_or_class_hash.class_hash, - verify.class_name, + verify.contract_name, verify.verifier, verify.network, verify.confirm_verification, diff --git a/crates/sncast/src/starknet_commands/verify/base.rs b/crates/sncast/src/starknet_commands/verify/base.rs index c8ad43eec7..b2cdeb485c 100644 --- a/crates/sncast/src/starknet_commands/verify/base.rs +++ b/crates/sncast/src/starknet_commands/verify/base.rs @@ -71,12 +71,12 @@ pub trait VerificationInterface { workspace_dir: Utf8PathBuf, contract_address: Option, class_hash: Option, - class_name: String, + contract_name: String, ) -> Result { let file_data = read_workspace_files(workspace_dir)?; let source_code = serde_json::Value::Object(file_data); let payload = VerificationPayload { - class_name, + contract_name, contract_address, class_hash, source_code, @@ -88,7 +88,7 @@ pub trait VerificationInterface { #[derive(Serialize, Debug)] pub struct VerificationPayload { - pub class_name: String, + pub contract_name: String, pub contract_address: Option, pub class_hash: Option, pub source_code: serde_json::Value, diff --git a/crates/sncast/src/starknet_commands/verify/mod.rs b/crates/sncast/src/starknet_commands/verify/mod.rs index 11eb8f399e..8f380c9b73 100644 --- a/crates/sncast/src/starknet_commands/verify/mod.rs +++ b/crates/sncast/src/starknet_commands/verify/mod.rs @@ -34,9 +34,9 @@ pub struct Verify { #[clap(flatten)] pub contract_address_or_class_hash: ContractAddressOrClassHashGroup, - /// Class name of the contract to be verified. + /// Name of the contract that is being verified #[clap(short, long)] - pub class_name: String, + pub contract_name: String, /// Verification provider to be used #[clap(short, long, value_enum)] @@ -96,7 +96,7 @@ fn get_verifier( pub async fn verify( contract_address: Option, class_hash: Option, - class_name: String, + contract_name: String, verifier: Verifier, network: Network, confirm_verification: bool, @@ -116,8 +116,8 @@ pub async fn verify( } } - if !artifacts.contains_key(&class_name) { - return Err(anyhow!("Contract named '{class_name}' was not found")); + if !artifacts.contains_key(&contract_name) { + return Err(anyhow!("Contract named '{contract_name}' was not found")); } // Build JSON Payload for the verification request @@ -132,7 +132,7 @@ pub async fn verify( workspace_dir.to_path_buf(), contract_address, class_hash, - class_name, + contract_name, ) .await } diff --git a/crates/sncast/tests/e2e/verify/voyager.rs b/crates/sncast/tests/e2e/verify/voyager.rs index 87bf84cd22..909171b506 100644 --- a/crates/sncast/tests/e2e/verify/voyager.rs +++ b/crates/sncast/tests/e2e/verify/voyager.rs @@ -34,7 +34,7 @@ async fn test_happy_case() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "voyager", @@ -86,7 +86,7 @@ async fn test_happy_case_class_hash() { "verify", "--class-hash", MAP_CONTRACT_CLASS_HASH_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "voyager", @@ -138,7 +138,7 @@ async fn test_failed_verification() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "voyager", @@ -174,7 +174,7 @@ async fn test_verification_abort() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "nonexistent", "--verifier", "voyager", @@ -207,7 +207,7 @@ async fn test_wrong_contract_name_passed() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "nonexistent", "--verifier", "voyager", @@ -238,7 +238,7 @@ async fn test_no_class_hash_or_contract_address_provided() { "--accounts-file", ACCOUNT_FILE_PATH, "verify", - "--class-name", + "--contract-name", "Map", "--verifier", "voyager", @@ -257,7 +257,7 @@ async fn test_no_class_hash_or_contract_address_provided() { error: the following required arguments were not provided: <--contract-address |--class-hash > - Usage: sncast verify --class-name --verifier --network <--contract-address |--class-hash > + Usage: sncast verify --contract-name --verifier --network <--contract-address |--class-hash > For more information, try '--help'." ), @@ -276,7 +276,7 @@ async fn test_both_class_hash_or_contract_address_provided() { MAP_CONTRACT_ADDRESS_SEPOLIA, "--class-hash", MAP_CONTRACT_CLASS_HASH_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "voyager", @@ -293,7 +293,7 @@ async fn test_both_class_hash_or_contract_address_provided() { formatdoc!( r" error: the argument '--contract-address ' cannot be used with '--class-hash ' - Usage: sncast verify --class-name --verifier --network <--contract-address |--class-hash >" + Usage: sncast verify --contract-name --verifier --network <--contract-address |--class-hash >" ), ); } @@ -324,7 +324,7 @@ async fn test_happy_case_with_confirm_verification_flag() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "voyager", @@ -377,7 +377,7 @@ async fn test_happy_case_specify_package() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "supercomplexcode", "--verifier", "voyager", @@ -431,7 +431,7 @@ async fn test_worskpaces_package_specified_virtual_fibonacci() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "FibonacciContract", "--verifier", "voyager", @@ -469,7 +469,7 @@ async fn test_worskpaces_package_no_contract() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "nonexistent", "--verifier", "voyager", diff --git a/crates/sncast/tests/e2e/verify/walnut.rs b/crates/sncast/tests/e2e/verify/walnut.rs index 22496d84d2..a8e4fde404 100644 --- a/crates/sncast/tests/e2e/verify/walnut.rs +++ b/crates/sncast/tests/e2e/verify/walnut.rs @@ -34,7 +34,7 @@ async fn test_happy_case() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "walnut", @@ -86,7 +86,7 @@ async fn test_happy_case_class_hash() { "verify", "--class-hash", MAP_CONTRACT_CLASS_HASH_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "walnut", @@ -138,7 +138,7 @@ async fn test_failed_verification() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "walnut", @@ -174,7 +174,7 @@ async fn test_verification_abort() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "nonexistent", "--verifier", "walnut", @@ -207,7 +207,7 @@ async fn test_wrong_contract_name_passed() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "nonexistent", "--verifier", "walnut", @@ -238,7 +238,7 @@ async fn test_no_class_hash_or_contract_address_provided() { "--accounts-file", ACCOUNT_FILE_PATH, "verify", - "--class-name", + "--contract-name", "Map", "--verifier", "walnut", @@ -257,7 +257,7 @@ async fn test_no_class_hash_or_contract_address_provided() { error: the following required arguments were not provided: <--contract-address |--class-hash > - Usage: sncast verify --class-name --verifier --network <--contract-address |--class-hash > + Usage: sncast verify --contract-name --verifier --network <--contract-address |--class-hash > For more information, try '--help'." ), @@ -276,7 +276,7 @@ async fn test_both_class_hash_or_contract_address_provided() { MAP_CONTRACT_ADDRESS_SEPOLIA, "--class-hash", MAP_CONTRACT_CLASS_HASH_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "walnut", @@ -293,7 +293,7 @@ async fn test_both_class_hash_or_contract_address_provided() { formatdoc!( r" error: the argument '--contract-address ' cannot be used with '--class-hash ' - Usage: sncast verify --class-name --verifier --network <--contract-address |--class-hash >" + Usage: sncast verify --contract-name --verifier --network <--contract-address |--class-hash >" ), ); } @@ -324,7 +324,7 @@ async fn test_happy_case_with_confirm_verification_flag() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "Map", "--verifier", "walnut", @@ -377,7 +377,7 @@ async fn test_happy_case_specify_package() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "supercomplexcode", "--verifier", "walnut", @@ -431,7 +431,7 @@ async fn test_worskpaces_package_specified_virtual_fibonacci() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "FibonacciContract", "--verifier", "walnut", @@ -469,7 +469,7 @@ async fn test_worskpaces_package_no_contract() { "verify", "--contract-address", MAP_CONTRACT_ADDRESS_SEPOLIA, - "--class-name", + "--contract-name", "nonexistent", "--verifier", "walnut", diff --git a/design_documents/contract_verification.md b/design_documents/contract_verification.md index 982e28e0bf..a3440b27cb 100644 --- a/design_documents/contract_verification.md +++ b/design_documents/contract_verification.md @@ -26,7 +26,7 @@ The `verify` command will perform following actions: #### Parameters -#### `--class-name` +#### `--contract-name` Required. Name of the contract to be submitted for verification. diff --git a/docs/src/appendix/sncast/verify.md b/docs/src/appendix/sncast/verify.md index 2e45e289ca..0e284fcaf5 100644 --- a/docs/src/appendix/sncast/verify.md +++ b/docs/src/appendix/sncast/verify.md @@ -13,7 +13,7 @@ Conflicts with: `--contract-address` The class hash of the contract that is to be verified. -## `--class-name ` +## `--contract-name ` Required. The name of the contract class. The contract name is the part after the `mod` keyword in your contract file. diff --git a/docs/src/starknet/verify.md b/docs/src/starknet/verify.md index 174c78a0a3..7e6e672c6b 100644 --- a/docs/src/starknet/verify.md +++ b/docs/src/starknet/verify.md @@ -31,7 +31,7 @@ Then run: $ sncast \ verify \ --contract-address 0x8448a68b5ea1affc45e3fd4b8b480ea36a51dc34e337a16d2567d32d0c6f8b \ - --class-name SimpleBalance \ + --contract-name SimpleBalance \ --verifier walnut \ --network sepolia