From 652d723efbbe269943a7f08d436a98570995dfbd Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Mon, 29 Jul 2024 19:13:36 -0400 Subject: [PATCH 01/12] Use explicit protocol version for test Wasms. Also modified the makefile to regenerate Wasms in the directory corresponding to the necessary protocol version. I'm not sure yet if we need to maintain several versions of every Wasm, so I'm only leaving the v20 Wasms checked-in for now (I did try to generate v21 though just for a sanity check). Going forward I think we could keep explicitly versioned Wasms around for tests that need them, but otherwise have just a single version. --- soroban-test-wasms/Makefile | 4 +- soroban-test-wasms/src/lib.rs | 130 +++++------ soroban-test-wasms/wasm-workspace/Cargo.lock | 217 ++++++++---------- soroban-test-wasms/wasm-workspace/Cargo.toml | 19 +- soroban-test-wasms/wasm-workspace/Makefile | 20 +- .../opt/{curr => 20}/auth_test_contract.wasm | Bin .../{curr => 20}/contract_sac_transfer.wasm | Bin .../opt/{curr => 20}/example_add_f32.wasm | Bin .../opt/{curr => 20}/example_add_i32.wasm | Bin .../opt/{curr => 20}/example_alloc.wasm | Bin .../opt/{curr => 20}/example_complex.wasm | Bin .../{curr => 20}/example_contract_data.wasm | Bin .../{curr => 20}/example_create_contract.wasm | Bin .../opt/{curr => 20}/example_err.wasm | Bin .../opt/{curr => 20}/example_fannkuch.wasm | Bin .../opt/{curr => 20}/example_fib.wasm | Bin .../opt/{curr => 20}/example_hostile.wasm | Bin .../{curr => 20}/example_invoke_contract.wasm | Bin .../{curr => 20}/example_linear_memory.wasm | Bin .../{curr => 20}/example_simple_account.wasm | Bin .../opt/{curr => 20}/example_sum_i32.wasm | Bin .../example_updateable_contract.wasm | Bin .../{curr => 20}/example_upload_contract.wasm | Bin .../opt/{curr => 20}/example_vec.wasm | Bin .../opt/{curr => 20}/hostile_large_val.wasm | Bin .../opt/{curr => 20}/loadgen.wasm | Bin .../opt/{curr => 20}/recursive_account.wasm | Bin .../opt/{curr => 20}/sac_reentry_account.wasm | Bin .../soroban_write_upgrade_bytes_contract.wasm | Bin .../test_conditional_account.wasm | Bin .../{curr => 20}/test_delegated_account.wasm | Bin .../opt/{curr => 20}/test_deployer.wasm | Bin .../write_upgrade_bytes/src/lib.rs | 2 +- 33 files changed, 186 insertions(+), 206 deletions(-) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/auth_test_contract.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/contract_sac_transfer.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_add_f32.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_add_i32.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_alloc.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_complex.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_contract_data.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_create_contract.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_err.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_fannkuch.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_fib.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_hostile.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_invoke_contract.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_linear_memory.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_simple_account.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_sum_i32.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_updateable_contract.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_upload_contract.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/example_vec.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/hostile_large_val.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/loadgen.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/recursive_account.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/sac_reentry_account.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/soroban_write_upgrade_bytes_contract.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/test_conditional_account.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/test_delegated_account.wasm (100%) rename soroban-test-wasms/wasm-workspace/opt/{curr => 20}/test_deployer.wasm (100%) diff --git a/soroban-test-wasms/Makefile b/soroban-test-wasms/Makefile index c31323745..7207bda25 100644 --- a/soroban-test-wasms/Makefile +++ b/soroban-test-wasms/Makefile @@ -1,2 +1,4 @@ +PROTOCOL_VERSION ?= + regenerate-test-wasms: - make -C wasm-workspace regenerate-test-wasms \ No newline at end of file + make PROTOCOL_VERSION=$(PROTOCOL_VERSION) -C wasm-workspace regenerate-test-wasms \ No newline at end of file diff --git a/soroban-test-wasms/src/lib.rs b/soroban-test-wasms/src/lib.rs index 1af921efe..73035976b 100644 --- a/soroban-test-wasms/src/lib.rs +++ b/soroban-test-wasms/src/lib.rs @@ -1,7 +1,7 @@ -//! This crate bundles together a bunch of pre-compiled WASM binaries as +//! This crate bundles together a bunch of pre-compiled Wasm binaries as //! constants that can be used elsewhere in end-to-end tests of the host crate, //! stellar-core, or other embeddings that need to have some well-formed and -//! meaningful WASM inputs to draw on. +//! meaningful Wasm inputs to draw on. //! //! They are generated in (and then here copied out of) the embedded workspace //! `wasm-workspace` which, confusingly, uses both the adjacent (in-repo) @@ -9,29 +9,29 @@ //! (external) `soroban-sdk` crate, with its dependencies on `soroban-env-guest` //! and `soroban-env-common` patched to use the local versions in this repo. //! -//! Regeneration of the WASMs is _not_ totally automated: we do not know exactly -//! when the WASMs need to be regenerated, and so they _aren't_ unless you +//! Regeneration of the Wasms is _not_ totally automated: we do not know exactly +//! when the Wasms need to be regenerated, and so they _aren't_ unless you //! manually run `make` in the `wasm-workspace` subdirectory. //! //! There are 3 reasons for this crate (and its adjacent .rs inputs) to exist: //! //! 1. To centralize the logic for compiling and embedding the .rs inputs into -//! WASM test binaries in a single location, so that other consumers of -//! test WASMs can just refer to this crate, in this repo, by its URL + git +//! Wasm test binaries in a single location, so that other consumers of +//! test Wasms can just refer to this crate, in this repo, by its URL + git //! hash. //! //! 2. To break what would otherwise be an awkward and multi-step cross-repo -//! cyclical dependency between `rs-soroban-sdk` (or wherever the WASM test +//! cyclical dependency between `rs-soroban-sdk` (or wherever the Wasm test //! inputs live) and the `rs-soroban-env` repo. Specifically when we make a //! change to the env interface version number in -//! `rs-soroban-env/soroban-env-common`, we need to regenerate the WASMs so -//! that the WASM-based tests in `rs-soroban-env/soroban-env-host` still -//! pass; but if we store the test WASMs and their .rs inputs in a separate +//! `rs-soroban-env/soroban-env-common`, we need to regenerate the Wasms so +//! that the Wasm-based tests in `rs-soroban-env/soroban-env-host` still +//! pass; but if we store the test Wasms and their .rs inputs in a separate //! repo (worst of all the SDK repo) we would need to patch it to refer //! back to the local path of the `rs-soroban-env` repo containing our //! change-in-progress to `rs-soroban-env/soroban-env-common`, and then -//! copy the WASMs back into `rs-soroban-env/soroban-env-host`. By storing -//! the WASMs and their .rs inputs in 'rs-soroban-env', here in the +//! copy the Wasms back into `rs-soroban-env/soroban-env-host`. By storing +//! the Wasms and their .rs inputs in 'rs-soroban-env', here in the //! embedded `wasm-workspace` directory, we can (somewhat) contain this //! mess, writing down the necessary patch directive permanently and //! including the `.wasm` files directly from the embedded workspace. @@ -42,60 +42,56 @@ //! documentation purpopses without having to worry about breaking tests in //! the host here. -pub use curr::*; +// Protocol 20 Wasms. +pub const ADD_I32: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_add_i32.wasm").as_slice(); +pub const SUM_I32: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_sum_i32.wasm").as_slice(); +pub const ADD_F32: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_add_f32.wasm").as_slice(); +pub const ALLOC: &[u8] = include_bytes!("../wasm-workspace/opt/20/example_alloc.wasm").as_slice(); +pub const CREATE_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_create_contract.wasm").as_slice(); +pub const CONTRACT_STORAGE: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_contract_data.wasm").as_slice(); +pub const LINEAR_MEMORY: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_linear_memory.wasm").as_slice(); +pub const LOADGEN: &[u8] = include_bytes!("../wasm-workspace/opt/20/loadgen.wasm").as_slice(); +pub const VEC: &[u8] = include_bytes!("../wasm-workspace/opt/20/example_vec.wasm").as_slice(); +pub const INVOKE_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_invoke_contract.wasm").as_slice(); +pub const HOSTILE: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_hostile.wasm").as_slice(); +pub const FIB: &[u8] = include_bytes!("../wasm-workspace/opt/20/example_fib.wasm").as_slice(); +pub const FANNKUCH: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_fannkuch.wasm").as_slice(); +pub const COMPLEX: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_complex.wasm").as_slice(); +pub const SIMPLE_ACCOUNT_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_simple_account.wasm").as_slice(); +pub const AUTH_TEST_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/auth_test_contract.wasm").as_slice(); +pub const UPDATEABLE_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_updateable_contract.wasm").as_slice(); +pub const UPLOAD_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/example_upload_contract.wasm").as_slice(); +pub const DELEGATED_ACCOUNT_TEST_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/test_delegated_account.wasm").as_slice(); +pub const ERR: &[u8] = include_bytes!("../wasm-workspace/opt/20/example_err.wasm").as_slice(); +pub const WRITE_BYTES: &[u8] = + include_bytes!("../wasm-workspace/opt/20/soroban_write_upgrade_bytes_contract.wasm") + .as_slice(); +pub const CONDITIONAL_ACCOUNT_TEST_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/test_conditional_account.wasm").as_slice(); +pub const SAC_REENTRY_TEST_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/sac_reentry_account.wasm").as_slice(); +pub const CONTRACT_SAC_TRANSFER_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/contract_sac_transfer.wasm").as_slice(); +pub const RECURSIVE_ACCOUNT_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/recursive_account.wasm").as_slice(); -mod curr { - pub const ADD_I32: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_add_i32.wasm").as_slice(); - pub const SUM_I32: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_sum_i32.wasm").as_slice(); - pub const ADD_F32: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_add_f32.wasm").as_slice(); - pub const ALLOC: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_alloc.wasm").as_slice(); - pub const CREATE_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_create_contract.wasm").as_slice(); - pub const CONTRACT_STORAGE: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_contract_data.wasm").as_slice(); - pub const LINEAR_MEMORY: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_linear_memory.wasm").as_slice(); - pub const LOADGEN: &[u8] = include_bytes!("../wasm-workspace/opt/curr/loadgen.wasm").as_slice(); - pub const VEC: &[u8] = include_bytes!("../wasm-workspace/opt/curr/example_vec.wasm").as_slice(); - pub const INVOKE_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_invoke_contract.wasm").as_slice(); - pub const HOSTILE: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_hostile.wasm").as_slice(); - pub const FIB: &[u8] = include_bytes!("../wasm-workspace/opt/curr/example_fib.wasm").as_slice(); - pub const FANNKUCH: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_fannkuch.wasm").as_slice(); - pub const COMPLEX: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_complex.wasm").as_slice(); - pub const SIMPLE_ACCOUNT_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_simple_account.wasm").as_slice(); - pub const AUTH_TEST_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/auth_test_contract.wasm").as_slice(); - pub const UPDATEABLE_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_updateable_contract.wasm").as_slice(); - pub const UPLOAD_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/example_upload_contract.wasm").as_slice(); - pub const DELEGATED_ACCOUNT_TEST_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/test_delegated_account.wasm").as_slice(); - pub const ERR: &[u8] = include_bytes!("../wasm-workspace/opt/curr/example_err.wasm").as_slice(); - pub const WRITE_BYTES: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/soroban_write_upgrade_bytes_contract.wasm") - .as_slice(); - pub const CONDITIONAL_ACCOUNT_TEST_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/test_conditional_account.wasm").as_slice(); - pub const SAC_REENTRY_TEST_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/sac_reentry_account.wasm").as_slice(); - pub const CONTRACT_SAC_TRANSFER_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/contract_sac_transfer.wasm").as_slice(); - pub const RECURSIVE_ACCOUNT_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/recursive_account.wasm").as_slice(); +pub const HOSTILE_LARGE_VALUE: &[u8] = + include_bytes!("../wasm-workspace/opt/20/hostile_large_val.wasm").as_slice(); - pub const HOSTILE_LARGE_VALUE: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/hostile_large_val.wasm").as_slice(); - - pub const DEPLOYER_TEST_CONTRACT: &[u8] = - include_bytes!("../wasm-workspace/opt/curr/test_deployer.wasm").as_slice(); -} +pub const DEPLOYER_TEST_CONTRACT: &[u8] = + include_bytes!("../wasm-workspace/opt/20/test_deployer.wasm").as_slice(); diff --git a/soroban-test-wasms/wasm-workspace/Cargo.lock b/soroban-test-wasms/wasm-workspace/Cargo.lock index 8fe9244ff..ddd92657e 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 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -165,7 +165,7 @@ checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" name = "contract_sac_transfer" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -341,16 +341,15 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[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]] @@ -365,15 +364,16 @@ dependencies = [ [[package]] name = "ed25519-dalek" -version = "2.0.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +checksum = "4a3daa8e81a3963a60642bcc1f90a670680bd4a77535faa384e9d1c79d620871" dependencies = [ "curve25519-dalek", "ed25519", "rand_core", "serde", "sha2", + "subtle", "zeroize", ] @@ -395,7 +395,6 @@ dependencies = [ "ff", "generic-array", "group", - "pkcs8", "rand_core", "sec1", "subtle", @@ -424,7 +423,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 +431,7 @@ dependencies = [ name = "example_add_i32" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -440,7 +439,7 @@ dependencies = [ name = "example_alloc" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -448,7 +447,7 @@ dependencies = [ name = "example_complex" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -456,7 +455,7 @@ dependencies = [ name = "example_contract_data" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -464,7 +463,7 @@ dependencies = [ name = "example_create_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -472,7 +471,7 @@ dependencies = [ name = "example_err" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -480,7 +479,7 @@ dependencies = [ name = "example_fannkuch" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -488,7 +487,7 @@ dependencies = [ name = "example_fib" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -496,7 +495,7 @@ dependencies = [ name = "example_hostile" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -504,7 +503,7 @@ dependencies = [ name = "example_invoke_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -512,7 +511,7 @@ dependencies = [ name = "example_linear_memory" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -520,7 +519,7 @@ dependencies = [ name = "example_simple_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -528,7 +527,7 @@ dependencies = [ name = "example_sum_i32" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -536,7 +535,7 @@ dependencies = [ name = "example_updateable_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -544,7 +543,7 @@ dependencies = [ name = "example_upload_contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -552,7 +551,7 @@ dependencies = [ name = "example_vec" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -659,7 +658,7 @@ dependencies = [ name = "hostile_large_val" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -753,9 +752,7 @@ dependencies = [ "cfg-if", "ecdsa", "elliptic-curve", - "once_cell", "sha2", - "signature", ] [[package]] @@ -783,7 +780,7 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" name = "loadgen" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -864,6 +861,18 @@ version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2", +] + [[package]] name = "paste" version = "1.0.14" @@ -908,6 +917,15 @@ dependencies = [ "syn", ] +[[package]] +name = "primeorder" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7dbe9ed3b56368bd99483eb32fe9c17fdd3730aebadc906918ce78d54c7eeb4" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -960,7 +978,7 @@ dependencies = [ name = "recursive_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -999,20 +1017,19 @@ checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" 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", ] @@ -1122,9 +1139,7 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "soroban-builtin-sdk-macros" -version = "20.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cc32c6e817f3ca269764ec0d7d14da6210b74a5bf14d4e745aa3ee860558900" +version = "21.2.0" dependencies = [ "itertools", "proc-macro2", @@ -1134,22 +1149,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.2.0" dependencies = [ "arbitrary", "crate-git-revision", @@ -1157,31 +1157,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.2.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.2.0" dependencies = [ "backtrace", "curve25519-dalek", + "ecdsa", "ed25519-dalek", + "elliptic-curve", + "generic-array", "getrandom", "hex-literal", "hmac", @@ -1189,60 +1189,48 @@ 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.2.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", ] [[package]] name = "soroban-ledger-snapshot" -version = "20.5.0" +version = "21.4.0" 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", ] [[package]] name = "soroban-sdk" -version = "20.5.0" +version = "21.4.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1260,7 +1248,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "20.5.0" +version = "21.4.0" dependencies = [ "crate-git-revision", "darling", @@ -1269,33 +1257,33 @@ 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", ] [[package]] name = "soroban-spec" -version = "20.5.0" +version = "21.4.0" dependencies = [ "base64 0.13.1", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", "thiserror", "wasmparser", ] [[package]] name = "soroban-spec-rust" -version = "20.5.0" +version = "21.4.0" dependencies = [ "prettyplease", "proc-macro2", "quote", "sha2", "soroban-spec", - "stellar-xdr 20.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "stellar-xdr", "syn", "thiserror", ] @@ -1303,8 +1291,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 +1304,7 @@ dependencies = [ name = "soroban-write-upgrade-bytes-contract" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1356,9 +1343,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "20.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e59cdf3eb4467fb5a4b00b52e7de6dca72f67fac6f9b700f55c95a5d86f09c9d" +checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1370,17 +1357,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 +1384,7 @@ dependencies = [ name = "test_conditional_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1416,7 +1392,7 @@ dependencies = [ name = "test_delegated_account" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1424,7 +1400,7 @@ dependencies = [ name = "test_deployer" version = "0.0.0" dependencies = [ - "soroban-env-common 20.3.0", + "soroban-env-common", "soroban-sdk", ] @@ -1557,15 +1533,13 @@ checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[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 +1549,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.1.0", + "semver", ] [[package]] @@ -1662,11 +1637,3 @@ name = "zeroize" version = "1.6.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" diff --git a/soroban-test-wasms/wasm-workspace/Cargo.toml b/soroban-test-wasms/wasm-workspace/Cargo.toml index 3f664d85e..9c2dafc8d 100644 --- a/soroban-test-wasms/wasm-workspace/Cargo.toml +++ b/soroban-test-wasms/wasm-workspace/Cargo.toml @@ -1,12 +1,12 @@ # This file defines a workspace that is _periodically_ recompiled as part of -# updating the WASM files that are then embedded as as bytes constants in the +# updating the Wasm files that are then embedded as as bytes constants in the # surrounding crate `soroban-test-wasms`. # # Neither the rust crates in this workspace, nor the workspace itself, are (in # cargo's mind) part of the outer workspace containing # soroban-env-{host,guest,macros,wasm-tests} etc. The inner workspace is # excluded from the outer workspace, and the crates within it must be manually -# built (and should only be built as WASM). See the adjacent `Makefile` for +# built (and should only be built as Wasm). See the adjacent `Makefile` for # invocation. # # The dependency graph here is complex and subtle and needs to be understood if @@ -59,23 +59,24 @@ lto = true rust-version = "1.74.0" [workspace.dependencies.soroban-sdk] -version = "=20.5.0" -git = "https://github.com/stellar/rs-soroban-sdk" +version = "=21.4.0" +# git = "https://github.com/stellar/rs-soroban-sdk" [workspace.dependencies.soroban-env-common] -version = "=20.3.0" -git = "https://github.com/stellar/rs-soroban-env" +version = "=21.2.0" +# git = "https://github.com/stellar/rs-soroban-env" -# Always build from the local instance of env as we need to rebuild test WASMs +# Always build from the local instance of env as we need to rebuild test Wasms # only due to the env changes. -[patch."https://github.com/stellar/rs-soroban-env"] +# [patch."https://github.com/stellar/rs-soroban-env"] +[patch.crates-io] soroban-env-common = { path = "../../soroban-env-common" } soroban-env-guest = { path = "../../soroban-env-guest" } soroban-env-host = { path = "../../soroban-env-host" } # Always build using the local SDK. Usually the env change is accompanied with # the corresponding SDK change. -[patch."https://github.com/stellar/rs-soroban-sdk"] +# [patch."https://github.com/stellar/rs-soroban-sdk"] soroban-sdk = { path = "../../../rs-soroban-sdk/soroban-sdk" } # [patch."https://github.com/stellar/rs-stellar-xdr"] diff --git a/soroban-test-wasms/wasm-workspace/Makefile b/soroban-test-wasms/wasm-workspace/Makefile index 6a980e757..4ff6ac1c9 100644 --- a/soroban-test-wasms/wasm-workspace/Makefile +++ b/soroban-test-wasms/wasm-workspace/Makefile @@ -1,6 +1,19 @@ -# This rebuilds the workspace's .rs files into WASMs that will be embedded as +# This rebuilds the workspace's .rs files into Wasms that will be embedded as # constants into the crate `soroban-test-wasms` defined in the enclosing # directory. See that crate for more details. +# This requires `PROTOCOL_VERSION` variable to be set when running `make`. +# The `PROTOCOL_VERSION` has to match the version of `soroban-env-common` +# specified in `Cargo.toml`. An output Wasm for a given `PROTOCOL_VERSION` is +# considered `frozen` as soon as the corresponding version of Soroban +# environment has been released. E.g. protocol 20 Wasms can't be modified after +# the Soroban initial release. It's ok though to add new Wasms for the old +# protocols, or omit Wasms or protocols when they don't provide any new behavior +# (e.g. there isn't much point in re-building the initial protocol 20 Wasms for +# the later protocol versions). + +ifeq ($(PROTOCOL_VERSION),) + $(error PROTOCOL_VERSION is not set) +endif regenerate-test-wasms: for i in $(wildcard */Cargo.toml); do \ @@ -9,7 +22,8 @@ regenerate-test-wasms: --release \ --crate-type=cdylib); \ done + mkdir -p opt/$(PROTOCOL_VERSION) for i in target/wasm32-unknown-unknown/release/*.wasm ; do \ - wasm-opt -Oz "$$i" -o "opt/curr/$$(basename $$i)"; \ - ls -l "opt/curr/$$(basename $$i)"; \ + wasm-opt -Oz "$$i" -o "opt/$(PROTOCOL_VERSION)/$$(basename $$i)"; \ + ls -l "opt/$(PROTOCOL_VERSION)/$$(basename $$i)"; \ done \ No newline at end of file diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/auth_test_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/20/auth_test_contract.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/auth_test_contract.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/auth_test_contract.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/contract_sac_transfer.wasm b/soroban-test-wasms/wasm-workspace/opt/20/contract_sac_transfer.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/contract_sac_transfer.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/contract_sac_transfer.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_add_f32.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_add_f32.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_add_f32.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_add_f32.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_add_i32.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_add_i32.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_add_i32.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_add_i32.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_alloc.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_alloc.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_alloc.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_alloc.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_complex.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_complex.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_complex.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_complex.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_contract_data.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_contract_data.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_contract_data.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_contract_data.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_create_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_create_contract.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_create_contract.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_create_contract.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_err.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_err.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_err.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_err.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_fannkuch.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_fannkuch.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_fannkuch.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_fannkuch.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_fib.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_fib.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_fib.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_fib.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_hostile.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_hostile.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_hostile.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_hostile.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_invoke_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_invoke_contract.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_invoke_contract.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_invoke_contract.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_linear_memory.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_linear_memory.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_linear_memory.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_linear_memory.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_simple_account.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_simple_account.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_simple_account.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_simple_account.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_sum_i32.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_sum_i32.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_sum_i32.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_sum_i32.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_updateable_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_updateable_contract.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_updateable_contract.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_updateable_contract.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_upload_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_upload_contract.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_upload_contract.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_upload_contract.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/example_vec.wasm b/soroban-test-wasms/wasm-workspace/opt/20/example_vec.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/example_vec.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/example_vec.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/hostile_large_val.wasm b/soroban-test-wasms/wasm-workspace/opt/20/hostile_large_val.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/hostile_large_val.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/hostile_large_val.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/loadgen.wasm b/soroban-test-wasms/wasm-workspace/opt/20/loadgen.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/loadgen.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/loadgen.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/recursive_account.wasm b/soroban-test-wasms/wasm-workspace/opt/20/recursive_account.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/recursive_account.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/recursive_account.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/sac_reentry_account.wasm b/soroban-test-wasms/wasm-workspace/opt/20/sac_reentry_account.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/sac_reentry_account.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/sac_reentry_account.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/soroban_write_upgrade_bytes_contract.wasm b/soroban-test-wasms/wasm-workspace/opt/20/soroban_write_upgrade_bytes_contract.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/soroban_write_upgrade_bytes_contract.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/soroban_write_upgrade_bytes_contract.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/test_conditional_account.wasm b/soroban-test-wasms/wasm-workspace/opt/20/test_conditional_account.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/test_conditional_account.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/test_conditional_account.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/test_delegated_account.wasm b/soroban-test-wasms/wasm-workspace/opt/20/test_delegated_account.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/test_delegated_account.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/test_delegated_account.wasm diff --git a/soroban-test-wasms/wasm-workspace/opt/curr/test_deployer.wasm b/soroban-test-wasms/wasm-workspace/opt/20/test_deployer.wasm similarity index 100% rename from soroban-test-wasms/wasm-workspace/opt/curr/test_deployer.wasm rename to soroban-test-wasms/wasm-workspace/opt/20/test_deployer.wasm 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..3c0d4546c 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 @@ -22,6 +22,6 @@ impl WriteBytesContract { env.storage().instance().extend_ttl(BALANCE_TTL_THRESHOLD, EXTEND_AMOUNT); - hash + hash.into() } } From 7bdabb235c8fee22f008ae8472d20ad03a05af2f Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Mon, 29 Jul 2024 19:22:37 -0400 Subject: [PATCH 02/12] !fixup fmt --- soroban-test-wasms/src/lib.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/soroban-test-wasms/src/lib.rs b/soroban-test-wasms/src/lib.rs index 73035976b..9afba19b2 100644 --- a/soroban-test-wasms/src/lib.rs +++ b/soroban-test-wasms/src/lib.rs @@ -79,8 +79,7 @@ pub const DELEGATED_ACCOUNT_TEST_CONTRACT: &[u8] = include_bytes!("../wasm-workspace/opt/20/test_delegated_account.wasm").as_slice(); pub const ERR: &[u8] = include_bytes!("../wasm-workspace/opt/20/example_err.wasm").as_slice(); pub const WRITE_BYTES: &[u8] = - include_bytes!("../wasm-workspace/opt/20/soroban_write_upgrade_bytes_contract.wasm") - .as_slice(); + include_bytes!("../wasm-workspace/opt/20/soroban_write_upgrade_bytes_contract.wasm").as_slice(); pub const CONDITIONAL_ACCOUNT_TEST_CONTRACT: &[u8] = include_bytes!("../wasm-workspace/opt/20/test_conditional_account.wasm").as_slice(); pub const SAC_REENTRY_TEST_CONTRACT: &[u8] = From a3af1a84ddcd219d9e7ade0c73fe7c6930bd3672 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 30 Jul 2024 13:44:37 -0400 Subject: [PATCH 03/12] !fixup add tracy to benchmark utils features --- soroban-bench-utils/Cargo.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/soroban-bench-utils/Cargo.toml b/soroban-bench-utils/Cargo.toml index 359049df4..e622fa72a 100644 --- a/soroban-bench-utils/Cargo.toml +++ b/soroban-bench-utils/Cargo.toml @@ -10,6 +10,9 @@ edition = "2021" rust-version.workspace = true publish = false +[features] +tracy = [] + [dependencies] soroban-env-common = { workspace = true } tracking-allocator = "=0.4.0" From f7545e220c34812cee0a73425da4792ec57d50fa Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 30 Jul 2024 13:57:43 -0400 Subject: [PATCH 04/12] !fixup fix tracy_span macro --- soroban-bench-utils/src/tracker.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soroban-bench-utils/src/tracker.rs b/soroban-bench-utils/src/tracker.rs index 0875c39ff..43804ee66 100644 --- a/soroban-bench-utils/src/tracker.rs +++ b/soroban-bench-utils/src/tracker.rs @@ -155,7 +155,7 @@ impl<'a> HostTracker<'a> { // start the mem measurement #[cfg(feature = "tracy")] { - self.tracy_span = Some(tracy_span!("tracker active")); + self.tracy_span = Some(tracy_client::span!("tracker active")); } self.mem_tracker.0.store(0, Ordering::SeqCst); self.alloc_guard = if let Some(t) = token { From 4556e87cd180bec4994a7e276e72811b2a573c77 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 30 Jul 2024 15:03:38 -0400 Subject: [PATCH 05/12] !fixup more tracy fixes --- Cargo.lock | 1 + soroban-bench-utils/Cargo.toml | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 05557febc..0b009d2cf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1357,6 +1357,7 @@ dependencies = [ "perf-event", "soroban-env-common", "tracking-allocator", + "tracy-client", ] [[package]] diff --git a/soroban-bench-utils/Cargo.toml b/soroban-bench-utils/Cargo.toml index e622fa72a..ce363dbb3 100644 --- a/soroban-bench-utils/Cargo.toml +++ b/soroban-bench-utils/Cargo.toml @@ -11,11 +11,14 @@ rust-version.workspace = true publish = false [features] -tracy = [] +tracy = ["soroban-env-common/tracy", "dep:tracy-client"] + + [dependencies] soroban-env-common = { workspace = true } tracking-allocator = "=0.4.0" +tracy-client = { version = "=0.16.4", features = ["enable", "timer-fallback"], default-features = false, optional = true } [target.'cfg(target_os = "linux")'.dependencies] perf-event = "0.4.7" From 3fb3afe7b42f7038fef408812cc12730e53c4da3 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 30 Jul 2024 16:06:40 -0400 Subject: [PATCH 06/12] !fixup yet another try to fix tracy --- soroban-bench-utils/Cargo.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/soroban-bench-utils/Cargo.toml b/soroban-bench-utils/Cargo.toml index ce363dbb3..bce796843 100644 --- a/soroban-bench-utils/Cargo.toml +++ b/soroban-bench-utils/Cargo.toml @@ -10,15 +10,15 @@ edition = "2021" rust-version.workspace = true publish = false -[features] -tracy = ["soroban-env-common/tracy", "dep:tracy-client"] +[target.'cfg(not(target_family = "wasm"))'.dependencies] +tracy-client = { version = "=0.16.4", features = ["enable", "timer-fallback"], default-features = false, optional = true } +[target.'cfg(target_os = "linux")'.dependencies] +perf-event = "0.4.7" +[features] +tracy = ["soroban-env-common/tracy", "dep:tracy-client"] [dependencies] soroban-env-common = { workspace = true } tracking-allocator = "=0.4.0" -tracy-client = { version = "=0.16.4", features = ["enable", "timer-fallback"], default-features = false, optional = true } - -[target.'cfg(target_os = "linux")'.dependencies] -perf-event = "0.4.7" From 886e811952fd0a13e9c6776ebc33c64624cc4af6 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 6 Aug 2024 16:08:22 -0400 Subject: [PATCH 07/12] !fixup gate tracy to not be used in non-Wasm builds --- soroban-bench-utils/src/tracker.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/soroban-bench-utils/src/tracker.rs b/soroban-bench-utils/src/tracker.rs index 43804ee66..f734f08a1 100644 --- a/soroban-bench-utils/src/tracker.rs +++ b/soroban-bench-utils/src/tracker.rs @@ -128,7 +128,7 @@ pub struct HostTracker<'a> { mem_tracker: MemTracker, start_time: Instant, alloc_guard: Option>, - #[cfg(feature = "tracy")] + #[cfg(all(not(target_family = "wasm"), feature = "tracy"))] tracy_span: Option, } @@ -146,14 +146,14 @@ impl<'a> HostTracker<'a> { mem_tracker, start_time: Instant::now(), alloc_guard: None, - #[cfg(feature = "tracy")] + #[cfg(all(not(target_family = "wasm"), feature = "tracy"))] tracy_span: None, } } pub fn start(&mut self, token: Option<&'a mut AllocationGroupToken>) { // start the mem measurement - #[cfg(feature = "tracy")] + #[cfg(all(not(target_family = "wasm"), feature = "tracy"))] { self.tracy_span = Some(tracy_client::span!("tracker active")); } @@ -179,7 +179,7 @@ impl<'a> HostTracker<'a> { let mem_bytes = self.mem_tracker.0.load(Ordering::SeqCst); let time_nsecs = stop_time.duration_since(self.start_time).as_nanos() as u64; self.alloc_guard = None; - #[cfg(feature = "tracy")] + #[cfg(all(not(target_family = "wasm"), feature = "tracy"))] { self.tracy_span = None } From 7aac13872beee7606ac7ac9a9d4be31be6d4c809 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 6 Aug 2024 16:31:12 -0400 Subject: [PATCH 08/12] !fixup fix opt_build warning --- soroban-env-host/build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soroban-env-host/build.rs b/soroban-env-host/build.rs index 06a09a4d9..41fc4fc12 100644 --- a/soroban-env-host/build.rs +++ b/soroban-env-host/build.rs @@ -1,5 +1,6 @@ -fn main() { +fn main() { println!("cargo:rerun-if-changed=build.rs"); + println!("cargo::rustc-check-cfg=cfg(opt_build)"); let opt_level = std::env::var("OPT_LEVEL").unwrap_or_else(|_| "0".to_string()); if opt_level != "0" { println!("cargo:rustc-cfg=opt_build"); From 196cebc41ffbc6b27d3e14b1564f0bd0e9c8550b Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 6 Aug 2024 16:52:35 -0400 Subject: [PATCH 09/12] !fixup fmt --- soroban-env-host/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soroban-env-host/build.rs b/soroban-env-host/build.rs index 41fc4fc12..e06565ece 100644 --- a/soroban-env-host/build.rs +++ b/soroban-env-host/build.rs @@ -1,4 +1,4 @@ -fn main() { +fn main() { println!("cargo:rerun-if-changed=build.rs"); println!("cargo::rustc-check-cfg=cfg(opt_build)"); let opt_level = std::env::var("OPT_LEVEL").unwrap_or_else(|_| "0".to_string()); From 06c0ccef56690d978e25b5065ce8e5fb114a2500 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 6 Aug 2024 16:55:56 -0400 Subject: [PATCH 10/12] !fixup rust compat --- soroban-env-host/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soroban-env-host/build.rs b/soroban-env-host/build.rs index e06565ece..6e6b0c622 100644 --- a/soroban-env-host/build.rs +++ b/soroban-env-host/build.rs @@ -1,6 +1,6 @@ fn main() { println!("cargo:rerun-if-changed=build.rs"); - println!("cargo::rustc-check-cfg=cfg(opt_build)"); + println!("cargo:rustc-check-cfg=cfg(opt_build)"); let opt_level = std::env::var("OPT_LEVEL").unwrap_or_else(|_| "0".to_string()); if opt_level != "0" { println!("cargo:rustc-cfg=opt_build"); From cfa7c8d4e18c5960fa4322593746b80f403959da Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Tue, 6 Aug 2024 20:39:35 -0400 Subject: [PATCH 11/12] !fixup try using a better instance for CI --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 1b041716b..474c2e8f0 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -75,7 +75,7 @@ jobs: rust: [msrv, latest] test-protocol: [20, 21] sys: - - os: ubuntu-latest + - os: ubuntu-latest-16-cores target: wasm32-unknown-unknown test: false - os: ubuntu-latest From ce01981090fb8ca9a60a1de8ea26ad85a61553c0 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Wed, 7 Aug 2024 16:29:57 -0400 Subject: [PATCH 12/12] !fixup actually use 16 core instance for tests --- .github/workflows/rust.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 474c2e8f0..2c3f4ac01 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -75,10 +75,10 @@ jobs: rust: [msrv, latest] test-protocol: [20, 21] sys: - - os: ubuntu-latest-16-cores + - os: ubuntu-latest target: wasm32-unknown-unknown test: false - - os: ubuntu-latest + - os: ubuntu-latest-16-cores target: x86_64-unknown-linux-gnu test: true # TODO: Re-enable these builds if we see value in doing so.