Skip to content

Commit

Permalink
Merge branch 'feat/os_keychain' into feat/muxed_keys
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Jan 7, 2025
2 parents 06932dc + 63f247e commit 73eead7
Show file tree
Hide file tree
Showing 40 changed files with 892 additions and 140 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
- run: rustup target add ${{ matrix.sys.target }}

- if: matrix.sys.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev
run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libudev-dev libdbus-1-dev

- name: Setup vars
run: |
Expand All @@ -69,6 +69,7 @@ jobs:
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
working-directory: ${{ env.BUILD_WORKING_DIR }}
run: sudo apt-get update && sudo apt-get -y install libdbus-1-dev
run: cargo build --target-dir="$GITHUB_WORKSPACE/target" --package ${{ matrix.crate.name }} --features opt --release --target ${{ matrix.sys.target }}

- name: Build provenance for attestation (release only)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/bindings-ts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: rustup update
- run: sudo apt install -y libdbus-1-dev
- run: cargo build
- run: rustup target add wasm32-unknown-unknown
- run: make build-test-wasms
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/rpc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: rustup update
- run: sudo apt install -y libdbus-1-dev
- run: cargo build
- run: rustup target add wasm32-unknown-unknown
- run: make build-test-wasms
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- uses: actions/checkout@v4
- uses: stellar/actions/rust-cache@main
- run: rustup update
- run: sudo apt install -y libdbus-1-dev
- run: make generate-full-help-doc
- run: git add -N . && git diff HEAD --exit-code

Expand Down Expand Up @@ -90,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
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:
Expand Down
111 changes: 111 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,7 +938,7 @@ Create and manage identities including keys and addresses

###### **Subcommands:**

* `add` — Add a new identity (keypair, ledger, macOS keychain)
* `add` — Add a new identity (keypair, ledger, OS specific secure store)
* `address` — Given an identity return its address (public key)
* `fund` — Fund an identity on a test network
* `generate` — Generate a new identity with a seed phrase, currently 12 words
Expand All @@ -951,7 +951,7 @@ Create and manage identities including keys and addresses

## `stellar keys add`

Add a new identity (keypair, ledger, macOS keychain)
Add a new identity (keypair, ledger, OS specific secure store)

**Usage:** `stellar keys add [OPTIONS] <NAME>`

Expand Down Expand Up @@ -1024,6 +1024,7 @@ Generate a new identity with a seed phrase, currently 12 words
* `--no-fund` — Do not fund address
* `--seed <SEED>` — Optional seed to use when generating seed phrase. Random otherwise
* `-s`, `--as-secret` — Output the generated identity as a secret key
* `--secure-store` — Save in OS-specific secure store
* `--global` — Use global config
* `--config-dir <CONFIG_DIR>` — Location of config directory, default is "."
* `--hd-path <HD_PATH>` — When generating a secret key, which `hd_path` should be used from the original `seed_phrase`
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-spec-typescript/ts-tests/src/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Address, Keypair } from "@stellar/stellar-sdk";
import { basicNodeSigner } from "@stellar/stellar-sdk/contract";

const rootKeypair = Keypair.fromSecret(
spawnSync("./soroban", ["keys", "secret", "root"], {
spawnSync("./stellar", ["keys", "secret", "root"], {
shell: true,
encoding: "utf8",
}).stdout.trim(),
Expand Down
44 changes: 44 additions & 0 deletions cmd/crates/soroban-test/tests/it/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,47 @@ fn set_default_network() {
.stdout(predicate::str::contains("STELLAR_NETWORK=testnet"))
.success();
}

#[test]
fn cannot_create_contract_with_test_name() {
let sandbox = TestEnv::default();
sandbox
.new_assert_cmd("keys")
.arg("generate")
.arg("--no-fund")
.arg("d")
.assert()
.success();
sandbox
.new_assert_cmd("contract")
.arg("alias")
.arg("add")
.arg("d")
.arg("--id=CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE")
.assert()
.stderr(predicate::str::contains("cannot overlap with key"))
.failure();
}

#[test]
fn cannot_create_key_with_alias() {
let sandbox = TestEnv::default();
sandbox
.new_assert_cmd("contract")
.arg("alias")
.arg("add")
.arg("t")
.arg("--id=CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE")
.assert()
.success();
sandbox
.new_assert_cmd("keys")
.arg("generate")
.arg("--no-fund")
.arg("t")
.assert()
.stderr(predicate::str::contains(
"cannot overlap with contract alias",
))
.failure();
}
26 changes: 25 additions & 1 deletion cmd/crates/soroban-test/tests/it/integration/custom_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use soroban_test::TestEnv;

use crate::integration::util::{deploy_custom, extend_contract};

use super::util::invoke_with_roundtrip;
use super::util::{invoke, invoke_with_roundtrip};

fn invoke_custom(e: &TestEnv, id: &str, func: &str) -> assert_cmd::Command {
let mut s = e.new_assert_cmd("contract");
Expand Down Expand Up @@ -40,7 +40,9 @@ async fn parse() {
negative_i32(sandbox, id).await;
negative_i64(sandbox, id).await;
account_address(sandbox, id).await;
account_address_with_alias(sandbox, id).await;
contract_address(sandbox, id).await;
contract_address_with_alias(sandbox, id).await;
bytes(sandbox, id).await;
const_enum(sandbox, id).await;
number_arg_return_ok(sandbox, id);
Expand Down Expand Up @@ -237,6 +239,12 @@ async fn account_address(sandbox: &TestEnv, id: &str) {
.await;
}

async fn account_address_with_alias(sandbox: &TestEnv, id: &str) {
let res = invoke(sandbox, id, "addresse", &json!("test").to_string()).await;
let test = format!("\"{}\"", super::tx::operations::test_address(sandbox));
assert_eq!(test, res);
}

async fn contract_address(sandbox: &TestEnv, id: &str) {
invoke_with_roundtrip(
sandbox,
Expand All @@ -247,6 +255,22 @@ async fn contract_address(sandbox: &TestEnv, id: &str) {
.await;
}

async fn contract_address_with_alias(sandbox: &TestEnv, id: &str) {
sandbox
.new_assert_cmd("contract")
.arg("alias")
.arg("add")
.arg("test_contract")
.arg("--id=CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE")
.assert()
.success();
let res = invoke(sandbox, id, "addresse", &json!("test_contract").to_string()).await;
assert_eq!(
res,
"\"CA3D5KRYM6CB7OWQ6TWYRR3Z4T7GNZLKERYNZGGA5SOAOPIFY6YQGAXE\""
);
}

async fn bytes(sandbox: &TestEnv, id: &str) {
invoke_with_roundtrip(sandbox, id, "bytes", json!("7374656c6c6172")).await;
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/crates/soroban-test/tests/it/integration/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use soroban_test::{AssertExt, TestEnv};

use crate::integration::util::{deploy_contract, DeployKind, HELLO_WORLD};

mod operations;
pub mod operations;

#[tokio::test]
async fn simulate() {
Expand Down
Loading

0 comments on commit 73eead7

Please sign in to comment.