From a289badc26eb8751f3999ba4e8cee06cee86f851 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Fri, 12 Apr 2024 19:10:54 -0400 Subject: [PATCH 1/3] Add an account contract with secp256r1 sig verification and test it end-to-end --- .../src/builtin_contracts/testutils.rs | 19 + .../src/test/stellar_asset_contract.rs | 61 ++- soroban-env-host/src/vm/parsed_module.rs | 3 +- soroban-test-wasms/src/lib.rs | 3 + soroban-test-wasms/wasm-workspace/Cargo.lock | 463 +++++++++--------- soroban-test-wasms/wasm-workspace/Cargo.toml | 9 +- .../wasm-workspace/complex/src/lib.rs | 5 +- .../wasm-workspace/increment/Cargo.toml | 20 + .../wasm-workspace/increment/src/lib.rs | 72 +++ .../wasm-workspace/opt/curr/increment.wasm | Bin 0 -> 1552 bytes .../write_upgrade_bytes/src/lib.rs | 12 +- 11 files changed, 414 insertions(+), 253 deletions(-) create mode 100644 soroban-test-wasms/wasm-workspace/increment/Cargo.toml create mode 100644 soroban-test-wasms/wasm-workspace/increment/src/lib.rs create mode 100644 soroban-test-wasms/wasm-workspace/opt/curr/increment.wasm diff --git a/soroban-env-host/src/builtin_contracts/testutils.rs b/soroban-env-host/src/builtin_contracts/testutils.rs index 755533ee2..43895044c 100644 --- a/soroban-env-host/src/builtin_contracts/testutils.rs +++ b/soroban-env-host/src/builtin_contracts/testutils.rs @@ -256,6 +256,25 @@ pub(crate) fn sign_payload_for_ed25519( .unwrap() } +#[allow(dead_code)] +pub(crate) fn sign_payload_for_secp256r1( + host: &Host, + signer: &p256::ecdsa::SigningKey, + payload: &[u8], +) -> BytesN<64> { + use p256::ecdsa::Signature; + let mut sig: Signature = signer.sign_prehash_recoverable(payload).unwrap().0; + sig = sig.normalize_s().unwrap_or(sig); + println!("produced signature {:x?}", sig.to_bytes()); + BytesN::<64>::try_from_val( + host, + &host + .bytes_new_from_slice(sig.to_bytes().as_slice()) + .unwrap(), + ) + .unwrap() +} + #[allow(clippy::too_many_arguments)] pub(crate) fn create_account( host: &Host, diff --git a/soroban-env-host/src/test/stellar_asset_contract.rs b/soroban-env-host/src/test/stellar_asset_contract.rs index c4b4895df..d0b93529e 100644 --- a/soroban-env-host/src/test/stellar_asset_contract.rs +++ b/soroban-env-host/src/test/stellar_asset_contract.rs @@ -27,8 +27,9 @@ use crate::{ Env, EnvBase, Host, HostError, LedgerInfo, Symbol, TryFromVal, TryIntoVal, Val, }; use ed25519_dalek::SigningKey; +use hex_literal::hex; use soroban_test_wasms::{ - ERR, INVOKE_CONTRACT, SAC_REENTRY_TEST_CONTRACT, SIMPLE_ACCOUNT_CONTRACT, + ERR, INCREMENT, INVOKE_CONTRACT, SAC_REENTRY_TEST_CONTRACT, SIMPLE_ACCOUNT_CONTRACT, }; use stellar_strkey::ed25519; @@ -3060,6 +3061,64 @@ fn test_custom_account_auth() { .is_err()); } +#[allow(clippy::type_complexity)] +fn secp256r1_sign_fn<'a>( + host: &'a Host, + signing_key: &'a p256::ecdsa::SigningKey, +) -> Box Val + 'a> { + use crate::builtin_contracts::testutils::sign_payload_for_secp256r1; + Box::new(|payload: &[u8]| -> Val { + sign_payload_for_secp256r1(host, signing_key, payload).into() + }) +} + +#[test] +fn test_account_with_p256_signer() -> Result<(), HostError> { + use p256::ecdsa::SigningKey; + + let host = Host::test_host_with_recording_footprint(); + host.set_ledger_info(LedgerInfo { + protocol_version: crate::meta::get_ledger_protocol_version(crate::meta::INTERFACE_VERSION), + sequence_number: 123, + timestamp: 123456, + network_id: [5; 32], + base_reserve: 5_000_000, + min_persistent_entry_ttl: 4096, + min_temp_entry_ttl: 16, + max_entry_ttl: 6_312_000, + })?; + host.enable_debug()?; + + let contract_addr_obj = host.register_test_contract_wasm(INCREMENT); + let contract_addr: Address = contract_addr_obj.try_into_val(&host)?; + // key pair taken from RFC 6979 Appendix 2.5 (NIST P-256 + SHA-256) + // + let x = hex!("C9AFA9D845BA75166B5C215767B1D6934E50C3DB36E89B127B8A622B120F6721"); + let signing_key = SigningKey::from_bytes(&x.into()).unwrap(); + let admin = TestSigner::AccountContract(AccountContractSigner { + address: contract_addr.clone(), + sign: secp256r1_sign_fn(&host, &signing_key), + }); + // initialize the contract by calling its `init` with the secp256r1 public key + let verifying_key = host.bytes_new_from_slice(&hex!("0460FED4BA255A9D31C961EB74C6356D68C049B8923B61FA6CE669622E60F29FB67903FE1008B8BC99A41AE9E95628BC64F2F1B20C2D7E9F5177A3C294D4462299"))?; + let _ = host.call( + contract_addr_obj.clone(), + Symbol::try_from_small_str("init")?, + test_vec!(&host, verifying_key).into(), + )?; + + authorize_single_invocation(&host, &admin, &contract_addr, "increment", test_vec![&host]); + + let v = host.call( + contract_addr_obj, + Symbol::try_from_small_str("increment")?, + test_vec![&host].into(), + )?; + + assert_eq!(v.get_payload(), Val::from_u32(1).as_val().get_payload()); + Ok(()) +} + #[test] fn test_recording_auth_for_stellar_asset_contract() { let test = StellarAssetContractTest::setup(function_name!()); diff --git a/soroban-env-host/src/vm/parsed_module.rs b/soroban-env-host/src/vm/parsed_module.rs index b320972a5..3b3efdaff 100644 --- a/soroban-env-host/src/vm/parsed_module.rs +++ b/soroban-env-host/src/vm/parsed_module.rs @@ -300,7 +300,8 @@ impl ParsedModule { host, (ScErrorType::WasmVm, ScErrorCode::InvalidInput), "contract protocol number is newer than host", - got_proto + got_proto, + want_proto )); } Ok(()) diff --git a/soroban-test-wasms/src/lib.rs b/soroban-test-wasms/src/lib.rs index 1af921efe..56b6d6e3d 100644 --- a/soroban-test-wasms/src/lib.rs +++ b/soroban-test-wasms/src/lib.rs @@ -98,4 +98,7 @@ mod curr { pub const DEPLOYER_TEST_CONTRACT: &[u8] = include_bytes!("../wasm-workspace/opt/curr/test_deployer.wasm").as_slice(); + + pub const INCREMENT: &[u8] = + include_bytes!("../wasm-workspace/opt/curr/increment.wasm").as_slice(); } diff --git a/soroban-test-wasms/wasm-workspace/Cargo.lock b/soroban-test-wasms/wasm-workspace/Cargo.lock index 8fe9244ff..4888a2d40 100644 --- a/soroban-test-wasms/wasm-workspace/Cargo.lock +++ b/soroban-test-wasms/wasm-workspace/Cargo.lock @@ -45,15 +45,15 @@ dependencies = [ name = "auth_test_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] [[package]] name = "autocfg" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" [[package]] name = "backtrace" @@ -90,9 +90,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -111,9 +111,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytes-lit" @@ -129,12 +129,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "libc", -] +checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" [[package]] name = "cfg-if" @@ -144,9 +141,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" dependencies = [ "android-tzdata", "iana-time-zone", @@ -157,29 +154,29 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "contract_sac_transfer" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] @@ -197,9 +194,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.5.4" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28f85c3514d2a6e64160359b45a3918c3b4178bcbf4ae5d03ab2d02e521c479a" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core", @@ -219,9 +216,9 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" +checksum = "ad291aa74992b9b7a7e88c38acbbf6ad7e107f1d90ee8775b7bc1fc3394f485c" dependencies = [ "quote", "syn", @@ -229,9 +226,9 @@ dependencies = [ [[package]] name = "curve25519-dalek" -version = "4.1.1" +version = "4.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" dependencies = [ "cfg-if", "cpufeatures", @@ -257,9 +254,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" dependencies = [ "darling_core", "darling_macro", @@ -267,9 +264,9 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" dependencies = [ "fnv", "ident_case", @@ -281,9 +278,9 @@ dependencies = [ [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core", "quote", @@ -292,9 +289,9 @@ dependencies = [ [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "zeroize", @@ -302,9 +299,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -335,22 +332,21 @@ dependencies = [ [[package]] name = "downcast-rs" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" [[package]] name = "ecdsa" -version = "0.16.8" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4b1e0c257a9e9f25f90ff76d7a68360ed497ee519c8e428d1825ef0000799d4" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", "digest", "elliptic-curve", "rfc6979", "signature", - "spki", ] [[package]] @@ -379,15 +375,15 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" [[package]] name = "elliptic-curve" -version = "0.13.6" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d97ca172ae9dc9f9b779a6e3a65d308f2af74e5b8c921299075bdb4a0370e914" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", @@ -395,7 +391,6 @@ dependencies = [ "ff", "generic-array", "group", - "pkcs8", "rand_core", "sec1", "subtle", @@ -424,7 +419,7 @@ checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" name = "example_add_f32" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -432,7 +427,7 @@ dependencies = [ name = "example_add_i32" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -440,7 +435,7 @@ dependencies = [ name = "example_alloc" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -448,7 +443,7 @@ dependencies = [ name = "example_complex" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -456,7 +451,7 @@ dependencies = [ name = "example_contract_data" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -464,7 +459,7 @@ dependencies = [ name = "example_create_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -472,7 +467,7 @@ dependencies = [ name = "example_err" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -480,7 +475,7 @@ dependencies = [ name = "example_fannkuch" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -488,7 +483,7 @@ dependencies = [ name = "example_fib" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -496,7 +491,7 @@ dependencies = [ name = "example_hostile" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -504,7 +499,7 @@ dependencies = [ name = "example_invoke_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -512,7 +507,7 @@ dependencies = [ name = "example_linear_memory" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -520,7 +515,7 @@ dependencies = [ name = "example_simple_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -528,7 +523,7 @@ dependencies = [ name = "example_sum_i32" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -536,7 +531,7 @@ dependencies = [ name = "example_updateable_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -544,7 +539,7 @@ dependencies = [ name = "example_upload_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -552,7 +547,7 @@ dependencies = [ name = "example_vec" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -568,9 +563,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.4" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53a56f0780318174bad1c127063fd0c5fdfb35398e3cd79ffaab931a6c79df80" +checksum = "c007b1ae3abe1cb6f85a16305acd418b7ca6343b953633fee2b76d8f108b830f" [[package]] name = "fnv" @@ -604,9 +599,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "group" @@ -627,9 +622,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "hex" @@ -659,15 +654,15 @@ dependencies = [ name = "hostile_large_val" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -692,6 +687,15 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "increment" +version = "0.0.0" +dependencies = [ + "hex", + "soroban-env-common", + "soroban-sdk", +] + [[package]] name = "indexmap" version = "1.9.3" @@ -705,12 +709,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.2", + "hashbrown 0.14.3", "serde", ] @@ -731,15 +735,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" dependencies = [ "wasm-bindgen", ] @@ -753,25 +757,23 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "once_cell", "sha2", - "signature", ] [[package]] name = "keccak" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" dependencies = [ "cpufeatures", ] [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "libm" @@ -783,27 +785,27 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" name = "loadgen" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -819,6 +821,12 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + [[package]] name = "num-derive" version = "0.4.1" @@ -851,18 +859,30 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" + +[[package]] +name = "p256" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] [[package]] name = "paste" @@ -882,9 +902,9 @@ dependencies = [ [[package]] name = "platforms" -version = "3.2.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" +checksum = "db23d408679286588f4d4644f965003d056e3dd5abcaaa938116871d7ce2fee7" [[package]] name = "powerfmt" @@ -908,6 +928,15 @@ dependencies = [ "syn", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -960,7 +989,7 @@ dependencies = [ name = "recursive_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -991,37 +1020,36 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "sac_reentry_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] [[package]] name = "sec1" -version = "0.7.3" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" dependencies = [ "base16ct", "der", "generic-array", - "pkcs8", "subtle", "zeroize", ] [[package]] name = "semver" -version = "1.0.20" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" [[package]] name = "serde" @@ -1056,16 +1084,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "3.4.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "ee80b0e361bbf88fd2f6e242ccd19cfda072cb0faa6ae694ecee08199938569a" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.2.6", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -1073,9 +1102,9 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "6561dc161a9224638a31d876ccdfefbc1df91d3f3a8342eddb35f055d48c7655" dependencies = [ "darling", "proc-macro2", @@ -1116,15 +1145,13 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" -version = "20.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc32c6e817f3ca269764ec0d7d14da6210b74a5bf14d4e745aa3ee860558900" +version = "21.0.0" dependencies = [ "itertools", "proc-macro2", @@ -1134,22 +1161,7 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "20.3.0" -dependencies = [ - "crate-git-revision", - "ethnum", - "num-derive", - "num-traits", - "soroban-env-macros 20.3.0", - "static_assertions", - "stellar-xdr 20.1.0 (git+https://github.com/stellar/rs-stellar-xdr?rev=3a001b1fbb20e4cfa2cef2c0cc450564e8528057)", -] - -[[package]] -name = "soroban-env-common" -version = "20.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c14e18d879c520ff82612eaae0590acaf6a7f3b977407e1abb1c9e31f94c7814" +version = "21.0.0" dependencies = [ "arbitrary", "crate-git-revision", @@ -1157,31 +1169,31 @@ dependencies = [ "num-derive", "num-traits", "serde", - "soroban-env-macros 20.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soroban-env-macros", "soroban-wasmi", "static_assertions", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", + "wasmparser", ] [[package]] name = "soroban-env-guest" -version = "20.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5122ca2abd5ebcc1e876a96b9b44f87ce0a0e06df8f7c09772ddb58b159b7454" +version = "21.0.0" dependencies = [ - "soroban-env-common 20.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soroban-env-common", "static_assertions", ] [[package]] name = "soroban-env-host" -version = "20.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "114a0fa0d0cc39d0be16b1ee35b6e5f4ee0592ddcf459bde69391c02b03cf520" +version = "21.0.0" dependencies = [ "backtrace", "curve25519-dalek", + "ecdsa", "ed25519-dalek", + "elliptic-curve", + "generic-array", "getrandom", "hex-literal", "hmac", @@ -1189,42 +1201,30 @@ dependencies = [ "num-derive", "num-integer", "num-traits", + "p256", "rand", "rand_chacha", + "sec1", "sha2", "sha3", "soroban-builtin-sdk-macros", - "soroban-env-common 20.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soroban-env-common", "soroban-wasmi", "static_assertions", "stellar-strkey", + "wasmparser", ] [[package]] name = "soroban-env-macros" -version = "20.3.0" -dependencies = [ - "itertools", - "proc-macro2", - "quote", - "serde", - "serde_json", - "stellar-xdr 20.1.0 (git+https://github.com/stellar/rs-stellar-xdr?rev=3a001b1fbb20e4cfa2cef2c0cc450564e8528057)", - "syn", -] - -[[package]] -name = "soroban-env-macros" -version = "20.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13e3f8c86f812e0669e78fcb3eae40c385c6a9dd1a4886a1de733230b4fcf27" +version = "21.0.0" dependencies = [ "itertools", "proc-macro2", "quote", "serde", "serde_json", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", "syn", ] @@ -1235,7 +1235,7 @@ dependencies = [ "serde", "serde_json", "serde_with", - "soroban-env-common 20.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soroban-env-common", "soroban-env-host", "thiserror", ] @@ -1269,10 +1269,10 @@ dependencies = [ "quote", "rustc_version", "sha2", - "soroban-env-common 20.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "soroban-env-common", "soroban-spec", "soroban-spec-rust", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", "syn", ] @@ -1281,7 +1281,7 @@ name = "soroban-spec" version = "20.5.0" dependencies = [ "base64 0.13.1", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", "thiserror", "wasmparser", ] @@ -1295,7 +1295,7 @@ dependencies = [ "quote", "sha2", "soroban-spec", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", "syn", "thiserror", ] @@ -1303,8 +1303,7 @@ dependencies = [ [[package]] name = "soroban-wasmi" version = "0.31.1-soroban.20.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "smallvec", "spin", @@ -1317,7 +1316,7 @@ dependencies = [ name = "soroban-write-upgrade-bytes-contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1329,9 +1328,9 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -1357,8 +1356,6 @@ dependencies = [ [[package]] name = "stellar-xdr" version = "20.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e59cdf3eb4467fb5a4b00b52e7de6dca72f67fac6f9b700f55c95a5d86f09c9d" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1370,17 +1367,6 @@ dependencies = [ "stellar-strkey", ] -[[package]] -name = "stellar-xdr" -version = "20.1.0" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=3a001b1fbb20e4cfa2cef2c0cc450564e8528057#3a001b1fbb20e4cfa2cef2c0cc450564e8528057" -dependencies = [ - "crate-git-revision", - "escape-bytes", - "hex", - "stellar-strkey", -] - [[package]] name = "strsim" version = "0.10.0" @@ -1408,7 +1394,7 @@ dependencies = [ name = "test_conditional_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1416,7 +1402,7 @@ dependencies = [ name = "test_delegated_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1424,24 +1410,24 @@ dependencies = [ name = "test_deployer" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "6e3de26b0965292219b4287ff031fcba86837900fe9cd2b34ea8ad893c0953d2" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" dependencies = [ "proc-macro2", "quote", @@ -1450,12 +1436,13 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "c8248b6521bb14bc45b4067159b9b6ad792e2d6d754d6c41fb50e29fefe38749" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -1470,10 +1457,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "7ba3a3ef41e6672a2f0f001392bb5dcd3ff0a9992d618ca761a11c3121547774" dependencies = [ + "num-conv", "time-core", ] @@ -1503,9 +1491,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1513,9 +1501,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" dependencies = [ "bumpalo", "log", @@ -1528,9 +1516,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1538,9 +1526,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", @@ -1551,21 +1539,19 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasmi_arena" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +version = "0.4.0" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" [[package]] name = "wasmi_core" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "downcast-rs", "libm", @@ -1575,11 +1561,12 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.88.0" +version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" +checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ - "indexmap 1.9.3", + "indexmap 2.2.6", + "semver", ] [[package]] @@ -1593,18 +1580,18 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ "windows-targets", ] [[package]] name = "windows-targets" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ "windows_aarch64_gnullvm", "windows_aarch64_msvc", @@ -1617,56 +1604,48 @@ dependencies = [ [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" - -[[patch.unused]] -name = "soroban-env-guest" -version = "20.3.0" - -[[patch.unused]] -name = "soroban-env-host" -version = "20.3.0" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" diff --git a/soroban-test-wasms/wasm-workspace/Cargo.toml b/soroban-test-wasms/wasm-workspace/Cargo.toml index 3f664d85e..51a4dffa6 100644 --- a/soroban-test-wasms/wasm-workspace/Cargo.toml +++ b/soroban-test-wasms/wasm-workspace/Cargo.toml @@ -43,7 +43,8 @@ members = [ "hostile_large_val", "contract_sac_transfer", "sum_i32", - "deployer" + "deployer", + "increment", ] [profile.release] opt-level = "z" @@ -63,7 +64,7 @@ version = "=20.5.0" git = "https://github.com/stellar/rs-soroban-sdk" [workspace.dependencies.soroban-env-common] -version = "=20.3.0" +version = "=21.0.0" git = "https://github.com/stellar/rs-soroban-env" # Always build from the local instance of env as we need to rebuild test WASMs @@ -78,5 +79,5 @@ soroban-env-host = { path = "../../soroban-env-host" } [patch."https://github.com/stellar/rs-soroban-sdk"] soroban-sdk = { path = "../../../rs-soroban-sdk/soroban-sdk" } -# [patch."https://github.com/stellar/rs-stellar-xdr"] -# stellar-xdr = { path = "../../../rs-stellar-xdr/" } +[patch."https://github.com/stellar/rs-stellar-xdr"] +stellar-xdr = { path = "../../../rs-stellar-xdr/" } diff --git a/soroban-test-wasms/wasm-workspace/complex/src/lib.rs b/soroban-test-wasms/wasm-workspace/complex/src/lib.rs index 67c7859f5..c4f99a364 100644 --- a/soroban-test-wasms/wasm-workspace/complex/src/lib.rs +++ b/soroban-test-wasms/wasm-workspace/complex/src/lib.rs @@ -33,7 +33,10 @@ impl Contract { time: ledger.timestamp(), }; let data = symbol_short!("data"); - let hash = e.crypto().sha256(&my_ledger.network_id.clone().into()); + let hash: BytesN<32> = e + .crypto() + .sha256(&my_ledger.network_id.clone().into()) + .into(); let mut buf: [u8; 32] = [0; 32]; hash.copy_into_slice(&mut buf); let vec_with_half_hash = Vec::from_slice(&e, &[Bytes::from_slice(&e, &buf[0..16])]); diff --git a/soroban-test-wasms/wasm-workspace/increment/Cargo.toml b/soroban-test-wasms/wasm-workspace/increment/Cargo.toml new file mode 100644 index 000000000..93733668e --- /dev/null +++ b/soroban-test-wasms/wasm-workspace/increment/Cargo.toml @@ -0,0 +1,20 @@ +[package] +name = "increment" +version = "0.0.0" +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +edition = "2021" +publish = false +rust-version.workspace = true + +[lib] +crate-type = ["cdylib", "rlib"] +doctest = false + +[dependencies] +soroban-sdk = { workspace = true } +soroban-env-common = { workspace = true } +hex = "=0.4.3" + +[features] +next = ["soroban-env-common/next"] diff --git a/soroban-test-wasms/wasm-workspace/increment/src/lib.rs b/soroban-test-wasms/wasm-workspace/increment/src/lib.rs new file mode 100644 index 000000000..7500e2832 --- /dev/null +++ b/soroban-test-wasms/wasm-workspace/increment/src/lib.rs @@ -0,0 +1,72 @@ +#![no_std] +use soroban_sdk::{ + auth::CustomAccountInterface, contract, contracterror, contractimpl, contracttype, + crypto::Hash, BytesN, Env, +}; + +#[contract] +pub struct IncrementContract; + +#[derive(Clone)] +#[contracttype] +pub enum DataKey { + Owner, + Counter, +} + +#[contracterror] +#[derive(Clone, Copy)] +pub enum AccError { + InvalidSignature = 1, +} + +#[contractimpl] +impl IncrementContract { + pub fn init(env: Env, verifying_key: BytesN<65>) { + env.storage() + .persistent() + .set(&DataKey::Owner, &verifying_key); + env.storage().instance().set(&DataKey::Counter, &0_u32) + } + + pub fn increment(env: Env) -> u32 { + env.current_contract_address().require_auth(); + let mut count: u32 = env.storage().instance().get(&DataKey::Counter).unwrap_or(0); + count += 1; + env.storage().instance().set(&DataKey::Counter, &count); + count + } + + // #[allow(non_snake_case)] + // pub fn __check_auth( + // env: Env, + // signature_payload: BytesN<32>, + // signature: BytesN<64>, + // _auth_context: Vec, + // ) { + // let verifying_key = env.storage().persistent().get(&DataKey::Owner).unwrap(); + // let digest: Hash<32> = signature_payload.into(); + // env.crypto() + // .secp256r1_verify(&verifying_key, &digest, &signature); + // } +} + +#[contractimpl] +impl CustomAccountInterface for IncrementContract { + type Signature = BytesN<64>; + + type Error = AccError; + + #[allow(non_snake_case)] + fn __check_auth( + env: Env, + signature_payload: Hash<32>, + signatures: BytesN<64>, + _auth_contexts: soroban_sdk::Vec, + ) -> Result<(), AccError> { + let verifying_key = env.storage().persistent().get(&DataKey::Owner).unwrap(); + env.crypto() + .secp256r1_verify(&verifying_key, &signature_payload, &signatures); + Ok(()) + } +} diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/increment.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/increment.wasm new file mode 100644 index 0000000000000000000000000000000000000000..bc0204a4d4c5199db65c59d88c586a7e78c792e1 GIT binary patch literal 1552 zcmZ8h&2HO95T4m3^+(I5f%XuiC{~US%^`vuN1>hepk?aM+wD=^QP}@KQr$B=YHk|C(dWsHk^sz>s0q&9~ zz`Yc6M)rXGz)MBL%;gy`VA13Vo4GrDigGr40oD}cZ}a&NJ?D?|xuF_H@f8E37xoe; z7kgn4tDy=LSYPwJ;8X>D&p%I2!6r7FCC}^liSMbf!_o4*Q{|7mwm(*!mA)~H?|?+R zB;eK+H?DE*G8?w6CgOxm1jtwT)uGXlKTv6D+G}fQ$)B{Hx7Vx+-UVs*w_yha2y}RX zUMQR`5?#+`Guvk5v(I+GI-ry;R+vEd6+Uxc!V{w*&_KpW5Nh7i$`TDRpA0E25$&%G}u(4Fzy3vGxVY<1S>xwD3#6DFtB%W0a!dMh3+_>x48^mHbkG!{?(6S^)(>PoLy{bpKefy(CmqA)Ful~6$j!C@RnG5K)rw?7MsaIf=a z?t-s;iLwyJS+Eq>D4t?`MmjEpij;mxj9~t z@kajDAo4qDfd5C6m}5#y%vgI;4vl$iJ^j#lT2J*f$>M(lDxwqM`4m_{(L(-UyoUm?X+F=60*j!>Vp&_7vjrxYN(V^#`?T yy;{5bpu1b&>(;vUcJ0yrzO&nIKdN_~y@SBtt<{}++jrF7LDy0DJH0s3?f)Oyl07~E literal 0 HcmV?d00001 diff --git a/soroban-test-wasms/wasm-workspace/write_upgrade_bytes/src/lib.rs b/soroban-test-wasms/wasm-workspace/write_upgrade_bytes/src/lib.rs index e99a1ff76..46684e0d4 100644 --- a/soroban-test-wasms/wasm-workspace/write_upgrade_bytes/src/lib.rs +++ b/soroban-test-wasms/wasm-workspace/write_upgrade_bytes/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -use soroban_sdk::{contract, contractimpl, Env, Bytes, BytesN}; +use soroban_sdk::{contract, contractimpl, Bytes, BytesN, Env}; pub(crate) const EXTEND_AMOUNT: u32 = 1036800; // 60 days pub(crate) const BALANCE_TTL_THRESHOLD: u32 = EXTEND_AMOUNT; @@ -18,10 +18,14 @@ impl WriteBytesContract { pub fn write(env: Env, xdr_bytes: Bytes) -> BytesN<32> { let hash = env.crypto().sha256(&xdr_bytes); env.storage().temporary().set(&hash, &xdr_bytes); - env.storage().temporary().extend_ttl(&hash, BALANCE_TTL_THRESHOLD, EXTEND_AMOUNT); + env.storage() + .temporary() + .extend_ttl(&hash, BALANCE_TTL_THRESHOLD, EXTEND_AMOUNT); - env.storage().instance().extend_ttl(BALANCE_TTL_THRESHOLD, EXTEND_AMOUNT); + env.storage() + .instance() + .extend_ttl(BALANCE_TTL_THRESHOLD, EXTEND_AMOUNT); - hash + hash.into() } } From 65f926895e32cd84bcf54b5e62029244e0a5e965 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Mon, 17 Jun 2024 13:40:52 -0400 Subject: [PATCH 2/3] . --- soroban-env-host/src/test/invocation.rs | 34 ++- soroban-test-wasms/src/lib.rs | 2 + soroban-test-wasms/wasm-workspace/Cargo.lock | 172 ++++++++---- soroban-test-wasms/wasm-workspace/Cargo.toml | 3 +- .../opt/curr/auth_test_contract.wasm | Bin 6878 -> 6899 bytes .../opt/curr/contract_sac_transfer.wasm | Bin 590 -> 594 bytes .../opt/curr/example_add_f32.wasm | Bin 633 -> 633 bytes .../opt/curr/example_add_i32.wasm | Bin 584 -> 584 bytes .../opt/curr/example_alloc.wasm | Bin 3078 -> 3078 bytes .../opt/curr/example_complex.wasm | Bin 873 -> 873 bytes .../opt/curr/example_contract_data.wasm | Bin 2926 -> 2926 bytes .../opt/curr/example_create_contract.wasm | Bin 542 -> 542 bytes .../wasm-workspace/opt/curr/example_err.wasm | Bin 1695 -> 1716 bytes .../opt/curr/example_fannkuch.wasm | Bin 1101 -> 1101 bytes .../wasm-workspace/opt/curr/example_fib.wasm | Bin 352 -> 352 bytes .../opt/curr/example_hostile.wasm | Bin 2002 -> 2002 bytes .../opt/curr/example_invoke_contract.wasm | Bin 2522 -> 2526 bytes .../opt/curr/example_linear_memory.wasm | Bin 2087 -> 2091 bytes .../opt/curr/example_simple_account.wasm | Bin 1220 -> 1232 bytes .../opt/curr/example_sum_i32.wasm | Bin 689 -> 708 bytes .../opt/curr/example_updateable_contract.wasm | Bin 933 -> 933 bytes .../opt/curr/example_upload_contract.wasm | Bin 383 -> 387 bytes .../wasm-workspace/opt/curr/example_vec.wasm | Bin 467 -> 467 bytes .../opt/curr/hostile_large_val.wasm | Bin 1987 -> 1991 bytes .../wasm-workspace/opt/curr/increment.wasm | Bin 1552 -> 1548 bytes .../wasm-workspace/opt/curr/loadgen.wasm | Bin 1139 -> 1139 bytes .../opt/curr/recursive_account.wasm | Bin 1723 -> 1723 bytes .../opt/curr/sac_reentry_account.wasm | Bin 1014 -> 941 bytes .../soroban_write_upgrade_bytes_contract.wasm | Bin 460 -> 460 bytes .../wasm-workspace/opt/curr/storage_list.wasm | Bin 0 -> 784 bytes .../opt/curr/test_conditional_account.wasm | Bin 911 -> 923 bytes .../opt/curr/test_delegated_account.wasm | Bin 1014 -> 1026 bytes .../opt/curr/test_deployer.wasm | Bin 1103 -> 1107 bytes .../wasm-workspace/storage_list/Cargo.toml | 18 ++ .../wasm-workspace/storage_list/output.rs | 263 ++++++++++++++++++ .../wasm-workspace/storage_list/src/lib.rs | 27 ++ .../wasm-workspace/storage_list/src/test.rs | 13 + 37 files changed, 480 insertions(+), 52 deletions(-) create mode 100644 soroban-test-wasms/wasm-workspace/opt/curr/storage_list.wasm create mode 100644 soroban-test-wasms/wasm-workspace/storage_list/Cargo.toml create mode 100644 soroban-test-wasms/wasm-workspace/storage_list/output.rs create mode 100644 soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs create mode 100644 soroban-test-wasms/wasm-workspace/storage_list/src/test.rs diff --git a/soroban-env-host/src/test/invocation.rs b/soroban-env-host/src/test/invocation.rs index 77c25e3b2..6fca306d2 100644 --- a/soroban-env-host/src/test/invocation.rs +++ b/soroban-env-host/src/test/invocation.rs @@ -10,7 +10,7 @@ use crate::{ budget::AsBudget, events::HostEvent, test::observe::ObservedHost, xdr::ScErrorType, ContractFunctionSet, Error, Host, HostError, Symbol, Tag, }; -use soroban_test_wasms::{ADD_I32, ALLOC, ERR, INVOKE_CONTRACT, VEC}; +use soroban_test_wasms::{ADD_I32, ALLOC, ERR, INVOKE_CONTRACT, STORAGE_LIST, VEC}; #[test] fn invoke_single_contract_function() -> Result<(), HostError> { @@ -44,6 +44,38 @@ fn invoke_single_contract_function() -> Result<(), HostError> { Ok(()) } +#[test] +fn invoke_storage_list() -> Result<(), HostError> { + let host = observe_host!(Host::test_host_with_recording_footprint()); + let contract_id_obj = host.register_test_contract_wasm(STORAGE_LIST); + let a = 4i32; + let b = 7i32; + let c = 0x7fffffff_i32; + + let res = host.call( + contract_id_obj, + Symbol::try_from_small_str("add")?, + host.test_vec_obj(&[a, b])?, + )?; + assert_eq!(i32::try_from_val(&*host, &res)?, a + b); + // overflow + let res = host.call( + contract_id_obj, + Symbol::try_from_small_str("add")?, + host.test_vec_obj(&[a, c])?, + ); + let code = (ScErrorType::WasmVm, ScErrorCode::InvalidAction); + + eprintln!( + "time ellapsed in nano-seconds for VmInstantiation: {}", + host.as_budget() + .get_time(ContractCostType::VmInstantiation)? + ); + + assert!(HostError::result_matches_err(res, code)); + Ok(()) +} + #[test] fn invoke_alloc() -> Result<(), HostError> { let host = observe_host!(Host::test_host_with_recording_footprint()); diff --git a/soroban-test-wasms/src/lib.rs b/soroban-test-wasms/src/lib.rs index 56b6d6e3d..64ea292f2 100644 --- a/soroban-test-wasms/src/lib.rs +++ b/soroban-test-wasms/src/lib.rs @@ -101,4 +101,6 @@ mod curr { pub const INCREMENT: &[u8] = include_bytes!("../wasm-workspace/opt/curr/increment.wasm").as_slice(); + pub const STORAGE_LIST: &[u8] = + include_bytes!("../wasm-workspace/opt/curr/storage_list.wasm").as_slice(); } diff --git a/soroban-test-wasms/wasm-workspace/Cargo.lock b/soroban-test-wasms/wasm-workspace/Cargo.lock index 4888a2d40..a2198a598 100644 --- a/soroban-test-wasms/wasm-workspace/Cargo.lock +++ b/soroban-test-wasms/wasm-workspace/Cargo.lock @@ -45,7 +45,7 @@ dependencies = [ name = "auth_test_contract" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -162,7 +162,7 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" name = "contract_sac_transfer" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -419,7 +419,7 @@ checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" name = "example_add_f32" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -427,7 +427,7 @@ dependencies = [ name = "example_add_i32" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -435,7 +435,7 @@ dependencies = [ name = "example_alloc" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -443,7 +443,7 @@ dependencies = [ name = "example_complex" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -451,7 +451,7 @@ dependencies = [ name = "example_contract_data" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -459,7 +459,7 @@ dependencies = [ name = "example_create_contract" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -467,7 +467,7 @@ dependencies = [ name = "example_err" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -475,7 +475,7 @@ dependencies = [ name = "example_fannkuch" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -483,7 +483,7 @@ dependencies = [ name = "example_fib" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -491,7 +491,7 @@ dependencies = [ name = "example_hostile" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -499,7 +499,7 @@ dependencies = [ name = "example_invoke_contract" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -507,7 +507,7 @@ dependencies = [ name = "example_linear_memory" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -515,7 +515,7 @@ dependencies = [ name = "example_simple_account" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -523,7 +523,7 @@ dependencies = [ name = "example_sum_i32" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -531,7 +531,7 @@ dependencies = [ name = "example_updateable_contract" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -539,7 +539,7 @@ dependencies = [ name = "example_upload_contract" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -547,7 +547,7 @@ dependencies = [ name = "example_vec" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -654,7 +654,7 @@ dependencies = [ name = "hostile_large_val" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -692,7 +692,7 @@ name = "increment" version = "0.0.0" dependencies = [ "hex", - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -785,7 +785,7 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" name = "loadgen" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -989,7 +989,7 @@ dependencies = [ name = "recursive_account" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -1028,7 +1028,7 @@ checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" name = "sac_reentry_account" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -1151,7 +1151,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" -version = "21.0.0" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "084aab008009e712c445a9d7eab837a86559a6c2341f30bc4f33e9b258947688" dependencies = [ "itertools", "proc-macro2", @@ -1162,6 +1164,21 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "21.0.0" +dependencies = [ + "crate-git-revision", + "ethnum", + "num-derive", + "num-traits", + "soroban-env-macros 21.0.0", + "static_assertions", + "stellar-xdr 20.1.0", +] + +[[package]] +name = "soroban-env-common" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c16ee889fe99d6828bf3ffac00c84382793c31d62682401dbfa3e1b512f0c542" dependencies = [ "arbitrary", "crate-git-revision", @@ -1169,24 +1186,28 @@ dependencies = [ "num-derive", "num-traits", "serde", - "soroban-env-macros", + "soroban-env-macros 21.1.0", "soroban-wasmi", "static_assertions", - "stellar-xdr", + "stellar-xdr 21.1.0", "wasmparser", ] [[package]] name = "soroban-env-guest" -version = "21.0.0" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95e591a15e488e66d3edd4be044fc4ffea438945f022c27129e933275744666f" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.1.0", "static_assertions", ] [[package]] name = "soroban-env-host" -version = "21.0.0" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b73f48ae8081ecfb6c0d56c67f139c52cb6d5b6800d5e1adb9eef8e14a155b9" dependencies = [ "backtrace", "curve25519-dalek", @@ -1208,7 +1229,7 @@ dependencies = [ "sha2", "sha3", "soroban-builtin-sdk-macros", - "soroban-env-common", + "soroban-env-common 21.1.0", "soroban-wasmi", "static_assertions", "stellar-strkey", @@ -1224,25 +1245,40 @@ dependencies = [ "quote", "serde", "serde_json", - "stellar-xdr", + "stellar-xdr 20.1.0", + "syn", +] + +[[package]] +name = "soroban-env-macros" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d0581e3aba14892ee0ce63788f3d3e5d9eb1ab18906a9b7c66d77dae9e9fea" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr 21.1.0", "syn", ] [[package]] name = "soroban-ledger-snapshot" -version = "20.5.0" +version = "21.1.0-rc.1" dependencies = [ "serde", "serde_json", "serde_with", - "soroban-env-common", + "soroban-env-common 21.1.0", "soroban-env-host", "thiserror", ] [[package]] name = "soroban-sdk" -version = "20.5.0" +version = "21.1.0-rc.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1260,7 +1296,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "20.5.0" +version = "21.1.0-rc.1" dependencies = [ "crate-git-revision", "darling", @@ -1269,33 +1305,33 @@ dependencies = [ "quote", "rustc_version", "sha2", - "soroban-env-common", + "soroban-env-common 21.1.0", "soroban-spec", "soroban-spec-rust", - "stellar-xdr", + "stellar-xdr 21.1.0", "syn", ] [[package]] name = "soroban-spec" -version = "20.5.0" +version = "21.1.0-rc.1" dependencies = [ "base64 0.13.1", - "stellar-xdr", + "stellar-xdr 21.1.0", "thiserror", "wasmparser", ] [[package]] name = "soroban-spec-rust" -version = "20.5.0" +version = "21.1.0-rc.1" dependencies = [ "prettyplease", "proc-macro2", "quote", "sha2", "soroban-spec", - "stellar-xdr", + "stellar-xdr 21.1.0", "syn", "thiserror", ] @@ -1303,7 +1339,8 @@ dependencies = [ [[package]] name = "soroban-wasmi" version = "0.31.1-soroban.20.0.1" -source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" dependencies = [ "smallvec", "spin", @@ -1316,7 +1353,7 @@ dependencies = [ name = "soroban-write-upgrade-bytes-contract" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -1356,6 +1393,19 @@ dependencies = [ [[package]] name = "stellar-xdr" version = "20.1.0" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=d0138770652a615e3cd99447f2f2727658c17450#d0138770652a615e3cd99447f2f2727658c17450" +dependencies = [ + "crate-git-revision", + "escape-bytes", + "hex", + "stellar-strkey", +] + +[[package]] +name = "stellar-xdr" +version = "21.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec43c9c5ae7ec7b6ac9e263b6d5b9e3781aa05ba3a1c05f6e70701c5c6600665" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1367,6 +1417,14 @@ dependencies = [ "stellar-strkey", ] +[[package]] +name = "storage_list" +version = "0.0.0" +dependencies = [ + "soroban-env-common 21.0.0", + "soroban-sdk", +] + [[package]] name = "strsim" version = "0.10.0" @@ -1394,7 +1452,7 @@ dependencies = [ name = "test_conditional_account" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -1402,7 +1460,7 @@ dependencies = [ name = "test_delegated_account" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -1410,7 +1468,7 @@ dependencies = [ name = "test_deployer" version = "0.0.0" dependencies = [ - "soroban-env-common", + "soroban-env-common 21.0.0", "soroban-sdk", ] @@ -1545,13 +1603,15 @@ checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" [[package]] name = "wasmi_arena" -version = "0.4.0" -source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" [[package]] name = "wasmi_core" version = "0.13.0" -source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" dependencies = [ "downcast-rs", "libm", @@ -1649,3 +1709,15 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" + +[[patch.unused]] +name = "soroban-env-guest" +version = "21.0.0" + +[[patch.unused]] +name = "soroban-env-host" +version = "21.0.0" + +[[patch.unused]] +name = "stellar-xdr" +version = "21.0.1" diff --git a/soroban-test-wasms/wasm-workspace/Cargo.toml b/soroban-test-wasms/wasm-workspace/Cargo.toml index 51a4dffa6..f5fd5f94f 100644 --- a/soroban-test-wasms/wasm-workspace/Cargo.toml +++ b/soroban-test-wasms/wasm-workspace/Cargo.toml @@ -45,6 +45,7 @@ members = [ "sum_i32", "deployer", "increment", + "storage_list", ] [profile.release] opt-level = "z" @@ -60,7 +61,7 @@ lto = true rust-version = "1.74.0" [workspace.dependencies.soroban-sdk] -version = "=20.5.0" +version = "=21.1.0-rc.1" git = "https://github.com/stellar/rs-soroban-sdk" [workspace.dependencies.soroban-env-common] diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/auth_test_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/auth_test_contract.wasm index 24197c3dbc225a4fcd9659fe2c015832e96e2409..909e7b03e09e97070f4b8355799f9ce05c424ba9 100644 GIT binary patch delta 449 zcmXYrJ1hiI6o&7)b7#!j*X+YC(PIw7|b zkx)sznrSGN3avssqN9^2l$;IC`M>`^C+D0O^UK`JG|_q;*5_cq?_32Yt4e^$`%mA} zb*5cB(^-g%VM%XmC7fJ3eA{809R5KI2gL(SLsA&DjB{&r!k>|PX#EPPgga@8gB>V` z2?t%`L}yZoORPleHgGmTNQT<4WIRk#oZ5zG|G=`{JjF`rZpoib{n@vF+ffe7*d6gg zG>B??A!umU3tl=uu)$?V+1}LU2$yW|@FcTgNoV3)uHcW;N*e2`(vP2>D3g%%Kb0*| z5?UI!2wgSAx!Mm2|3P&D;=a|qgCcH&qnJVHkfJ$?lp!HLB3;O8)IxTmy~vBvIpn)& zBY$t?envY3jP7GM5EDD`&SXqWbIQTleY|--I6ehVw3vS#zi5IMQA>@PL-|}bmo)}f p=CiqObFgMv3#L)A3U00HS{1iiwTz)+tzZ6uBRuvb)Z{1-A0+vsh?doKlU7CE`6gN5igV(KC53oWB6~p$jFo=yNAU3d$X(7#l z=@gjnE&y5%y%<5*N*h znhO
%K3j@1-e3zaZ($&|M@!xH%lu@#V)=?(?LG7d%76HBXlK#nbY?TfVJ(&srPb zeK!!aj{JSWptqMJ2XpW7=DB%%O2736?R)=)gXSBdDNT(>$LNi&7vckYA*LnriE=5K eQ}v==$mua%R}=AKshCfu%4#e+9!+VbGW!KHv1Bj+ diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/contract_sac_transfer.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/contract_sac_transfer.wasm index 6cc1825acced51f4f85d746010efadee2df2e6ba..1c2f393c3c6dd1c2ea95c87d5a40a7b6891d7e02 100644 GIT binary patch delta 73 zcmX@da*1Wb4MuiR1`sHoe4o+I)Wpb8&rr`mwLz28ottNvSDGmWfFzDV7E% U=BZ`|<|#l4Gh;)8q%?CQ0GFN;+5i9m delta 66 zcmey#@{?u5e?~@;NlY%L#zqEuK&V@kY@}?SY-nndWRjL@mS}9AVxF96ZfI_9Y+{s> Unv!H@nPzNgU}0csnwrJ{0FsjuasU7T diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_add_i32.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_add_i32.wasm index ba6b3fc4e132b2fa351b6ef2863bb5159b7b71e3..b9346f416008483e79cd185f5cadae1f4416c0cd 100644 GIT binary patch delta 67 zcmX@Xa)M>UIYvg&$>$keOihdo^$hh4bc>Sp43$ldQ!OpiObrq(&5}}6k}MOGQc^4p VOw3cw49ru25@yDR21#k=MgXMf6BYmf delta 67 zcmX@Xa)M>UIYvg2$>$keOpT2U^ng&eDA`EaJlW9HB*`Q#)hyB2JjFaY(cIA7+}Ok@ VB{e0<%rec`(7?jL(lj-V0RW%e60QIM diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_alloc.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_alloc.wasm index e2c73e260c7f58bbf2ed535f0748d5b40ede3df5..d7ba0a6e038ea37fb1e52887e3be703c94799ebc 100644 GIT binary patch delta 67 zcmZpZXp`8`!_6oSp43$ldQ!OpiObrq(&5}}6k}MOGQc^4p VOw3cw49ru25@yDR21#k=MgYdV6QBS9 delta 67 zcmaFK_L6PGdnQJa$sd?pOpT2U^ng&eDA`EaJlW9HB*`Q#)hyB2JjFaY(cIA7+}Ok@ VB{e0<%rec`(7?jL(lj-V0RX|U6F2|> diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_contract_data.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_contract_data.wasm index 92d8cfd0ef725c65af140dfc99cf1e5fdff068a0..13c95f07bf80e6d7e25caf02009690acdc3d14c8 100644 GIT binary patch delta 67 zcmaDS_D*cW7cNH8$zQo#Oihdo^$hh4bc>Sp43$ldQ!OpiObrq(&5}}6k}MOGQc^4p VOw3cw49ru25@yDR21#k=MgZ4q6XXB@ delta 67 zcmaDS_D*cW7cNGT$zQo#OpT2U^ng&eDA`EaJlW9HB*`Q#)hyB2JjFaY(cIA7+}Ok@ VB{e0<%rec`(7?jL(lj-V0RYlp6MO&w diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_create_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_create_contract.wasm index 2d17154ac45fd58bd7f2f94b05e73af5a4d8c402..002c0d14885369452f72d534ae1e61949e75ecca 100644 GIT binary patch delta 67 zcmbQoGLL1$5=KVR$x9hsOihdo^$hh4bc>Sp43$ldQ!OpiObrq(&5}}6k}MOGQc^4p VOw3cw49ru25@yDR21#k=MgV)d5^ewh delta 67 zcmbQoGLL1$5=KUm$x9hsOpT2U^ng&eDA`EaJlW9HB*`Q#)hyB2JjFaY(cIA7+}Ok@ VB{e0<%rec`(7?jL(lj-V0RVQc5(WSO diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_err.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_err.wasm index ec2fbd518654c3f82ba2ea5c68cfe639a050b97c..520cffa5611cfba930fb5d34e0fb166663743251 100644 GIT binary patch delta 222 zcmbQwyM=dy7bD}3&EAX^jP>gnnV9Pt>zEuA7#%sic^MQK6`2(n6j_)Z6qs2YnCcxF z6J4sBCJSYH68fYLIAYmXw;3WSN+hl45CKVxDSdV4eb$Ff%qZNJ=v|0stoH BGG71y delta 207 zcmdnOJD+!h7bD~2&EAX^jP)}anV9OC>X;mu9TXT9nA}+$6qp=2-FTUp>YNxA7!;VY zbQu_wm>uskxbZSbDKM{9WKm#tG{|=3@&_tqc099? zv}r95BZ$_kSp43$ldQ!OpiObrq(&5}}6k}MOGQc^4p VOw3cw49ru25@yDR21#k=MgXkA6E*+< delta 67 zcmX@hah7AlWoAZ^$ybEDcP| TQ_T#_Q-Bg?#)bw-Y34=%s-F{1 delta 65 zcmaFB^nhu?Ge(h#&s|K7jSTdFP`4=ANZCBu(9|T!BrVk}(bzo2JUP+a(A?bE#3&^- TCCSV(&DhYu!oborHH`rPrIZrp diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_hostile.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_hostile.wasm index 02f99a6855f6458848c456023baa87cbc66899d2..5cc67e8201a0dc942701e7eabb887771b02d81aa 100644 GIT binary patch delta 67 zcmcb_e~EuX2s@+bvb!$jj$3*D5=qLNAm1_l6&PZFH~ delta 67 zcmcb_e~EuX2s@+5OGt@KCElSoiR5mqEwX{q#HAu8HOG-^ivP?`$ ZNwG9AF;6u!Fi!zWm>C-yB&C@f0RXqT6A=Ia delta 69 zcmca7d`oyk3Mab=0|?|#&gQf;)HgEFGt@IswlFkIPBl(Rv@kGCHZV>!GE6Z|19H+* U5)CcPlMT`g4GfKpObpT(0ALRhHUIzs diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_linear_memory.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_linear_memory.wasm index d0f8092348cd7526ee49ebda2eee0d831cbfe7bb..34161dcf3fb63b084b12a359a45b06e3dbb58591 100644 GIT binary patch delta 77 zcmZ23uv%clT6T6(1`sHpyoKG)($vU6&s5Jq+1w<>z$7sx*)Yk}EHyRJ%qY#+Al1ao d#5CDF&A=crHPO)AFwr>GLN_I|sH7689RLm^6hQz0 delta 73 zcmZ22uv}onT6T631`sHoyoKG))Y!;C4+wROl8uzjlMPKxl1$Q4%@U2xQ_PbS%?-`X YjZKVFQd5%5EYpk)4J-^SO;ght0Jj7Z%K!iX diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_simple_account.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_simple_account.wasm index 9f2162b3fedec9c4c8f1da66a0d41e086dcf9bf7..9f715631aaa9d79bdd2014fbf40aa25cb1e99d83 100644 GIT binary patch delta 262 zcmX@Yd4Y4nz4~4jc5Vg%E(HcBMgayX?z4)K@7cY?zK+;8JiWDo!Hu16q$i`FlH$-0wuW>m?xJq zDu^;Ua%8P_QfPBxX>n?4XlM`+U{YY(yozxF6Qk&4Zx$C*6C*=CLp=lCqGUZoWmDr+ oOUpDd4zMqz4}HLc5Vg%E(HcBMgayX?t_d>Om)ol$_$PI*-9)b435=`ObRSabxaP- z4hl>x4or1Uj0#MStqlhlvUC|3l$agwGq~|GNGUL{Rb)_Lb~MO#5kwKiH*M)=N!qj_PEA1FJG!KAOo}KJ=A{<9MF?c<#7Q`7IqVvl|2e+>>Kg6j+RL9eDAF=de6Dl!9{*%b|BBF#)TV zB$>H4Nq(Dgw3FmAH`63Fvz)Wq599lY^Cm> zR1oV|r^<&~=<4|<)2KzPUt+OP=t#mVvigVwWW2)XSdNs?oX8W|l=vdxRZ3Xvp*4XB z97b|1Qm3Ny(QjAc1@&sh6mR?!5iveGf|O{#wZY3b+}#2?j~r~xBTeUOtNg-;$~HX* zU{)TpHu|MuJAJ?Fb-a#yba&D5n*ClLhLgT)!a761SM delta 342 zcmX|6!AiqG5Z#&GZ7Q*lgVc-SM#Yd=z{&X}z3 z*OopI-w^RpRG;2zLxIB*HFYhFG3K!n%1T?J2529oEmSi3f#*b?v_NqpPgK{$Cn0Z= zfU`usEEwxC7wH^(&XI_*K8EgTBbkt0Iq2}s{~V@70uQdBFg1O3ahcmv@t#vCED{Vk zqljifI@q?&{+bM`*rwI2{)Vx&LjN*0u2bAe!;W6CIW&i((ctpd3~Ao;btmZPttj_> mKgxBcgWUJB^V|ep6zU)}nKAo8*XYc2Bc1IIE`~REbodK=VMLMu diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_updateable_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_updateable_contract.wasm index ca5c801e3cd987d297fac4c42907f1103eea3012..b7dfb0c7ac70b547517aae6d758d76aa43df14a8 100644 GIT binary patch delta 67 zcmZ3=zLb4~HZ!B>WF2M~QxhXYJwrVM-J)bYLuFIrR7=Y=Q-efHv!v9NB+JC4loU$? V6Z2Fv1M?K1gqg9SK~kEz5dcYt5tIM` delta 67 zcmZ3=zLb4~HZ!BhWF2M~Q)43oJs{LAN;Xn9Pc}3)Nis=GHA^%$PcctUG&eLiH#RX! VNli&IvrIEKG_WwRG)+xo002aL5i9@z diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_upload_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/example_upload_contract.wasm index 0d3a2497bd2c2ab8c95356b336af4b5bf8a796c1..00ef7272e25b24391431bb7f49e2077923eaf3d7 100644 GIT binary patch delta 97 zcmey*)XcnrlaXDN0R)OC3oxqrn&=sTc_4zLsJJ*KyDYT`$Tl%D)HBpG&@D>VGgLM; qPPMd5Gc`!GG)qcNNwQ2#N=dOaFfmUxGcZp9N|+fN8YHEe8vy{zx)uTe delta 93 zcmZo>{?D|5laXD70R-|V3oxpAn(G;Yc_4zLsJJ*KyDYT`$ksP9&@60t`~zd{7R<=0wH~OdRY^O#Ivo-1?K>GpbJJW8vED z!NSPQF3JD`<&y*0?JP}=4D?L(43y1HQVdKIQ<4pnOwCeL6U~g$j15vv%uGy^&C?7F W5>pcm%?%TcQ!R8;GK)$of!YD}upgHI delta 123 zcmX@kf0%!RH=~$S-=k-;3JeO20t`~zd<+T}frWvkX=)k+0C4dhAOHXW diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/increment.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/increment.wasm index bc0204a4d4c5199db65c59d88c586a7e78c792e1..28acf5e436b1a64746fcd2d4ab61eea7a97502ef 100644 GIT binary patch delta 73 zcmbQh)5EiYiEDcP|Q_T#_Q-Bg?#)bw-Y34=%_;wUG delta 77 zcmeC-nZUDwiSp43$ldQ!OpiObrq(&5}}6k}MOGQc^4p VOw3cw49ru25@yDR21#k=MgY{*8UY>DZ0Tto2OH^^A4O42}ZXN{lKDj^&CB%nnQr3Jk8i3rT!GAoK&GU3Ay@-rmLdZWBR97KM=5#$ diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/soroban_write_upgrade_bytes_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/soroban_write_upgrade_bytes_contract.wasm index a281966972e16c95ee192cf2b131bf0de284e414..208cc95cbbbc7488469358bf580354134ecf7aca 100644 GIT binary patch delta 67 zcmX@Ze1>^L5F?}L^L5F?|=7kY=y`)f*7f>W?lh%rzL=uKTkqtGz zwhz&3-XT4gK11oXFOiN`c1;&{XTJHqotfQ%Ae|rpU|qdnd5-x7(B`>xQDR^(H4Je~ zq8VP%d5u0WI&JAYGVTL%RY8u5$`SUoeLhEbv3LYy4(@VozZSOgTGJ+Ca+BOM&{L85 z*B{diD*DyN)hYe6s_#cZ7WiTsaWs7Yg9vW@Fh~Vw)o)DsiHr*5hv1rVlO2Kkseu+_ zIUDk!h02i4U9?aZ9v=fV!TkkqYf!hqwPW`Q@7(HpWk~2dl(1gH-)p#kT2qOA74I;E zY&YJ)!nR`L!F$5b7WcH(vcahYjvGj%K_PwR?JmjpmJ7Lb={$l7MxW~zbM^6qXRSPC zDGAf0mR)mv1jYeaP~`P~z_~I6!_)|)$?6_6+Q{iyrq(PXyony3*9tkBN|UWGoz(yg ziRsjY9b_IsDPX8I3ofrieq`1#AGBMXP)+sYM3S=uWsW3QJDl#fC zG1W0SFgqwPvN$l+J2EOTI<_|)V93&CU{GRkywBjq%OIt|;AoKT_@A-Rk;|XO0mwVZ z0O3kOxDTORNpD_OpsaN^50fT0kYSq5!w91Fvbn*oP+)dqYim(t2HL@xrN{`BfoXF$V;3W%=wvZw7gG}>Lp?)11KpxzJws(v q<5Ww_G*g2_OS7cZlqAcs4zHIDl#ds zFx4?RFgqwPu{bc*IWa0QIkq<(V93&CU{GRqywBjq%OIt|yjGDxf!Wa@+mXwk#R14V z$dK(Q1z|n}G9|rvSrr(ZtZR9gxPi23El&_5h@n@@4K$B23uq0a6I)x0A|nqYH#d;Y z(dNY00%SY2G=KpInDK!@fRWprnL~lakt1uZlR}#lOAA;+Kmh2@&C?mX7#T$-D>1v6 z8XFnt0ikYDvXQcRvZ1L-l1W;sS)#Fdig|LPxuLnav58SiYD$usWty>}frWvkX=)k+ E0ClxLcmMzZ diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/test_delegated_account.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/test_delegated_account.wasm index 26ec6913d787444f6932ddc9bb49bb20e3e72ca7..5bf64cc55d6cf6ea267007b6d02578d16be5bd30 100644 GIT binary patch delta 237 zcmeyy-o!ECK>bo?)&q=8%=L_Q$_$PI*-A_*435=`j0#LlbxaP-4hoDc4ovlqj0%j7 ztqlhlvUC|3lo%ZEGq~|GNGUKl8e}{EXDoE&@@H`X@(waUxKa@ALnv3$o0kbW+)-8-oOm)ol$_$PI*-9)b435=`ObRSabxaP-4hl>x4or1Uj0#MS ztqlhlvUC|3l$agwGq~|GNGUL{Rb)_Lb~MO#P+-|y&&bKd zC^ET|*~Qe@$UqMWb&HaXl+BY3O-+(a(o)S5jm=ZclM~Gi&CQKXj8alllFTgAj13Je K3@lAk(-;7W9xoCA diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/test_deployer.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/test_deployer.wasm index 954070c54dbd76f7a827cdb37536917418faba05..3a2ba1dd28e7355f3a2e2a507d98aa2e593f6d5f 100644 GIT binary patch delta 73 zcmX@lahYSoO=fmc1`sHo{D9fc)Wpb8&rr`mwPK+&IbHGSN8MC^^Y2B_+)? VCDAz1+$<^C$kI3|5h$L*005ZZ6Epw- diff --git a/soroban-test-wasms/wasm-workspace/storage_list/Cargo.toml b/soroban-test-wasms/wasm-workspace/storage_list/Cargo.toml new file mode 100644 index 000000000..841930fff --- /dev/null +++ b/soroban-test-wasms/wasm-workspace/storage_list/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "storage_list" +version = "0.0.0" +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +edition = "2021" +rust-version.workspace = true + +[lib] +crate-type = ["cdylib", "rlib"] +doctest = false + +[dependencies] +soroban-sdk = { workspace = true } +soroban-env-common = { workspace = true } + +[features] +next = ["soroban-env-common/next"] diff --git a/soroban-test-wasms/wasm-workspace/storage_list/output.rs b/soroban-test-wasms/wasm-workspace/storage_list/output.rs new file mode 100644 index 000000000..570657548 --- /dev/null +++ b/soroban-test-wasms/wasm-workspace/storage_list/output.rs @@ -0,0 +1,263 @@ +warning: Patch `soroban-env-guest v21.0.0 (/Users/jay/Projects/rs-soroban-env/soroban-env-guest)` was not used in the crate graph. +Perhaps you misspelled the source URL being patched. +Possible URLs for `[patch.]`: + crates-io +warning: Patch `soroban-env-host v21.0.0 (/Users/jay/Projects/rs-soroban-env/soroban-env-host)` was not used in the crate graph. +Perhaps you misspelled the source URL being patched. +Possible URLs for `[patch.]`: + crates-io +warning: Patch `stellar-xdr v21.0.1 (/Users/jay/Projects/rs-stellar-xdr)` was not used in the crate graph. +Check that the patched package version and available features are compatible +with the dependency requirements. If the patch has a different version from +what is locked in the Cargo.lock file, run `cargo update` to use the new +version. This may also occur with an optional dependency that is not enabled. + Checking storage_list v0.0.0 (/Users/jay/Projects/rs-soroban-env/soroban-test-wasms/wasm-workspace/storage_list) +Vec(ScSpecTypeVec { element_type: U32 }) +Vec(ScSpecTypeVec { element_type: U32 }) +Vec(ScSpecTypeVec { element_type: U32 }) + Finished dev [unoptimized + debuginfo] target(s) in 0.16s + +#![feature(prelude_import)] +#![no_std] +#[prelude_import] +use core::prelude::rust_2021::*; +#[macro_use] +extern crate core; +extern crate compiler_builtins as _; +use soroban_sdk::{contract, contractimpl, contracttype, Env, Vec}; +pub enum DataKey { + List, +} +pub static __SPEC_XDR_TYPE_DATAKEY: [u8; 44usize] = DataKey::spec_xdr(); +impl DataKey { + pub const fn spec_xdr() -> [u8; 44usize] { + *b"\x00\x00\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x07DataKey\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x04List" + } +} +impl soroban_sdk::TryFromVal for DataKey { + type Error = soroban_sdk::ConversionError; + #[inline(always)] + fn try_from_val( + env: &soroban_sdk::Env, + val: &soroban_sdk::Val, + ) -> Result { + use soroban_sdk::{EnvBase, TryIntoVal, TryFromVal}; + const CASES: &'static [&'static str] = &["List"]; + let vec: soroban_sdk::Vec = val.try_into_val(env)?; + let mut iter = vec.try_iter(); + let discriminant: soroban_sdk::Symbol = iter + .next() + .ok_or(soroban_sdk::ConversionError)?? + .try_into_val(env) + .map_err(|_| soroban_sdk::ConversionError)?; + Ok( + match u32::from( + env.symbol_index_in_strs(discriminant.to_symbol_val(), CASES)?, + ) as usize + { + 0 => { + if iter.len() > 0 { + return Err(soroban_sdk::ConversionError); + } + Self::List + } + _ => Err(soroban_sdk::ConversionError {})?, + }, + ) + } +} +impl soroban_sdk::TryFromVal for soroban_sdk::Val { + type Error = soroban_sdk::ConversionError; + #[inline(always)] + fn try_from_val( + env: &soroban_sdk::Env, + val: &DataKey, + ) -> Result { + use soroban_sdk::{TryIntoVal, TryFromVal}; + match val { + DataKey::List => { + let tup: (soroban_sdk::Val,) = ( + soroban_sdk::Symbol::try_from_val(env, &"List")?.to_val(), + ); + tup.try_into_val(env).map_err(Into::into) + } + } + } +} +#[automatically_derived] +impl ::core::clone::Clone for DataKey { + #[inline] + fn clone(&self) -> DataKey { + DataKey::List + } +} +#[automatically_derived] +impl ::core::fmt::Debug for DataKey { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result { + ::core::fmt::Formatter::write_str(f, "List") + } +} +pub struct Test; +///TestClient is a client for calling the contract defined in "Test". +pub struct TestClient<'a> { + pub env: soroban_sdk::Env, + pub address: soroban_sdk::Address, + #[doc(hidden)] + #[cfg(not(any(test, feature = "testutils")))] + _phantom: core::marker::PhantomData<&'a ()>, +} +impl<'a> TestClient<'a> { + pub fn new(env: &soroban_sdk::Env, address: &soroban_sdk::Address) -> Self { + Self { + env: env.clone(), + address: address.clone(), + #[cfg(not(any(test, feature = "testutils")))] + _phantom: core::marker::PhantomData, + } + } +} +impl Test { + pub fn set_list(env: Env, list: Vec) { + env.storage().persistent().set(&DataKey::List, &list); + } + pub fn get_list(env: Env) -> Vec { + env.storage().persistent().get(&DataKey::List).unwrap_or(Vec::new(&env)) + } +} +#[doc(hidden)] +#[allow(non_snake_case)] +pub static __SPEC_XDR_FN_SET_LIST: [u8; 48usize] = Test::spec_xdr_set_list(); +impl Test { + pub const fn spec_xdr_set_list() -> [u8; 48usize] { + *b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08set_list\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x04list\x00\x00\x03\xea\x00\x00\x00\x04\x00\x00\x00\x00" + } +} +#[doc(hidden)] +#[allow(non_snake_case)] +pub static __SPEC_XDR_FN_GET_LIST: [u8; 36usize] = Test::spec_xdr_get_list(); +impl Test { + pub const fn spec_xdr_get_list() -> [u8; 36usize] { + *b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x08get_list\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x03\xea\x00\x00\x00\x04" + } +} +impl<'a> TestClient<'a> { + pub fn set_list(&self, list: &Vec) -> () { + use core::ops::Not; + use soroban_sdk::{IntoVal, FromVal}; + let res = self + .env + .invoke_contract( + &self.address, + &soroban_sdk::Symbol::new(&self.env, &"set_list"), + ::soroban_sdk::Vec::from_array(&self.env, [list.into_val(&self.env)]), + ); + res + } + pub fn try_set_list( + &self, + list: &Vec, + ) -> Result< + Result< + (), + <() as soroban_sdk::TryFromVal>::Error, + >, + Result, + > { + use soroban_sdk::{IntoVal, FromVal}; + let res = self + .env + .try_invoke_contract( + &self.address, + &soroban_sdk::Symbol::new(&self.env, &"set_list"), + ::soroban_sdk::Vec::from_array(&self.env, [list.into_val(&self.env)]), + ); + res + } + pub fn get_list(&self) -> Vec { + use core::ops::Not; + use soroban_sdk::{IntoVal, FromVal}; + let res = self + .env + .invoke_contract( + &self.address, + &soroban_sdk::Symbol::new(&self.env, &"get_list"), + ::soroban_sdk::Vec::new(&self.env), + ); + res + } + pub fn try_get_list( + &self, + ) -> Result< + Result< + Vec, + as soroban_sdk::TryFromVal>::Error, + >, + Result, + > { + use soroban_sdk::{IntoVal, FromVal}; + let res = self + .env + .try_invoke_contract( + &self.address, + &soroban_sdk::Symbol::new(&self.env, &"get_list"), + ::soroban_sdk::Vec::new(&self.env), + ); + res + } +} +#[doc(hidden)] +pub mod __set_list { + use super::*; + #[deprecated(note = "use `TestClient::new(&env, &contract_id).set_list` instead")] + pub extern fn invoke_raw( + env: soroban_sdk::Env, + arg_0: soroban_sdk::Val, + ) -> soroban_sdk::Val { + <_ as soroban_sdk::IntoVal< + soroban_sdk::Env, + soroban_sdk::Val, + >>::into_val( + #[allow(deprecated)] + &::set_list( + env.clone(), + <_ as soroban_sdk::unwrap::UnwrapOptimized>::unwrap_optimized( + <_ as soroban_sdk::TryFromValForContractFn< + soroban_sdk::Env, + soroban_sdk::Val, + >>::try_from_val_for_contract_fn(&env, &arg_0), + ), + ), + &env, + ) + } + #[deprecated(note = "use `TestClient::new(&env, &contract_id).set_list` instead")] + pub fn invoke_raw_slice( + env: soroban_sdk::Env, + args: &[soroban_sdk::Val], + ) -> soroban_sdk::Val { + #[allow(deprecated)] invoke_raw(env, args[0usize]) + } + use super::*; +} +#[doc(hidden)] +pub mod __get_list { + use super::*; + #[deprecated(note = "use `TestClient::new(&env, &contract_id).get_list` instead")] + pub extern fn invoke_raw(env: soroban_sdk::Env) -> soroban_sdk::Val { + <_ as soroban_sdk::IntoVal< + soroban_sdk::Env, + soroban_sdk::Val, + >>::into_val(#[allow(deprecated)] &::get_list(env.clone()), &env) + } + #[deprecated(note = "use `TestClient::new(&env, &contract_id).get_list` instead")] + pub fn invoke_raw_slice( + env: soroban_sdk::Env, + args: &[soroban_sdk::Val], + ) -> soroban_sdk::Val { + #[allow(deprecated)] invoke_raw(env) + } + use super::*; +} diff --git a/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs b/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs new file mode 100644 index 000000000..fb2ae8309 --- /dev/null +++ b/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs @@ -0,0 +1,27 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, contracttype, Env, Vec}; + +#[derive(Clone, Debug)] +#[contracttype] +pub enum DataKey { + List, +} + +#[contract] +pub struct Test; + +#[contractimpl] +impl Test { + pub fn set_list(env: Env, list: Vec) { + env.storage().persistent().set(&DataKey::List, &list); + } + + pub fn get_list(env: Env) -> Vec { + env.storage() + .persistent() + .get(&DataKey::List) + .unwrap_or(Vec::new(&env)) + } +} + +// mod test; diff --git a/soroban-test-wasms/wasm-workspace/storage_list/src/test.rs b/soroban-test-wasms/wasm-workspace/storage_list/src/test.rs new file mode 100644 index 000000000..6b697ecf8 --- /dev/null +++ b/soroban-test-wasms/wasm-workspace/storage_list/src/test.rs @@ -0,0 +1,13 @@ +#![cfg(test)] + +use super::*; +use soroban_sdk::{vec, Env}; + +// #[test] +// fn test() { +// let env = Env::default(); +// let contract_id = env.register_contract(None, Test); +// let client = TestClient::new(&env, &contract_id); + +// client.set_list(&vec![1u64, 2u64]); +// } From dd1eb7878c4c90cf5a936c2042634f7012a45c86 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Mon, 17 Jun 2024 14:33:53 -0400 Subject: [PATCH 3/3] add --- .../wasm-workspace/opt/curr/storage_list.wasm | Bin 784 -> 1338 bytes .../wasm-workspace/storage_list/src/lib.rs | 16 ++++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/storage_list.wasm b/soroban-test-wasms/wasm-workspace/opt/curr/storage_list.wasm index dc138ada0050efe45660f0b1a32a7d0672c67af1..50acd83ae6b95e3555f53218a56e676be6bd4b1a 100644 GIT binary patch literal 1338 zcmZuw&2G~`5T4oHIBvF1T?&T=2{~!6jgmBN6miK~v>b{AMMC1{IE`DH^p7}1>LrQP zs31#VOO(98RgiUSKW*Bt6qrI*HQs&kU5T`_V;!{N}jDWvSyDo9D1i*~}rU1`R;A-^Fbwsf7S=5}<2S?)kq z@S4L#jSUn!Vhte2)KA#9AmcDqXh&tHUWyu7HxQed*!(p%mv^iLMW42*c-lAGR5!UCdFiG{3&hU&A`XrfTgZ$qTr>CsUW*!$MD!BH zX_rO!bC7PB%*Z@r)L*Qo!#N=KnPwksnZxnv_y?ek4tp$DCa59?MGfi_eZ#X0Vlsla zK%s4J>5tOKULnEv9r&ub$f3H1=R^m%<|iW3*tRgEf3MAC78HxnZpRDW3Oc7RX^aw- z!sP^>&EPo@6-x+l8>e1So4#2uy`j$g&eD6QC*6*}*A35ty&la7wf<}+pHWNh1n1hr zXKoN0b`x^zny4eVtjjG>hHmiklCD<%fniSYvFBTg6 GmC_$Mv+cJ4 delta 478 zcmXv~!DQz@&*UzPsXh1vT5r_!g&Ni1N%59RX$`+#K z#E&DqM=nWUu_tyPLt?S3EnaKmLxSpPDCpVI{q=fsL8c;q()fi}Q8d~eefsi^DIV`0 z4EH~d4`?CYyMwXRTb%uWSe>%|16CEvN91jh@(TIGJ{)t&naUh=#+8SIZyMxJiBj@^ z>2*R~M}D>NSNQCgHgzWK7v0eA4gGgZAG}REqP{Ga*@)jLmeKfUg*gw^6^@+>(X{R> z>4CftQH_M+X}DJl4)vrxaSJZUl6kIT$3D)_gPR6jw}Q1Yv$y#QnI1U`QaAjjfzHU- zNH{Ea1Dkay`In8-CZbZj2pA+yKCDjp_SIHGWE|U$L%>$gD3Xy9ke^IsxB6YP%kP+f SP)~sQO!elM>dpL2|F{M{J7&QE diff --git a/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs b/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs index fb2ae8309..8ae80fa5d 100644 --- a/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs +++ b/soroban-test-wasms/wasm-workspace/storage_list/src/lib.rs @@ -5,6 +5,8 @@ use soroban_sdk::{contract, contractimpl, contracttype, Env, Vec}; #[contracttype] pub enum DataKey { List, + U32, + U64, } #[contract] @@ -22,6 +24,20 @@ impl Test { .get(&DataKey::List) .unwrap_or(Vec::new(&env)) } + + pub fn set_u32(env: Env, v: u32) { + env.storage().persistent().set(&DataKey::U32, &v); + } + pub fn get_u32(env: Env) { + env.storage().persistent().get(&DataKey::U32).unwrap() + } + + pub fn set_u64(env: Env, v: u64) { + env.storage().persistent().set(&DataKey::U64, &v); + } + pub fn get_u64(env: Env) { + env.storage().persistent().get(&DataKey::U64).unwrap() + } } // mod test;