diff --git a/Makefile b/Makefile index 3d033115d5..a84cf70f22 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ endif REPOSITORY_BRANCH := "$(shell git rev-parse --abbrev-ref HEAD)" BUILD_TIMESTAMP ?= $(shell date '+%Y-%m-%dT%H:%M:%S') -SOROBAN_PORT?=8000 +STELLAR_PORT?=8000 # The following works around incompatibility between the rust and the go linkers - # the rust would generate an object file with min-version of 13.0 where-as the go @@ -52,7 +52,7 @@ test: build-test cargo test --workspace --exclude soroban-test --features additional-libs cargo test -p soroban-test -- --skip integration:: -# expects a quickstart container running with the rpc exposed at localhost:SOROBAN_PORT +# expects a quickstart container running with the rpc exposed at localhost:STELLAR_PORT rpc-test: cargo test --features it --test it -- integration --test-threads=4 diff --git a/cmd/crates/soroban-test/src/lib.rs b/cmd/crates/soroban-test/src/lib.rs index b1381be806..2e10afc2da 100644 --- a/cmd/crates/soroban-test/src/lib.rs +++ b/cmd/crates/soroban-test/src/lib.rs @@ -131,13 +131,10 @@ impl TestEnv { } pub fn new() -> TestEnv { - if let Ok(rpc_url) = std::env::var("SOROBAN_RPC_URL") { - return Self::with_rpc_url(&rpc_url); - } if let Ok(rpc_url) = std::env::var("STELLAR_RPC_URL") { return Self::with_rpc_url(&rpc_url); } - let host_port = std::env::var("SOROBAN_PORT") + let host_port = std::env::var("STELLAR_PORT") .as_deref() .ok() .and_then(|n| n.parse().ok()) @@ -159,9 +156,9 @@ impl TestEnv { let mut cmd: Command = self.bin(); cmd.arg(subcommand) - .env("SOROBAN_ACCOUNT", TEST_ACCOUNT) - .env("SOROBAN_RPC_URL", &self.network.rpc_url) - .env("SOROBAN_NETWORK_PASSPHRASE", LOCAL_NETWORK_PASSPHRASE) + .env("STELLAR_ACCOUNT", TEST_ACCOUNT) + .env("STELLAR_RPC_URL", &self.network.rpc_url) + .env("STELLAR_NETWORK_PASSPHRASE", LOCAL_NETWORK_PASSPHRASE) .env("XDG_CONFIG_HOME", self.dir().join("config").as_os_str()) .env("XDG_DATA_HOME", self.data_dir().as_os_str()) .current_dir(self.dir()); diff --git a/cmd/crates/soroban-test/tests/it/config.rs b/cmd/crates/soroban-test/tests/it/config.rs index acea840aa6..97d30daa1b 100644 --- a/cmd/crates/soroban-test/tests/it/config.rs +++ b/cmd/crates/soroban-test/tests/it/config.rs @@ -200,7 +200,7 @@ fn use_env() { sandbox .new_assert_cmd("keys") .env( - "SOROBAN_SECRET_KEY", + "STELLAR_SECRET_KEY", "SDIY6AQQ75WMD4W46EYB7O6UYMHOCGQHLAQGQTKHDX4J2DYQCHVCQYFD", ) .arg("add") @@ -225,7 +225,7 @@ fn set_default_identity() { sandbox .new_assert_cmd("keys") .env( - "SOROBAN_SECRET_KEY", + "STELLAR_SECRET_KEY", "SC4ZPYELVR7S7EE7KZDZN3ETFTNQHHLTUL34NUAAWZG5OK2RGJ4V2U3Z", ) .arg("add") @@ -245,7 +245,7 @@ fn set_default_identity() { sandbox .new_assert_cmd("env") - .env_remove("SOROBAN_ACCOUNT") + .env_remove("STELLAR_ACCOUNT") .assert() .stdout(predicate::str::contains("STELLAR_ACCOUNT=alice")) .success(); diff --git a/cmd/crates/soroban-test/tests/it/integration/cookbook.rs b/cmd/crates/soroban-test/tests/it/integration/cookbook.rs index 656559652f..e810ba7f7e 100644 --- a/cmd/crates/soroban-test/tests/it/integration/cookbook.rs +++ b/cmd/crates/soroban-test/tests/it/integration/cookbook.rs @@ -135,7 +135,7 @@ fn run_command( let mut assert = sandbox .new_assert_cmd(&cmd) // Cookbook tests are responsible for setting a source account. - .env_remove("SOROBAN_ACCOUNT") + .env_remove("STELLAR_ACCOUNT") .args(&modified_args) .assert(); eprintln!("{}", assert.stderr_as_str()); diff --git a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs index efdb012176..526ff181a3 100644 --- a/cmd/crates/soroban-test/tests/it/integration/dotenv.rs +++ b/cmd/crates/soroban-test/tests/it/integration/dotenv.rs @@ -4,7 +4,7 @@ use super::util::deploy_hello; fn write_env_file(e: &TestEnv, contents: &str) { let env_file = e.dir().join(".env"); - let contents = format!("SOROBAN_CONTRACT_ID={contents}"); + let contents = format!("STELLAR_CONTRACT_ID={contents}"); std::fs::write(&env_file, &contents).unwrap(); assert_eq!(contents, std::fs::read_to_string(env_file).unwrap()); } @@ -33,7 +33,7 @@ async fn current_env_not_overwritten() { write_env_file(&e, &deploy_hello(&e).await); e.new_assert_cmd("contract") .env( - "SOROBAN_CONTRACT_ID", + "STELLAR_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", ) .arg("invoke") @@ -54,7 +54,7 @@ async fn cli_args_have_priority() { write_env_file(e, &id); e.new_assert_cmd("contract") .env( - "SOROBAN_CONTRACT_ID", + "STELLAR_CONTRACT_ID", "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", ) .arg("invoke") diff --git a/cmd/soroban-cli/src/cli.rs b/cmd/soroban-cli/src/cli.rs index 3ed58a7037..2a3b6f9a88 100644 --- a/cmd/soroban-cli/src/cli.rs +++ b/cmd/soroban-cli/src/cli.rs @@ -20,7 +20,11 @@ pub async fn main() { // Map SOROBAN_ env vars to STELLAR_ env vars for backwards compatibility // with the soroban-cli prior to when the stellar-cli was released. // - let vars = env_vars::unprefixed(); + let mut vars = env_vars::unprefixed(); + + // Manually add SECRET_KEY so it doesn't leak on `stellar env`. + vars.push("SECRET_KEY"); + for var in vars { let soroban_key = format!("SOROBAN_{var}"); let stellar_key = format!("STELLAR_{var}"); diff --git a/cmd/soroban-cli/src/commands/keys/add.rs b/cmd/soroban-cli/src/commands/keys/add.rs index 8537d76779..36cf899b42 100644 --- a/cmd/soroban-cli/src/commands/keys/add.rs +++ b/cmd/soroban-cli/src/commands/keys/add.rs @@ -82,7 +82,7 @@ impl Cmd { } fn read_secret(&self, print: &Print) -> Result { - if let Ok(secret_key) = std::env::var("SOROBAN_SECRET_KEY") { + if let Ok(secret_key) = std::env::var("STELLAR_SECRET_KEY") { Ok(Secret::SecretKey { secret_key }) } else if self.secrets.secure_store { let prompt = "Type a 12/24 word seed phrase:"; diff --git a/cmd/soroban-cli/src/config/locator.rs b/cmd/soroban-cli/src/config/locator.rs index c3ef280dad..0c16f9cb81 100644 --- a/cmd/soroban-cli/src/config/locator.rs +++ b/cmd/soroban-cli/src/config/locator.rs @@ -35,7 +35,7 @@ pub enum Error { HomeDirNotFound, #[error("Failed read current directory")] CurrentDirNotFound, - #[error("Failed read current directory and no SOROBAN_CONFIG_HOME is set")] + #[error("Failed read current directory and no STELLAR_CONFIG_HOME is set")] NoConfigEnvVar, #[error("Failed to create directory: {path:?}")] DirCreationFailed { path: PathBuf },