diff --git a/Cargo.lock b/Cargo.lock index 98174aeea..83afe4934 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,6 +297,12 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes-lit" version = "0.0.5" @@ -785,6 +791,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -806,6 +821,17 @@ dependencies = [ "allocator-api2", ] +[[package]] +name = "heapless" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25ba4bd83f9415b58b4ed8dc5714c76e626a105be4646c02630ad730ad3b5aa4" +dependencies = [ + "hash32", + "stable_deref_trait", + "zeroize", +] + [[package]] name = "hermit-abi" version = "0.3.3" @@ -1694,7 +1720,7 @@ dependencies = [ "soroban-test-wasms", "soroban-wasmi", "static_assertions", - "stellar-strkey", + "stellar-strkey 0.0.18", "tabwriter", "textplots", "thousands", @@ -1790,6 +1816,12 @@ dependencies = [ "der", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + [[package]] name = "static_assertions" version = "1.1.0" @@ -1806,6 +1838,18 @@ dependencies = [ "data-encoding", ] +[[package]] +name = "stellar-strkey" +version = "0.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f34ff61c0ca6f1c2b4169e8d1633417bd9225f58b6175e4e317204565d16277" +dependencies = [ + "crate-git-revision 0.0.9", + "data-encoding", + "heapless", + "zeroize", +] + [[package]] name = "stellar-xdr" version = "27.0.0" @@ -1822,7 +1866,7 @@ dependencies = [ "serde", "serde_with", "sha2", - "stellar-strkey", + "stellar-strkey 0.0.13", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 907b6f2d0..8e4073775 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ exclude = ["soroban-test-wasms/wasm-workspace"] # code guarded by `unstable-*` features to make it enabled # unconditionally. version = "27.0.0" -rust-version = "1.84.0" +rust-version = "1.87.0" [workspace.dependencies] soroban-env-common = { version = "=27.0.0", path = "soroban-env-common", default-features = false } diff --git a/cackle.toml b/cackle.toml index 32998ea98..c9ea34742 100644 --- a/cackle.toml +++ b/cackle.toml @@ -109,6 +109,9 @@ allow_apis = [ [pkg.rand] allow_unsafe = true +allow_apis = [ + "rand", +] [pkg.backtrace] allow_apis = [ @@ -146,6 +149,18 @@ allow_unsafe = true [pkg.subtle] allow_unsafe = true +[pkg.byteorder] +allow_unsafe = true + +[pkg.hash32] +allow_unsafe = true + +[pkg.stable_deref_trait] +allow_unsafe = true + +[pkg.stellar-strkey] +allow_unsafe = true + [pkg.zeroize] allow_unsafe = true @@ -245,6 +260,14 @@ build.allow_apis = [ "env", ] +[pkg.heapless] +allow_unsafe = true +build.allow_apis = [ + "env", + "fs", + "process", +] + [pkg.tracking-allocator] allow_unsafe = true from.test.allow_apis = [ diff --git a/deny.toml b/deny.toml index 5a607e97a..297b63647 100644 --- a/deny.toml +++ b/deny.toml @@ -246,6 +246,10 @@ skip = [ { name = "hashbrown", version = "=0.14.1" }, { name = "syn", version = "=1.0.109" }, { name = "crate-git-revision", version = "=0.0.6" }, + # Transitional duplicate: we depend on stellar-strkey 0.0.18 directly while + # the published stellar-xdr 27.0.0 still pulls in 0.0.13. This goes away once + # the stellar-xdr v28 (protocol-28) release also ships on strkey 0.0.18. + { name = "stellar-strkey", version = "=0.0.13" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive diff --git a/soroban-env-host/Cargo.toml b/soroban-env-host/Cargo.toml index 379498809..c1651add2 100644 --- a/soroban-env-host/Cargo.toml +++ b/soroban-env-host/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" version.workspace = true readme = "../README.md" edition = "2021" -rust-version = "1.84.0" +rust-version = "1.87.0" build = "build.rs" exclude = ["observations/"] @@ -18,7 +18,7 @@ soroban-builtin-sdk-macros = { workspace = true } soroban-env-common = { workspace = true, features = ["std", "wasmi", "shallow-val-hash"] } wasmi = { workspace = true } wasmparser = { workspace = true } -stellar-strkey = "0.0.13" +stellar-strkey = "0.0.18" static_assertions = "1.1.0" sha2 = "0.10.8" hex-literal = "0.4.1" diff --git a/soroban-env-host/src/crypto/poseidon/poseidon2.rs b/soroban-env-host/src/crypto/poseidon/poseidon2.rs index 35f89060d..8c8f984ef 100644 --- a/soroban-env-host/src/crypto/poseidon/poseidon2.rs +++ b/soroban-env-host/src/crypto/poseidon/poseidon2.rs @@ -89,7 +89,7 @@ impl Poseidon2 { /// (https://eprint.iacr.org/2023/323) fn matmul_m4(&self, host: &Host, state: &mut [F]) -> Result<(), HostError> { let t = self.params.t; - if t % 4 != 0 { + if !t.is_multiple_of(4) { return Err(host.error( INVALID_INPUT, "Poseidon2: matmul_m4 state size must be divisible by 4", diff --git a/soroban-env-host/src/crypto/poseidon/poseidon2_params.rs b/soroban-env-host/src/crypto/poseidon/poseidon2_params.rs index 58a9d6c87..7fa56c298 100644 --- a/soroban-env-host/src/crypto/poseidon/poseidon2_params.rs +++ b/soroban-env-host/src/crypto/poseidon/poseidon2_params.rs @@ -46,7 +46,7 @@ impl Poseidon2Params { ], )); } - if rounds_f % 2 != 0 { + if !rounds_f.is_multiple_of(2) { return Err(host.error( INVALID_INPUT, "Poseidon2: `rounds_f` must be even", diff --git a/soroban-env-host/src/crypto/poseidon/poseidon_params.rs b/soroban-env-host/src/crypto/poseidon/poseidon_params.rs index eee355bd1..96f4b7473 100644 --- a/soroban-env-host/src/crypto/poseidon/poseidon_params.rs +++ b/soroban-env-host/src/crypto/poseidon/poseidon_params.rs @@ -46,7 +46,7 @@ impl PoseidonParams { ], )); } - if rounds_f % 2 != 0 { + if !rounds_f.is_multiple_of(2) { return Err(host.error( INVALID_INPUT, "Poseidon: `rounds_f` must be even", diff --git a/soroban-env-host/src/host/conversion.rs b/soroban-env-host/src/host/conversion.rs index 1d297ed9d..e9193b545 100644 --- a/soroban-env-host/src/host/conversion.rs +++ b/soroban-env-host/src/host/conversion.rs @@ -686,7 +686,7 @@ impl Host { )) } }; - Ok(strkey.to_string()) + Ok(strkey.to_string().as_str().to_string()) } pub(crate) fn muxed_sc_address_to_strkey( @@ -708,7 +708,7 @@ impl Host { ed25519: muxed_account.ed25519.0.metered_clone(self)?, }, ); - Ok(strkey.to_string()) + Ok(strkey.to_string().as_str().to_string()) } _ => Err(self.err( ScErrorType::Object, diff --git a/soroban-fuzz-targets/Cargo.toml b/soroban-fuzz-targets/Cargo.toml index 1931ef255..206f461b5 100644 --- a/soroban-fuzz-targets/Cargo.toml +++ b/soroban-fuzz-targets/Cargo.toml @@ -7,7 +7,7 @@ authors = ["Stellar Development Foundation "] license = "Apache-2.0" version.workspace = true edition = "2021" -rust-version = "1.84.0" +rust-version = "1.87.0" publish = false [dependencies]