diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 048015009..9ae750a77 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -44,7 +44,7 @@ jobs:
fail-fast: false
matrix:
rust: [msrv, latest]
- include:
+ sys:
- os: ubuntu-latest-16-cores
target: x86_64-unknown-linux-gnu
- os: ubuntu-latest-16-cores
@@ -55,7 +55,7 @@ jobs:
target: aarch64-apple-darwin
- os: windows-latest-8-cores
target: x86_64-pc-windows-msvc
- runs-on: ${{ matrix.os }}
+ runs-on: ${{ matrix.sys.os }}
env:
CI_TESTS: true
steps:
@@ -74,17 +74,18 @@ jobs:
run: echo RUSTFLAGS='-Dwarnings -Dclippy::all -Dclippy::pedantic' >> $GITHUB_ENV
- run: rustup update
- run: cargo version
- - run: rustup target add ${{ matrix.target }}
+ - run: rustup target add ${{ matrix.sys.target }}
- run: rustup target add wasm32-unknown-unknown
- - if: matrix.target == 'aarch64-unknown-linux-gnu'
- run: sudo apt-get update && sudo apt-get -y install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- - run: cargo clippy --all-targets --target ${{ matrix.target }}
+ - 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: cargo clippy --all-targets --target ${{ matrix.sys.target }}
- run: make build-test
- - if: startsWith(matrix.target, 'x86_64')
+ # TODO: enable ARM linux
+ - if: startsWith(matrix.sys.target, 'x86_64') || runner.os == 'macOS'
# specify directories explicitly (otherwise it will fail with missing symbols)
run: |
for I in cmd/soroban-cli cmd/crates/* cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world ; do
- cargo test --target ${{ matrix.target }} --manifest-path $I/Cargo.toml
+ cargo test --target ${{ matrix.sys.target }} --manifest-path $I/Cargo.toml
done
publish-dry-run:
@@ -97,10 +98,11 @@ jobs:
target: x86_64-unknown-linux-gnu
cargo-hack-feature-options: --feature-powerset
additional-deb-packages: libudev-dev
- # - os: ubuntu-latest-16-cores
- # target: aarch64-unknown-linux-gnu
- # cargo-hack-feature-options: --feature-powerset
- # additional-deb-packages: libudev-dev libssl-dev
+ # TODO: add back ARM support
+ #- os: ubuntu-latest-16-cores
+ # target: aarch64-unknown-linux-gnu
+ # cargo-hack-feature-options: --feature-powerset
+ # additional-deb-packages: libudev-dev libssl-dev
- os: macos-latest
target: x86_64-apple-darwin
cargo-hack-feature-options: --feature-powerset
diff --git a/Cargo.lock b/Cargo.lock
index 5bd7c178c..6fdf9ee5b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -241,12 +241,6 @@ version = "0.3.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a"
-[[package]]
-name = "arrayvec"
-version = "0.7.6"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50"
-
[[package]]
name = "ascii-canvas"
version = "3.0.0"
@@ -727,6 +721,12 @@ version = "3.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c"
+[[package]]
+name = "byteorder"
+version = "0.5.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0fc10e8cc6b2580fda3f36eb6dc5316657f812a3df879a44a66fc9f0fdbc4855"
+
[[package]]
name = "byteorder"
version = "1.5.0"
@@ -1084,7 +1084,7 @@ version = "3.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61"
dependencies = [
- "byteorder",
+ "byteorder 1.5.0",
"digest 0.9.0",
"rand_core 0.5.1",
"subtle",
@@ -1942,9 +1942,6 @@ name = "hashbrown"
version = "0.14.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
-dependencies = [
- "ahash",
-]
[[package]]
name = "heck"
@@ -2692,6 +2689,12 @@ version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
+[[package]]
+name = "leb128"
+version = "0.2.5"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67"
+
[[package]]
name = "ledger-apdu"
version = "0.10.0"
@@ -2719,7 +2722,7 @@ version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "45ba81a1f5f24396b37211478aff7fbcd605dd4544df8dbed07b9da3c2057aee"
dependencies = [
- "byteorder",
+ "byteorder 1.5.0",
"cfg-if",
"hex",
"hidapi",
@@ -2884,12 +2887,6 @@ dependencies = [
"tokio",
]
-[[package]]
-name = "multi-stash"
-version = "0.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f"
-
[[package]]
name = "native-tls"
version = "0.2.12"
@@ -3782,9 +3779,9 @@ checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152"
[[package]]
name = "rustc_version"
-version = "0.4.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"
dependencies = [
"semver",
]
@@ -4423,9 +4420,9 @@ dependencies = [
[[package]]
name = "soroban-builtin-sdk-macros"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e4c8668199d95e3061cd42e1b96a91451c656a238a607fa53f96f0a3fdcf5f3"
+checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1"
dependencies = [
"itertools 0.10.5",
"proc-macro2",
@@ -4487,11 +4484,11 @@ dependencies = [
"sha2 0.10.8",
"shell-escape",
"shlex",
- "soroban-ledger-snapshot 22.0.0-rc.1.1",
- "soroban-sdk 22.0.0-rc.1.1",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-ledger-snapshot 22.0.0-rc.3",
+ "soroban-sdk 22.0.0-rc.3",
+ "soroban-spec 22.0.0-rc.3",
"soroban-spec-json",
- "soroban-spec-rust 22.0.0-rc.1.1",
+ "soroban-spec-rust 22.0.0-rc.3",
"soroban-spec-tools",
"soroban-spec-typescript",
"stellar-rpc-client",
@@ -4514,6 +4511,7 @@ dependencies = [
"ulid",
"url",
"walkdir",
+ "wasm-gen",
"wasm-opt",
"wasmparser 0.90.0",
"which",
@@ -4532,7 +4530,7 @@ dependencies = [
"num-traits",
"serde",
"soroban-env-macros 21.2.1",
- "soroban-wasmi 0.31.1-soroban.20.0.1",
+ "soroban-wasmi",
"static_assertions",
"stellar-xdr 21.2.0",
"wasmparser 0.116.1",
@@ -4540,17 +4538,17 @@ dependencies = [
[[package]]
name = "soroban-env-common"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6bdf1d66133d6b29e2834acea79decb57c47c71aa01885cae2b9ad621d67525c"
+checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642"
dependencies = [
"crate-git-revision 0.0.6",
"ethnum",
"num-derive",
"num-traits",
"serde",
- "soroban-env-macros 22.0.0-rc.1.1",
- "soroban-wasmi 0.36.1-soroban.22.0.0",
+ "soroban-env-macros 22.0.0-rc.3",
+ "soroban-wasmi",
"static_assertions",
"stellar-xdr 22.0.0-rc.1.1",
"wasmparser 0.116.1",
@@ -4568,11 +4566,11 @@ dependencies = [
[[package]]
name = "soroban-env-guest"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fa9610ac8a4a900e6f35b2ed171bc325c7e9883929f5e9da758e85f1226dd284"
+checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e"
dependencies = [
- "soroban-env-common 22.0.0-rc.1.1",
+ "soroban-env-common 22.0.0-rc.3",
"static_assertions",
]
@@ -4603,7 +4601,7 @@ dependencies = [
"sha3",
"soroban-builtin-sdk-macros 21.2.1",
"soroban-env-common 21.2.1",
- "soroban-wasmi 0.31.1-soroban.20.0.1",
+ "soroban-wasmi",
"static_assertions",
"stellar-strkey 0.0.8",
"wasmparser 0.116.1",
@@ -4611,9 +4609,9 @@ dependencies = [
[[package]]
name = "soroban-env-host"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0c695d22888ede1f98c016a4a690be307817d133be0e0f32a25fd6e53bb6c929"
+checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0"
dependencies = [
"ark-bls12-381",
"ark-ec",
@@ -4637,9 +4635,9 @@ dependencies = [
"sec1",
"sha2 0.10.8",
"sha3",
- "soroban-builtin-sdk-macros 22.0.0-rc.1.1",
- "soroban-env-common 22.0.0-rc.1.1",
- "soroban-wasmi 0.36.1-soroban.22.0.0",
+ "soroban-builtin-sdk-macros 22.0.0-rc.3",
+ "soroban-env-common 22.0.0-rc.3",
+ "soroban-wasmi",
"static_assertions",
"stellar-strkey 0.0.9",
"wasmparser 0.116.1",
@@ -4662,9 +4660,9 @@ dependencies = [
[[package]]
name = "soroban-env-macros"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d926d0daa3ba798cd70ce962ea10012e630d75088352369a6d248b2644dd7a2c"
+checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7"
dependencies = [
"itertools 0.10.5",
"proc-macro2",
@@ -4695,15 +4693,15 @@ dependencies = [
[[package]]
name = "soroban-ledger-snapshot"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c07ca63290730b803f0637e00994f803d2f24cc6383ac8680724050d07690a89"
+checksum = "56375490f176006a636db0e50c2269c55626e0ff7222711bb78d77028376fe0d"
dependencies = [
"serde",
"serde_json",
"serde_with",
- "soroban-env-common 22.0.0-rc.1.1",
- "soroban-env-host 22.0.0-rc.1.1",
+ "soroban-env-common 22.0.0-rc.3",
+ "soroban-env-host 22.0.0-rc.3",
"thiserror",
]
@@ -4729,18 +4727,19 @@ dependencies = [
[[package]]
name = "soroban-sdk"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "68b715e15357dbdda2fe0626005b75c2253bb3786deec3001d4077462a9dadd3"
+checksum = "6d063d0df000aaec20105aab3d743660322bc0269934ea95d79fa19aa8792385"
dependencies = [
"bytes-lit",
"rand",
+ "rustc_version",
"serde",
"serde_json",
- "soroban-env-guest 22.0.0-rc.1.1",
- "soroban-env-host 22.0.0-rc.1.1",
- "soroban-ledger-snapshot 22.0.0-rc.1.1",
- "soroban-sdk-macros 22.0.0-rc.1.1",
+ "soroban-env-guest 22.0.0-rc.3",
+ "soroban-env-host 22.0.0-rc.3",
+ "soroban-ledger-snapshot 22.0.0-rc.3",
+ "soroban-sdk-macros 22.0.0-rc.3",
"stellar-strkey 0.0.9",
]
@@ -4766,9 +4765,9 @@ dependencies = [
[[package]]
name = "soroban-sdk-macros"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00d1b8d96ccf53ea9c30d86352756cace630ca5c7e1200fff32ffc793bedd593"
+checksum = "508c9d819a05109120664aab86c371e1b72c5bea20b1a13158b4ef7948d9f673"
dependencies = [
"crate-git-revision 0.0.6",
"darling",
@@ -4777,9 +4776,9 @@ dependencies = [
"quote",
"rustc_version",
"sha2 0.10.8",
- "soroban-env-common 22.0.0-rc.1.1",
- "soroban-spec 22.0.0-rc.1.1",
- "soroban-spec-rust 22.0.0-rc.1.1",
+ "soroban-env-common 22.0.0-rc.3",
+ "soroban-spec 22.0.0-rc.3",
+ "soroban-spec-rust 22.0.0-rc.3",
"stellar-xdr 22.0.0-rc.1.1",
"syn 2.0.77",
]
@@ -4798,9 +4797,9 @@ dependencies = [
[[package]]
name = "soroban-spec"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4603430fd36848da7189e758d7f3fe1d7bbfef024e8aad2230a8be8252a583c1"
+checksum = "69001c97783ed3ce197eac2404e7beeabedd16e40e6f0aa210d1bc6a13063c33"
dependencies = [
"base64 0.13.1",
"stellar-xdr 22.0.0-rc.1.1",
@@ -4817,7 +4816,7 @@ dependencies = [
"serde_derive",
"serde_json",
"sha2 0.9.9",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-spec 22.0.0-rc.3",
"stellar-xdr 22.0.0-rc.1.1",
"thiserror",
]
@@ -4840,15 +4839,15 @@ dependencies = [
[[package]]
name = "soroban-spec-rust"
-version = "22.0.0-rc.1.1"
+version = "22.0.0-rc.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f5d5f3fe5b27e0b1c1d9ecdff04c4e31f5cd4d12cdc052d54f0e4995cf637b9c"
+checksum = "a45dbf346f91ed23ea63b1c256c522da9e6f0e2db1887b990a8f0f1d842a3093"
dependencies = [
"prettyplease",
"proc-macro2",
"quote",
"sha2 0.10.8",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-spec 22.0.0-rc.3",
"stellar-xdr 22.0.0-rc.1.1",
"syn 2.0.77",
"thiserror",
@@ -4863,7 +4862,7 @@ dependencies = [
"hex",
"itertools 0.10.5",
"serde_json",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-spec 22.0.0-rc.3",
"stellar-strkey 0.0.11",
"stellar-xdr 22.0.0-rc.1.1",
"thiserror",
@@ -4886,7 +4885,7 @@ dependencies = [
"serde_derive",
"serde_json",
"sha2 0.9.9",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-spec 22.0.0-rc.3",
"stellar-xdr 22.0.0-rc.1.1",
"temp-dir",
"thiserror",
@@ -4907,8 +4906,8 @@ dependencies = [
"serde_json",
"sha2 0.10.8",
"soroban-cli",
- "soroban-ledger-snapshot 22.0.0-rc.1.1",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-ledger-snapshot 22.0.0-rc.3",
+ "soroban-spec 22.0.0-rc.3",
"soroban-spec-tools",
"stellar-rpc-client",
"stellar-strkey 0.0.11",
@@ -4938,24 +4937,7 @@ dependencies = [
"smallvec",
"spin",
"wasmi_arena",
- "wasmi_core 0.13.0",
- "wasmparser-nostd",
-]
-
-[[package]]
-name = "soroban-wasmi"
-version = "0.36.1-soroban.22.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "7044ea0ee6ff67039df1f232f0d3d98121f69a0409e944774912fc5f043c280f"
-dependencies = [
- "arrayvec",
- "multi-stash",
- "num-derive",
- "num-traits",
- "smallvec",
- "spin",
- "wasmi_collections",
- "wasmi_core 0.36.3",
+ "wasmi_core",
"wasmparser-nostd",
]
@@ -4998,7 +4980,7 @@ version = "21.5.0"
dependencies = [
"async-trait",
"bollard",
- "byteorder",
+ "byteorder 1.5.0",
"ed25519-dalek 2.1.1",
"env_logger",
"futures",
@@ -5019,7 +5001,7 @@ dependencies = [
"serial_test",
"sha2 0.9.9",
"slip10",
- "soroban-spec 22.0.0-rc.1.1",
+ "soroban-spec 22.0.0-rc.3",
"stellar-rpc-client",
"stellar-strkey 0.0.11",
"stellar-xdr 22.0.0-rc.1.1",
@@ -5033,7 +5015,7 @@ dependencies = [
[[package]]
name = "stellar-rpc-client"
version = "21.4.0"
-source = "git+https://github.com/stellar/rs-stellar-rpc-client?branch=main#7554d4c87c026313a1f5b3c7ae66a92b5ff7e091"
+source = "git+https://github.com/stellar/rs-stellar-rpc-client?rev=7554d4c87c026313a1f5b3c7ae66a92b5ff7e091#7554d4c87c026313a1f5b3c7ae66a92b5ff7e091"
dependencies = [
"clap",
"hex",
@@ -5122,17 +5104,6 @@ dependencies = [
"thiserror",
]
-[[package]]
-name = "string-interner"
-version = "0.17.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e"
-dependencies = [
- "cfg-if",
- "hashbrown 0.14.5",
- "serde",
-]
-
[[package]]
name = "string_cache"
version = "0.8.7"
@@ -6021,6 +5992,16 @@ version = "0.2.92"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96"
+[[package]]
+name = "wasm-gen"
+version = "0.1.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b854b1461005a7b3365742310f7faa3cac3add809d66928c64a40c7e9e842ebb"
+dependencies = [
+ "byteorder 0.5.3",
+ "leb128",
+]
+
[[package]]
name = "wasm-opt"
version = "0.114.2"
@@ -6080,17 +6061,6 @@ version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073"
-[[package]]
-name = "wasmi_collections"
-version = "0.36.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a1ee1cf2328e7fbb8654fda8449395c64c36ef5a30511e79fae0265a96e1a446"
-dependencies = [
- "ahash",
- "hashbrown 0.14.5",
- "string-interner",
-]
-
[[package]]
name = "wasmi_core"
version = "0.13.0"
@@ -6103,18 +6073,6 @@ dependencies = [
"paste",
]
-[[package]]
-name = "wasmi_core"
-version = "0.36.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4e77c1e701d21edfd263e5c6c940861202c6b840c715040cfdca6211bf8857aa"
-dependencies = [
- "downcast-rs",
- "libm",
- "num-traits",
- "paste",
-]
-
[[package]]
name = "wasmparser"
version = "0.90.0"
@@ -6449,7 +6407,7 @@ version = "0.7.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0"
dependencies = [
- "byteorder",
+ "byteorder 1.5.0",
"zerocopy-derive",
]
diff --git a/Cargo.toml b/Cargo.toml
index 8b10f373d..58caad196 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -39,26 +39,26 @@ default-features = true
# Dependencies from the rs-soroban-sdk repo:
[workspace.dependencies.soroban-spec]
-version = "=22.0.0-rc.1.1"
+version = "=22.0.0-rc.3"
[workspace.dependencies.soroban-spec-rust]
-version = "=22.0.0-rc.1.1"
+version = "=22.0.0-rc.3"
[workspace.dependencies.soroban-sdk]
-version = "=22.0.0-rc.1.1"
+version = "=22.0.0-rc.3"
[workspace.dependencies.soroban-token-sdk]
-version = "=22.0.0-rc.1.1"
+version = "=22.0.0-rc.3"
[workspace.dependencies.soroban-ledger-snapshot]
-version = "=22.0.0-rc.1.1"
+version = "=22.0.0-rc.3"
# Dependencies from the rs-stellar-rpc-client repo:
[workspace.dependencies.soroban-rpc]
package = "stellar-rpc-client"
version = "21.4.0"
git = "https://github.com/stellar/rs-stellar-rpc-client"
-branch = "main"
+rev = "7554d4c87c026313a1f5b3c7ae66a92b5ff7e091"
# Dependencies from elsewhere shared by crates:
[workspace.dependencies]
diff --git a/FULL_HELP_DOCS.md b/FULL_HELP_DOCS.md
index b3724b98b..8c151cb84 100644
--- a/FULL_HELP_DOCS.md
+++ b/FULL_HELP_DOCS.md
@@ -334,6 +334,7 @@ To view the commands that will be executed, without executing them, use the --pr
If ommitted, wasm files are written only to the cargo target directory.
* `--print-commands-only` — Print commands to build without executing them
+* `--meta ` — Add key-value to contract meta (adds the meta to the `contractmetav0` custom section)
diff --git a/Makefile b/Makefile
index 8a1333bd9..f534410e0 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ endif
# By default make `?=` operator will treat empty assignment as a set value and will not use the default value.
# Both cases should fallback to default of getting the version from git tag.
ifeq ($(strip $(REPOSITORY_VERSION)),)
- override REPOSITORY_VERSION = "$(shell git describe --tags --always --abbrev=0 --match='v[0-9]*.[0-9]*.[0-9]*' 2> /dev/null | sed 's/^.//')"
+ override REPOSITORY_VERSION = "$(shell ( git describe --tags --always --abbrev=0 --match='v[0-9]*.[0-9]*.[0-9]*' 2> /dev/null | sed 's/^.//' ) )"
endif
REPOSITORY_BRANCH := "$(shell git rev-parse --abbrev-ref HEAD)"
BUILD_TIMESTAMP ?= $(shell date '+%Y-%m-%dT%H:%M:%S')
diff --git a/README.md b/README.md
index 8fadb6740..381f5a3dd 100644
--- a/README.md
+++ b/README.md
@@ -37,6 +37,13 @@ Install the latest version from source:
cargo install --locked stellar-cli --features opt
```
+Install or run the unreleased main branch with nix:
+```
+% nix run 'github:stellar/stellar-cli' -- --help
+or install
+% nix profile install github:stellar/stellar-cli
+```
+
## Autocomplete
The Stellar CLI supports some autocompletion. To set up, run the following commands:
diff --git a/cmd/crates/soroban-spec-tools/src/contract.rs b/cmd/crates/soroban-spec-tools/src/contract.rs
index 9984a19d1..501609111 100644
--- a/cmd/crates/soroban-spec-tools/src/contract.rs
+++ b/cmd/crates/soroban-spec-tools/src/contract.rs
@@ -40,9 +40,9 @@ pub enum Error {
impl Spec {
pub fn new(bytes: &[u8]) -> Result {
- let mut env_meta: Option<&[u8]> = None;
- let mut meta: Option<&[u8]> = None;
- let mut spec: Option<&[u8]> = None;
+ let mut env_meta: Option> = None;
+ let mut meta: Option> = None;
+ let mut spec: Option> = None;
for payload in wasmparser::Parser::new(0).parse_all(bytes) {
let payload = payload?;
if let wasmparser::Payload::CustomSection(section) = payload {
@@ -52,13 +52,19 @@ impl Spec {
"contractspecv0" => &mut spec,
_ => continue,
};
- *out = Some(section.data());
+
+ if let Some(existing_data) = out {
+ let combined_data = [existing_data, section.data()].concat();
+ *out = Some(combined_data);
+ } else {
+ *out = Some(section.data().to_vec());
+ }
};
}
let mut env_meta_base64 = None;
let env_meta = if let Some(env_meta) = env_meta {
- env_meta_base64 = Some(base64.encode(env_meta));
+ env_meta_base64 = Some(base64.encode(&env_meta));
let cursor = Cursor::new(env_meta);
let mut read = Limited::new(cursor, Limits::none());
ScEnvMetaEntry::read_xdr_iter(&mut read).collect::, xdr::Error>>()?
@@ -68,7 +74,7 @@ impl Spec {
let mut meta_base64 = None;
let meta = if let Some(meta) = meta {
- meta_base64 = Some(base64.encode(meta));
+ meta_base64 = Some(base64.encode(&meta));
let cursor = Cursor::new(meta);
let mut depth_limit_read = Limited::new(cursor, Limits::none());
ScMetaEntry::read_xdr_iter(&mut depth_limit_read)
@@ -78,7 +84,7 @@ impl Spec {
};
let (spec_base64, spec) = if let Some(spec) = spec {
- let (spec_base64, spec) = Spec::spec_to_base64(spec)?;
+ let (spec_base64, spec) = Spec::spec_to_base64(&spec)?;
(Some(spec_base64), spec)
} else {
(None, vec![])
diff --git a/cmd/crates/soroban-test/tests/fixtures/workspace/contracts/add/src/lib.rs b/cmd/crates/soroban-test/tests/fixtures/workspace/contracts/add/src/lib.rs
index 1552f5855..d04162b5a 100644
--- a/cmd/crates/soroban-test/tests/fixtures/workspace/contracts/add/src/lib.rs
+++ b/cmd/crates/soroban-test/tests/fixtures/workspace/contracts/add/src/lib.rs
@@ -1,9 +1,11 @@
#![no_std]
-use soroban_sdk::{contract, contractimpl};
+use soroban_sdk::{contract, contractimpl, contractmeta};
#[contract]
pub struct Contract;
+contractmeta!(key = "Description", val = "A test add contract");
+
#[contractimpl]
impl Contract {
pub fn add(x: u64, y: u64) -> u128 {
diff --git a/cmd/crates/soroban-test/tests/it/build.rs b/cmd/crates/soroban-test/tests/it/build.rs
index aba6aadf5..925d88df1 100644
--- a/cmd/crates/soroban-test/tests/it/build.rs
+++ b/cmd/crates/soroban-test/tests/it/build.rs
@@ -116,3 +116,37 @@ cargo rustc --manifest-path=contracts/add/Cargo.toml --crate-type=cdylib --targe
",
));
}
+
+#[test]
+fn build_with_metadata() {
+ let sandbox = TestEnv::default();
+ let cargo_dir = std::path::PathBuf::from(env!("CARGO_MANIFEST_DIR"));
+ let fixture_path = cargo_dir.join("tests/fixtures/workspace/contracts/add");
+ let outdir = sandbox.dir().join("out");
+
+ sandbox
+ .new_assert_cmd("contract")
+ .current_dir(&fixture_path)
+ .arg("build")
+ .arg("--meta")
+ .arg("contract meta=added on build")
+ .arg("--out-dir")
+ .arg(&outdir)
+ .assert()
+ .success();
+
+ // verify that the metadata added in the contract code via contractmetadata! macro is present
+ // as well as the meta that is included on build
+ let wasm_path = fixture_path.join(&outdir).join("add.wasm");
+ sandbox
+ .new_assert_cmd("contract")
+ .current_dir(&fixture_path)
+ .arg("info")
+ .arg("meta")
+ .arg("--wasm")
+ .arg(wasm_path)
+ .assert()
+ .success()
+ .stdout(predicate::str::contains("Description: A test add contract"))
+ .stdout(predicate::str::contains("contract meta: added on build"));
+}
diff --git a/cmd/soroban-cli/Cargo.toml b/cmd/soroban-cli/Cargo.toml
index 00b8df302..efef18e0f 100644
--- a/cmd/soroban-cli/Cargo.toml
+++ b/cmd/soroban-cli/Cargo.toml
@@ -124,6 +124,7 @@ glob = "0.3.1"
fqdn = "0.3.12"
open = "5.3.0"
url = "2.5.2"
+wasm-gen = "0.1.4"
[build-dependencies]
crate-git-revision = "0.0.4"
diff --git a/cmd/soroban-cli/src/commands/contract/build.rs b/cmd/soroban-cli/src/commands/contract/build.rs
index bf40b8c94..ac1aa1302 100644
--- a/cmd/soroban-cli/src/commands/contract/build.rs
+++ b/cmd/soroban-cli/src/commands/contract/build.rs
@@ -1,3 +1,4 @@
+use cargo_metadata::{Metadata, MetadataCommand, Package};
use clap::Parser;
use itertools::Itertools;
use std::{
@@ -10,8 +11,7 @@ use std::{
path::{self, Path, PathBuf},
process::{Command, ExitStatus, Stdio},
};
-
-use cargo_metadata::{Metadata, MetadataCommand, Package};
+use stellar_xdr::curr::{Limits, ScMetaEntry, ScMetaV0, StringM, WriteXdr};
use crate::{commands::global, print::Print};
@@ -65,6 +65,20 @@ pub struct Cmd {
/// Print commands to build without executing them
#[arg(long, conflicts_with = "out_dir", help_heading = "Other")]
pub print_commands_only: bool,
+ /// Add key-value to contract meta (adds the meta to the `contractmetav0` custom section)
+ #[arg(long, num_args=1, value_parser=parse_meta_arg, action=clap::ArgAction::Append, help_heading = "Metadata")]
+ pub meta: Vec<(String, String)>,
+}
+
+fn parse_meta_arg(s: &str) -> Result<(String, String), Error> {
+ let parts = s.splitn(2, '=');
+
+ let (key, value) = parts
+ .map(str::trim)
+ .next_tuple()
+ .ok_or_else(|| Error::MetaArg("must be in the form 'key=value'".to_string()))?;
+
+ Ok((key.to_string(), value.to_string()))
}
#[derive(thiserror::Error, Debug)]
@@ -87,8 +101,17 @@ pub enum Error {
GettingCurrentDir(io::Error),
#[error("retreiving CARGO_HOME: {0}")]
CargoHome(io::Error),
+ #[error("reading wasm file: {0}")]
+ ReadingWasmFile(io::Error),
+ #[error("writing wasm file: {0}")]
+ WritingWasmFile(io::Error),
+ #[error("invalid meta entry: {0}")]
+ MetaArg(String),
}
+const WASM_TARGET: &str = "wasm32-unknown-unknown";
+const META_CUSTOM_SECTION_NAME: &str = "contractmetav0";
+
impl Cmd {
pub fn run(&self, global_args: &global::Args) -> Result<(), Error> {
let print = Print::new(global_args.quiet);
@@ -118,7 +141,7 @@ impl Cmd {
manifest_path.to_string_lossy()
));
cmd.arg("--crate-type=cdylib");
- cmd.arg("--target=wasm32-unknown-unknown");
+ cmd.arg(format!("--target={WASM_TARGET}"));
if self.profile == "release" {
cmd.arg("--release");
} else {
@@ -168,14 +191,16 @@ impl Cmd {
return Err(Error::Exit(status));
}
+ let file = format!("{}.wasm", p.name.replace('-', "_"));
+ let target_file_path = Path::new(target_dir)
+ .join(WASM_TARGET)
+ .join(&self.profile)
+ .join(&file);
+
+ self.handle_contract_metadata_args(&target_file_path)?;
+
if let Some(out_dir) = &self.out_dir {
fs::create_dir_all(out_dir).map_err(Error::CreatingOutDir)?;
-
- let file = format!("{}.wasm", p.name.replace('-', "_"));
- let target_file_path = Path::new(target_dir)
- .join("wasm32-unknown-unknown")
- .join(&self.profile)
- .join(&file);
let out_file_path = Path::new(out_dir).join(&file);
fs::copy(target_file_path, out_file_path).map_err(Error::CopyingWasmFile)?;
}
@@ -251,6 +276,34 @@ impl Cmd {
// the output.
cmd.exec()
}
+
+ fn handle_contract_metadata_args(&self, target_file_path: &PathBuf) -> Result<(), Error> {
+ if self.meta.is_empty() {
+ return Ok(());
+ }
+
+ let mut wasm_bytes = fs::read(target_file_path).map_err(Error::ReadingWasmFile)?;
+
+ for (k, v) in self.meta.clone() {
+ let key: StringM = k
+ .clone()
+ .try_into()
+ .map_err(|e| Error::MetaArg(format!("{k} is an invalid metadata key: {e}")))?;
+
+ let val: StringM = v
+ .clone()
+ .try_into()
+ .map_err(|e| Error::MetaArg(format!("{v} is an invalid metadata value: {e}")))?;
+ let meta_entry = ScMetaEntry::ScMetaV0(ScMetaV0 { key, val });
+ let xdr: Vec = meta_entry
+ .to_xdr(Limits::none())
+ .map_err(|e| Error::MetaArg(format!("failed to encode metadata entry: {e}")))?;
+
+ wasm_gen::write_custom_section(&mut wasm_bytes, META_CUSTOM_SECTION_NAME, &xdr);
+ }
+
+ fs::write(target_file_path, wasm_bytes).map_err(Error::WritingWasmFile)
+ }
}
/// Configure cargo/rustc to replace absolute paths in panic messages / debuginfo
diff --git a/cmd/soroban-cli/src/commands/global.rs b/cmd/soroban-cli/src/commands/global.rs
index be883b6fd..02c0b3b58 100644
--- a/cmd/soroban-cli/src/commands/global.rs
+++ b/cmd/soroban-cli/src/commands/global.rs
@@ -4,7 +4,7 @@ use clap::{
};
use std::path::PathBuf;
-use super::config;
+use super::{config, HEADING_GLOBAL};
const USAGE_STYLES: Styles = Styles::styled()
.header(AnsiColor::Green.on_default().effects(Effects::BOLD))
@@ -24,19 +24,19 @@ pub struct Args {
pub locator: config::locator::Args,
/// Filter logs output. To turn on `stellar_cli::log::footprint=debug` or off `=off`. Can also use env var `RUST_LOG`.
- #[arg(long, short = 'f', global = true)]
+ #[arg(long, short = 'f', global = true, help_heading = HEADING_GLOBAL)]
pub filter_logs: Vec,
/// Do not write logs to stderr including `INFO`
- #[arg(long, short = 'q', global = true)]
+ #[arg(long, short = 'q', global = true, help_heading = HEADING_GLOBAL)]
pub quiet: bool,
/// Log DEBUG events
- #[arg(long, short = 'v', global = true)]
+ #[arg(long, short = 'v', global = true, help_heading = HEADING_GLOBAL)]
pub verbose: bool,
/// Log DEBUG and TRACE events
- #[arg(long, visible_alias = "vv", global = true)]
+ #[arg(long, visible_alias = "vv", global = true, help_heading = HEADING_GLOBAL)]
pub very_verbose: bool,
/// List installed plugins. E.g. `stellar-hello`
@@ -44,7 +44,7 @@ pub struct Args {
pub list: bool,
/// Do not cache your simulations and transactions
- #[arg(long, env = "STELLAR_NO_CACHE", global = true)]
+ #[arg(long, env = "STELLAR_NO_CACHE", global = true, help_heading = HEADING_GLOBAL)]
pub no_cache: bool,
}
diff --git a/cmd/soroban-cli/src/commands/mod.rs b/cmd/soroban-cli/src/commands/mod.rs
index 0a1d4629b..a6a85e816 100644
--- a/cmd/soroban-cli/src/commands/mod.rs
+++ b/cmd/soroban-cli/src/commands/mod.rs
@@ -20,6 +20,7 @@ pub mod version;
pub mod txn_result;
pub const HEADING_RPC: &str = "Options (RPC)";
+pub const HEADING_GLOBAL: &str = "Options (Global)";
const ABOUT: &str =
"Work seamlessly with Stellar accounts, contracts, and assets from the command line.
diff --git a/cmd/soroban-cli/src/config/locator.rs b/cmd/soroban-cli/src/config/locator.rs
index 70b4f75f8..0a13c4cc3 100644
--- a/cmd/soroban-cli/src/config/locator.rs
+++ b/cmd/soroban-cli/src/config/locator.rs
@@ -12,7 +12,7 @@ use std::{
};
use stellar_strkey::{Contract, DecodeError};
-use crate::{utils::find_config_dir, Pwd};
+use crate::{commands::HEADING_GLOBAL, utils::find_config_dir, Pwd};
use super::{
alias,
@@ -82,11 +82,11 @@ pub enum Error {
#[group(skip)]
pub struct Args {
/// Use global config
- #[arg(long, global = true)]
+ #[arg(long, global = true, help_heading = HEADING_GLOBAL)]
pub global: bool,
/// Location of config directory, default is "."
- #[arg(long, global = true)]
+ #[arg(long, global = true, help_heading = HEADING_GLOBAL)]
pub config_dir: Option,
}
diff --git a/flake.lock b/flake.lock
index fef18714e..fd92bacb2 100644
--- a/flake.lock
+++ b/flake.lock
@@ -36,11 +36,11 @@
},
"nixpkgs_2": {
"locked": {
- "lastModified": 1718428119,
- "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=",
+ "lastModified": 1728538411,
+ "narHash": "sha256-f0SBJz1eZ2yOuKUr5CA9BHULGXVSn6miBuUWdTyhUhU=",
"owner": "NixOS",
"repo": "nixpkgs",
- "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5",
+ "rev": "b69de56fac8c2b6f8fd27f2eca01dcda8e0a4221",
"type": "github"
},
"original": {
@@ -62,11 +62,11 @@
"nixpkgs": "nixpkgs_2"
},
"locked": {
- "lastModified": 1727144949,
- "narHash": "sha256-uMZMjoCS2nf40TAE1686SJl3OXWfdfM+BDEfRdr+uLc=",
+ "lastModified": 1729823394,
+ "narHash": "sha256-RiinJqorqSLKh1oSpiMHnBe6nQdJzE45lX6fSnAuDnI=",
"owner": "oxalica",
"repo": "rust-overlay",
- "rev": "2e19799819104b46019d339e78d21c14372d3666",
+ "rev": "7e52e80f5faa374ad4c607d62c6d362589cb523f",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 1923d75bb..0a30ea556 100644
--- a/flake.nix
+++ b/flake.nix
@@ -1,5 +1,5 @@
{
- description = "stellar-cli development shell";
+ description = "stellar-cli";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -14,14 +14,13 @@
pkgs = import nixpkgs {
inherit system overlays;
};
- in
- with pkgs;
- {
- devShells.default = mkShell {
- nativeBuildInputs = lib.optionals (stdenv.isDarwin) [
+ stellardev = {
+ name = "stellar";
+ src = ./.;
+ nativeBuildInputs = pkgs.lib.optionals (pkgs.stdenv.isDarwin) [
pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
];
- buildInputs = [
+ buildInputs = with pkgs; [
openssl
pkg-config
jq
@@ -31,6 +30,29 @@
})
] ++ lib.optionals (stdenv.isLinux) [libudev-zero];
};
+ stellarcli = stellardev // {
+ cargoLock = {
+ lockFile = ./Cargo.lock;
+ };
+
+ cargoLock.outputHashes = {
+ # The only git+https dependency in Cargo.lock
+ "stellar-rpc-client-21.4.0" = "sha256-ue7Ynux9YaDP3f/XkHz2OPd2g0iCX5R0yS5SaVHEYxQ";
+ };
+
+ doCheck = false;
+
+ GIT_REVISION = "${self.rev or self.dirtyRev or "unknown"}";
+ };
+ rustPlatformMod = pkgs.makeRustPlatform {
+ cargo = pkgs.rust-bin.stable.latest.default;
+ rustc = pkgs.rust-bin.stable.latest.default;
+ };
+ in
+ with pkgs;
+ {
+ devShells.default = mkShell stellardev;
+ packages.default = rustPlatformMod.buildRustPackage stellarcli;
}
);
}