From 61ab749d7ed1cd91e7ab8e06f9e9833994e7ab4a Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 27 Mar 2025 17:34:08 -0400 Subject: [PATCH 01/28] Add keys integration tests --- .../soroban-test/tests/it/integration/keys.rs | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/cmd/crates/soroban-test/tests/it/integration/keys.rs b/cmd/crates/soroban-test/tests/it/integration/keys.rs index 28723b3a12..273e365e85 100644 --- a/cmd/crates/soroban-test/tests/it/integration/keys.rs +++ b/cmd/crates/soroban-test/tests/it/integration/keys.rs @@ -33,6 +33,23 @@ async fn fund() { .success(); } +#[tokio::test] +async fn secret() { + let sandbox = &TestEnv::new(); + sandbox + .new_assert_cmd("keys") + .arg("generate") + .arg("test2") + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .arg("secret") + .arg("test2") + .assert() + .success(); +} + #[tokio::test] #[allow(clippy::too_many_lines)] async fn overwrite_identity() { @@ -73,3 +90,37 @@ async fn overwrite_identity() { assert_ne!(initial_pubkey, pubkey_for_identity(sandbox, "test2")); } + +#[tokio::test] +async fn secret_with_secure_store_key() { + let sandbox = &TestEnv::new(); + sandbox + .new_assert_cmd("keys") + .args(["generate", "test2", "--secure-store"]) + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .arg("secret") + .arg("test2") + .assert() + .stderr(predicate::str::contains("does not reveal secret key")) + .failure(); +} + +#[tokio::test] +async fn public_key_with_secure_store_key() { + let sandbox = &TestEnv::new(); + sandbox + .new_assert_cmd("keys") + .args(["generate", "test2", "--secure-store"]) + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .arg("public-key") + .arg("test2") + .assert() + .stdout(predicate::str::contains("G")) + .success(); +} \ No newline at end of file From 64ccc1a6e1f0e8e9f19c7dd54b49a54e1a428f7e Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:25:25 -0400 Subject: [PATCH 02/28] Test creating a new account and signing with secure store key --- .../soroban-test/tests/it/integration/tx.rs | 1 + .../tests/it/integration/tx/secure_store.rs | 109 ++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs diff --git a/cmd/crates/soroban-test/tests/it/integration/tx.rs b/cmd/crates/soroban-test/tests/it/integration/tx.rs index 1863e7b2e7..742300ebbb 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx.rs @@ -5,6 +5,7 @@ use soroban_test::{AssertExt, TestEnv}; use crate::integration::util::{deploy_contract, DeployKind, DeployOptions, HELLO_WORLD}; pub mod operations; +pub mod secure_store; #[tokio::test] async fn simulate() { diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs new file mode 100644 index 0000000000..5779e4c3b7 --- /dev/null +++ b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs @@ -0,0 +1,109 @@ +use soroban_cli::{ + config::locator, + tx::{builder, ONE_XLM}, + utils::contract_id_hash_from_asset, + xdr::{self, ReadXdr, SequenceNumber}, +}; +use soroban_rpc::LedgerEntryResult; +use soroban_test::{AssertExt, TestEnv}; +use predicates::prelude::predicate; +use crate::integration::{ + hello_world::invoke_hello_world, + util::{deploy_contract, DeployOptions, HELLO_WORLD}, + tx::build_sim_sign_send +}; +use soroban_cli::signer::keyring::keyring_mock; + +pub fn test_address(sandbox: &TestEnv) -> String { + sandbox + .new_assert_cmd("keys") + .arg("address") + .arg("test") + .assert() + .success() + .stdout_as_str() +} + +fn new_account(sandbox: &TestEnv, name: &str) -> String { + sandbox.generate_account(name, None).assert().success(); + sandbox + .new_assert_cmd("keys") + .args(["address", name]) + .assert() + .success() + .stdout_as_str() +} + +fn gen_account_no_fund(sandbox: &TestEnv, name: &str) -> String { + sandbox + .new_assert_cmd("keys") + .args(["generate", "--no-fund", name]) + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .args(["address", name]) + .assert() + .success() + .stdout_as_str() +} + +// todo: move these functions to utils for reusability +// returns test and test1 addresses +fn setup_accounts(sandbox: &TestEnv) -> (String, String) { + (test_address(sandbox), new_account(sandbox, "test1")) +} + +fn secure_store_key(sandbox: &TestEnv, name: &str) -> String { + sandbox + .new_assert_cmd("keys") + .args(["generate", "--fund", "--secure-store", name]) + .assert() + .success() + .stdout_as_str(); + + sandbox + .new_assert_cmd("keys") + .args(["address", name]) + .assert() + .success() + .stdout_as_str() +} + + +// test that we can create a create-account tx and sign it with a secure-store key +#[tokio::test] +async fn create_account() { + let sandbox = &TestEnv::new(); + let secure_store_address = secure_store_key(sandbox, "secure-store"); + + sandbox + .new_assert_cmd("keys") + .args(["generate", "--no-fund", "new"]) + .assert() + .success(); + let new_address = sandbox + .new_assert_cmd("keys") + .args(["address", "new"]) + .assert() + .success() + .stdout_as_str(); + + let starting_balance = ONE_XLM * 100; + sandbox + .new_assert_cmd("tx") + .args([ + "new", + "create-account", + "--destination", + new_address.as_str(), + "--starting-balance", + starting_balance.to_string().as_str(), + "--source", + "secure-store", + ]) + .assert() + .success() + .stdout_as_str(); + +} \ No newline at end of file From 74fb8a3289d39997becbb54fa264721ae3845767 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:35:16 -0400 Subject: [PATCH 03/28] WIP: create a StellarEntry::new impl for ledger-tests --- cmd/soroban-cli/Cargo.toml | 1 + cmd/soroban-cli/src/signer/keyring.rs | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index 3d886fb5bf..b6ba7603df 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -40,6 +40,7 @@ version_lt_23 = [] version_gte_23 = [] opt = ["dep:wasm-opt"] emulator-tests = ["stellar-ledger/emulator-tests"] +ledger-tests = [] [dependencies] stellar-xdr = { workspace = true, features = ["cli"] } diff --git a/cmd/soroban-cli/src/signer/keyring.rs b/cmd/soroban-cli/src/signer/keyring.rs index 7dda2e795a..1cbb1ae8d8 100644 --- a/cmd/soroban-cli/src/signer/keyring.rs +++ b/cmd/soroban-cli/src/signer/keyring.rs @@ -19,9 +19,25 @@ pub struct StellarEntry { } impl StellarEntry { + #[cfg(not(feature = "ledger-tests"))] pub fn new(name: &str) -> Result { Ok(StellarEntry { - keyring: Entry::new(name, &whoami::username())?, + keyring: Entry::new(name, &whoami::username())? + }) + } + + #[cfg(feature = "ledger-tests")] + pub fn new(name: &str) -> Result { + use keyring::mock::{self, MockCredential}; + let test_phrase: &str = + "depth decade power loud smile spatial sign movie judge february rate broccoli"; + keyring_mock::set_default_credential_builder(keyring_mock::mock::default_credential_builder()); + let entry = Entry::new(name, &whoami::username())?; + let mock: &MockCredential = entry.get_credential().downcast_ref().unwrap(); + entry.set_password(test_phrase); + + Ok(StellarEntry { + keyring: entry, }) } @@ -86,6 +102,10 @@ impl StellarEntry { } } +pub mod keyring_mock { + pub use keyring::{mock, set_default_credential_builder}; +} + #[cfg(test)] mod test { use super::*; From b8a4dd3203e7cdb5cbbcec6ba2b245b739766aa1 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:36:51 -0400 Subject: [PATCH 04/28] Use Secret's signer fn to get the signer instead of creating one using the signing key --- cmd/soroban-cli/src/config/mod.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cmd/soroban-cli/src/config/mod.rs b/cmd/soroban-cli/src/config/mod.rs index 41076d05a4..7666547ed3 100644 --- a/cmd/soroban-cli/src/config/mod.rs +++ b/cmd/soroban-cli/src/config/mod.rs @@ -89,12 +89,10 @@ impl Args { #[allow(clippy::unused_async)] pub async fn sign(&self, tx: Transaction) -> Result { - let key = self.key_pair()?; + let key = &self.source_account.resolve_secret(&self.locator)?; + let signer = key.signer(self.hd_path, Print::new(false)).await?; let network = &self.get_network()?; - let signer = Signer { - kind: SignerKind::Local(LocalKey { key }), - print: Print::new(false), - }; + Ok(signer.sign_tx(tx, network).await?) } From 22000ff2da7d50444d7f0f699434fe314d28cede Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 1 Apr 2025 11:41:09 -0400 Subject: [PATCH 05/28] Update secure store integration test --- .../soroban-test/tests/it/integration/tx/secure_store.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs index 5779e4c3b7..b1db13eb61 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs @@ -89,6 +89,9 @@ async fn create_account() { .success() .stdout_as_str(); + let client = sandbox.network.rpc_client().unwrap(); + let secure_account = client.get_account(&secure_store_address).await.unwrap(); + let starting_balance = ONE_XLM * 100; sandbox .new_assert_cmd("tx") @@ -106,4 +109,10 @@ async fn create_account() { .success() .stdout_as_str(); + + let secure_account_after = client.get_account(&secure_store_address).await.unwrap(); + assert!(secure_account_after.balance < secure_account.balance); + + let new_account = client.get_account(&new_address).await.unwrap(); + assert_eq!(new_account.balance, starting_balance); } \ No newline at end of file From 4ef50ea5a49d3c55aa20cac058a04088167b2b1f Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:05:55 -0400 Subject: [PATCH 06/28] Clippy --- .../soroban-test/tests/it/integration/tx/secure_store.rs | 2 +- cmd/soroban-cli/src/config/mod.rs | 2 +- cmd/soroban-cli/src/signer/keyring.rs | 9 ++++----- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs index b1db13eb61..962cb2e0f4 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs @@ -12,7 +12,7 @@ use crate::integration::{ util::{deploy_contract, DeployOptions, HELLO_WORLD}, tx::build_sim_sign_send }; -use soroban_cli::signer::keyring::keyring_mock; +use soroban_cli::signer::keyring::credential_mock; pub fn test_address(sandbox: &TestEnv) -> String { sandbox diff --git a/cmd/soroban-cli/src/config/mod.rs b/cmd/soroban-cli/src/config/mod.rs index 7666547ed3..b575d8f2d8 100644 --- a/cmd/soroban-cli/src/config/mod.rs +++ b/cmd/soroban-cli/src/config/mod.rs @@ -7,7 +7,7 @@ use std::{ use crate::{ print::Print, - signer::{self, LocalKey, Signer, SignerKind}, + signer, xdr::{self, SequenceNumber, Transaction, TransactionEnvelope}, Pwd, }; diff --git a/cmd/soroban-cli/src/signer/keyring.rs b/cmd/soroban-cli/src/signer/keyring.rs index 1cbb1ae8d8..9c313e77c6 100644 --- a/cmd/soroban-cli/src/signer/keyring.rs +++ b/cmd/soroban-cli/src/signer/keyring.rs @@ -28,12 +28,11 @@ impl StellarEntry { #[cfg(feature = "ledger-tests")] pub fn new(name: &str) -> Result { - use keyring::mock::{self, MockCredential}; let test_phrase: &str = "depth decade power loud smile spatial sign movie judge february rate broccoli"; - keyring_mock::set_default_credential_builder(keyring_mock::mock::default_credential_builder()); + credential_mock::set_default_credential_builder(credential_mock::mock::default_credential_builder()); let entry = Entry::new(name, &whoami::username())?; - let mock: &MockCredential = entry.get_credential().downcast_ref().unwrap(); + let mock: &credential_mock::MockCredential = entry.get_credential().downcast_ref().unwrap(); entry.set_password(test_phrase); Ok(StellarEntry { @@ -102,8 +101,8 @@ impl StellarEntry { } } -pub mod keyring_mock { - pub use keyring::{mock, set_default_credential_builder}; +pub mod credential_mock { + pub use keyring::{mock::{self, MockCredential}, set_default_credential_builder}; } #[cfg(test)] From 68b6905d9c47babd1152b97c5e82ea63eadab04c Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 1 Apr 2025 16:06:47 -0400 Subject: [PATCH 07/28] Cargo fmt --- .../soroban-test/tests/it/integration/keys.rs | 2 +- .../tests/it/integration/tx/secure_store.rs | 18 ++++++++---------- cmd/soroban-cli/src/signer/keyring.rs | 17 ++++++++++------- 3 files changed, 19 insertions(+), 18 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/integration/keys.rs b/cmd/crates/soroban-test/tests/it/integration/keys.rs index 273e365e85..84532a67ae 100644 --- a/cmd/crates/soroban-test/tests/it/integration/keys.rs +++ b/cmd/crates/soroban-test/tests/it/integration/keys.rs @@ -123,4 +123,4 @@ async fn public_key_with_secure_store_key() { .assert() .stdout(predicate::str::contains("G")) .success(); -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs index 962cb2e0f4..6cd6b07160 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs @@ -1,3 +1,10 @@ +use crate::integration::{ + hello_world::invoke_hello_world, + tx::build_sim_sign_send, + util::{deploy_contract, DeployOptions, HELLO_WORLD}, +}; +use predicates::prelude::predicate; +use soroban_cli::signer::keyring::credential_mock; use soroban_cli::{ config::locator, tx::{builder, ONE_XLM}, @@ -6,13 +13,6 @@ use soroban_cli::{ }; use soroban_rpc::LedgerEntryResult; use soroban_test::{AssertExt, TestEnv}; -use predicates::prelude::predicate; -use crate::integration::{ - hello_world::invoke_hello_world, - util::{deploy_contract, DeployOptions, HELLO_WORLD}, - tx::build_sim_sign_send -}; -use soroban_cli::signer::keyring::credential_mock; pub fn test_address(sandbox: &TestEnv) -> String { sandbox @@ -70,7 +70,6 @@ fn secure_store_key(sandbox: &TestEnv, name: &str) -> String { .stdout_as_str() } - // test that we can create a create-account tx and sign it with a secure-store key #[tokio::test] async fn create_account() { @@ -109,10 +108,9 @@ async fn create_account() { .success() .stdout_as_str(); - let secure_account_after = client.get_account(&secure_store_address).await.unwrap(); assert!(secure_account_after.balance < secure_account.balance); let new_account = client.get_account(&new_address).await.unwrap(); assert_eq!(new_account.balance, starting_balance); -} \ No newline at end of file +} diff --git a/cmd/soroban-cli/src/signer/keyring.rs b/cmd/soroban-cli/src/signer/keyring.rs index 9c313e77c6..f82dbea621 100644 --- a/cmd/soroban-cli/src/signer/keyring.rs +++ b/cmd/soroban-cli/src/signer/keyring.rs @@ -22,22 +22,22 @@ impl StellarEntry { #[cfg(not(feature = "ledger-tests"))] pub fn new(name: &str) -> Result { Ok(StellarEntry { - keyring: Entry::new(name, &whoami::username())? + keyring: Entry::new(name, &whoami::username())?, }) } #[cfg(feature = "ledger-tests")] pub fn new(name: &str) -> Result { let test_phrase: &str = - "depth decade power loud smile spatial sign movie judge february rate broccoli"; - credential_mock::set_default_credential_builder(credential_mock::mock::default_credential_builder()); + "depth decade power loud smile spatial sign movie judge february rate broccoli"; + credential_mock::set_default_credential_builder( + credential_mock::mock::default_credential_builder(), + ); let entry = Entry::new(name, &whoami::username())?; let mock: &credential_mock::MockCredential = entry.get_credential().downcast_ref().unwrap(); entry.set_password(test_phrase); - Ok(StellarEntry { - keyring: entry, - }) + Ok(StellarEntry { keyring: entry }) } pub fn set_seed_phrase(&self, seed_phrase: SeedPhrase) -> Result<(), Error> { @@ -102,7 +102,10 @@ impl StellarEntry { } pub mod credential_mock { - pub use keyring::{mock::{self, MockCredential}, set_default_credential_builder}; + pub use keyring::{ + mock::{self, MockCredential}, + set_default_credential_builder, + }; } #[cfg(test)] From 8579eb1a085713d5f292b5f6e4f74e517efc2d5c Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 3 Apr 2025 09:10:31 -0400 Subject: [PATCH 08/28] Fix feature name for secure store tests --- cmd/soroban-cli/Cargo.toml | 2 +- cmd/soroban-cli/src/signer/keyring.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index b6ba7603df..badf959a4b 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -40,7 +40,7 @@ version_lt_23 = [] version_gte_23 = [] opt = ["dep:wasm-opt"] emulator-tests = ["stellar-ledger/emulator-tests"] -ledger-tests = [] +secure-store-tests = [] [dependencies] stellar-xdr = { workspace = true, features = ["cli"] } diff --git a/cmd/soroban-cli/src/signer/keyring.rs b/cmd/soroban-cli/src/signer/keyring.rs index f82dbea621..cc21467423 100644 --- a/cmd/soroban-cli/src/signer/keyring.rs +++ b/cmd/soroban-cli/src/signer/keyring.rs @@ -19,14 +19,14 @@ pub struct StellarEntry { } impl StellarEntry { - #[cfg(not(feature = "ledger-tests"))] + #[cfg(not(feature = "secure-store-tests"))] pub fn new(name: &str) -> Result { Ok(StellarEntry { keyring: Entry::new(name, &whoami::username())?, }) } - #[cfg(feature = "ledger-tests")] + #[cfg(feature = "secure-store-tests")] pub fn new(name: &str) -> Result { let test_phrase: &str = "depth decade power loud smile spatial sign movie judge february rate broccoli"; From acfa9699d45d19c7401d9a4e239d204d50164ef0 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 3 Apr 2025 09:12:22 -0400 Subject: [PATCH 09/28] Move secure store create_account test and put behind feature --- cmd/crates/soroban-test/Cargo.toml | 1 + cmd/crates/soroban-test/tests/it/main.rs | 2 ++ .../it/{integration/tx => }/secure_store.rs | 22 +++++-------------- 3 files changed, 8 insertions(+), 17 deletions(-) rename cmd/crates/soroban-test/tests/it/{integration/tx => }/secure_store.rs (81%) diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index 9ec098d4b9..a1cc96d511 100644 --- a/cmd/crates/soroban-test/Cargo.toml +++ b/cmd/crates/soroban-test/Cargo.toml @@ -56,3 +56,4 @@ it = [] emulator-tests = ["stellar-ledger/emulator-tests"] version_lt_23 = [] version_gte_23 = [] +secure-store-tests = [] \ No newline at end of file diff --git a/cmd/crates/soroban-test/tests/it/main.rs b/cmd/crates/soroban-test/tests/it/main.rs index a16d2311b5..251610eb25 100644 --- a/cmd/crates/soroban-test/tests/it/main.rs +++ b/cmd/crates/soroban-test/tests/it/main.rs @@ -10,5 +10,7 @@ mod integration; mod log; mod plugin; mod rpc_provider; +#[cfg(feature = "secure-store-tests")] +mod secure_store; mod util; mod version; diff --git a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs similarity index 81% rename from cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs rename to cmd/crates/soroban-test/tests/it/secure_store.rs index 6cd6b07160..ba4136e9f9 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -1,17 +1,4 @@ -use crate::integration::{ - hello_world::invoke_hello_world, - tx::build_sim_sign_send, - util::{deploy_contract, DeployOptions, HELLO_WORLD}, -}; -use predicates::prelude::predicate; -use soroban_cli::signer::keyring::credential_mock; -use soroban_cli::{ - config::locator, - tx::{builder, ONE_XLM}, - utils::contract_id_hash_from_asset, - xdr::{self, ReadXdr, SequenceNumber}, -}; -use soroban_rpc::LedgerEntryResult; +use soroban_cli::tx::ONE_XLM; use soroban_test::{AssertExt, TestEnv}; pub fn test_address(sandbox: &TestEnv) -> String { @@ -48,8 +35,8 @@ fn gen_account_no_fund(sandbox: &TestEnv, name: &str) -> String { .stdout_as_str() } -// todo: move these functions to utils for reusability -// returns test and test1 addresses +// // todo: move these functions to utils for reusability +// // returns test and test1 addresses fn setup_accounts(sandbox: &TestEnv) -> (String, String) { (test_address(sandbox), new_account(sandbox, "test1")) } @@ -70,7 +57,8 @@ fn secure_store_key(sandbox: &TestEnv, name: &str) -> String { .stdout_as_str() } -// test that we can create a create-account tx and sign it with a secure-store key +// // test that we can create a create-account tx and sign it with a secure-store key +// #[cfg(feature = "ledger-tests")] #[tokio::test] async fn create_account() { let sandbox = &TestEnv::new(); From 8b21b9476502b647629acd265e87bc0d3adc6114 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 3 Apr 2025 09:22:39 -0400 Subject: [PATCH 10/28] Move key it tests that use secure store to secure store test --- .../soroban-test/tests/it/secure_store.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index ba4136e9f9..6e72c5f3e3 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -1,5 +1,6 @@ use soroban_cli::tx::ONE_XLM; use soroban_test::{AssertExt, TestEnv}; +use predicates::prelude::predicate; pub fn test_address(sandbox: &TestEnv) -> String { sandbox @@ -102,3 +103,20 @@ async fn create_account() { let new_account = client.get_account(&new_address).await.unwrap(); assert_eq!(new_account.balance, starting_balance); } + +#[tokio::test] +async fn get_secret_key() { + let sandbox = &TestEnv::new(); + sandbox + .new_assert_cmd("keys") + .args(["generate", "test2", "--secure-store"]) + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .arg("secret") + .arg("test2") + .assert() + .stderr(predicate::str::contains("does not reveal secret key")) + .failure(); +} \ No newline at end of file From 917f12972eb2d51e2218cb91abacd1bb54256fc2 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 8 Apr 2025 16:24:33 -0400 Subject: [PATCH 11/28] Move secure store tests --- .../soroban-test/tests/it/integration/keys.rs | 36 +------------------ .../soroban-test/tests/it/integration/tx.rs | 1 - .../soroban-test/tests/it/secure_store.rs | 19 +++++++++- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/integration/keys.rs b/cmd/crates/soroban-test/tests/it/integration/keys.rs index 84532a67ae..3e9b18a95c 100644 --- a/cmd/crates/soroban-test/tests/it/integration/keys.rs +++ b/cmd/crates/soroban-test/tests/it/integration/keys.rs @@ -89,38 +89,4 @@ async fn overwrite_identity() { .success(); assert_ne!(initial_pubkey, pubkey_for_identity(sandbox, "test2")); -} - -#[tokio::test] -async fn secret_with_secure_store_key() { - let sandbox = &TestEnv::new(); - sandbox - .new_assert_cmd("keys") - .args(["generate", "test2", "--secure-store"]) - .assert() - .success(); - sandbox - .new_assert_cmd("keys") - .arg("secret") - .arg("test2") - .assert() - .stderr(predicate::str::contains("does not reveal secret key")) - .failure(); -} - -#[tokio::test] -async fn public_key_with_secure_store_key() { - let sandbox = &TestEnv::new(); - sandbox - .new_assert_cmd("keys") - .args(["generate", "test2", "--secure-store"]) - .assert() - .success(); - sandbox - .new_assert_cmd("keys") - .arg("public-key") - .arg("test2") - .assert() - .stdout(predicate::str::contains("G")) - .success(); -} +} \ No newline at end of file diff --git a/cmd/crates/soroban-test/tests/it/integration/tx.rs b/cmd/crates/soroban-test/tests/it/integration/tx.rs index 742300ebbb..1863e7b2e7 100644 --- a/cmd/crates/soroban-test/tests/it/integration/tx.rs +++ b/cmd/crates/soroban-test/tests/it/integration/tx.rs @@ -5,7 +5,6 @@ use soroban_test::{AssertExt, TestEnv}; use crate::integration::util::{deploy_contract, DeployKind, DeployOptions, HELLO_WORLD}; pub mod operations; -pub mod secure_store; #[tokio::test] async fn simulate() { diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index 6e72c5f3e3..4e4c0a63fb 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -119,4 +119,21 @@ async fn get_secret_key() { .assert() .stderr(predicate::str::contains("does not reveal secret key")) .failure(); -} \ No newline at end of file +} + +#[tokio::test] +async fn public_key_with_secure_store() { + let sandbox = &TestEnv::new(); + sandbox + .new_assert_cmd("keys") + .args(["generate", "test2", "--secure-store"]) + .assert() + .success(); + sandbox + .new_assert_cmd("keys") + .arg("public-key") + .arg("test2") + .assert() + .stdout(predicate::str::contains("G")) + .success(); +} From 1c468de2f51dcbf7801f2283529cad75f2d84d89 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Wed, 9 Apr 2025 09:18:26 -0400 Subject: [PATCH 12/28] Cargo fmt: --- cmd/crates/soroban-test/tests/it/integration/keys.rs | 2 +- cmd/crates/soroban-test/tests/it/secure_store.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/integration/keys.rs b/cmd/crates/soroban-test/tests/it/integration/keys.rs index 3e9b18a95c..b89953f2cd 100644 --- a/cmd/crates/soroban-test/tests/it/integration/keys.rs +++ b/cmd/crates/soroban-test/tests/it/integration/keys.rs @@ -89,4 +89,4 @@ async fn overwrite_identity() { .success(); assert_ne!(initial_pubkey, pubkey_for_identity(sandbox, "test2")); -} \ No newline at end of file +} diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index 4e4c0a63fb..040f3ac92c 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -1,6 +1,6 @@ +use predicates::prelude::predicate; use soroban_cli::tx::ONE_XLM; use soroban_test::{AssertExt, TestEnv}; -use predicates::prelude::predicate; pub fn test_address(sandbox: &TestEnv) -> String { sandbox From 19985d507d153055d93a16f70e698975077cf756 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 10 Apr 2025 17:32:34 -0400 Subject: [PATCH 13/28] Cleanup --- cmd/crates/soroban-test/Cargo.toml | 2 +- .../soroban-test/tests/it/secure_store.rs | 23 +------------------ cmd/stellar-cli/Cargo.toml | 1 + 3 files changed, 3 insertions(+), 23 deletions(-) diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index a1cc96d511..fb315c9d06 100644 --- a/cmd/crates/soroban-test/Cargo.toml +++ b/cmd/crates/soroban-test/Cargo.toml @@ -56,4 +56,4 @@ it = [] emulator-tests = ["stellar-ledger/emulator-tests"] version_lt_23 = [] version_gte_23 = [] -secure-store-tests = [] \ No newline at end of file +secure-store-tests = ["soroban-cli/secure-store-tests"] \ No newline at end of file diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index 040f3ac92c..3143c94305 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -22,26 +22,6 @@ fn new_account(sandbox: &TestEnv, name: &str) -> String { .stdout_as_str() } -fn gen_account_no_fund(sandbox: &TestEnv, name: &str) -> String { - sandbox - .new_assert_cmd("keys") - .args(["generate", "--no-fund", name]) - .assert() - .success(); - sandbox - .new_assert_cmd("keys") - .args(["address", name]) - .assert() - .success() - .stdout_as_str() -} - -// // todo: move these functions to utils for reusability -// // returns test and test1 addresses -fn setup_accounts(sandbox: &TestEnv) -> (String, String) { - (test_address(sandbox), new_account(sandbox, "test1")) -} - fn secure_store_key(sandbox: &TestEnv, name: &str) -> String { sandbox .new_assert_cmd("keys") @@ -58,8 +38,7 @@ fn secure_store_key(sandbox: &TestEnv, name: &str) -> String { .stdout_as_str() } -// // test that we can create a create-account tx and sign it with a secure-store key -// #[cfg(feature = "ledger-tests")] +// test that we can create a create-account tx and sign it with a secure-store key #[tokio::test] async fn create_account() { let sandbox = &TestEnv::new(); diff --git a/cmd/stellar-cli/Cargo.toml b/cmd/stellar-cli/Cargo.toml index 4a2808f6f5..25176a9928 100644 --- a/cmd/stellar-cli/Cargo.toml +++ b/cmd/stellar-cli/Cargo.toml @@ -28,6 +28,7 @@ bin-dir = "{ bin }{ binary-ext }" default = [] opt = ["soroban-cli/opt"] emulator-tests = ["soroban-cli/emulator-tests"] +secure-store-tests = ["soroban-cli/secure-store-tests"] [dependencies] soroban-cli = { workspace = true } From 9e6926322d8765d843f6f622869260bb08bde7cf Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 10 Apr 2025 17:32:49 -0400 Subject: [PATCH 14/28] Add secure-store-tests to makefile e2e-test --- Makefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile b/Makefile index c3d50d3359..8fbf935156 100644 --- a/Makefile +++ b/Makefile @@ -53,6 +53,7 @@ test: build-test e2e-test: cargo test --features it --test it -- integration + cargo test --features it --test it -- integration --features secure-store-tests check: cargo clippy --all-targets From 99079e65008613a73cf841655cd11b7522d1b802 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:37:32 -0400 Subject: [PATCH 15/28] Remove secure-store-tests feature, and mocked credential impl --- Makefile | 1 - cmd/crates/soroban-test/Cargo.toml | 3 +-- cmd/crates/soroban-test/tests/it/main.rs | 1 - cmd/soroban-cli/Cargo.toml | 1 - cmd/soroban-cli/src/signer/keyring.rs | 22 ---------------------- cmd/stellar-cli/Cargo.toml | 1 - 6 files changed, 1 insertion(+), 28 deletions(-) diff --git a/Makefile b/Makefile index 8fbf935156..c3d50d3359 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,6 @@ test: build-test e2e-test: cargo test --features it --test it -- integration - cargo test --features it --test it -- integration --features secure-store-tests check: cargo clippy --all-targets diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index fb315c9d06..10d383d99b 100644 --- a/cmd/crates/soroban-test/Cargo.toml +++ b/cmd/crates/soroban-test/Cargo.toml @@ -55,5 +55,4 @@ default = [] it = [] emulator-tests = ["stellar-ledger/emulator-tests"] version_lt_23 = [] -version_gte_23 = [] -secure-store-tests = ["soroban-cli/secure-store-tests"] \ No newline at end of file +version_gte_23 = [] \ No newline at end of file diff --git a/cmd/crates/soroban-test/tests/it/main.rs b/cmd/crates/soroban-test/tests/it/main.rs index 251610eb25..d166c40944 100644 --- a/cmd/crates/soroban-test/tests/it/main.rs +++ b/cmd/crates/soroban-test/tests/it/main.rs @@ -10,7 +10,6 @@ mod integration; mod log; mod plugin; mod rpc_provider; -#[cfg(feature = "secure-store-tests")] mod secure_store; mod util; mod version; diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml index badf959a4b..3d886fb5bf 100644 --- a/cmd/soroban-cli/Cargo.toml +++ b/cmd/soroban-cli/Cargo.toml @@ -40,7 +40,6 @@ version_lt_23 = [] version_gte_23 = [] opt = ["dep:wasm-opt"] emulator-tests = ["stellar-ledger/emulator-tests"] -secure-store-tests = [] [dependencies] stellar-xdr = { workspace = true, features = ["cli"] } diff --git a/cmd/soroban-cli/src/signer/keyring.rs b/cmd/soroban-cli/src/signer/keyring.rs index cc21467423..7dda2e795a 100644 --- a/cmd/soroban-cli/src/signer/keyring.rs +++ b/cmd/soroban-cli/src/signer/keyring.rs @@ -19,27 +19,12 @@ pub struct StellarEntry { } impl StellarEntry { - #[cfg(not(feature = "secure-store-tests"))] pub fn new(name: &str) -> Result { Ok(StellarEntry { keyring: Entry::new(name, &whoami::username())?, }) } - #[cfg(feature = "secure-store-tests")] - pub fn new(name: &str) -> Result { - let test_phrase: &str = - "depth decade power loud smile spatial sign movie judge february rate broccoli"; - credential_mock::set_default_credential_builder( - credential_mock::mock::default_credential_builder(), - ); - let entry = Entry::new(name, &whoami::username())?; - let mock: &credential_mock::MockCredential = entry.get_credential().downcast_ref().unwrap(); - entry.set_password(test_phrase); - - Ok(StellarEntry { keyring: entry }) - } - pub fn set_seed_phrase(&self, seed_phrase: SeedPhrase) -> Result<(), Error> { let mut data = seed_phrase.seed_phrase.into_phrase(); self.keyring.set_password(&data)?; @@ -101,13 +86,6 @@ impl StellarEntry { } } -pub mod credential_mock { - pub use keyring::{ - mock::{self, MockCredential}, - set_default_credential_builder, - }; -} - #[cfg(test)] mod test { use super::*; diff --git a/cmd/stellar-cli/Cargo.toml b/cmd/stellar-cli/Cargo.toml index 25176a9928..4a2808f6f5 100644 --- a/cmd/stellar-cli/Cargo.toml +++ b/cmd/stellar-cli/Cargo.toml @@ -28,7 +28,6 @@ bin-dir = "{ bin }{ binary-ext }" default = [] opt = ["soroban-cli/opt"] emulator-tests = ["soroban-cli/emulator-tests"] -secure-store-tests = ["soroban-cli/secure-store-tests"] [dependencies] soroban-cli = { workspace = true } From bffcb5b11fb0b2bb7f3dcb8d631fd2df258ca2e6 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Thu, 17 Apr 2025 11:56:24 -0400 Subject: [PATCH 16/28] Remove unused fns --- .../soroban-test/tests/it/secure_store.rs | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index 3143c94305..210bd0f5f2 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -2,26 +2,6 @@ use predicates::prelude::predicate; use soroban_cli::tx::ONE_XLM; use soroban_test::{AssertExt, TestEnv}; -pub fn test_address(sandbox: &TestEnv) -> String { - sandbox - .new_assert_cmd("keys") - .arg("address") - .arg("test") - .assert() - .success() - .stdout_as_str() -} - -fn new_account(sandbox: &TestEnv, name: &str) -> String { - sandbox.generate_account(name, None).assert().success(); - sandbox - .new_assert_cmd("keys") - .args(["address", name]) - .assert() - .success() - .stdout_as_str() -} - fn secure_store_key(sandbox: &TestEnv, name: &str) -> String { sandbox .new_assert_cmd("keys") From cfb97388a5e892510bbf6aad474960ff78e4da93 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 21 Apr 2025 14:44:32 -0400 Subject: [PATCH 17/28] Small tweak to secure store it test --- cmd/crates/soroban-test/tests/it/secure_store.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index 210bd0f5f2..2319a68adb 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -68,7 +68,7 @@ async fn get_secret_key() { let sandbox = &TestEnv::new(); sandbox .new_assert_cmd("keys") - .args(["generate", "test2", "--secure-store"]) + .args(["generate", "secret-test", "--secure-store"]) .assert() .success(); sandbox @@ -85,7 +85,7 @@ async fn public_key_with_secure_store() { let sandbox = &TestEnv::new(); sandbox .new_assert_cmd("keys") - .args(["generate", "test2", "--secure-store"]) + .args(["generate", "public-test", "--secure-store"]) .assert() .success(); sandbox From 7bf14dfb648ee7803de8be27157d64cf6bc7ad79 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:11:52 -0400 Subject: [PATCH 18/28] Fix --- cmd/crates/soroban-test/tests/it/secure_store.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/secure_store.rs index 2319a68adb..e7bf5df878 100644 --- a/cmd/crates/soroban-test/tests/it/secure_store.rs +++ b/cmd/crates/soroban-test/tests/it/secure_store.rs @@ -68,13 +68,13 @@ async fn get_secret_key() { let sandbox = &TestEnv::new(); sandbox .new_assert_cmd("keys") - .args(["generate", "secret-test", "--secure-store"]) + .args(["generate", "secret-key-test", "--secure-store"]) .assert() .success(); sandbox .new_assert_cmd("keys") .arg("secret") - .arg("test2") + .arg("secret-key-test") .assert() .stderr(predicate::str::contains("does not reveal secret key")) .failure(); @@ -85,13 +85,13 @@ async fn public_key_with_secure_store() { let sandbox = &TestEnv::new(); sandbox .new_assert_cmd("keys") - .args(["generate", "public-test", "--secure-store"]) + .args(["generate", "public-key-test", "--secure-store"]) .assert() .success(); sandbox .new_assert_cmd("keys") .arg("public-key") - .arg("test2") + .arg("public-key-test") .assert() .stdout(predicate::str::contains("G")) .success(); From 96ff9afd609ed6dbdaff3847d85fed389a7e8028 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 21 Apr 2025 15:33:30 -0400 Subject: [PATCH 19/28] Install gnome-keyring for linux it tests --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 28af9671b4..699e37d16e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -91,7 +91,7 @@ jobs: - run: rustup target add ${{ matrix.sys.target }} - run: rustup target add wasm32-unknown-unknown - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev libdbus-1-dev + run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev libdbus-1-dev gnome-keyring - run: cargo clippy --all-targets --target ${{ matrix.sys.target }} - run: make test env: From 51fa225510987d4e341fb4b99f21d5be3d194146 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:00:19 -0400 Subject: [PATCH 20/28] Move secure store tests to integration --- cmd/crates/soroban-test/tests/it/integration.rs | 1 + .../soroban-test/tests/it/{ => integration}/secure_store.rs | 0 cmd/crates/soroban-test/tests/it/main.rs | 1 - 3 files changed, 1 insertion(+), 1 deletion(-) rename cmd/crates/soroban-test/tests/it/{ => integration}/secure_store.rs (100%) diff --git a/cmd/crates/soroban-test/tests/it/integration.rs b/cmd/crates/soroban-test/tests/it/integration.rs index c7a3fbec5c..da7eaec7c4 100644 --- a/cmd/crates/soroban-test/tests/it/integration.rs +++ b/cmd/crates/soroban-test/tests/it/integration.rs @@ -6,6 +6,7 @@ mod dotenv; mod hello_world; mod init; mod keys; +mod secure_store; mod snapshot; mod tx; mod util; diff --git a/cmd/crates/soroban-test/tests/it/secure_store.rs b/cmd/crates/soroban-test/tests/it/integration/secure_store.rs similarity index 100% rename from cmd/crates/soroban-test/tests/it/secure_store.rs rename to cmd/crates/soroban-test/tests/it/integration/secure_store.rs diff --git a/cmd/crates/soroban-test/tests/it/main.rs b/cmd/crates/soroban-test/tests/it/main.rs index d166c40944..a16d2311b5 100644 --- a/cmd/crates/soroban-test/tests/it/main.rs +++ b/cmd/crates/soroban-test/tests/it/main.rs @@ -10,6 +10,5 @@ mod integration; mod log; mod plugin; mod rpc_provider; -mod secure_store; mod util; mod version; From b1aefe4f03e6115c7de0265f1cac426fcaa3767a Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Mon, 21 Apr 2025 17:01:58 -0400 Subject: [PATCH 21/28] Move gnome-keyring install to rpc-tests workflow --- .github/workflows/rpc-tests.yml | 2 +- .github/workflows/rust.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index 4b72a991bd..96d9ace0fb 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/checkout@v4 - uses: stellar/actions/rust-cache@main - run: rustup update - - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev + - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring if: runner.os == 'Linux' - run: cargo build - run: rustup target add wasm32-unknown-unknown diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 699e37d16e..28af9671b4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -91,7 +91,7 @@ jobs: - run: rustup target add ${{ matrix.sys.target }} - run: rustup target add wasm32-unknown-unknown - if: runner.os == 'Linux' - run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev libdbus-1-dev gnome-keyring + run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev libdbus-1-dev - run: cargo clippy --all-targets --target ${{ matrix.sys.target }} - run: make test env: From eb127926aab2915473d5110ac57c50ca519fceb5 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 22 Apr 2025 10:32:39 -0400 Subject: [PATCH 22/28] Start dbus and gnome-keyring for linux integration tests --- .github/workflows/rpc-tests.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index 96d9ace0fb..c0e0635097 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -32,8 +32,15 @@ jobs: - uses: actions/checkout@v4 - uses: stellar/actions/rust-cache@main - run: rustup update - - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring + - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring dbus dbus-x11 if: runner.os == 'Linux' + - name: Start D-Bus and GNOME Keyring + if: runner.os == 'Linux' + run: | + export $(dbus-launch) + eval $(gnome-keyring-daemon --start --components=secrets) + export DBUS_SESSION_BUS_ADDRESS + echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV - run: cargo build - run: rustup target add wasm32-unknown-unknown - run: make build-test-wasms From cd0a575b541dad7f74d7b92affce3e7ca8bb575d Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 22 Apr 2025 11:51:08 -0400 Subject: [PATCH 23/28] Enable additional-libs for rpc-tests --- .github/workflows/rpc-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index c0e0635097..79c9e76d85 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -41,7 +41,7 @@ jobs: eval $(gnome-keyring-daemon --start --components=secrets) export DBUS_SESSION_BUS_ADDRESS echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV - - run: cargo build + - run: cargo build --features additional-libs - run: rustup target add wasm32-unknown-unknown - run: make build-test-wasms - run: SOROBAN_PORT=8000 cargo test --features it --package soroban-test --test it -- integration --test-threads=1 From 3322074061a4d38e60e4ac7b33a79c007e0f315e Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 22 Apr 2025 12:10:33 -0400 Subject: [PATCH 24/28] fixup! Start dbus and gnome-keyring for linux integration tests --- .github/workflows/rpc-tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index 79c9e76d85..70660545b4 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -37,6 +37,10 @@ jobs: - name: Start D-Bus and GNOME Keyring if: runner.os == 'Linux' run: | + mkdir -p /tmp/runtime-dir + export XDG_RUNTIME_DIR=/tmp/runtime-dir + chmod 700 $XDG_RUNTIME_DIR + export $(dbus-launch) eval $(gnome-keyring-daemon --start --components=secrets) export DBUS_SESSION_BUS_ADDRESS From d2c7da0dc792ab006241caac3c0d7b2f12da1a1e Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 22 Apr 2025 12:43:20 -0400 Subject: [PATCH 25/28] Temporarily comment out excluding other os in rpc-tests --- .github/workflows/rpc-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index 70660545b4..b2259faed3 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -20,10 +20,10 @@ jobs: - ubuntu-jammy-16-cores-arm64 # Intel - macos-13 - exclude: + # exclude: # Only run Linux x64 tests on pull request to save some time - - sys: ${{ github.event_name != 'push' && 'ubuntu-jammy-16-cores-arm64' }} - - sys: ${{ github.event_name != 'push' && 'macos-13' }} + # - sys: ${{ github.event_name != 'push' && 'ubuntu-jammy-16-cores-arm64' }} + # - sys: ${{ github.event_name != 'push' && 'macos-13' }} runs-on: ${{ matrix.sys }} steps: - uses: stellar/quickstart@main From ab9ecc6242c5fcbb83334777bc27b7a302d266ce Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Tue, 22 Apr 2025 12:48:38 -0400 Subject: [PATCH 26/28] Update starting gnome-keyring for linux integration tests --- .github/workflows/rpc-tests.yml | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index b2259faed3..fd441c33fc 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -34,17 +34,11 @@ jobs: - run: rustup update - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring dbus dbus-x11 if: runner.os == 'Linux' - - name: Start D-Bus and GNOME Keyring + - name: Start GNOME Keyring if: runner.os == 'Linux' run: | - mkdir -p /tmp/runtime-dir - export XDG_RUNTIME_DIR=/tmp/runtime-dir - chmod 700 $XDG_RUNTIME_DIR - - export $(dbus-launch) - eval $(gnome-keyring-daemon --start --components=secrets) - export DBUS_SESSION_BUS_ADDRESS - echo "DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS" >> $GITHUB_ENV + gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar' + gnome-keyring-daemon - run: cargo build --features additional-libs - run: rustup target add wasm32-unknown-unknown - run: make build-test-wasms From 6b288a4dc33aa78ae90030f4d800d7828362827c Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Wed, 23 Apr 2025 10:35:05 -0400 Subject: [PATCH 27/28] Add exclude back in so that only Linux x64 is run on pull requests --- .github/workflows/rpc-tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index fd441c33fc..a540e3ae8a 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -20,10 +20,10 @@ jobs: - ubuntu-jammy-16-cores-arm64 # Intel - macos-13 - # exclude: + exclude: # Only run Linux x64 tests on pull request to save some time - # - sys: ${{ github.event_name != 'push' && 'ubuntu-jammy-16-cores-arm64' }} - # - sys: ${{ github.event_name != 'push' && 'macos-13' }} + - sys: ${{ github.event_name != 'push' && 'ubuntu-jammy-16-cores-arm64' }} + - sys: ${{ github.event_name != 'push' && 'macos-13' }} runs-on: ${{ matrix.sys }} steps: - uses: stellar/quickstart@main From 7a505b46a1a56965211d79fb0a16f72d125d6b61 Mon Sep 17 00:00:00 2001 From: elizabethengelman <4752801+elizabethengelman@users.noreply.github.com> Date: Wed, 23 Apr 2025 14:44:39 -0400 Subject: [PATCH 28/28] Tweak rpc-tests.yml --- .github/workflows/rpc-tests.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rpc-tests.yml b/.github/workflows/rpc-tests.yml index a540e3ae8a..18b0756d05 100644 --- a/.github/workflows/rpc-tests.yml +++ b/.github/workflows/rpc-tests.yml @@ -32,12 +32,18 @@ jobs: - uses: actions/checkout@v4 - uses: stellar/actions/rust-cache@main - run: rustup update - - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring dbus dbus-x11 + - run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev gnome-keyring if: runner.os == 'Linux' - - name: Start GNOME Keyring + - name: Start gnome-keyring + if: runner.os == 'Linux' + # run gnome-keyring with 'foobar' as password for the login keyring + # this will create a new login keyring and unlock it + # the login password doesn't matter, but the keyring must be unlocked for the tests to work + # this is based on the ci workflow in the keyring crate repo + run: gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar' + - name: Check GNOME Keyring if: runner.os == 'Linux' run: | - gnome-keyring-daemon --components=secrets --daemonize --unlock <<< 'foobar' gnome-keyring-daemon - run: cargo build --features additional-libs - run: rustup target add wasm32-unknown-unknown