diff --git a/forc-plugins/forc-client/src/cmd/deploy.rs b/forc-plugins/forc-client/src/cmd/deploy.rs index 65835fa0e6e..8313b466675 100644 --- a/forc-plugins/forc-client/src/cmd/deploy.rs +++ b/forc-plugins/forc-client/src/cmd/deploy.rs @@ -29,10 +29,10 @@ pub struct Command { /// --salt contract_b:0x0000000000000000000000000000000000000000000000000000000000000002 #[clap(long)] pub salt: Option>, - /// Generate a random salt for the contract. - /// Useful for testing or deploying examples to a shared network. + /// Generate a default salt (0x0000000000000000000000000000000000000000000000000000000000000000) for the contract. + /// Useful for CI, to create reproducable deployments. #[clap(long)] - pub random_salt: bool, + pub default_salt: bool, #[clap(flatten)] pub build_output: BuildOutput, #[clap(flatten)] diff --git a/forc-plugins/forc-client/src/op/deploy.rs b/forc-plugins/forc-client/src/op/deploy.rs index 9e504e7dcb7..3510349bba1 100644 --- a/forc-plugins/forc-client/src/op/deploy.rs +++ b/forc-plugins/forc-client/src/op/deploy.rs @@ -131,7 +131,7 @@ pub async fn deploy(command: cmd::Deploy) -> Result> { .check_program_type(vec![TreeType::Contract]) .is_ok() { - let salt = match (&contract_salt_map, command.random_salt) { + let salt = match (&contract_salt_map, command.default_salt) { (Some(map), false) => { if let Some(salt) = map.get(pkg.descriptor.manifest_file.project_name()) { *salt @@ -139,10 +139,10 @@ pub async fn deploy(command: cmd::Deploy) -> Result> { Default::default() } } - (None, true) => rand::random(), - (None, false) => Default::default(), + (None, true) => Default::default(), + (None, false) => rand::random(), (Some(_), true) => { - bail!("Both `--salt` and `--random-salt` were specified: must choose one") + bail!("Both `--salt` and `--default-salt` were specified: must choose one") } }; let contract_id = diff --git a/test/src/e2e_vm_tests/harness.rs b/test/src/e2e_vm_tests/harness.rs index c4e796cf48c..8dd14020ff1 100644 --- a/test/src/e2e_vm_tests/harness.rs +++ b/test/src/e2e_vm_tests/harness.rs @@ -72,6 +72,7 @@ pub(crate) async fn deploy_contract(file_name: &str, run_config: &RunConfig) -> ..Default::default() }, signing_key: Some(SecretKey::from_str(SECRET_KEY).unwrap()), + default_salt: true, ..Default::default() }) .await