From 40824b952a3dac351678ed9ae3436655e2bdc1da Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Sat, 13 Jul 2024 06:56:33 +1000 Subject: [PATCH 01/57] Add in contract assertions to prng functions (#1295) ### What Add in contract assertions to prng functions. ### Why It's really easy to think you can use the prng functions inside your tests to help setup random test data, without reaslising that these functions are restricted to use within a contract. Close #1165 --- soroban-sdk/src/lib.rs | 18 +++++++++ soroban-sdk/src/prng.rs | 9 +++++ soroban-sdk/src/storage.rs | 20 ++-------- soroban-sdk/src/tests/prng.rs | 73 +++++++++++++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 17 deletions(-) diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index 18ddb6a4a..c032484ea 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -117,6 +117,24 @@ pub mod reexports_for_macros { pub use ::ctor; } +/// Assert in contract asserts that the contract is currently executing within a +/// contract. The macro maps to code when testutils are enabled or in tests, +/// otherwise maps to nothing. +#[macro_export] +macro_rules! assert_in_contract { + ($env:expr $(,)?) => {{ + { + #[cfg(any(test, feature = "testutils"))] + assert!( + ($env).in_contract(), + "this function is not accessible outside of a contract, wrap \ + the call with `env.as_contract()` to access it from a \ + particular contract" + ); + } + }}; +} + /// Create a short [Symbol] constant with the given string. /// /// A short symbol's maximum length is 9 characters. For longer symbols, use diff --git a/soroban-sdk/src/prng.rs b/soroban-sdk/src/prng.rs index 7cc381c56..8b0425c9f 100644 --- a/soroban-sdk/src/prng.rs +++ b/soroban-sdk/src/prng.rs @@ -96,6 +96,7 @@ impl Prng { /// low risk tolerance, see the module-level comment.** pub fn seed(&self, seed: Bytes) { let env = self.env(); + assert_in_contract!(env); internal::Env::prng_reseed(env, seed.into()).unwrap_infallible(); } @@ -379,6 +380,7 @@ impl Prng { impl Shuffle for Vec { fn shuffle(&mut self, prng: &Prng) { let env = prng.env(); + assert_in_contract!(env); let obj = internal::Env::prng_vec_shuffle(env, self.to_object()).unwrap_infallible(); *self = unsafe { Self::unchecked_new(env.clone(), obj) }; } @@ -454,6 +456,7 @@ impl Fill for u64 { impl Gen for u64 { fn gen(prng: &Prng) -> Self { let env = prng.env(); + assert_in_contract!(env); internal::Env::prng_u64_in_inclusive_range(env, u64::MIN, u64::MAX).unwrap_infallible() } } @@ -463,6 +466,7 @@ impl GenRange for u64 { fn gen_range(prng: &Prng, r: impl RangeBounds) -> Self { let env = prng.env(); + assert_in_contract!(env); let start_bound = match r.start_bound() { Bound::Included(b) => *b, Bound::Excluded(b) => *b + 1, @@ -485,6 +489,7 @@ impl Fill for Bytes { /// If the length of Bytes is greater than u32::MAX in length. fn fill(&mut self, prng: &Prng) { let env = prng.env(); + assert_in_contract!(env); let len: u32 = self.len(); let obj = internal::Env::prng_bytes_new(env, len.into()).unwrap_infallible(); *self = unsafe { Bytes::unchecked_new(env.clone(), obj) }; @@ -496,6 +501,7 @@ impl GenLen for Bytes { /// Generates the Bytes with the Prng of the given length. fn gen_len(prng: &Prng, len: u32) -> Self { let env = prng.env(); + assert_in_contract!(env); let obj = internal::Env::prng_bytes_new(env, len.into()).unwrap_infallible(); unsafe { Bytes::unchecked_new(env.clone(), obj) } } @@ -521,6 +527,7 @@ impl Gen for BytesN { /// If the length of BytesN is greater than u32::MAX in length. fn gen(prng: &Prng) -> Self { let env = prng.env(); + assert_in_contract!(env); let len: u32 = N.try_into().unwrap_optimized(); let obj = internal::Env::prng_bytes_new(env, len.into()).unwrap_infallible(); unsafe { BytesN::unchecked_new(env.clone(), obj) } @@ -535,6 +542,7 @@ impl Fill for [u8] { /// If the slice is greater than u32::MAX in length. fn fill(&mut self, prng: &Prng) { let env = prng.env(); + assert_in_contract!(env); let len: u32 = self.len().try_into().unwrap_optimized(); let bytes: Bytes = internal::Env::prng_bytes_new(env, len.into()) .unwrap_infallible() @@ -551,6 +559,7 @@ impl Fill for [u8; N] { /// If the array is greater than u32::MAX in length. fn fill(&mut self, prng: &Prng) { let env = prng.env(); + assert_in_contract!(env); let len: u32 = N.try_into().unwrap_optimized(); let bytes: Bytes = internal::Env::prng_bytes_new(env, len.into()) .unwrap_infallible() diff --git a/soroban-sdk/src/storage.rs b/soroban-sdk/src/storage.rs index 03a1b9e14..9bd0a3ea0 100644 --- a/soroban-sdk/src/storage.rs +++ b/soroban-sdk/src/storage.rs @@ -86,8 +86,7 @@ impl Storage { /// This should be used for data that requires persistency, such as token /// balances, user properties etc. pub fn persistent(&self) -> Persistent { - #[cfg(any(test, feature = "testutils"))] - self.verify_in_contract("persistent"); + assert_in_contract!(self.env); Persistent { storage: self.clone(), @@ -106,8 +105,7 @@ impl Storage { /// This should be used for data that needs to only exist for a limited /// period of time, such as oracle data, claimable balances, offer, etc. pub fn temporary(&self) -> Temporary { - #[cfg(any(test, feature = "testutils"))] - self.verify_in_contract("persistent"); + assert_in_contract!(self.env); Temporary { storage: self.clone(), @@ -140,8 +138,7 @@ impl Storage { /// operates on etc. Do not use this with any data that can scale in /// unbounded fashion (such as user balances). pub fn instance(&self) -> Instance { - #[cfg(any(test, feature = "testutils"))] - self.verify_in_contract("persistent"); + assert_in_contract!(self.env); Instance { storage: self.clone(), @@ -299,17 +296,6 @@ impl Storage { fn get_internal(&self, key: Val, storage_type: StorageType) -> Val { internal::Env::get_contract_data(&self.env, key, storage_type).unwrap_infallible() } - - #[cfg(any(test, feature = "testutils"))] - fn verify_in_contract(&self, storage_kind: &str) { - if !self.env.in_contract() { - panic!( - "'{storage_kind}' storage is not accessible outside of the \ - contract, wrap the call with `env.as_contract()` to \ - access it from a particular contract" - ); - } - } } pub struct Persistent { diff --git a/soroban-sdk/src/tests/prng.rs b/soroban-sdk/src/tests/prng.rs index 046a1b435..28213b859 100644 --- a/soroban-sdk/src/tests/prng.rs +++ b/soroban-sdk/src/tests/prng.rs @@ -318,3 +318,76 @@ fn test_prng_gen_array() { ); }); } + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_seed() { + let e = Env::default(); + e.prng().seed(crate::Bytes::from_array(&e, &[0u8; 32])); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_shuffle() { + let e = Env::default(); + e.prng().shuffle(&mut Vec::::new(&e)); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_gen_u64() { + let e = Env::default(); + let _: u64 = e.prng().gen(); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_gen_bytesn() { + let e = Env::default(); + let _: BytesN<32> = e.prng().gen(); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_gen_range() { + let e = Env::default(); + let _: u64 = e.prng().gen_range(1..20); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_fill_bytes() { + let e = Env::default(); + e.prng().fill(&mut Bytes::new(&e)); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_fill_bytesn() { + let e = Env::default(); + e.prng().fill(&mut BytesN::from_array(&e, &[0u8; 32])); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_fill_slice() { + let e = Env::default(); + let mut arr = [0u8; 32]; + let slice = arr.as_mut(); + e.prng().fill(slice); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_fill_array() { + let e = Env::default(); + let mut arr = [0u8; 32]; + e.prng().fill(&mut arr); +} + +#[test] +#[should_panic(expected = "`env.as_contract()`")] +fn useful_error_message_for_access_outside_contract_gen_len() { + let e = Env::default(); + let _: Bytes = e.prng().gen_len(32); +} From 0c4c42bc7a8735081fa6286bbab2a3d5ebed8be6 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 16 Jul 2024 00:57:26 +1000 Subject: [PATCH 02/57] Fix rust 2024 incompatibilities (#1294) ### What Change dev_dependencies and build_dependencies into their hyphen separated versions. ### Why Rust edition 2024 that'll be released in October 2024 won't support the underscore variant any longer. --- soroban-ledger-snapshot/Cargo.toml | 2 +- soroban-sdk-macros/Cargo.toml | 2 +- soroban-spec-rust/Cargo.toml | 2 +- soroban-spec/Cargo.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/soroban-ledger-snapshot/Cargo.toml b/soroban-ledger-snapshot/Cargo.toml index 514ecef69..d6f9a6dd1 100644 --- a/soroban-ledger-snapshot/Cargo.toml +++ b/soroban-ledger-snapshot/Cargo.toml @@ -18,5 +18,5 @@ serde_with = { version = "3.4.0", features = ["hex"] } serde_json = "1.0.0" thiserror = "1.0" -[dev_dependencies] +[dev-dependencies] pretty_assertions = "1.2.1" diff --git a/soroban-sdk-macros/Cargo.toml b/soroban-sdk-macros/Cargo.toml index c52205e91..927ce56c5 100644 --- a/soroban-sdk-macros/Cargo.toml +++ b/soroban-sdk-macros/Cargo.toml @@ -14,7 +14,7 @@ rust-version.workspace = true proc-macro = true doctest = false -[build_dependencies] +[build-dependencies] rustc_version = "0.4.0" crate-git-revision = "0.0.6" diff --git a/soroban-spec-rust/Cargo.toml b/soroban-spec-rust/Cargo.toml index 0d367f25d..eb14f9139 100644 --- a/soroban-spec-rust/Cargo.toml +++ b/soroban-spec-rust/Cargo.toml @@ -20,5 +20,5 @@ proc-macro2 = "1.0" sha2 = "0.10.7" prettyplease = "0.2.4" -[dev_dependencies] +[dev-dependencies] pretty_assertions = "1.2.1" diff --git a/soroban-spec/Cargo.toml b/soroban-spec/Cargo.toml index 719c15811..0d48f5306 100644 --- a/soroban-spec/Cargo.toml +++ b/soroban-spec/Cargo.toml @@ -16,5 +16,5 @@ base64 = "0.13.0" thiserror = "1.0.32" wasmparser = "0.116.1" -[dev_dependencies] +[dev-dependencies] pretty_assertions = "1.2.1" From 3fcab0dde67a1a318660bad8bfa5e7aebf8b1769 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 16 Jul 2024 15:56:32 +1000 Subject: [PATCH 03/57] Update stellar-xdr, soroban-env-* (#1299) ### What Update stellar-xdr, soroban-env-* ### Why To get the latest stellar-xdr lib available in an env for the stellar-cli. --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3db258b3f..d12f31686 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1105,9 +1105,9 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "soroban-builtin-sdk-macros" -version = "21.1.2" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4aa78f4b1c752f5471b033fe54279ef0617ace342be7be11acc7d90e5677790e" +checksum = "44877373b3dc6c662377cb1600e3a62706d75e484b6064f9cd22e467c676b159" dependencies = [ "itertools", "proc-macro2", @@ -1117,9 +1117,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "21.1.2" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9acd7dbf8fc4222f62a4f06c5b32c3e097de97f5ff48218c8d77676d3424f363" +checksum = "590add16843a61b01844e19e89bccaaee6aa21dc76809017b0662c17dc139ee9" dependencies = [ "arbitrary", "crate-git-revision", @@ -1136,9 +1136,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "21.1.2" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "558a69d53d543a4b1ac60681332594dc1417080cffd2a6851bb6e0a376ebc76f" +checksum = "05ec8dc43acdd6c7e7b371acf44fc1a7dac24934ae3b2f05fafd618818548176" dependencies = [ "soroban-env-common", "static_assertions", @@ -1146,9 +1146,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "21.1.2" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956beee1e959b7b8ac7bea8396454d1534927276830430bf015eafdc756d84ae" +checksum = "4e25aaffe0c62eb65e0e349f725b4b8b13ad0764d78a15aab5bbccb5c4797726" dependencies = [ "backtrace", "curve25519-dalek", @@ -1179,9 +1179,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "21.1.2" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e04b96c8cf73c941ca134eefd00aa5085c4bcae5d534dd3937f4d69b401a838b" +checksum = "3e16b761459fdf3c4b62b24df3941498d14e5246e6fadfb4774ed8114d243aa4" dependencies = [ "itertools", "proc-macro2", @@ -1328,9 +1328,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "21.1.0" +version = "21.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec43c9c5ae7ec7b6ac9e263b6d5b9e3781aa05ba3a1c05f6e70701c5c6600665" +checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" dependencies = [ "arbitrary", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 982080a5e..86b823390 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,17 +24,17 @@ soroban-ledger-snapshot = { version = "21.1.1", path = "soroban-ledger-snapshot" soroban-token-sdk = { version = "21.1.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=21.1.2" +version = "=21.2.0" # git = "https://github.com/stellar/rs-soroban-env" # rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" [workspace.dependencies.soroban-env-guest] -version = "=21.1.2" +version = "=21.2.0" # git = "https://github.com/stellar/rs-soroban-env" # rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" [workspace.dependencies.soroban-env-host] -version = "=21.1.2" +version = "=21.2.0" # git = "https://github.com/stellar/rs-soroban-env" # rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" @@ -42,7 +42,7 @@ version = "=21.1.2" version = "=0.0.8" [workspace.dependencies.stellar-xdr] -version = "=21.1.0" +version = "=21.2.0" default-features = false features = ["curr"] # git = "https://github.com/stellar/rs-stellar-xdr" From 430917b05936a51d7201b00c4451f0da872668b7 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 16 Jul 2024 16:23:43 +1000 Subject: [PATCH 04/57] Fix client code gen to use efficient symbol (#1297) ### What Change the client generated code to use the efficient compile time const Symbol generation for contract invocation function names when the function names are small enough. ### Why The client is intended to be a zero-cost abstraction when compared with invoking a contract with `env.invoke_contract(cid, fn, args)`, but currently it is ~200 bytes more expensive in WASM size. This is because the generated client code is using runtime conversion from a &str to a Symbol for all symbols, even small ones that can be converted to a Symbol at compile time using const expressions. This change reduces the size of contracts using a single short symbol by ~200 bytes. Close #1290 --- soroban-sdk-macros/src/derive_client.rs | 13 +++++--- soroban-sdk-macros/src/lib.rs | 24 ++++----------- soroban-sdk-macros/src/symbol.rs | 40 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 soroban-sdk-macros/src/symbol.rs diff --git a/soroban-sdk-macros/src/derive_client.rs b/soroban-sdk-macros/src/derive_client.rs index 645437a7a..74c14fab8 100644 --- a/soroban-sdk-macros/src/derive_client.rs +++ b/soroban-sdk-macros/src/derive_client.rs @@ -1,8 +1,8 @@ use proc_macro2::TokenStream; use quote::{format_ident, quote}; -use syn::{Error, FnArg, Path, Type, TypePath, TypeReference}; +use syn::{Error, FnArg, LitStr, Path, Type, TypePath, TypeReference}; -use crate::syn_ext; +use crate::{symbol, syn_ext}; pub fn derive_client_type(crate_path: &Path, ty: &str, name: &str) -> TokenStream { let ty_str = quote!(#ty).to_string(); @@ -144,6 +144,11 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> let fn_ident = &f.ident; let fn_try_ident = format_ident!("try_{}", &f.ident); let fn_name = fn_ident.to_string(); + let fn_name_symbol = symbol::short_or_long( + crate_path, + quote!(&self.env), + &LitStr::new(&fn_name, fn_ident.span()), + ); // Check for the Env argument. let env_input = f.inputs.first().and_then(|a| match a { @@ -215,7 +220,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> use #crate_path::{IntoVal,FromVal}; let res = self.env.invoke_contract( &self.address, - &#crate_path::Symbol::new(&self.env, &#fn_name), + &#fn_name_symbol, #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], ); #[cfg(any(test, feature = "testutils"))] @@ -248,7 +253,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> use #crate_path::{IntoVal,FromVal}; let res = self.env.try_invoke_contract( &self.address, - &#crate_path::Symbol::new(&self.env, &#fn_name), + &#fn_name_symbol, #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], ); #[cfg(any(test, feature = "testutils"))] diff --git a/soroban-sdk-macros/src/lib.rs b/soroban-sdk-macros/src/lib.rs index 2dd411055..863d42b73 100644 --- a/soroban-sdk-macros/src/lib.rs +++ b/soroban-sdk-macros/src/lib.rs @@ -12,6 +12,7 @@ mod derive_struct_tuple; mod doc; mod map_type; mod path; +mod symbol; mod syn_ext; use derive_client::{derive_client_impl, derive_client_type}; @@ -40,8 +41,6 @@ use soroban_spec_rust::{generate_from_wasm, GenerateFromFileError}; use stellar_xdr::curr as stellar_xdr; use stellar_xdr::{Limits, ScMetaEntry, ScMetaV0, StringM, WriteXdr}; -use soroban_env_common::Symbol; - pub(crate) const DEFAULT_XDR_RW_LIMITS: Limits = Limits { depth: 500, len: 0x1000000, @@ -50,28 +49,15 @@ pub(crate) const DEFAULT_XDR_RW_LIMITS: Limits = Limits { #[proc_macro] pub fn internal_symbol_short(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as LitStr); - _symbol_short("crate", &input) + let crate_path: Path = syn::parse_str("crate").unwrap(); + symbol::short(&crate_path, &input).into() } #[proc_macro] pub fn symbol_short(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as LitStr); - _symbol_short("soroban_sdk", &input) -} - -fn _symbol_short(crate_path: &str, s: &LitStr) -> TokenStream { - let crate_path = format_ident!("{crate_path}"); - match Symbol::try_from_small_str(&s.value()) { - Ok(_) => quote! {{ - #[allow(deprecated)] - const SYMBOL: #crate_path::Symbol = #crate_path::Symbol::short(#s); - SYMBOL - }} - .into(), - Err(e) => Error::new(s.span(), format!("{e}")) - .to_compile_error() - .into(), - } + let crate_path: Path = syn::parse_str("soroban_sdk").unwrap(); + symbol::short(&crate_path, &input).into() } fn default_crate_path() -> Path { diff --git a/soroban-sdk-macros/src/symbol.rs b/soroban-sdk-macros/src/symbol.rs new file mode 100644 index 000000000..ae658451d --- /dev/null +++ b/soroban-sdk-macros/src/symbol.rs @@ -0,0 +1,40 @@ +use proc_macro2::TokenStream; +use quote::quote; +use syn::{Error, LitStr, Path}; + +use soroban_env_common::{Symbol, SymbolError}; + +/// Generates code that renders the Symbol as a compile-time const Symbol if +/// small enough, otherwise generates a compile error. +/// +/// Also generates a compile error if the string cannot be represented as a +/// Symbol. +pub fn short(crate_path: &Path, s: &LitStr) -> TokenStream { + match Symbol::try_from_small_str(&s.value()) { + Ok(_) => quote! {{ + #[allow(deprecated)] + const SYMBOL: #crate_path::Symbol = #crate_path::Symbol::short(#s); + SYMBOL + }}, + Err(e) => Error::new(s.span(), format!("{e}")).to_compile_error(), + } +} + +/// Generates code that renders the Symbol as a compile-time const Symbol if +/// small enough, otherwise as a Symbol::new construction. +/// +/// Also generates a compile error if the string cannot be represented as a +/// Symbol. +pub fn short_or_long(crate_path: &Path, env: TokenStream, s: &LitStr) -> TokenStream { + match Symbol::try_from_small_str(&s.value()) { + Ok(_) => quote! {{ + #[allow(deprecated)] + const SYMBOL: #crate_path::Symbol = #crate_path::Symbol::short(#s); + SYMBOL + }}, + Err(SymbolError::TooLong(_)) => quote! {{ + #crate_path::Symbol::new(#env, #s) + }}, + Err(e) => Error::new(s.span(), format!("{e}")).to_compile_error(), + } +} From 9c9185269841fc1370ac2f0d3f016d3d573878ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 16 Jul 2024 06:41:40 +0000 Subject: [PATCH 05/57] Bump version to 21.2.0 (#1300) ### What Bump version to 21.2.0, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/9951784866. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.2.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.2.0&title=21.2.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.2.0&title=21.2.0&target=release/v21.2.0 Co-authored-by: github-actions[bot] --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d12f31686..4a3d9259b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.1.1" +version = "21.2.0" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.1.1" +version = "21.2.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.1.1" +version = "21.2.0" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.1.1" +version = "21.2.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.1.1" +version = "21.2.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.1.1" +version = "21.2.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 86b823390..3470fd713 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.1.1" +version = "21.2.0" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.1.1", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.1.1", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.1.1", path = "soroban-spec" } -soroban-spec-rust = { version = "21.1.1", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.1.1", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.1.1", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.2.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.2.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.2.0", path = "soroban-spec" } +soroban-spec-rust = { version = "21.2.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.2.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.2.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.0" From 1f10e9a15f4e5914598cb0d1a36b1f094e0bbed7 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 17 Jul 2024 01:32:29 +1000 Subject: [PATCH 06/57] Document the accuracy of the ledger timestamp (#1289) ### What Document the accuracy of the ledger timestamp. ### Why It's important that the accuracy is known by developers relying on the timestamp for certain use cases. The update here is taken from a recent update in the Stellar docs and communicates the same. Related stellar/stellar-docs#509 Related stellar/stellar-docs#572 Close #1258 --- soroban-sdk/src/ledger.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/soroban-sdk/src/ledger.rs b/soroban-sdk/src/ledger.rs index f849220c9..a91801610 100644 --- a/soroban-sdk/src/ledger.rs +++ b/soroban-sdk/src/ledger.rs @@ -3,6 +3,9 @@ use crate::{env::internal, unwrap::UnwrapInfallible, BytesN, Env, TryIntoVal}; /// Ledger retrieves information about the current ledger. /// +/// For more details about the ledger and the ledger header that the values in the Ledger are derived from, see: +/// - https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers +/// /// ### Examples /// /// ``` @@ -75,9 +78,12 @@ impl Ledger { /// Returns a unix timestamp for when the ledger was closed. /// - /// The timestamp is the number of seconds, excluding leap seconds, - /// that have elapsed since unix epoch. Unix epoch is January 1st, 1970, - /// at 00:00:00 UTC. + /// The timestamp is the number of seconds, excluding leap seconds, that + /// have elapsed since unix epoch. Unix epoch is January 1st, 1970, at + /// 00:00:00 UTC. + /// + /// For more details see: + /// - https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers#close-time pub fn timestamp(&self) -> u64 { internal::Env::get_ledger_timestamp(self.env()) .unwrap_infallible() From cd541d059e14ca7e12b1309aa2e4f705f69c8ce5 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 18 Jul 2024 16:31:24 +1000 Subject: [PATCH 07/57] Keep testutils on/off state internal to the sdk (#1301) ### What Change how testutils code is generated to make it rely only on the state of the SDK testutils feature, and not influenced at all by the contract crate's feature set or test cfg. Today the SDK macros generate both non-testutils and testutils code and it is up to the contract crate to enable or disable it. With this change the SDK macros only generate testutils code if the SDK is compiled with testutils. ### Why Today both the SDK and the contract crate must be configured with the testutils feature (or the test cfg) to enable the testutils that are generated by the SDK macros. The SDK has a testutils feature that enables the testutils functions and types in the SDK. The contract crate generated code also has code behind a testutils feature, and the contract crate testutils feature (or test cfg) must be enabled for them to function as well. This largely works, but it results in an oddity in more complex workspace setups that you can be using a testutils SDK with a non-testutils compiled contract crate meaning that none of the types or functions in that crate can be used with testutils functions. This largely goes unnoticed because it is a bit of an edge case and definitely not apparent in simpler setups. Even larger setups may never notice this as an oddity if they always happen to configure their crates appropriately. This also goes unnoticed because when the test cfg is enabled (when building for tests) we also enable all that testutils generated code. This issue has become more apparent to me lately because I'm experimenting with Soroban contracts inside Jupyter notebooks, as one way that folks can experiment and learn Soroban. The Rust runtime kernel for Jupyter notebooks doesn't currently support enable features for code in the notebook so I end up with an odd situation where testutils are enabled in the SDK, but not in the contract. After looking at how to solve this problem it occurred to me that the way we implemented the generated testutils code is not ideal, even independent of this problem. Instead of implementing the generated code so it contains a new testutils feature for the contract crate, we should have made all the generated testutils code enabled/disabled based on the SDKs feature flag. The advantage of this is that in any workspace whenever you have testutils enabled on the SDK, all contracts will also have testutils enabled. Instead of having many levers to pull to get testutils enabled, there is just one. ### Reviewing I recommend reviewing with whitespace changes disabled, because a large portion of the diff is the change to indents when some code was moved inside if..else statements. ### Merging This change _should_ be practically non-breaking. While technically it is removing code from being generated when compiled with an SDK without testutils enabled, most of the testutils code in generated code would be unusable without it anyway. It might be warranted to hold this change until v22, just for the purpose of shipping it in a preview / rc and getting feedback before committing to it. But I think the change is also pretty straightforward and low risk. I'd like to merge this in a minor release, but it warrants some discussion. --- soroban-sdk-macros/src/arbitrary.rs | 4 - soroban-sdk-macros/src/derive_client.rs | 353 ++++++++++-------- soroban-sdk-macros/src/derive_enum.rs | 121 +++--- soroban-sdk-macros/src/derive_enum_int.rs | 65 ++-- soroban-sdk-macros/src/derive_fn.rs | 1 - soroban-sdk-macros/src/derive_struct.rs | 121 +++--- soroban-sdk-macros/src/derive_struct_tuple.rs | 120 +++--- soroban-sdk-macros/src/lib.rs | 70 ++-- 8 files changed, 440 insertions(+), 415 deletions(-) diff --git a/soroban-sdk-macros/src/arbitrary.rs b/soroban-sdk-macros/src/arbitrary.rs index 5369f0d7d..07044aba7 100644 --- a/soroban-sdk-macros/src/arbitrary.rs +++ b/soroban-sdk-macros/src/arbitrary.rs @@ -312,15 +312,11 @@ fn quote_arbitrary( arbitrary_type_decl: TokenStream2, arbitrary_ctor: TokenStream2, ) -> TokenStream2 { - if !cfg!(any(test, feature = "testutils")) { - return quote!(); - } quote! { // This allows us to create a scope to import std and arbitrary, while // also keeping everything from the current scope. This is better than a // module because: modules inside functions have surprisingly // inconsistent scoping rules and visibility management is harder. - #[cfg(any(test, feature = "testutils"))] const _: () = { // derive(Arbitrary) expects these two to be in scope use #path::testutils::arbitrary::std; diff --git a/soroban-sdk-macros/src/derive_client.rs b/soroban-sdk-macros/src/derive_client.rs index 74c14fab8..07a0504e1 100644 --- a/soroban-sdk-macros/src/derive_client.rs +++ b/soroban-sdk-macros/src/derive_client.rs @@ -9,119 +9,124 @@ pub fn derive_client_type(crate_path: &Path, ty: &str, name: &str) -> TokenStrea // Render the Client. let client_doc = format!("{name} is a client for calling the contract defined in {ty_str}."); let client_ident = format_ident!("{}", name); - quote! { - #[doc = #client_doc] - pub struct #client_ident<'a> { - pub env: #crate_path::Env, - pub address: #crate_path::Address, - #[doc(hidden)] - #[cfg(not(any(test, feature = "testutils")))] - _phantom: core::marker::PhantomData<&'a ()>, - #[doc(hidden)] - #[cfg(any(test, feature = "testutils"))] - set_auths: Option<&'a [#crate_path::xdr::SorobanAuthorizationEntry]>, - #[doc(hidden)] - #[cfg(any(test, feature = "testutils"))] - mock_auths: Option<&'a [#crate_path::testutils::MockAuth<'a>]>, - #[doc(hidden)] - #[cfg(any(test, feature = "testutils"))] - mock_all_auths: bool, - #[doc(hidden)] - #[cfg(any(test, feature = "testutils"))] - allow_non_root_auth: bool, - } + if cfg!(not(feature = "testutils")) { + quote! { + #[doc = #client_doc] + pub struct #client_ident<'a> { + pub env: #crate_path::Env, + pub address: #crate_path::Address, + #[doc(hidden)] + _phantom: core::marker::PhantomData<&'a ()>, + } - impl<'a> #client_ident<'a> { - pub fn new(env: &#crate_path::Env, address: &#crate_path::Address) -> Self { - Self { - env: env.clone(), - address: address.clone(), - #[cfg(not(any(test, feature = "testutils")))] - _phantom: core::marker::PhantomData, - #[cfg(any(test, feature = "testutils"))] - set_auths: None, - #[cfg(any(test, feature = "testutils"))] - mock_auths: None, - #[cfg(any(test, feature = "testutils"))] - mock_all_auths: false, - #[cfg(any(test, feature = "testutils"))] - allow_non_root_auth: false, + impl<'a> #client_ident<'a> { + pub fn new(env: &#crate_path::Env, address: &#crate_path::Address) -> Self { + Self { + env: env.clone(), + address: address.clone(), + _phantom: core::marker::PhantomData, + } } } + } + } else { + quote! { + #[doc = #client_doc] + pub struct #client_ident<'a> { + pub env: #crate_path::Env, + pub address: #crate_path::Address, + #[doc(hidden)] + set_auths: Option<&'a [#crate_path::xdr::SorobanAuthorizationEntry]>, + #[doc(hidden)] + mock_auths: Option<&'a [#crate_path::testutils::MockAuth<'a>]>, + #[doc(hidden)] + mock_all_auths: bool, + #[doc(hidden)] + allow_non_root_auth: bool, + } - /// Set authorizations in the environment which will be consumed by - /// contracts when they invoke `Address::require_auth` or - /// `Address::require_auth_for_args` functions. - /// - /// Requires valid signatures for the authorization to be successful. - /// To mock auth without requiring valid signatures, use `mock_auths`. - /// - /// See `soroban_sdk::Env::set_auths` for more details and examples. - #[cfg(any(test, feature = "testutils"))] - pub fn set_auths(&self, auths: &'a [#crate_path::xdr::SorobanAuthorizationEntry]) -> Self { - Self { - env: self.env.clone(), - address: self.address.clone(), - set_auths: Some(auths), - mock_auths: self.mock_auths.clone(), - mock_all_auths: false, - allow_non_root_auth: false, + impl<'a> #client_ident<'a> { + pub fn new(env: &#crate_path::Env, address: &#crate_path::Address) -> Self { + Self { + env: env.clone(), + address: address.clone(), + set_auths: None, + mock_auths: None, + mock_all_auths: false, + allow_non_root_auth: false, + } } - } - /// Mock authorizations in the environment which will cause matching invokes - /// of `Address::require_auth` and `Address::require_auth_for_args` to - /// pass. - /// - /// See `soroban_sdk::Env::set_auths` for more details and examples. - #[cfg(any(test, feature = "testutils"))] - pub fn mock_auths(&self, mock_auths: &'a [#crate_path::testutils::MockAuth<'a>]) -> Self { - Self { - env: self.env.clone(), - address: self.address.clone(), - set_auths: self.set_auths.clone(), - mock_auths: Some(mock_auths), - mock_all_auths: false, - allow_non_root_auth: false, + /// Set authorizations in the environment which will be consumed by + /// contracts when they invoke `Address::require_auth` or + /// `Address::require_auth_for_args` functions. + /// + /// Requires valid signatures for the authorization to be successful. + /// To mock auth without requiring valid signatures, use `mock_auths`. + /// + /// See `soroban_sdk::Env::set_auths` for more details and examples. + pub fn set_auths(&self, auths: &'a [#crate_path::xdr::SorobanAuthorizationEntry]) -> Self { + Self { + env: self.env.clone(), + address: self.address.clone(), + set_auths: Some(auths), + mock_auths: self.mock_auths.clone(), + mock_all_auths: false, + allow_non_root_auth: false, + } } - } - /// Mock all calls to the `Address::require_auth` and - /// `Address::require_auth_for_args` functions in invoked contracts, - /// having them succeed as if authorization was provided. - /// - /// See `soroban_sdk::Env::mock_all_auths` for more details and - /// examples. - #[cfg(any(test, feature = "testutils"))] - pub fn mock_all_auths(&self) -> Self { - Self { - env: self.env.clone(), - address: self.address.clone(), - set_auths: None, - mock_auths: None, - mock_all_auths: true, - allow_non_root_auth: false, + /// Mock authorizations in the environment which will cause matching invokes + /// of `Address::require_auth` and `Address::require_auth_for_args` to + /// pass. + /// + /// See `soroban_sdk::Env::set_auths` for more details and examples. + pub fn mock_auths(&self, mock_auths: &'a [#crate_path::testutils::MockAuth<'a>]) -> Self { + Self { + env: self.env.clone(), + address: self.address.clone(), + set_auths: self.set_auths.clone(), + mock_auths: Some(mock_auths), + mock_all_auths: false, + allow_non_root_auth: false, + } } - } - /// A version of `mock_all_auths` that allows authorizations that - /// are not present in the root invocation. - /// - /// Refer to `mock_all_auths` documentation for details and - /// prefer using `mock_all_auths` unless non-root authorization is - /// required. - /// - /// See `soroban_sdk::Env::mock_all_auths_allowing_non_root_auth` - /// for more details and examples. - #[cfg(any(test, feature = "testutils"))] - pub fn mock_all_auths_allowing_non_root_auth(&self) -> Self { - Self { - env: self.env.clone(), - address: self.address.clone(), - set_auths: None, - mock_auths: None, - mock_all_auths: true, - allow_non_root_auth: true, + /// Mock all calls to the `Address::require_auth` and + /// `Address::require_auth_for_args` functions in invoked contracts, + /// having them succeed as if authorization was provided. + /// + /// See `soroban_sdk::Env::mock_all_auths` for more details and + /// examples. + pub fn mock_all_auths(&self) -> Self { + Self { + env: self.env.clone(), + address: self.address.clone(), + set_auths: None, + mock_auths: None, + mock_all_auths: true, + allow_non_root_auth: false, + } + } + + /// A version of `mock_all_auths` that allows authorizations that + /// are not present in the root invocation. + /// + /// Refer to `mock_all_auths` documentation for details and + /// prefer using `mock_all_auths` unless non-root authorization is + /// required. + /// + /// See `soroban_sdk::Env::mock_all_auths_allowing_non_root_auth` + /// for more details and examples. + pub fn mock_all_auths_allowing_non_root_auth(&self) -> Self { + Self { + env: self.env.clone(), + address: self.address.clone(), + set_auths: None, + mock_auths: None, + mock_all_auths: true, + allow_non_root_auth: true, + } } } } @@ -193,74 +198,94 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> let fn_output = f.output(); let fn_try_output = f.try_output(crate_path); let fn_attrs = f.attrs; - quote! { - #(#fn_attrs)* - pub fn #fn_ident(&self, #(#fn_input_types),*) -> #fn_output { - use core::ops::Not; - #[cfg(any(test, feature = "testutils"))] - let old_auth_manager = self.env.in_contract().not().then(|| - self.env.host().snapshot_auth_manager().unwrap() - ); - #[cfg(any(test, feature = "testutils"))] - { - if let Some(set_auths) = self.set_auths { - self.env.set_auths(set_auths); - } - if let Some(mock_auths) = self.mock_auths { - self.env.mock_auths(mock_auths); - } - if self.mock_all_auths { - if self.allow_non_root_auth { - self.env.mock_all_auths_allowing_non_root_auth(); - } else { - self.env.mock_all_auths(); - } - } + if cfg!(not(feature = "testutils")) { + quote! { + #(#fn_attrs)* + pub fn #fn_ident(&self, #(#fn_input_types),*) -> #fn_output { + use core::ops::Not; + use #crate_path::{IntoVal,FromVal}; + let res = self.env.invoke_contract( + &self.address, + &#fn_name_symbol, + #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], + ); + res } - use #crate_path::{IntoVal,FromVal}; - let res = self.env.invoke_contract( - &self.address, - &#fn_name_symbol, - #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], - ); - #[cfg(any(test, feature = "testutils"))] - if let Some(old_auth_manager) = old_auth_manager { - self.env.host().set_auth_manager(old_auth_manager).unwrap(); + + #(#fn_attrs)* + pub fn #fn_try_ident(&self, #(#fn_input_types),*) -> #fn_try_output { + use #crate_path::{IntoVal,FromVal}; + let res = self.env.try_invoke_contract( + &self.address, + &#fn_name_symbol, + #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], + ); + res } - res } - - #(#fn_attrs)* - pub fn #fn_try_ident(&self, #(#fn_input_types),*) -> #fn_try_output { - #[cfg(any(test, feature = "testutils"))] - use core::ops::Not; - #[cfg(any(test, feature = "testutils"))] - let old_auth_manager = self.env.in_contract().not().then(|| - self.env.host().snapshot_auth_manager().unwrap() - ); - #[cfg(any(test, feature = "testutils"))] - { - if let Some(set_auths) = self.set_auths { - self.env.set_auths(set_auths); - } - if let Some(mock_auths) = self.mock_auths { - self.env.mock_auths(mock_auths); + } else { + quote! { + #(#fn_attrs)* + pub fn #fn_ident(&self, #(#fn_input_types),*) -> #fn_output { + use core::ops::Not; + let old_auth_manager = self.env.in_contract().not().then(|| + self.env.host().snapshot_auth_manager().unwrap() + ); + { + if let Some(set_auths) = self.set_auths { + self.env.set_auths(set_auths); + } + if let Some(mock_auths) = self.mock_auths { + self.env.mock_auths(mock_auths); + } + if self.mock_all_auths { + if self.allow_non_root_auth { + self.env.mock_all_auths_allowing_non_root_auth(); + } else { + self.env.mock_all_auths(); + } + } } - if self.mock_all_auths { - self.env.mock_all_auths(); + use #crate_path::{IntoVal,FromVal}; + let res = self.env.invoke_contract( + &self.address, + &#fn_name_symbol, + #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], + ); + if let Some(old_auth_manager) = old_auth_manager { + self.env.host().set_auth_manager(old_auth_manager).unwrap(); } + res } - use #crate_path::{IntoVal,FromVal}; - let res = self.env.try_invoke_contract( - &self.address, - &#fn_name_symbol, - #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], - ); - #[cfg(any(test, feature = "testutils"))] - if let Some(old_auth_manager) = old_auth_manager { - self.env.host().set_auth_manager(old_auth_manager).unwrap(); + + #(#fn_attrs)* + pub fn #fn_try_ident(&self, #(#fn_input_types),*) -> #fn_try_output { + use core::ops::Not; + let old_auth_manager = self.env.in_contract().not().then(|| + self.env.host().snapshot_auth_manager().unwrap() + ); + { + if let Some(set_auths) = self.set_auths { + self.env.set_auths(set_auths); + } + if let Some(mock_auths) = self.mock_auths { + self.env.mock_auths(mock_auths); + } + if self.mock_all_auths { + self.env.mock_all_auths(); + } + } + use #crate_path::{IntoVal,FromVal}; + let res = self.env.try_invoke_contract( + &self.address, + &#fn_name_symbol, + #crate_path::vec![&self.env, #(#fn_input_names.into_val(&self.env)),*], + ); + if let Some(old_auth_manager) = old_auth_manager { + self.env.host().set_auth_manager(old_auth_manager).unwrap(); + } + res } - res } } }) diff --git a/soroban-sdk-macros/src/derive_enum.rs b/soroban-sdk-macros/src/derive_enum.rs index 5222a43a4..5f4b8f50e 100644 --- a/soroban-sdk-macros/src/derive_enum.rs +++ b/soroban-sdk-macros/src/derive_enum.rs @@ -162,10 +162,8 @@ pub fn derive_type_enum( None }; - let arbitrary_tokens = crate::arbitrary::derive_arbitrary_enum(path, vis, enum_ident, data); - // Output. - quote! { + let mut output = quote! { #spec_gen impl #path::TryFromVal<#path::Env, #path::Val> for #enum_ident { @@ -194,81 +192,82 @@ pub fn derive_type_enum( } } } + }; - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScVec> for #enum_ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVec) -> Result { - use #path::xdr::Validate; - use #path::TryIntoVal; + // Additional output when testutils are enabled. + if cfg!(feature = "testutils") { + let arbitrary_tokens = crate::arbitrary::derive_arbitrary_enum(path, vis, enum_ident, data); + output.extend(quote! { + impl #path::TryFromVal<#path::Env, #path::xdr::ScVec> for #enum_ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVec) -> Result { + use #path::xdr::Validate; + use #path::TryIntoVal; - let vec = val; - let mut iter = vec.iter(); - let discriminant: #path::xdr::ScSymbol = iter.next().ok_or(#path::xdr::Error::Invalid)?.clone().try_into().map_err(|_| #path::xdr::Error::Invalid)?; - let discriminant_name: &str = &discriminant.to_utf8_string()?; + let vec = val; + let mut iter = vec.iter(); + let discriminant: #path::xdr::ScSymbol = iter.next().ok_or(#path::xdr::Error::Invalid)?.clone().try_into().map_err(|_| #path::xdr::Error::Invalid)?; + let discriminant_name: &str = &discriminant.to_utf8_string()?; - Ok(match discriminant_name { - #(#try_from_xdrs,)* - _ => Err(#path::xdr::Error::Invalid)?, - }) + Ok(match discriminant_name { + #(#try_from_xdrs,)* + _ => Err(#path::xdr::Error::Invalid)?, + }) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #enum_ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { - if let #path::xdr::ScVal::Vec(Some(vec)) = val { - <_ as #path::TryFromVal<_, _>>::try_from_val(env, vec) - } else { - Err(#path::xdr::Error::Invalid) + impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #enum_ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { + if let #path::xdr::ScVal::Vec(Some(vec)) = val { + <_ as #path::TryFromVal<_, _>>::try_from_val(env, vec) + } else { + Err(#path::xdr::Error::Invalid) + } } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<&#enum_ident> for #path::xdr::ScVec { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: &#enum_ident) -> Result { - extern crate alloc; - Ok(match val { - #(#into_xdrs,)* - }) + impl TryFrom<&#enum_ident> for #path::xdr::ScVec { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: &#enum_ident) -> Result { + extern crate alloc; + Ok(match val { + #(#into_xdrs,)* + }) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<#enum_ident> for #path::xdr::ScVec { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: #enum_ident) -> Result { - (&val).try_into() + impl TryFrom<#enum_ident> for #path::xdr::ScVec { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: #enum_ident) -> Result { + (&val).try_into() + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<&#enum_ident> for #path::xdr::ScVal { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: &#enum_ident) -> Result { - Ok(#path::xdr::ScVal::Vec(Some(val.try_into()?))) + impl TryFrom<&#enum_ident> for #path::xdr::ScVal { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: &#enum_ident) -> Result { + Ok(#path::xdr::ScVal::Vec(Some(val.try_into()?))) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<#enum_ident> for #path::xdr::ScVal { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: #enum_ident) -> Result { - (&val).try_into() + impl TryFrom<#enum_ident> for #path::xdr::ScVal { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: #enum_ident) -> Result { + (&val).try_into() + } } - } - #arbitrary_tokens + #arbitrary_tokens + }); } + output } struct VariantTokens { diff --git a/soroban-sdk-macros/src/derive_enum_int.rs b/soroban-sdk-macros/src/derive_enum_int.rs index 6eaf4ec27..6cc326c16 100644 --- a/soroban-sdk-macros/src/derive_enum_int.rs +++ b/soroban-sdk-macros/src/derive_enum_int.rs @@ -91,10 +91,8 @@ pub fn derive_type_enum_int( None }; - let arbitrary_tokens = crate::arbitrary::derive_arbitrary_enum_int(path, vis, enum_ident, data); - // Output. - quote! { + let mut output = quote! { #spec_gen const _: () = { fn assert_copy(v: #enum_ident) -> impl Copy { v } }; @@ -120,41 +118,46 @@ pub fn derive_type_enum_int( }) } } + }; - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #enum_ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { - if let #path::xdr::ScVal::U32(discriminant) = val { - Ok(match *discriminant { - #(#try_froms,)* - _ => Err(#path::xdr::Error::Invalid)?, - }) - } else { - Err(#path::xdr::Error::Invalid) + // Additional output when testutils are enabled. + if cfg!(feature = "testutils") { + let arbitrary_tokens = + crate::arbitrary::derive_arbitrary_enum_int(path, vis, enum_ident, data); + output.extend(quote! { + impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #enum_ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { + if let #path::xdr::ScVal::U32(discriminant) = val { + Ok(match *discriminant { + #(#try_froms,)* + _ => Err(#path::xdr::Error::Invalid)?, + }) + } else { + Err(#path::xdr::Error::Invalid) + } } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryInto<#path::xdr::ScVal> for &#enum_ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_into(self) -> Result<#path::xdr::ScVal, #path::xdr::Error> { - Ok((*self as u32).into()) + impl TryInto<#path::xdr::ScVal> for &#enum_ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_into(self) -> Result<#path::xdr::ScVal, #path::xdr::Error> { + Ok((*self as u32).into()) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryInto<#path::xdr::ScVal> for #enum_ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_into(self) -> Result<#path::xdr::ScVal, #path::xdr::Error> { - Ok((self as u32).into()) + impl TryInto<#path::xdr::ScVal> for #enum_ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_into(self) -> Result<#path::xdr::ScVal, #path::xdr::Error> { + Ok((self as u32).into()) + } } - } - #arbitrary_tokens + #arbitrary_tokens + }); } + output } diff --git a/soroban-sdk-macros/src/derive_fn.rs b/soroban-sdk-macros/src/derive_fn.rs index 8b347892f..168d8b0fc 100644 --- a/soroban-sdk-macros/src/derive_fn.rs +++ b/soroban-sdk-macros/src/derive_fn.rs @@ -181,7 +181,6 @@ pub fn derive_contract_function_registration_ctor<'a>( let ctor_ident = format_ident!("__{ty_str}_{trait_str}_{methods_hash}_ctor"); quote! { - #[cfg(any(test, feature = "testutils"))] #[doc(hidden)] #[#crate_path::reexports_for_macros::ctor::ctor] fn #ctor_ident() { diff --git a/soroban-sdk-macros/src/derive_struct.rs b/soroban-sdk-macros/src/derive_struct.rs index c50e9ed76..729a57022 100644 --- a/soroban-sdk-macros/src/derive_struct.rs +++ b/soroban-sdk-macros/src/derive_struct.rs @@ -100,10 +100,8 @@ pub fn derive_type_struct( None }; - let arbitrary_tokens = crate::arbitrary::derive_arbitrary_struct(path, vis, ident, data); - // Output. - quote! { + let mut output = quote! { #spec_gen impl #path::TryFromVal<#path::Env, #path::Val> for #ident { @@ -131,78 +129,79 @@ pub fn derive_type_struct( Ok(env.map_new_from_slices(&KEYS, &vals).map_err(|_| ConversionError)?.into()) } } + }; - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScMap> for #ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScMap) -> Result { - use #path::xdr::Validate; - use #path::TryIntoVal; - let map = val; - if map.len() != #field_count_usize { - return Err(#path::xdr::Error::Invalid); + // Additional output when testutils are enabled. + if cfg!(feature = "testutils") { + let arbitrary_tokens = crate::arbitrary::derive_arbitrary_struct(path, vis, ident, data); + output.extend(quote!{ + impl #path::TryFromVal<#path::Env, #path::xdr::ScMap> for #ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScMap) -> Result { + use #path::xdr::Validate; + use #path::TryIntoVal; + let map = val; + if map.len() != #field_count_usize { + return Err(#path::xdr::Error::Invalid); + } + map.validate()?; + Ok(Self{ + #(#try_from_xdrs,)* + }) } - map.validate()?; - Ok(Self{ - #(#try_from_xdrs,)* - }) } - } - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { - if let #path::xdr::ScVal::Map(Some(map)) = val { - <_ as #path::TryFromVal<_, _>>::try_from_val(env, map) - } else { - Err(#path::xdr::Error::Invalid) + impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { + if let #path::xdr::ScVal::Map(Some(map)) = val { + <_ as #path::TryFromVal<_, _>>::try_from_val(env, map) + } else { + Err(#path::xdr::Error::Invalid) + } } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<&#ident> for #path::xdr::ScMap { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: &#ident) -> Result { - extern crate alloc; - use #path::TryFromVal; - #path::xdr::ScMap::sorted_from(alloc::vec![ - #(#try_into_xdrs,)* - ]) + impl TryFrom<&#ident> for #path::xdr::ScMap { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: &#ident) -> Result { + extern crate alloc; + use #path::TryFromVal; + #path::xdr::ScMap::sorted_from(alloc::vec![ + #(#try_into_xdrs,)* + ]) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<#ident> for #path::xdr::ScMap { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: #ident) -> Result { - (&val).try_into() + impl TryFrom<#ident> for #path::xdr::ScMap { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: #ident) -> Result { + (&val).try_into() + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<&#ident> for #path::xdr::ScVal { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: &#ident) -> Result { - Ok(#path::xdr::ScVal::Map(Some(val.try_into()?))) + impl TryFrom<&#ident> for #path::xdr::ScVal { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: &#ident) -> Result { + Ok(#path::xdr::ScVal::Map(Some(val.try_into()?))) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<#ident> for #path::xdr::ScVal { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: #ident) -> Result { - (&val).try_into() + impl TryFrom<#ident> for #path::xdr::ScVal { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: #ident) -> Result { + (&val).try_into() + } } - } - #arbitrary_tokens + #arbitrary_tokens + }); } + output } diff --git a/soroban-sdk-macros/src/derive_struct_tuple.rs b/soroban-sdk-macros/src/derive_struct_tuple.rs index ee0e5a604..cdfcbc137 100644 --- a/soroban-sdk-macros/src/derive_struct_tuple.rs +++ b/soroban-sdk-macros/src/derive_struct_tuple.rs @@ -89,10 +89,8 @@ pub fn derive_type_struct_tuple( None }; - let arbitrary_tokens = crate::arbitrary::derive_arbitrary_struct_tuple(path, vis, ident, data); - // Output. - quote! { + let mut output = quote! { #spec_gen impl #path::TryFromVal<#path::Env, #path::Val> for #ident { @@ -120,77 +118,79 @@ pub fn derive_type_struct_tuple( Ok(env.vec_new_from_slice(&vals).map_err(|_| ConversionError)?.into()) } } + }; - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScVec> for #ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVec) -> Result { - use #path::xdr::Validate; - use #path::TryIntoVal; - let vec = val; - if vec.len() != #field_count_usize { - return Err(#path::xdr::Error::Invalid); + // Additional output when testutils are enabled. + if cfg!(feature = "testutils") { + let arbitrary_tokens = + crate::arbitrary::derive_arbitrary_struct_tuple(path, vis, ident, data); + output.extend(quote! { + impl #path::TryFromVal<#path::Env, #path::xdr::ScVec> for #ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVec) -> Result { + use #path::xdr::Validate; + use #path::TryIntoVal; + let vec = val; + if vec.len() != #field_count_usize { + return Err(#path::xdr::Error::Invalid); + } + Ok(Self{ + #(#try_from_xdrs,)* + }) } - Ok(Self{ - #(#try_from_xdrs,)* - }) } - } - #[cfg(any(test, feature = "testutils"))] - impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #ident { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { - if let #path::xdr::ScVal::Vec(Some(vec)) = val { - <_ as #path::TryFromVal<_, _>>::try_from_val(env, vec) - } else { - Err(#path::xdr::Error::Invalid) + impl #path::TryFromVal<#path::Env, #path::xdr::ScVal> for #ident { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from_val(env: &#path::Env, val: &#path::xdr::ScVal) -> Result { + if let #path::xdr::ScVal::Vec(Some(vec)) = val { + <_ as #path::TryFromVal<_, _>>::try_from_val(env, vec) + } else { + Err(#path::xdr::Error::Invalid) + } } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<&#ident> for #path::xdr::ScVec { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: &#ident) -> Result { - extern crate alloc; - use #path::TryFromVal; - Ok(#path::xdr::ScVec(alloc::vec![ - #(#try_into_xdrs,)* - ].try_into()?)) + impl TryFrom<&#ident> for #path::xdr::ScVec { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: &#ident) -> Result { + extern crate alloc; + use #path::TryFromVal; + Ok(#path::xdr::ScVec(alloc::vec![ + #(#try_into_xdrs,)* + ].try_into()?)) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<#ident> for #path::xdr::ScVec { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: #ident) -> Result { - (&val).try_into() + impl TryFrom<#ident> for #path::xdr::ScVec { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: #ident) -> Result { + (&val).try_into() + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<&#ident> for #path::xdr::ScVal { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: &#ident) -> Result { - Ok(#path::xdr::ScVal::Vec(Some(val.try_into()?))) + impl TryFrom<&#ident> for #path::xdr::ScVal { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: &#ident) -> Result { + Ok(#path::xdr::ScVal::Vec(Some(val.try_into()?))) + } } - } - #[cfg(any(test, feature = "testutils"))] - impl TryFrom<#ident> for #path::xdr::ScVal { - type Error = #path::xdr::Error; - #[inline(always)] - fn try_from(val: #ident) -> Result { - (&val).try_into() + impl TryFrom<#ident> for #path::xdr::ScVal { + type Error = #path::xdr::Error; + #[inline(always)] + fn try_from(val: #ident) -> Result { + (&val).try_into() + } } - } - #arbitrary_tokens + #arbitrary_tokens + }); } + output } diff --git a/soroban-sdk-macros/src/lib.rs b/soroban-sdk-macros/src/lib.rs index 863d42b73..daae39714 100644 --- a/soroban-sdk-macros/src/lib.rs +++ b/soroban-sdk-macros/src/lib.rs @@ -137,40 +137,42 @@ pub fn contract(metadata: TokenStream, input: TokenStream) -> TokenStream { let fn_set_registry_ident = format_ident!("__{ty_str}_fn_set_registry"); let crate_path = &args.crate_path; let client = derive_client_type(&args.crate_path, &ty_str, &client_ident); - quote! { + let mut output = quote! { #input2 #client + }; + if cfg!(feature = "testutils") { + output.extend(quote! { + mod #fn_set_registry_ident { + use super::*; - #[cfg(any(test, feature = "testutils"))] - mod #fn_set_registry_ident { - use super::*; + extern crate std; + use std::sync::Mutex; + use std::collections::BTreeMap; - extern crate std; - use std::sync::Mutex; - use std::collections::BTreeMap; + type F = dyn Send + Sync + Fn(#crate_path::Env, &[#crate_path::Val]) -> #crate_path::Val; - type F = dyn Send + Sync + Fn(#crate_path::Env, &[#crate_path::Val]) -> #crate_path::Val; + static FUNCS: Mutex> = Mutex::new(BTreeMap::new()); - static FUNCS: Mutex> = Mutex::new(BTreeMap::new()); + pub(crate) fn register(name: &'static str, func: &'static F) { + FUNCS.lock().unwrap().insert(name, func); + } - pub(crate) fn register(name: &'static str, func: &'static F) { - FUNCS.lock().unwrap().insert(name, func); + pub(crate) fn call(name: &str, env: #crate_path::Env, args: &[#crate_path::Val]) -> Option<#crate_path::Val> { + let fopt: Option<&'static F> = FUNCS.lock().unwrap().get(name).map(|f| f.clone()); + fopt.map(|f| f(env, args)) + } } - pub(crate) fn call(name: &str, env: #crate_path::Env, args: &[#crate_path::Val]) -> Option<#crate_path::Val> { - let fopt: Option<&'static F> = FUNCS.lock().unwrap().get(name).map(|f| f.clone()); - fopt.map(|f| f(env, args)) - } - } - - #[cfg(any(test, feature = "testutils"))] - #[doc(hidden)] - impl #crate_path::testutils::ContractFunctionSet for #ty { - fn call(&self, func: &str, env: #crate_path::Env, args: &[#crate_path::Val]) -> Option<#crate_path::Val> { - #fn_set_registry_ident::call(func, env, args) + #[doc(hidden)] + impl #crate_path::testutils::ContractFunctionSet for #ty { + fn call(&self, func: &str, env: #crate_path::Env, args: &[#crate_path::Val]) -> Option<#crate_path::Val> { + #fn_set_registry_ident::call(func, env, args) + } } - } - }.into() + }); + } + output.into() } #[derive(Debug, FromMeta)] @@ -231,20 +233,22 @@ pub fn contractimpl(metadata: TokenStream, input: TokenStream) -> TokenStream { match derived { Ok(derived_ok) => { - let cfs = derive_contract_function_registration_ctor( - crate_path, - ty, - trait_ident, - pub_methods.into_iter(), - ); - quote! { + let mut output = quote! { #[#crate_path::contractclient(crate_path = #crate_path_str, name = #client_ident, impl_only = true)] #[#crate_path::contractspecfn(name = #ty_str)] #imp #derived_ok - #cfs + }; + if cfg!(feature = "testutils") { + let cfs = derive_contract_function_registration_ctor( + crate_path, + ty, + trait_ident, + pub_methods.into_iter(), + ); + output.extend(quote! { #cfs }); } - .into() + output.into() } Err(derived_err) => quote! { #imp From ee516d12da734cc9ec2f303ce98bd24731c696f8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 18 Jul 2024 07:10:29 +0000 Subject: [PATCH 08/57] Bump version to 21.3.0 (#1303) ### What Bump version to 21.3.0, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/9986879237. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.3.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.3.0&title=21.3.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.3.0&title=21.3.0&target=release/v21.3.0 Co-authored-by: github-actions[bot] --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4a3d9259b..ec7d429a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.2.0" +version = "21.3.0" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.2.0" +version = "21.3.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.2.0" +version = "21.3.0" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.2.0" +version = "21.3.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.2.0" +version = "21.3.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.2.0" +version = "21.3.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 3470fd713..88916133a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.2.0" +version = "21.3.0" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.2.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.2.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.2.0", path = "soroban-spec" } -soroban-spec-rust = { version = "21.2.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.2.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.2.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.3.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.3.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.3.0", path = "soroban-spec" } +soroban-spec-rust = { version = "21.3.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.3.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.3.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.0" From f08c56046a39eb135fc2ef4d16ec2777599d0b12 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 24 Jul 2024 01:24:02 +1000 Subject: [PATCH 09/57] Fix Hash<> not cloneable (#1302) ### What Implement Clone for the Hash<> type introduced in v21. ### Why The BytesN<> type implements Clone, and the Hash<> type was added to replace BytesN<> in certain situations. It is harder to upgrade code in the wild that was written using BytesN<> because Hash<> isn't cloneable. Hash<> can be cloned, there's no reason to keep it. The type is also marked as transparent same as BytesN<> in this change. --- soroban-sdk/src/crypto.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/soroban-sdk/src/crypto.rs b/soroban-sdk/src/crypto.rs index e4f58add2..192912d33 100644 --- a/soroban-sdk/src/crypto.rs +++ b/soroban-sdk/src/crypto.rs @@ -18,6 +18,8 @@ use crate::{ /// **__Note:_** A Hash should not be used with storage, since no guarantee can /// be made about the Bytes stored as to whether they were infact from a secure /// cryptographic hash function. +#[derive(Clone)] +#[repr(transparent)] pub struct Hash(BytesN); impl Hash { From 5af5fe75b3e42525493b37d5f007c7ab35c29901 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 26 Jul 2024 12:50:17 +1000 Subject: [PATCH 10/57] Add fn for changing an Env's test config (#1308) ### What Add fn for changing an Envs config after creation. ### Why There are ways to create Envs without an opportunity to set a config. It's cumbersome to offer a way to set the config with all of the different ways, and adding a function for changing it after creation is the simplest way today to achieve this. This could create problems if in the future the config contains items that aren't easily changeable after instatiation of the Env. That problem doesn't exist today at least. In the future if we introduce items like that we'd probably need to resort to checking if the value is changing, and if so, panicing with a meaningful error message. That's not great, but still better for the overall API I think, especially given this is in tests. Close #1306 --- soroban-sdk/src/env.rs | 8 +++++++- soroban-sdk/src/tests/env.rs | 29 +++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index e4b050953..1bd15d50c 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -487,6 +487,7 @@ impl Env { f((*self.test_state.generators).borrow_mut()) } + /// Create an Env with the test config. pub fn new_with_config(config: EnvTestConfig) -> Env { struct EmptySnapshotSource(); @@ -515,6 +516,11 @@ impl Env { Env::new_for_testutils(config, rf, None, info, None) } + /// Change the test config of an Env. + pub fn set_config(&mut self, config: EnvTestConfig) { + self.test_state.config = config; + } + /// Used by multiple constructors to configure test environments consistently. fn new_for_testutils( config: EnvTestConfig, @@ -1246,7 +1252,7 @@ impl Env { /// Events, as an output source only, are not loaded into the Env. pub fn from_snapshot(s: Snapshot) -> Env { Env::new_for_testutils( - EnvTestConfig::default(), // TODO: Allow setting the config. + EnvTestConfig::default(), Rc::new(s.ledger.clone()), Some(Rc::new(RefCell::new(s.generators))), s.ledger.ledger_info(), diff --git a/soroban-sdk/src/tests/env.rs b/soroban-sdk/src/tests/env.rs index 73b64cb14..3eb4a1e0e 100644 --- a/soroban-sdk/src/tests/env.rs +++ b/soroban-sdk/src/tests/env.rs @@ -175,3 +175,32 @@ fn test_snapshot_file_disabled() { let _ = std::fs::remove_file(&p1); let _ = std::fs::remove_file(&p2); } + +/// Test that the test snapshot file is not written when disabled after +/// creation. +#[test] +fn test_snapshot_file_disabled_after_creation() { + let p = std::path::Path::new("test_snapshots") + .join("tests") + .join("env") + .join("test_snapshot_file_disabled_after_creation"); + let p1 = p.with_extension("1.json"); + assert!(!p1.exists()); + let p2 = p.with_extension("2.json"); + assert!(!p2.exists()); + { + let e1 = Env::default(); + let _ = e1.register_contract(None, Contract); + let mut e2 = Env::default(); + e2.set_config(EnvTestConfig { + capture_snapshot_at_drop: false, + }); + let _ = e2.register_contract(None, Contract); + assert!(!p1.exists()); + assert!(!p2.exists()); + } + assert!(p1.exists()); + assert!(!p2.exists()); + let _ = std::fs::remove_file(&p1); + let _ = std::fs::remove_file(&p2); +} From d6f5639f643d76e758beecbb0ca391f8cd304c24 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 26 Jul 2024 03:27:01 +0000 Subject: [PATCH 11/57] Bump version to 21.4.0 (#1309) ### What Bump version to 21.4.0, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/10105029897. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.4.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.4.0&title=21.4.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.4.0&title=21.4.0&target=release/v21.4.0 Co-authored-by: github-actions[bot] --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ec7d429a2..37a5093f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.3.0" +version = "21.4.0" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.3.0" +version = "21.4.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.3.0" +version = "21.4.0" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.3.0" +version = "21.4.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.3.0" +version = "21.4.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.3.0" +version = "21.4.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 88916133a..dd2a90e4c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.3.0" +version = "21.4.0" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.3.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.3.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.3.0", path = "soroban-spec" } -soroban-spec-rust = { version = "21.3.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.3.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.3.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.4.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.4.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.4.0", path = "soroban-spec" } +soroban-spec-rust = { version = "21.4.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.4.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.4.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.0" From 10a3372241c705aabac9642fab0cbcd44b57609e Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 30 Jul 2024 01:37:30 +1000 Subject: [PATCH 12/57] Add CI concurrency group (#1304) ### What Add CI concurrency group limiting to one build per branch, including main, canceling any older runs. ### Why Limit CI resource usage, especially of mac and windows instances. We never need out-of-date commit CI runs to complete on PRs. --- .github/workflows/rust.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8b15af696..3b524f9bd 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -6,6 +6,10 @@ on: pull_request: merge_group: +concurrency: + group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}-{{ github.event_name }} + cancel-in-progress: true + defaults: run: shell: bash From 39fd18fff26f79deeba07c62199a34f84ca4ddb3 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 8 Aug 2024 16:32:05 -0700 Subject: [PATCH 13/57] Expose rust code gen of contracts without the file import (#1311) ### What Expose rust code gen of contracts without the file import. ### Why The code gen function for rust code generates the interface and types as well as an import of the wasm binary. The CLI uses this function and wants to output the generated code without the wasm binary. Related to: - https://github.com/stellar/stellar-cli/pull/1532#discussion_r1708371038 --- soroban-spec-rust/src/lib.rs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/soroban-spec-rust/src/lib.rs b/soroban-spec-rust/src/lib.rs index 567c0ffc2..577e50d03 100644 --- a/soroban-spec-rust/src/lib.rs +++ b/soroban-spec-rust/src/lib.rs @@ -57,6 +57,14 @@ pub fn generate_from_wasm( } pub fn generate(specs: &[ScSpecEntry], file: &str, sha256: &str) -> TokenStream { + let generated = generate_without_file(specs); + quote! { + pub const WASM: &[u8] = soroban_sdk::contractfile!(file = #file, sha256 = #sha256); + #generated + } +} + +pub fn generate_without_file(specs: &[ScSpecEntry]) -> TokenStream { let mut spec_fns = Vec::new(); let mut spec_structs = Vec::new(); let mut spec_unions = Vec::new(); @@ -81,8 +89,6 @@ pub fn generate(specs: &[ScSpecEntry], file: &str, sha256: &str) -> TokenStream let error_enums = spec_error_enums.iter().map(|s| generate_error_enum(s)); quote! { - pub const WASM: &[u8] = soroban_sdk::contractfile!(file = #file, sha256 = #sha256); - #[soroban_sdk::contractclient(name = "Client")] #trait_ From d40bd031c14fbd3d75cf4473486ef7ef15af3364 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 00:13:06 +0000 Subject: [PATCH 14/57] Bump version to 21.5.0 (#1313) ### What Bump version to 21.5.0, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/10311168473. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.5.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.5.0&title=21.5.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.5.0&title=21.5.0&target=release/v21.5.0 Co-authored-by: github-actions[bot] --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 37a5093f4..5dc2a5e0f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.4.0" +version = "21.5.0" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.4.0" +version = "21.5.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.4.0" +version = "21.5.0" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.4.0" +version = "21.5.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.4.0" +version = "21.5.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.4.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index dd2a90e4c..8c8da305e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.4.0" +version = "21.5.0" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.4.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.4.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.4.0", path = "soroban-spec" } -soroban-spec-rust = { version = "21.4.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.4.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.4.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.5.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.5.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.5.0", path = "soroban-spec" } +soroban-spec-rust = { version = "21.5.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.5.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.5.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.0" From 48fc0e4c00f7e2454b0f593278be1fc87ee2775b Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Thu, 15 Aug 2024 13:39:58 -0700 Subject: [PATCH 15/57] Fix event comment (#1315) ### What Context - https://github.com/stellar/stellar-protocol/pull/1522 The second commit for unwrap.rs is required due to https://github.com/rust-lang/rust/issues/129031. --- soroban-sdk/src/token.rs | 18 ++++++------ soroban-sdk/src/unwrap.rs | 3 ++ tests/fuzz/fuzz/Cargo.lock | 58 ++++++++++++++++++++++---------------- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/soroban-sdk/src/token.rs b/soroban-sdk/src/token.rs index 4d7e64edc..37626e81f 100644 --- a/soroban-sdk/src/token.rs +++ b/soroban-sdk/src/token.rs @@ -140,7 +140,7 @@ pub trait TokenInterface { /// # Events /// /// Emits an event with topics `["transfer", from: Address, to: Address], - /// data = [amount: i128]` + /// data = amount: i128` fn transfer(env: Env, from: Address, to: Address, amount: i128); /// Transfer `amount` from `from` to `to`, consuming the allowance that @@ -164,7 +164,7 @@ pub trait TokenInterface { /// # Events /// /// Emits an event with topics `["transfer", from: Address, to: Address], - /// data = [amount: i128]` + /// data = amount: i128` fn transfer_from(env: Env, spender: Address, from: Address, to: Address, amount: i128); /// Burn `amount` from `from`. @@ -180,8 +180,8 @@ pub trait TokenInterface { /// /// # Events /// - /// Emits an event with topics `["burn", from: Address], data = [amount: - /// i128]` + /// Emits an event with topics `["burn", from: Address], data = amount: + /// i128` fn burn(env: Env, from: Address, amount: i128); /// Burn `amount` from `from`, consuming the allowance of `spender`. @@ -204,8 +204,8 @@ pub trait TokenInterface { /// /// # Events /// - /// Emits an event with topics `["burn", from: Address], data = [amount: - /// i128]` + /// Emits an event with topics `["burn", from: Address], data = amount: + /// i128` fn burn_from(env: Env, spender: Address, from: Address, amount: i128); /// Returns the number of decimals used to represent amounts of this token. @@ -286,7 +286,7 @@ pub trait StellarAssetInterface { /// # Events /// /// Emits an event with topics `["mint", admin: Address, to: Address], data - /// = [amount: i128]` + /// = amount: i128` fn mint(env: Env, to: Address, amount: i128); /// Clawback `amount` from `from` account. `amount` is burned in the @@ -301,7 +301,7 @@ pub trait StellarAssetInterface { /// # Events /// /// Emits an event with topics `["clawback", admin: Address, to: Address], - /// data = [amount: i128]` + /// data = amount: i128` fn clawback(env: Env, from: Address, amount: i128); } @@ -330,7 +330,7 @@ pub(crate) const SPEC_XDR_INPUT: &[&[u8]] = &[ &StellarAssetSpec::spec_xdr_transfer_from(), ]; -pub(crate) const SPEC_XDR_LEN: usize = 6460; +pub(crate) const SPEC_XDR_LEN: usize = 6456; impl StellarAssetSpec { /// Returns the XDR spec for the Token contract. diff --git a/soroban-sdk/src/unwrap.rs b/soroban-sdk/src/unwrap.rs index 52b03854c..102bbf165 100644 --- a/soroban-sdk/src/unwrap.rs +++ b/soroban-sdk/src/unwrap.rs @@ -64,6 +64,9 @@ impl UnwrapInfallible for Result { // destructuring the `never` variable into an empty set of cases is // the most honest since it's statically checked to _be_ infallible, // not just an assertion of our hopes.) + + // This allow and the Err can be removed once 1.82 becomes stable + #[allow(unreachable_patterns)] Err(never) => match never {}, } } diff --git a/tests/fuzz/fuzz/Cargo.lock b/tests/fuzz/fuzz/Cargo.lock index eb271c87f..d108f1c43 100644 --- a/tests/fuzz/fuzz/Cargo.lock +++ b/tests/fuzz/fuzz/Cargo.lock @@ -338,15 +338,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", ] @@ -959,8 +960,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "soroban-builtin-sdk-macros" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=a8c713db03ba5ebfdc4786b73dcba00284e15dbe#a8c713db03ba5ebfdc4786b73dcba00284e15dbe" +version = "21.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44877373b3dc6c662377cb1600e3a62706d75e484b6064f9cd22e467c676b159" dependencies = [ "itertools", "proc-macro2", @@ -970,8 +972,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=a8c713db03ba5ebfdc4786b73dcba00284e15dbe#a8c713db03ba5ebfdc4786b73dcba00284e15dbe" +version = "21.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "590add16843a61b01844e19e89bccaaee6aa21dc76809017b0662c17dc139ee9" dependencies = [ "arbitrary", "crate-git-revision", @@ -988,8 +991,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=a8c713db03ba5ebfdc4786b73dcba00284e15dbe#a8c713db03ba5ebfdc4786b73dcba00284e15dbe" +version = "21.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ec8dc43acdd6c7e7b371acf44fc1a7dac24934ae3b2f05fafd618818548176" dependencies = [ "soroban-env-common", "static_assertions", @@ -997,8 +1001,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=a8c713db03ba5ebfdc4786b73dcba00284e15dbe#a8c713db03ba5ebfdc4786b73dcba00284e15dbe" +version = "21.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e25aaffe0c62eb65e0e349f725b4b8b13ad0764d78a15aab5bbccb5c4797726" dependencies = [ "backtrace", "curve25519-dalek", @@ -1029,8 +1034,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "20.3.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=a8c713db03ba5ebfdc4786b73dcba00284e15dbe#a8c713db03ba5ebfdc4786b73dcba00284e15dbe" +version = "21.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e16b761459fdf3c4b62b24df3941498d14e5246e6fadfb4774ed8114d243aa4" dependencies = [ "itertools", "proc-macro2", @@ -1043,7 +1049,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "20.5.0" +version = "21.5.0" dependencies = [ "serde", "serde_json", @@ -1055,7 +1061,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "20.5.0" +version = "21.5.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1073,7 +1079,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "20.5.0" +version = "21.5.0" dependencies = [ "crate-git-revision", "darling", @@ -1091,7 +1097,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "20.5.0" +version = "21.5.0" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -1101,7 +1107,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "20.5.0" +version = "21.5.0" dependencies = [ "prettyplease", "proc-macro2", @@ -1116,7 +1122,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", @@ -1160,8 +1167,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "20.1.0" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=3a001b1fbb20e4cfa2cef2c0cc450564e8528057#3a001b1fbb20e4cfa2cef2c0cc450564e8528057" +version = "21.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1198,7 +1206,7 @@ dependencies = [ [[package]] name = "test_fuzz" -version = "20.5.0" +version = "21.5.0" dependencies = [ "soroban-sdk", ] @@ -1339,13 +1347,15 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[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", From 47f91dcb6310067dd74bc64ad41173b2de31e11f Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 15 Aug 2024 21:26:53 +0000 Subject: [PATCH 16/57] Bump version to 21.5.1 (#1316) ### What Bump version to 21.5.1, creating release branch. ### Why Triggered by @sisuresh in https://github.com/stellar/rs-soroban-sdk/actions/runs/10410569263. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.5.1` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.5.1&title=21.5.1 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.5.1&title=21.5.1&target=release/v21.5.1 Co-authored-by: github-actions[bot] --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5dc2a5e0f..de10cd958 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.5.0" +version = "21.5.1" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.5.0" +version = "21.5.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.5.0" +version = "21.5.1" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.5.0" +version = "21.5.1" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.5.0" +version = "21.5.1" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.5.0" +version = "21.5.1" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 8c8da305e..93448e3ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.5.0" +version = "21.5.1" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.5.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.5.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.5.0", path = "soroban-spec" } -soroban-spec-rust = { version = "21.5.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.5.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.5.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.5.1", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.5.1", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.5.1", path = "soroban-spec" } +soroban-spec-rust = { version = "21.5.1", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.5.1", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.5.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.0" From 41aa0dd39bdee3e6ef6811ef046c13a782e62aec Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 21 Aug 2024 07:07:51 +1000 Subject: [PATCH 17/57] Update soroban-env-* to 21.2.1 (#1323) ### What Update soroban-env-* to 21.2.1 ### Why To get a release of soroban-sdk with the unpinning of deps in env: - https://github.com/stellar/rs-soroban-env/pull/1441 --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index de10cd958..9965e14f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1105,9 +1105,9 @@ checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" [[package]] name = "soroban-builtin-sdk-macros" -version = "21.2.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44877373b3dc6c662377cb1600e3a62706d75e484b6064f9cd22e467c676b159" +checksum = "2f57a68ef8777e28e274de0f3a88ad9a5a41d9a2eb461b4dd800b086f0e83b80" dependencies = [ "itertools", "proc-macro2", @@ -1117,9 +1117,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "21.2.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "590add16843a61b01844e19e89bccaaee6aa21dc76809017b0662c17dc139ee9" +checksum = "2fd1c89463835fe6da996318156d39f424b4f167c725ec692e5a7a2d4e694b3d" dependencies = [ "arbitrary", "crate-git-revision", @@ -1136,9 +1136,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "21.2.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8dc43acdd6c7e7b371acf44fc1a7dac24934ae3b2f05fafd618818548176" +checksum = "6bfb2536811045d5cd0c656a324cbe9ce4467eb734c7946b74410d90dea5d0ce" dependencies = [ "soroban-env-common", "static_assertions", @@ -1146,9 +1146,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "21.2.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e25aaffe0c62eb65e0e349f725b4b8b13ad0764d78a15aab5bbccb5c4797726" +checksum = "2b7a32c28f281c423189f1298960194f0e0fc4eeb72378028171e556d8cd6160" dependencies = [ "backtrace", "curve25519-dalek", @@ -1179,9 +1179,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "21.2.0" +version = "21.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e16b761459fdf3c4b62b24df3941498d14e5246e6fadfb4774ed8114d243aa4" +checksum = "242926fe5e0d922f12d3796cd7cd02dd824e5ef1caa088f45fce20b618309f64" dependencies = [ "itertools", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 93448e3ce..72ea4bb40 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,17 +24,17 @@ soroban-ledger-snapshot = { version = "21.5.1", path = "soroban-ledger-snapshot" soroban-token-sdk = { version = "21.5.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=21.2.0" +version = "=21.2.1" # git = "https://github.com/stellar/rs-soroban-env" # rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" [workspace.dependencies.soroban-env-guest] -version = "=21.2.0" +version = "=21.2.1" # git = "https://github.com/stellar/rs-soroban-env" # rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" [workspace.dependencies.soroban-env-host] -version = "=21.2.0" +version = "=21.2.1" # git = "https://github.com/stellar/rs-soroban-env" # rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" From 94d13f646b462a7b82b225464b73867e478b835d Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 20 Aug 2024 22:08:25 +0000 Subject: [PATCH 18/57] Bump version to 21.5.2 (#1324) ### What Bump version to 21.5.2, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/10479729745. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.5.2` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.5.2&title=21.5.2 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.5.2&title=21.5.2&target=release/v21.5.2 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9965e14f7..141cfe706 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.5.1" +version = "21.5.2" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.5.1" +version = "21.5.2" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.5.1" +version = "21.5.2" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.5.1" +version = "21.5.2" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.5.1" +version = "21.5.2" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.5.1" +version = "21.5.2" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 72ea4bb40..7f943cd07 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.5.1" +version = "21.5.2" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.5.1", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.5.1", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.5.1", path = "soroban-spec" } -soroban-spec-rust = { version = "21.5.1", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.5.1", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.5.1", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.5.2", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.5.2", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.5.2", path = "soroban-spec" } +soroban-spec-rust = { version = "21.5.2", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.5.2", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.5.2", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.1" From c3dd2081b2dd91c14412886b0b23762d91e8b2f6 Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Tue, 20 Aug 2024 17:20:33 -0700 Subject: [PATCH 19/57] Add util to update issuer flags for SAC testing (#1320) ### What Resolves #1117 Instead of making a general `storage` utility to modify the account, I added a specific method to update the issuer flag. because there isn't any reason to mess with the other fields directly. I didn't want to expose the xdr in the interface, but doing that would've made the interface more clear. --------- Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --- soroban-sdk/src/env.rs | 23 +- soroban-sdk/src/tests/token_client.rs | 29 +- soroban-sdk/src/testutils.rs | 117 ++++++ .../token_client/test_issuer_flags.1.json | 334 ++++++++++++++++++ 4 files changed, 497 insertions(+), 6 deletions(-) create mode 100644 soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 1bd15d50c..0b815e1ca 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -455,6 +455,7 @@ use crate::{ testutils::{ budget::Budget, Address as _, AuthSnapshot, AuthorizedInvocation, ContractFunctionSet, EventsSnapshot, Generators, Ledger as _, MockAuth, MockAuthContract, Snapshot, + StellarAssetContract, StellarAssetIssuer, }, Bytes, BytesN, }; @@ -687,12 +688,13 @@ impl Env { /// Register the built-in Stellar Asset Contract with provided admin address. /// - /// Returns the contract ID of the registered token contract. + /// Returns a utility struct that contains the contract ID of the registered + /// token contract, as well as methods to read and update issuer flags. /// /// The contract will wrap a randomly-generated Stellar asset. This function /// is useful for using in the tests when an arbitrary token contract /// instance is needed. - pub fn register_stellar_asset_contract(&self, admin: Address) -> Address { + pub fn register_stellar_asset_contract_v2(&self, admin: Address) -> StellarAssetContract { let issuer_pk = self.with_generator(|mut g| g.address()); let issuer_id = xdr::AccountId(xdr::PublicKey::PublicKeyTypeEd25519(xdr::Uint256( issuer_pk.clone(), @@ -759,7 +761,22 @@ impl Env { (admin,).try_into_val(self).unwrap(), ); self.env_impl.set_auth_manager(prev_auth_manager).unwrap(); - token_id + + let issuer = StellarAssetIssuer::new(self.clone(), issuer_id); + + StellarAssetContract::new(token_id, issuer) + } + + /// Register the built-in Stellar Asset Contract with provided admin address. + /// + /// Returns the contract ID of the registered token contract. + /// + /// The contract will wrap a randomly-generated Stellar asset. This function + /// is useful for using in the tests when an arbitrary token contract + /// instance is needed. + #[deprecated(note = "use [Env::register_stellar_asset_contract_v2]")] + pub fn register_stellar_asset_contract(&self, admin: Address) -> Address { + self.register_stellar_asset_contract_v2(admin).address() } fn register_contract_with_optional_contract_id_and_executable<'a>( diff --git a/soroban-sdk/src/tests/token_client.rs b/soroban-sdk/src/tests/token_client.rs index bcba738e7..bf12fa2ef 100644 --- a/soroban-sdk/src/tests/token_client.rs +++ b/soroban-sdk/src/tests/token_client.rs @@ -5,7 +5,7 @@ use crate::{ use soroban_sdk::{ contract, contractimpl, contracttype, - testutils::{Address as _, MockAuth, MockAuthInvoke}, + testutils::{Address as _, IssuerFlags, MockAuth, MockAuthInvoke}, token::Client as TokenClient, Address, Env, IntoVal, Symbol, }; @@ -41,6 +41,28 @@ impl TestContract { } } +#[test] +fn test_issuer_flags() { + extern crate std; + + let env = Env::default(); + + let admin = Address::generate(&env); + let sac = env.register_stellar_asset_contract_v2(admin); + + assert_eq!(sac.issuer().flags(), 0); + + let required_and_revocable = + (IssuerFlags::RequiredFlag as u32) | (IssuerFlags::RevocableFlag as u32); + sac.issuer().set_flag(IssuerFlags::RequiredFlag); + sac.issuer().set_flag(IssuerFlags::RevocableFlag); + + assert_eq!(sac.issuer().flags(), required_and_revocable); + + sac.issuer().clear_flag(IssuerFlags::RequiredFlag); + assert_eq!(sac.issuer().flags(), IssuerFlags::RevocableFlag as u32); +} + #[test] fn test_mock_all_auth() { extern crate std; @@ -48,7 +70,8 @@ fn test_mock_all_auth() { let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let sac = env.register_stellar_asset_contract_v2(admin); + let token_contract_id = sac.address(); let contract_id = env.register_contract(None, TestContract); let client = TestContractClient::new(&env, &contract_id); @@ -96,7 +119,7 @@ fn test_mock_auth() { let env = Env::default(); let admin = Address::generate(&env); - let token_contract_id = env.register_stellar_asset_contract(admin); + let token_contract_id = env.register_stellar_asset_contract_v2(admin).address(); let contract_id = env.register_contract(None, TestContract); let client = TestContractClient::new(&env, &contract_id); diff --git a/soroban-sdk/src/testutils.rs b/soroban-sdk/src/testutils.rs index 6ad050beb..c4ceca943 100644 --- a/soroban-sdk/src/testutils.rs +++ b/soroban-sdk/src/testutils.rs @@ -6,12 +6,15 @@ pub mod arbitrary; mod sign; +use std::rc::Rc; + pub use sign::ed25519; mod mock_auth; pub use mock_auth::{ AuthorizedFunction, AuthorizedInvocation, MockAuth, MockAuthContract, MockAuthInvoke, }; +use soroban_env_host::TryIntoVal; pub mod storage; @@ -416,3 +419,117 @@ pub trait Deployer { /// the provided address, or if the instance/code has expired. fn get_contract_code_ttl(&self, contract: &crate::Address) -> u32; } + +pub use xdr::AccountFlags as IssuerFlags; + +#[derive(Clone)] +pub struct StellarAssetIssuer { + env: Env, + account_id: xdr::AccountId, +} + +impl StellarAssetIssuer { + pub(crate) fn new(env: Env, account_id: xdr::AccountId) -> Self { + Self { env, account_id } + } + + /// Returns the flags for the issuer. + pub fn flags(&self) -> u32 { + self.env + .host() + .with_mut_storage(|storage| { + let k = Rc::new(xdr::LedgerKey::Account(xdr::LedgerKeyAccount { + account_id: self.account_id.clone(), + })); + + let entry = storage.get( + &k, + soroban_env_host::budget::AsBudget::as_budget(self.env.host()), + )?; + + match entry.data { + xdr::LedgerEntryData::Account(ref e) => Ok(e.flags.clone()), + _ => panic!("expected account entry but got {:?}", entry.data), + } + }) + .unwrap() + } + + /// Adds the flag specified to the existing issuer flags + pub fn set_flag(&self, flag: IssuerFlags) { + self.overwrite_issuer_flags(self.flags() | (flag as u32)) + } + + /// Clears the flag specified from the existing issuer flags + pub fn clear_flag(&self, flag: IssuerFlags) { + self.overwrite_issuer_flags(self.flags() & (!(flag as u32))) + } + + pub fn address(&self) -> crate::Address { + xdr::ScAddress::Account(self.account_id.clone()) + .try_into_val(&self.env.clone()) + .unwrap() + } + + /// Sets the issuer flags field. + /// Each flag is a bit with values corresponding to [xdr::AccountFlags] + /// + /// Use this to test interactions between trustlines/balances and the issuer flags. + fn overwrite_issuer_flags(&self, flags: u32) { + if u64::from(flags) > xdr::MASK_ACCOUNT_FLAGS_V17 { + panic!( + "issuer flags value must be at most {}", + xdr::MASK_ACCOUNT_FLAGS_V17 + ); + } + + self.env + .host() + .with_mut_storage(|storage| { + let k = Rc::new(xdr::LedgerKey::Account(xdr::LedgerKeyAccount { + account_id: self.account_id.clone(), + })); + + let mut entry = storage + .get( + &k, + soroban_env_host::budget::AsBudget::as_budget(self.env.host()), + )? + .as_ref() + .clone(); + + match entry.data { + xdr::LedgerEntryData::Account(ref mut e) => e.flags = flags, + _ => panic!("expected account entry but got {:?}", entry.data), + } + + storage.put( + &k, + &Rc::new(entry), + None, + soroban_env_host::budget::AsBudget::as_budget(self.env.host()), + )?; + Ok(()) + }) + .unwrap(); + } +} + +pub struct StellarAssetContract { + address: crate::Address, + issuer: StellarAssetIssuer, +} + +impl StellarAssetContract { + pub(crate) fn new(address: crate::Address, issuer: StellarAssetIssuer) -> Self { + Self { address, issuer } + } + + pub fn address(&self) -> crate::Address { + self.address.clone() + } + + pub fn issuer(&self) -> StellarAssetIssuer { + self.issuer.clone() + } +} diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json new file mode 100644 index 000000000..680eeac45 --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json @@ -0,0 +1,334 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [ + [ + "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF", + { + "function": { + "contract_fn": { + "contract_address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL", + "function_name": "set_admin", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "account": { + "account_id": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "account": { + "account_id": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF", + "balance": 0, + "seq_num": 0, + "num_sub_entries": 0, + "inflation_dest": null, + "flags": 2, + "home_domain": "", + "thresholds": "01010101", + "signers": [], + "ext": "v0" + } + }, + "ext": "v0" + }, + null + ] + ], + [ + { + "contract_data": { + "contract": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF", + "key": { + "ledger_key_nonce": { + "nonce": 801925984706572462 + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + 6311999 + ] + ], + [ + { + "contract_data": { + "contract": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": "stellar_asset", + "storage": [ + { + "key": { + "symbol": "METADATA" + }, + "val": { + "map": [ + { + "key": { + "symbol": "decimal" + }, + "val": { + "u32": 7 + } + }, + { + "key": { + "symbol": "name" + }, + "val": { + "string": "aaa:GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF" + } + }, + { + "key": { + "symbol": "symbol" + }, + "val": { + "string": "aaa" + } + } + ] + } + }, + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "AssetInfo" + } + ] + }, + "val": { + "vec": [ + { + "symbol": "AlphaNum4" + }, + { + "map": [ + { + "key": { + "symbol": "asset_code" + }, + "val": { + "string": "aaa\\0" + } + }, + { + "key": { + "symbol": "issuer" + }, + "val": { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + } + } + ] + } + ] + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 120960 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" + }, + { + "symbol": "init_asset" + } + ], + "data": { + "bytes": "0000000161616100000000000000000000000000000000000000000000000000000000000000000000000002" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "init_asset" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" + }, + { + "symbol": "set_admin" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", + "type_": "contract", + "body": { + "v0": { + "topics": [ + { + "symbol": "set_admin" + }, + { + "address": "GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF" + }, + { + "string": "aaa:GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF" + } + ], + "data": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "set_admin" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file From 00596bb275d8b69f5b44b4de5100e80b8dc1b6a8 Mon Sep 17 00:00:00 2001 From: cuiweiyuan Date: Wed, 21 Aug 2024 08:22:45 +0800 Subject: [PATCH 20/57] chore: fix some comments (#1312) ### What fix some comments ### Why [TODO: Why this change is being made. Include any context required to understand the why.] ### Known limitations [TODO or N/A] Signed-off-by: cuiweiyuan Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --- soroban-sdk/src/crypto.rs | 2 +- soroban-sdk/src/token.rs | 4 ++-- soroban-sdk/src/try_from_val_for_contract_fn.rs | 2 +- soroban-spec-rust/src/lib.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/soroban-sdk/src/crypto.rs b/soroban-sdk/src/crypto.rs index 192912d33..731f26b8b 100644 --- a/soroban-sdk/src/crypto.rs +++ b/soroban-sdk/src/crypto.rs @@ -16,7 +16,7 @@ use crate::{ /// cryptographic hash function as its first parameter. /// /// **__Note:_** A Hash should not be used with storage, since no guarantee can -/// be made about the Bytes stored as to whether they were infact from a secure +/// be made about the Bytes stored as to whether they were in fact from a secure /// cryptographic hash function. #[derive(Clone)] #[repr(transparent)] diff --git a/soroban-sdk/src/token.rs b/soroban-sdk/src/token.rs index 37626e81f..16c1050a6 100644 --- a/soroban-sdk/src/token.rs +++ b/soroban-sdk/src/token.rs @@ -87,7 +87,7 @@ pub trait TokenInterface { /// /// The amount returned is the amount that spender is allowed to transfer /// out of from's balance. When the spender transfers amounts, the allowance - /// will be reduced by the amount transfered. + /// will be reduced by the amount transferred. /// /// # Arguments /// @@ -101,7 +101,7 @@ pub trait TokenInterface { /// The amount set is the amount that spender is approved to transfer out of /// from's balance. The spender will be allowed to transfer amounts, and /// when an amount is transferred the allowance will be reduced by the - /// amount transfered. + /// amount transferred. /// /// # Arguments /// diff --git a/soroban-sdk/src/try_from_val_for_contract_fn.rs b/soroban-sdk/src/try_from_val_for_contract_fn.rs index b6ee027c4..9620e4ad1 100644 --- a/soroban-sdk/src/try_from_val_for_contract_fn.rs +++ b/soroban-sdk/src/try_from_val_for_contract_fn.rs @@ -7,7 +7,7 @@ //! //! The trait exists primarily to allow some special types, e.g. //! [`crate::crypto::Hash`], to be used as inputs to contract functions without -//! otherwise being createable from a Val via the public TryFromVal trait, and +//! otherwise being creatable from a Val via the public TryFromVal trait, and //! therefore not storeable. //! //! For types that can be used and converted everywhere, implementing TryFromVal diff --git a/soroban-spec-rust/src/lib.rs b/soroban-spec-rust/src/lib.rs index 577e50d03..5e62c4172 100644 --- a/soroban-spec-rust/src/lib.rs +++ b/soroban-spec-rust/src/lib.rs @@ -103,7 +103,7 @@ pub fn generate_without_file(specs: &[ScSpecEntry]) -> TokenStream { /// Rust code. pub trait ToFormattedString { /// Converts the value to a String that is pretty formatted. If there is any - /// error parsin the token stream the raw String version of the code is + /// error parsing the token stream the raw String version of the code is /// returned instead. fn to_formatted_string(&self) -> Result; } From f57d2454e520ae11dc9c8d55db610557a24a556e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 21 Aug 2024 01:48:16 +0000 Subject: [PATCH 21/57] Bump version to 21.6.0 (#1325) ### What Bump version to 21.6.0, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/10481503334. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.6.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.6.0&title=21.6.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.6.0&title=21.6.0&target=release/v21.6.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 50 +++++++++++++++++++++++++------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 141cfe706..39bd2ba9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.5.2" +version = "21.6.0" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.5.2" +version = "21.6.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.5.2" +version = "21.6.0" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.5.2" +version = "21.6.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.5.2" +version = "21.6.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] @@ -1380,126 +1380,126 @@ dependencies = [ [[package]] name = "test_account" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1507,7 +1507,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.5.2" +version = "21.6.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 7f943cd07..8ff938800 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.5.2" +version = "21.6.0" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.5.2", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.5.2", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.5.2", path = "soroban-spec" } -soroban-spec-rust = { version = "21.5.2", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.5.2", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.5.2", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.6.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.6.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.6.0", path = "soroban-spec" } +soroban-spec-rust = { version = "21.6.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.6.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.6.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.1" From 63b1a9f8d5964c065ef81b7cc510eb2164182bab Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 11 Sep 2024 02:25:57 +1000 Subject: [PATCH 22/57] Fixes for Rust 1.81.0 (#1333) ### What Fixes for Rust 1.81: 1. Update semver-checks to 0.35.0. 2. Don't use the `extern` function for invoking a contract function when executing tests. ### Why 1. Semver checks is failing to run on the new version of Rust and needs updating. 2. Rust 1.81.0 changed the behavior of panics on `extern "C"` functions, such that panics cannot be caught by [std::panic::catch_unwind](https://doc.rust-lang.org/std/panic/fn.catch_unwind.html). Contracts expose their functions as an `extern` function that defaults to `extern "C"`. The test environment catches panics inside contract functions and resurfaces them as errors by using catch_unwind. The solution used was to make it so that the test environment never calls through the extern function, and instead calls through a non-extern function that does the same work. This seems like the sanest way to take away any dependence / relationship between the test environment and the Rust C-ABI so that any future changes to the C-ABI don't affect the test environment. An alternative solution would be to mark the contract function as `extern "C-unwind"` so that it retained unwind functionality, but that would continue to bind the SDK test environment to behaviour changes in extern fns. In the solution in this change the Abi qualifier `"C"` has been added. When the Abi qualifier is not specified it defaults to `"C"`, but for the sake of being explicit and removing any doubt from a reader it is now specified. The Rust reference confirms that `"C"` is the default: - https://doc.rust-lang.org/reference/items/functions.html#extern-function-qualifier. More details on this change to Rust 1.81.0 can be found at: - https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html#abort-on-uncaught-panics-in-extern-c-functions - https://github.com/rust-lang/rust/issues/74990 Close #1332 --- .github/workflows/rust.yml | 4 ++-- soroban-sdk-macros/src/derive_fn.rs | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3b524f9bd..ebde4e671 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -57,10 +57,10 @@ jobs: steps: - uses: actions/checkout@v3 - run: rustup update - - uses: stellar/binaries@v24 + - uses: stellar/binaries@v30 with: name: cargo-semver-checks - version: 0.32.0 + version: 0.35.0 - run: cargo semver-checks build-and-test: diff --git a/soroban-sdk-macros/src/derive_fn.rs b/soroban-sdk-macros/src/derive_fn.rs index 168d8b0fc..63745a7a5 100644 --- a/soroban-sdk-macros/src/derive_fn.rs +++ b/soroban-sdk-macros/src/derive_fn.rs @@ -50,7 +50,7 @@ pub fn derive_pub_fn( }); // Prepare the argument inputs. - let (wrap_args, wrap_calls): (Vec<_>, Vec<_>) = inputs + let (wrap_args, passthrough_calls, wrap_calls): (Vec<_>, Vec<_>, Vec<_>) = inputs .iter() .skip(if env_input.is_some() { 1 } else { 0 }) .enumerate() @@ -78,6 +78,7 @@ pub fn derive_pub_fn( colon_token: Colon::default(), ty: Box::new(Type::Verbatim(quote! { #crate_path::Val })), }); + let passthrough_call = quote! { #ident }; let call = quote! { <_ as #crate_path::unwrap::UnwrapOptimized>::unwrap_optimized( <_ as #crate_path::TryFromValForContractFn<#crate_path::Env, #crate_path::Val>>::try_from_val_for_contract_fn( @@ -86,11 +87,11 @@ pub fn derive_pub_fn( ) ) }; - (arg, call) + (arg, passthrough_call, call) } FnArg::Receiver(_) => { errors.push(Error::new(a.span(), "self argument not supported")); - (a.clone(), quote! {}) + (a.clone(), quote! {}, quote! {}) } }) .multiunzip(); @@ -132,8 +133,7 @@ pub fn derive_pub_fn( use super::*; #[deprecated(note = #deprecated_note)] - #[cfg_attr(target_family = "wasm", export_name = #wrap_export_name)] - pub extern fn invoke_raw(env: #crate_path::Env, #(#wrap_args),*) -> #crate_path::Val { + pub fn invoke_raw(env: #crate_path::Env, #(#wrap_args),*) -> #crate_path::Val { #use_trait; <_ as #crate_path::IntoVal<#crate_path::Env, #crate_path::Val>>::into_val( #[allow(deprecated)] @@ -154,6 +154,13 @@ pub fn derive_pub_fn( invoke_raw(env, #(#slice_args),*) } + #[deprecated(note = #deprecated_note)] + #[cfg_attr(target_family = "wasm", export_name = #wrap_export_name)] + pub extern "C" fn invoke_raw_extern(env: #crate_path::Env, #(#wrap_args),*) -> #crate_path::Val { + #[allow(deprecated)] + invoke_raw(env, #(#passthrough_calls),*) + } + use super::*; } }) From 0a86ece1c126605ffd44525db2586b69e38253e1 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 11 Sep 2024 06:40:37 +1000 Subject: [PATCH 23/57] Allow contractimpls across mods (#1322) ### What Add a new trait `ContractFunctionRegister` that wraps the existing `register` function that all contracts use to create a table of all their functions. ### Why When a contract is registered with the test environment it uses the table of functions to know what functions a contract has defined. Today contract functions get added to the table by using the ctor crate to call the `#mod::register` function where `#mod` is a generated module at the same location as where the `#[contract]` macro gets used. The problem with this, and that was reported in #1321, is that it's valid in Rust to place type implementations anywhere in a crate that is able to reference the type, but there's no way for the generated code to know what relative or absolute path to use to reference that `#mod`. The generated code assumes that the `#mod` is imported into the current scope, which it never will be because users have no reason to manually do it because it is hidden from them and they don't know it exists. This situation leads to the following error that makes little sense to a developer because it refers to hidden generated code: ``` use of undeclared crate or module `__Contract_fn_set_registry` ``` Most of the time when folks add additional `impl` blocks to a type they will import the type into the current module so as to reference it, and so we can improve the existing situation by shifting the call to `#mod::register` to be a call to `Contract::register`. To ensure that the `register` function does not clash with a contract function that may also be named `register` the function is defined on a hidden trait, `ContractFunctionRegister`, and is only used in the context of that trait. There are some other minor changes included that remove assumptions about the type name of a contract being a simple identifier, so that when it is more than an identifier, such as a path (e.g. `path::Identifier`), the full type name is preserved everywhere it is needed. Close #1321 --- Cargo.lock | 7 + soroban-sdk-macros/src/derive_fn.rs | 5 +- soroban-sdk-macros/src/derive_spec_fn.rs | 2 +- soroban-sdk-macros/src/lib.rs | 13 +- soroban-sdk/src/testutils.rs | 6 + tests/modular/Cargo.toml | 18 ++ tests/modular/src/feat1.rs | 11 + tests/modular/src/feat2.rs | 10 + tests/modular/src/lib.rs | 16 ++ tests/modular/src/test.rs | 16 ++ tests/modular/test_snapshots/test/test.1.json | 219 ++++++++++++++++++ 11 files changed, 315 insertions(+), 8 deletions(-) create mode 100644 tests/modular/Cargo.toml create mode 100644 tests/modular/src/feat1.rs create mode 100644 tests/modular/src/feat2.rs create mode 100644 tests/modular/src/lib.rs create mode 100644 tests/modular/src/test.rs create mode 100644 tests/modular/test_snapshots/test/test.1.json diff --git a/Cargo.lock b/Cargo.lock index 39bd2ba9b..7946d5317 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1483,6 +1483,13 @@ dependencies = [ "soroban-sdk", ] +[[package]] +name = "test_modular" +version = "21.6.0" +dependencies = [ + "soroban-sdk", +] + [[package]] name = "test_multiimpl" version = "21.6.0" diff --git a/soroban-sdk-macros/src/derive_fn.rs b/soroban-sdk-macros/src/derive_fn.rs index 63745a7a5..d23de97fe 100644 --- a/soroban-sdk-macros/src/derive_fn.rs +++ b/soroban-sdk-macros/src/derive_fn.rs @@ -181,9 +181,8 @@ pub fn derive_contract_function_registration_ctor<'a>( }) .multiunzip(); - let ty_str = quote!(#ty).to_string(); + let ty_str = quote!(#ty).to_string().replace(' ', "").replace(':', "_"); let trait_str = quote!(#trait_ident).to_string(); - let fn_set_registry_ident = format_ident!("__{ty_str}_fn_set_registry"); let methods_hash = format!("{:x}", Sha256::digest(idents.join(",").as_bytes())); let ctor_ident = format_ident!("__{ty_str}_{trait_str}_{methods_hash}_ctor"); @@ -192,7 +191,7 @@ pub fn derive_contract_function_registration_ctor<'a>( #[#crate_path::reexports_for_macros::ctor::ctor] fn #ctor_ident() { #( - #fn_set_registry_ident::register( + <#ty as #crate_path::testutils::ContractFunctionRegister>::register( #idents, #[allow(deprecated)] &#wrap_idents::invoke_raw_slice, diff --git a/soroban-sdk-macros/src/derive_spec_fn.rs b/soroban-sdk-macros/src/derive_spec_fn.rs index c6155c0a8..a759cc477 100644 --- a/soroban-sdk-macros/src/derive_spec_fn.rs +++ b/soroban-sdk-macros/src/derive_spec_fn.rs @@ -15,7 +15,7 @@ use crate::{doc::docs_from_attrs, map_type::map_type, DEFAULT_XDR_RW_LIMITS}; #[allow(clippy::too_many_arguments)] pub fn derive_fn_spec( - ty: &Ident, + ty: &Type, ident: &Ident, attrs: &[Attribute], inputs: &Punctuated, diff --git a/soroban-sdk-macros/src/lib.rs b/soroban-sdk-macros/src/lib.rs index daae39714..b66c1da63 100644 --- a/soroban-sdk-macros/src/lib.rs +++ b/soroban-sdk-macros/src/lib.rs @@ -66,7 +66,7 @@ fn default_crate_path() -> Path { #[derive(Debug, FromMeta)] struct ContractSpecArgs { - name: String, + name: Type, export: Option, } @@ -87,10 +87,9 @@ pub fn contractspecfn(metadata: TokenStream, input: TokenStream) -> TokenStream let methods: Vec<_> = item.fns(); let export = args.export.unwrap_or(true); - let ty = format_ident!("{}", args.name); let derived: Result = methods .iter() - .map(|m| derive_fn_spec(&ty, m.ident, m.attrs, m.inputs, m.output, export)) + .map(|m| derive_fn_spec(&args.name, m.ident, m.attrs, m.inputs, m.output, export)) .collect(); match derived { @@ -150,7 +149,7 @@ pub fn contract(metadata: TokenStream, input: TokenStream) -> TokenStream { use std::sync::Mutex; use std::collections::BTreeMap; - type F = dyn Send + Sync + Fn(#crate_path::Env, &[#crate_path::Val]) -> #crate_path::Val; + pub(crate) type F = #crate_path::testutils::ContractFunctionF; static FUNCS: Mutex> = Mutex::new(BTreeMap::new()); @@ -164,6 +163,12 @@ pub fn contract(metadata: TokenStream, input: TokenStream) -> TokenStream { } } + impl #crate_path::testutils::ContractFunctionRegister for #ty { + fn register(name: &'static str, func: &'static #fn_set_registry_ident::F) { + #fn_set_registry_ident::register(name, func); + } + } + #[doc(hidden)] impl #crate_path::testutils::ContractFunctionSet for #ty { fn call(&self, func: &str, env: #crate_path::Env, args: &[#crate_path::Val]) -> Option<#crate_path::Val> { diff --git a/soroban-sdk/src/testutils.rs b/soroban-sdk/src/testutils.rs index c4ceca943..7df726f64 100644 --- a/soroban-sdk/src/testutils.rs +++ b/soroban-sdk/src/testutils.rs @@ -202,6 +202,12 @@ impl Generators { } } +#[doc(hidden)] +pub type ContractFunctionF = dyn Send + Sync + Fn(Env, &[Val]) -> Val; +#[doc(hidden)] +pub trait ContractFunctionRegister { + fn register(name: &'static str, func: &'static ContractFunctionF); +} #[doc(hidden)] pub trait ContractFunctionSet { fn call(&self, func: &str, env: Env, args: &[Val]) -> Option; diff --git a/tests/modular/Cargo.toml b/tests/modular/Cargo.toml new file mode 100644 index 000000000..d6557e090 --- /dev/null +++ b/tests/modular/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "test_modular" +version.workspace = true +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +edition = "2021" +publish = false +rust-version.workspace = true + +[lib] +crate-type = ["cdylib"] +doctest = false + +[dependencies] +soroban-sdk = {path = "../../soroban-sdk"} + +[dev-dependencies] +soroban-sdk = {path = "../../soroban-sdk", features = ["testutils"]} diff --git a/tests/modular/src/feat1.rs b/tests/modular/src/feat1.rs new file mode 100644 index 000000000..49822a361 --- /dev/null +++ b/tests/modular/src/feat1.rs @@ -0,0 +1,11 @@ +use soroban_sdk::contractimpl; + +use crate::Contract; +use crate::ContractClient; + +#[contractimpl] +impl Contract { + pub fn one() -> u32 { + 1 + } +} diff --git a/tests/modular/src/feat2.rs b/tests/modular/src/feat2.rs new file mode 100644 index 000000000..b5b4aaccf --- /dev/null +++ b/tests/modular/src/feat2.rs @@ -0,0 +1,10 @@ +use soroban_sdk::contractimpl; + +use crate::ContractClient; + +#[contractimpl] +impl super::Contract { + pub fn two() -> u32 { + 2 + } +} diff --git a/tests/modular/src/lib.rs b/tests/modular/src/lib.rs new file mode 100644 index 000000000..17e1deae6 --- /dev/null +++ b/tests/modular/src/lib.rs @@ -0,0 +1,16 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl}; + +mod feat1; +mod feat2; +mod test; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn zero() -> u32 { + 0 + } +} diff --git a/tests/modular/src/test.rs b/tests/modular/src/test.rs new file mode 100644 index 000000000..74988fe18 --- /dev/null +++ b/tests/modular/src/test.rs @@ -0,0 +1,16 @@ +#![cfg(test)] + +use crate::{Contract, ContractClient}; +use soroban_sdk::Env; + +#[test] +fn test() { + let env = Env::default(); + + let id = env.register_contract(None, Contract); + let client = ContractClient::new(&env, &id); + + assert_eq!(client.zero(), 0); + assert_eq!(client.one(), 1); + assert_eq!(client.two(), 2); +} diff --git a/tests/modular/test_snapshots/test/test.1.json b/tests/modular/test_snapshots/test/test.1.json new file mode 100644 index 000000000..d3cd4a318 --- /dev/null +++ b/tests/modular/test_snapshots/test/test.1.json @@ -0,0 +1,219 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [], + [], + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "zero" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "zero" + } + ], + "data": { + "u32": 0 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "one" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "one" + } + ], + "data": { + "u32": 1 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "two" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "two" + } + ], + "data": { + "u32": 2 + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file From 5b2558ed2eaa0939491ad58e76b3cd776d6729a6 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 11 Sep 2024 06:45:03 +1000 Subject: [PATCH 24/57] Add IntoIterator for &Vec<> (#1328) ### What Add IntoIterator for `&Vec<>`. ### Why To improve the ergonomics of using the `soroban_sdk::Vec` type. So that it is possible to do `for _ in &vec`. So it is possible to iterate a vec without moving it. Today if a developer would like to iterate a Vec without moving it, they need to write `for _ in vec.iter()`. This pattern is a little odd because ordinarily a developer just passes `&vec` to iterate without moving. Note that iterating `&vec` will still be somewhat different than it would be to iterate a ref of a `std::vec::Vec` from the Rust std library. This is because the Rust std library `Vec` when iterating a vec is iterating refs to items in the vec. When iterating a `soroban_sdk::Vec` there is no items in memory to ref, rather during iteration each item is communicated across the host-guest interface and must be passed by value as no one is holding onto its value. --- soroban-sdk/src/vec.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/soroban-sdk/src/vec.rs b/soroban-sdk/src/vec.rs index 70ed89b47..46f66bc9b 100644 --- a/soroban-sdk/src/vec.rs +++ b/soroban-sdk/src/vec.rs @@ -894,6 +894,18 @@ where } } +impl IntoIterator for &Vec +where + T: IntoVal + TryFromVal, +{ + type Item = T; + type IntoIter = UnwrappedIter, T, T::Error>; + + fn into_iter(self) -> Self::IntoIter { + self.clone().into_iter() + } +} + impl Vec where T: IntoVal + TryFromVal, From 91fe9c9d18cc66155a96efb4616de57e1e3d7111 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 10 Sep 2024 23:55:48 +0000 Subject: [PATCH 25/57] Bump version to 21.7.0 (#1335) ### What Bump version to 21.7.0, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/10801711919. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.7.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.7.0&title=21.7.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.7.0&title=21.7.0&target=release/v21.7.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7946d5317..f65e81a42 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.6.0" +version = "21.7.0" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.6.0" +version = "21.7.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.6.0" +version = "21.7.0" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.6.0" +version = "21.7.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.6.0" +version = "21.7.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] @@ -1380,133 +1380,133 @@ dependencies = [ [[package]] name = "test_account" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1514,7 +1514,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.6.0" +version = "21.7.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 8ff938800..02f404f39 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.6.0" +version = "21.7.0" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.6.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.6.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.6.0", path = "soroban-spec" } -soroban-spec-rust = { version = "21.6.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.6.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.6.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.7.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.7.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.7.0", path = "soroban-spec" } +soroban-spec-rust = { version = "21.7.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.7.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.7.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.1" From 64c1645e5ae1ab3292a8fad41d1da161e56c537b Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 17 Sep 2024 02:31:51 +1000 Subject: [PATCH 26/57] Fix testutils invoke with incorrect arg count (#1336) ### What Panic if the number of args being passed to a natively registered contract don't match the number of args the contract function expects. ### Why This bug exists only in the testutils path of invoking a natively registered contract and does not impact WASM registered contracts, or the env as deployed. If a native contract is invoked with too few arguments, a panic occurs with an index out of bounds errors that is not intuitive to debug. The panic displayed to the developer should be as intuitive as possible. - Before: `index out of bounds: the len is 1 but the index is 1` - After: `invalid number of input arguments: 2 expected, got 1` If a native contract is invoked with too many arguments, no panic occurs, the additional arguments are simply ignored. The behaviour of invoking natively registered contracts in testutils should be as consistent as possible to invoking contracts on a deployed network. In both of these cases the invoke fails. - Before: no panic - After: `invalid number of input arguments: 2 expected, got 3` Thanks to @dmkozh who fixed this bug and proposed the better error experience in #1327 which is destined for the next major release of the sdk v22, and this pull request extracts the fix in isolation so we can release a bug fix release of the sdk v21. --------- Co-authored-by: Dmytro Kozhevin --- soroban-sdk-macros/src/derive_fn.rs | 5 + soroban-sdk/src/tests.rs | 1 + .../src/tests/contract_invoke_arg_count.rs | 73 ++++ .../test_correct_arg_count.1.json | 224 ++++++++++ .../test_too_few_args.1.json | 379 ++++++++++++++++ .../test_too_many_args.1.json | 409 ++++++++++++++++++ 6 files changed, 1091 insertions(+) create mode 100644 soroban-sdk/src/tests/contract_invoke_arg_count.rs create mode 100644 soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json create mode 100644 soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json create mode 100644 soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json diff --git a/soroban-sdk-macros/src/derive_fn.rs b/soroban-sdk-macros/src/derive_fn.rs index d23de97fe..a980cb0f3 100644 --- a/soroban-sdk-macros/src/derive_fn.rs +++ b/soroban-sdk-macros/src/derive_fn.rs @@ -113,6 +113,7 @@ pub fn derive_pub_fn( quote! {} }; let slice_args: Vec = (0..wrap_args.len()).map(|n| quote! { args[#n] }).collect(); + let arg_count = slice_args.len(); let use_trait = if let Some(t) = trait_ident { quote! { use super::#t } } else { @@ -145,11 +146,15 @@ pub fn derive_pub_fn( ) } + #[cfg(any(test, feature = "testutils"))] #[deprecated(note = #deprecated_note)] pub fn invoke_raw_slice( env: #crate_path::Env, args: &[#crate_path::Val], ) -> #crate_path::Val { + if args.len() != #arg_count { + panic!("invalid number of input arguments: {} expected, got {}", #arg_count, args.len()); + } #[allow(deprecated)] invoke_raw(env, #(#slice_args),*) } diff --git a/soroban-sdk/src/tests.rs b/soroban-sdk/src/tests.rs index fe43b9eb1..6cb330d43 100644 --- a/soroban-sdk/src/tests.rs +++ b/soroban-sdk/src/tests.rs @@ -11,6 +11,7 @@ mod contract_docs; mod contract_duration; mod contract_fn; mod contract_invoke; +mod contract_invoke_arg_count; mod contract_overlapping_type_fn_names; mod contract_snapshot; mod contract_store; diff --git a/soroban-sdk/src/tests/contract_invoke_arg_count.rs b/soroban-sdk/src/tests/contract_invoke_arg_count.rs new file mode 100644 index 000000000..32cd30c09 --- /dev/null +++ b/soroban-sdk/src/tests/contract_invoke_arg_count.rs @@ -0,0 +1,73 @@ +use crate as soroban_sdk; +use soroban_sdk::{contract, contractimpl, symbol_short, vec, Address, Env, IntoVal as _}; + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn add_with(env: Env, x: i32, y: Option, z: Option, contract_id: Address) -> i32 { + let mut args = vec![&env, x.into_val(&env)]; + if let Some(y) = y { + args.push_back(y.into_val(&env)); + } + if let Some(z) = z { + args.push_back(z.into_val(&env)); + } + env.invoke_contract(&contract_id, &symbol_short!("add"), args) + } +} + +#[contract] +pub struct AddContract; + +#[contractimpl] +impl AddContract { + pub fn add(_: Env, a: i32, b: i32) -> i32 { + a + b + } +} + +#[test] +fn test_correct_arg_count() { + let e = Env::default(); + + let add_contract_id = e.register_contract(None, AddContract); + + let contract_id = e.register_contract(None, Contract); + let client = ContractClient::new(&e, &contract_id); + + let x = 10i32; + let y = 12i32; + let z = client.add_with(&x, &Some(y), &None, &add_contract_id); + assert!(z == 22); +} + +#[test] +#[should_panic(expected = "invalid number of input arguments: 2 expected, got 1")] +fn test_too_few_args() { + let e = Env::default(); + + let add_contract_id = e.register_contract(None, AddContract); + + let contract_id = e.register_contract(None, Contract); + let client = ContractClient::new(&e, &contract_id); + + let x = 10i32; + let _ = client.add_with(&x, &None, &None, &add_contract_id); +} + +#[test] +#[should_panic(expected = "invalid number of input arguments: 2 expected, got 3")] +fn test_too_many_args() { + let e = Env::default(); + + let add_contract_id = e.register_contract(None, AddContract); + + let contract_id = e.register_contract(None, Contract); + let client = ContractClient::new(&e, &contract_id); + + let x = 10i32; + let y = 12i32; + let _ = client.add_with(&x, &Some(y), &Some(1), &add_contract_id); +} diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json new file mode 100644 index 000000000..a8163c6df --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json @@ -0,0 +1,224 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "add_with" + } + ], + "data": { + "vec": [ + { + "i32": 10 + }, + { + "i32": 12 + }, + "void", + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "add" + } + ], + "data": { + "vec": [ + { + "i32": 10 + }, + { + "i32": 12 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "add" + } + ], + "data": { + "i32": 22 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "add_with" + } + ], + "data": { + "i32": 22 + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json new file mode 100644 index 000000000..96d34f578 --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json @@ -0,0 +1,379 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "add_with" + } + ], + "data": { + "vec": [ + { + "i32": 10 + }, + "void", + "void", + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "add" + } + ], + "data": { + "i32": 10 + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "log" + } + ], + "data": { + "vec": [ + { + "string": "caught panic 'invalid number of input arguments: 2 expected, got 1' from contract function 'Symbol(add)'" + }, + { + "i32": 10 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "contract call failed" + }, + { + "symbol": "add" + }, + { + "vec": [ + { + "i32": 10 + } + ] + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "contract call failed" + }, + { + "symbol": "add_with" + }, + { + "vec": [ + { + "i32": 10 + }, + "void", + "void", + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json new file mode 100644 index 000000000..a6e9fcfbf --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json @@ -0,0 +1,409 @@ +{ + "generators": { + "address": 2, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 21, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "add_with" + } + ], + "data": { + "vec": [ + { + "i32": 10 + }, + { + "i32": 12 + }, + { + "i32": 1 + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "add" + } + ], + "data": { + "vec": [ + { + "i32": 10 + }, + { + "i32": 12 + }, + { + "i32": 1 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "log" + } + ], + "data": { + "vec": [ + { + "string": "caught panic 'invalid number of input arguments: 2 expected, got 3' from contract function 'Symbol(add)'" + }, + { + "i32": 10 + }, + { + "i32": 12 + }, + { + "i32": 1 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "contract call failed" + }, + { + "symbol": "add" + }, + { + "vec": [ + { + "i32": 10 + }, + { + "i32": 12 + }, + { + "i32": 1 + } + ] + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "contract call failed" + }, + { + "symbol": "add_with" + }, + { + "vec": [ + { + "i32": 10 + }, + { + "i32": 12 + }, + { + "i32": 1 + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "escalating error to panic" + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file From 9e35dceaba1a032fb76e486d2bcf970a7f31843e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 16 Sep 2024 19:02:12 +0000 Subject: [PATCH 27/57] Bump version to 21.7.1 (#1337) ### What Bump version to 21.7.1, creating release branch. ### Why Triggered by @dmkozh in https://github.com/stellar/rs-soroban-sdk/actions/runs/10888521028. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v21.7.1` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.7.1&title=21.7.1 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v21.7.1&title=21.7.1&target=release/v21.7.1 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 52 ++++++++++++++++++++++++++-------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f65e81a42..bff471fe8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1194,7 +1194,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.7.0" +version = "21.7.1" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1207,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.7.0" +version = "21.7.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.7.0" +version = "21.7.1" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1249,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.7.0" +version = "21.7.1" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1260,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.7.0" +version = "21.7.1" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,7 +1275,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] @@ -1380,133 +1380,133 @@ dependencies = [ [[package]] name = "test_account" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1514,7 +1514,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.7.0" +version = "21.7.1" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 02f404f39..31c9d69cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "21.7.0" +version = "21.7.1" rust-version = "1.74.0" [workspace.dependencies] -soroban-sdk = { version = "21.7.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.7.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.7.0", path = "soroban-spec" } -soroban-spec-rust = { version = "21.7.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.7.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.7.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "21.7.1", path = "soroban-sdk" } +soroban-sdk-macros = { version = "21.7.1", path = "soroban-sdk-macros" } +soroban-spec = { version = "21.7.1", path = "soroban-spec" } +soroban-spec-rust = { version = "21.7.1", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "21.7.1", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "21.7.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=21.2.1" From 6ede50a8dd77bef87354de78e1d4e3471084da02 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Mon, 16 Sep 2024 18:20:27 -0400 Subject: [PATCH 28/57] Support for constructor-related functionality in Soroban SDK. (#1327) ### What The main non-test changes are updates for the auth-related data structures and a wrapper for the new deployer function (`create_contract_with_constructor`). The remaining changes concern the test infrastructure support, specifically contract creation utilities that support passing constructor arguments. ### Why Supporting constructors introduced in protocol 22. ### Known limitations N/A --- Cargo.lock | 183 ++++-- Cargo.toml | 42 +- soroban-ledger-snapshot/src/lib.rs | 2 +- soroban-sdk/doctest_fixtures/README.md | 4 + soroban-sdk/doctest_fixtures/contract.wasm | Bin 0 -> 639 bytes .../contract_with_constructor.wasm | Bin 0 -> 2434 bytes soroban-sdk/src/auth.rs | 20 + soroban-sdk/src/deploy.rs | 111 +++- soroban-sdk/src/env.rs | 169 +++++- soroban-sdk/src/tests/contractimport.rs | 12 +- soroban-sdk/src/tests/env.rs | 23 +- soroban-sdk/src/tests/token_spec.rs | 4 +- soroban-sdk/src/testutils/mock_auth.rs | 6 + .../test/test_first_unchecked_panics.1.json | 2 +- .../test/test_get_unchecked_panics.1.json | 2 +- .../bytes/test/test_insert_panic.1.json | 2 +- .../test/test_last_unchecked_panics.1.json | 2 +- .../test/test_pop_unchecked_panics.1.json | 2 +- .../test/test_remove_unchecked_panics.1.json | 2 +- .../bytes/test/test_slice_panic.1.json | 2 +- ...checked_panics_on_key_type_mismatch.1.json | 2 +- .../test/test_remove_unchecked_panic.1.json | 2 +- ...checked_panics_on_key_type_mismatch.1.json | 2 +- .../tests/auth/auth_10_one/test.1.json | 77 ++- .../tests/auth/auth_15_one_repeat/test.1.json | 77 ++- .../test.1.json | 77 ++- .../auth/auth_20_deep_one_address/test.1.json | 77 ++- .../test_auth_tree.1.json | 77 ++- .../test.1.json | 102 +++- .../test_auth_tree.1.json | 77 ++- .../test.1.json | 102 +++- .../test_auth_tree.1.json | 77 ++- .../test_auth_as_tree.1.json | 77 ++- ...uth_not_allowed_with_separated_tree.1.json | 102 +++- .../tests/budget/test_budget.1.json | 27 +- .../contract_add_i32/test_functional.1.json | 27 +- .../test_invoke_expect_error.1.json | 27 +- .../contract_assert/test_try_invoke.1.json | 27 +- .../test_constructor.1.json | 572 ++++++++++++++++++ .../contract_docs/fn_/test_functional.1.json | 27 +- .../contract_duration/test_functional.1.json | 27 +- .../tests/contract_fn/test_functional.1.json | 27 +- .../test_invoke_expect_error.1.json | 27 +- .../test_invoke_expect_string.1.json | 27 +- .../contract_invoke/test_try_invoke.1.json | 27 +- .../test_correct_arg_count.1.json | 52 +- .../test_too_few_args.1.json | 52 +- .../test_too_many_args.1.json | 52 +- .../test_functional.1.json | 27 +- .../tests/contract_snapshot/test.1.json | 27 +- .../tests/contract_snapshot/test.2.json | 27 +- .../tests/contract_store/test_storage.1.json | 27 +- ...orage_extension_past_max_ttl_panics.1.json | 27 +- .../contract_timepoint/test_functional.1.json | 27 +- .../contract_udt_enum/test_functional.1.json | 27 +- .../test_functional.1.json | 27 +- .../test_error_on_partial_decode.1.json | 2 +- .../test_functional.1.json | 27 +- .../test_long_names_functional.1.json | 27 +- .../test_error_on_partial_decode.1.json | 2 +- .../test_functional.1.json | 27 +- ...test_verify_sig_ed25519_invalid_sig.1.json | 2 +- ...ult_and_from_snapshot_same_settings.1.json | 27 +- ...ult_and_from_snapshot_same_settings.2.json | 27 +- ...ct_deploys_predictable_contract_ids.1.json | 33 +- ...ct_deploys_predictable_contract_ids.2.json | 83 ++- ...ct_deploys_predictable_contract_ids.3.json | 83 ++- .../test_snapshots/tests/max_ttl/max.1.json | 30 +- .../tests/prng/test_prng_fill_array.1.json | 30 +- .../tests/prng/test_prng_fill_bytes.1.json | 30 +- .../tests/prng/test_prng_fill_bytesn.1.json | 30 +- .../tests/prng/test_prng_fill_slice.1.json | 30 +- .../tests/prng/test_prng_fill_u64.1.json | 30 +- .../tests/prng/test_prng_gen_array.1.json | 30 +- .../tests/prng/test_prng_gen_bytesn.1.json | 30 +- .../tests/prng/test_prng_gen_len_bytes.1.json | 30 +- .../tests/prng/test_prng_gen_range_u64.1.json | 30 +- ...en_range_u64_panic_on_invalid_range.1.json | 30 +- .../tests/prng/test_prng_gen_u64.1.json | 30 +- .../tests/prng/test_prng_seed.1.json | 30 +- .../tests/prng/test_prng_seed.2.json | 30 +- .../tests/prng/test_prng_shuffle.1.json | 30 +- .../tests/prng/test_vec_shuffle.1.json | 30 +- .../tests/storage_testutils/all.1.json | 30 +- .../temp_entry_expiration.1.json | 30 +- .../test_persistent_entry_expiration.1.json | 30 +- .../storage_testutils/ttl_getters.1.json | 55 +- .../token_client/test_issuer_flags.1.json | 2 +- .../token_client/test_mock_all_auth.1.json | 27 +- .../tests/token_client/test_mock_auth.1.json | 52 +- ...t_unchecked_panics_on_out_of_bounds.1.json | 2 +- ...k_unchecked_panics_on_out_of_bounds.1.json | 2 +- ...t_unchecked_panics_on_out_of_bounds.1.json | 2 +- .../test/test_remove_unchecked_panics.1.json | 2 +- .../test/test_try_get_unchecked_panics.1.json | 2 +- ...k_unchecked_panics_on_out_of_bounds.1.json | 2 +- ...t_unchecked_panics_on_out_of_bounds.1.json | 2 +- tests/account/test_snapshots/test/test.1.json | 52 +- .../test_snapshots/test/test_add.1.json | 27 +- .../test_snapshots/test/test_add.1.json | 27 +- .../test_snapshots/test/test_add.1.json | 27 +- .../alloc/test_snapshots/test/test_add.1.json | 27 +- .../test_a/test_with_mock_all_auth.1.json | 27 +- .../test_a/test_with_mock_auth.1.json | 52 +- ...est_with_real_contract_auth_approve.1.json | 52 +- ...est_with_real_contract_auth_decline.1.json | 52 +- .../test_b/test_with_mock_all_auth.1.json | 52 +- .../test_b/test_with_mock_auth.1.json | 77 ++- ...est_with_real_contract_auth_approve.1.json | 77 ++- ...est_with_real_contract_auth_decline.1.json | 77 ++- tests/constructor/Cargo.toml | 18 + tests/constructor/src/lib.rs | 85 +++ .../test/test_constructor.1.json | 572 ++++++++++++++++++ ..._constructor_arguments_causes_panic.1.json | 188 ++++++ ..._constructor_arguments_causes_panic.1.json | 204 +++++++ ..._constructor_arguments_causes_panic.1.json | 198 ++++++ ..._constructor_arguments_causes_panic.1.json | 179 ++++++ .../test_snapshots/test/test_hello.1.json | 27 +- .../test_snapshots/test/test_hello.1.json | 33 +- .../test_snapshots/test/hello_ok.1.json | 27 +- .../test/try_hello_error.1.json | 27 +- .../test/try_hello_error_panic.1.json | 27 +- .../test/try_hello_error_panic_string.1.json | 27 +- ...llo_error_unexpected_contract_error.1.json | 27 +- .../test_snapshots/test/try_hello_ok.1.json | 27 +- .../test_snapshots/test/test_pub_event.1.json | 27 +- .../test_snapshots/test/test_add.1.json | 52 +- .../test_snapshots/test/test_logging.1.json | 27 +- tests/modular/test_snapshots/test/test.1.json | 27 +- .../test_snapshots/test/test_hello.1.json | 27 +- tests/udt/test_snapshots/test/test_add.1.json | 27 +- .../test_snapshots/test/test_add.1.json | 27 +- 132 files changed, 6016 insertions(+), 282 deletions(-) create mode 100644 soroban-sdk/doctest_fixtures/contract_with_constructor.wasm create mode 100644 soroban-sdk/test_snapshots/tests/contract_constructor/test_constructor.1.json create mode 100644 tests/constructor/Cargo.toml create mode 100644 tests/constructor/src/lib.rs create mode 100644 tests/constructor/test_snapshots/test/test_constructor.1.json create mode 100644 tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json create mode 100644 tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json create mode 100644 tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json create mode 100644 tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json diff --git a/Cargo.lock b/Cargo.lock index bff471fe8..d5cd71e27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,18 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -41,6 +53,12 @@ dependencies = [ "derive_arbitrary", ] +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "autocfg" version = "1.1.0" @@ -525,6 +543,9 @@ name = "hashbrown" version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +dependencies = [ + "ahash", +] [[package]] name = "hex" @@ -697,6 +718,12 @@ dependencies = [ "adler", ] +[[package]] +name = "multi-stash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" + [[package]] name = "num-bigint" version = "0.4.4" @@ -1099,15 +1126,14 @@ 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 = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f57a68ef8777e28e274de0f3a88ad9a5a41d9a2eb461b4dd800b086f0e83b80" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "itertools", "proc-macro2", @@ -1117,9 +1143,8 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fd1c89463835fe6da996318156d39f424b4f167c725ec692e5a7a2d4e694b3d" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "arbitrary", "crate-git-revision", @@ -1136,9 +1161,8 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bfb2536811045d5cd0c656a324cbe9ce4467eb734c7946b74410d90dea5d0ce" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "soroban-env-common", "static_assertions", @@ -1146,9 +1170,8 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7a32c28f281c423189f1298960194f0e0fc4eeb72378028171e556d8cd6160" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "backtrace", "curve25519-dalek", @@ -1179,9 +1202,8 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "21.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "242926fe5e0d922f12d3796cd7cd02dd824e5ef1caa088f45fce20b618309f64" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" dependencies = [ "itertools", "proc-macro2", @@ -1194,7 +1216,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "pretty_assertions", "serde", @@ -1207,7 +1229,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1231,7 +1253,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "crate-git-revision", "darling", @@ -1249,7 +1271,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1260,7 +1282,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "pretty_assertions", "prettyplease", @@ -1275,20 +1297,23 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "soroban-wasmi" -version = "0.31.1-soroban.20.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +version = "0.36.0-soroban.22.0.0" +source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" dependencies = [ + "arrayvec", + "multi-stash", + "num-derive", + "num-traits", "smallvec", "spin", - "wasmi_arena", + "wasmi_collections", "wasmi_core", "wasmparser-nostd", ] @@ -1328,9 +1353,8 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "21.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" +version = "22.0.0" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8#39d7dbb0c12bd422ee43a6e2e3277789da4eaac8" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1342,6 +1366,17 @@ dependencies = [ "stellar-strkey", ] +[[package]] +name = "string-interner" +version = "0.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" +dependencies = [ + "cfg-if", + "hashbrown 0.14.3", + "serde", +] + [[package]] name = "strsim" version = "0.10.0" @@ -1380,133 +1415,140 @@ dependencies = [ [[package]] name = "test_account" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "21.7.1" +version = "22.0.0-rc.1" +dependencies = [ + "soroban-sdk", +] + +[[package]] +name = "test_constructor" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1514,7 +1556,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "21.7.1" +version = "22.0.0-rc.1" dependencies = [ "soroban-sdk", ] @@ -1662,16 +1704,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] -name = "wasmi_arena" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +name = "wasmi_collections" +version = "0.36.0-soroban.22.0.0" +source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +dependencies = [ + "ahash", + "hashbrown 0.14.3", + "string-interner", +] [[package]] name = "wasmi_core" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +version = "0.36.0-soroban.22.0.0" +source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" dependencies = [ "downcast-rs", "libm", @@ -1691,9 +1736,9 @@ dependencies = [ [[package]] name = "wasmparser-nostd" -version = "0.100.1" +version = "0.100.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" dependencies = [ "indexmap-nostd", ] @@ -1845,6 +1890,26 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "zeroize" version = "1.7.0" diff --git a/Cargo.toml b/Cargo.toml index 31c9d69cd..8ac1707fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,46 +12,46 @@ members = [ ] [workspace.package] -version = "21.7.1" -rust-version = "1.74.0" +version = "22.0.0-rc.1" +rust-version = "1.79.0" [workspace.dependencies] -soroban-sdk = { version = "21.7.1", path = "soroban-sdk" } -soroban-sdk-macros = { version = "21.7.1", path = "soroban-sdk-macros" } -soroban-spec = { version = "21.7.1", path = "soroban-spec" } -soroban-spec-rust = { version = "21.7.1", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "21.7.1", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "21.7.1", path = "soroban-token-sdk" } +soroban-sdk = { version = "22.0.0-rc.1", path = "soroban-sdk" } +soroban-sdk-macros = { version = "22.0.0-rc.1", path = "soroban-sdk-macros" } +soroban-spec = { version = "22.0.0-rc.1", path = "soroban-spec" } +soroban-spec-rust = { version = "22.0.0-rc.1", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "22.0.0-rc.1", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "22.0.0-rc.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=21.2.1" -# git = "https://github.com/stellar/rs-soroban-env" -# rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" +version = "=22.0.0" +git = "https://github.com/stellar/rs-soroban-env" +rev = "75b782119942a4c8be8003f2901db38b30b6db2d" [workspace.dependencies.soroban-env-guest] -version = "=21.2.1" -# git = "https://github.com/stellar/rs-soroban-env" -# rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" +version = "=22.0.0" +git = "https://github.com/stellar/rs-soroban-env" +rev = "75b782119942a4c8be8003f2901db38b30b6db2d" [workspace.dependencies.soroban-env-host] -version = "=21.2.1" -# git = "https://github.com/stellar/rs-soroban-env" -# rev = "0c918ac2bd808ba1a850281c6b1c731e7fe50c53" +version = "=22.0.0" +git = "https://github.com/stellar/rs-soroban-env" +rev = "75b782119942a4c8be8003f2901db38b30b6db2d" [workspace.dependencies.stellar-strkey] version = "=0.0.8" [workspace.dependencies.stellar-xdr] -version = "=21.2.0" +version = "=22.0.0" default-features = false features = ["curr"] -# git = "https://github.com/stellar/rs-stellar-xdr" -# rev = "d0138770652a615e3cd99447f2f2727658c17450" +git = "https://github.com/stellar/rs-stellar-xdr" +rev = "39d7dbb0c12bd422ee43a6e2e3277789da4eaac8" #[patch."https://github.com/stellar/rs-soroban-env"] #soroban-env-common = { path = "../rs-soroban-env/soroban-env-common" } #soroban-env-guest = { path = "../rs-soroban-env/soroban-env-guest" } -#soroban-env-host = { path = "../rs-soroban-env/soroban-env-host/" } +#soroban-env-host = { path = "../rs-soroban-env/soroban-env-host" } #[patch."https://github.com/stellar/rs-stellar-xdr"] #stellar-xdr = { path = "../rs-stellar-xdr/" } diff --git a/soroban-ledger-snapshot/src/lib.rs b/soroban-ledger-snapshot/src/lib.rs index bcdfeecaf..0aba7bea9 100644 --- a/soroban-ledger-snapshot/src/lib.rs +++ b/soroban-ledger-snapshot/src/lib.rs @@ -168,7 +168,7 @@ impl LedgerSnapshot { impl Default for LedgerSnapshot { fn default() -> Self { Self { - protocol_version: 20, + protocol_version: 22, sequence_number: Default::default(), timestamp: Default::default(), network_id: Default::default(), diff --git a/soroban-sdk/doctest_fixtures/README.md b/soroban-sdk/doctest_fixtures/README.md index aba0c17ca..61ea2ef4b 100644 --- a/soroban-sdk/doctest_fixtures/README.md +++ b/soroban-sdk/doctest_fixtures/README.md @@ -2,3 +2,7 @@ Files contained in this directory are used within examples inside docs, i.e. doctests. + +`contract.wasm` is a copy of `test_add_u64` test contract. + +`contract_with_constructor.wasm` is a copy of `test_constructor` test contract. diff --git a/soroban-sdk/doctest_fixtures/contract.wasm b/soroban-sdk/doctest_fixtures/contract.wasm index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..275050c9450ce05a46fcfc13d29d92c51f3fa08b 100644 GIT binary patch literal 639 zcmY*W!EVz)5S^K=P3SgYB#_{O)+q-#VB)4pnp^Dy7p{mKa@O`nq*c;jM?nZ=8z_ha z2d;cUf1`g^#!i~5d)Rq1Z|2R@F6exQ0Dup7##mr6rm}!B6*UB)HsKVzOiwWa5VnOR zgs=pHV?Plk232(lvV`05&MV8Fnb}$PnLy|?1;NwyZWN_@sUtH_1D7b{zZQue0HiHmd5&rmFRTa9pM^a(f`t4!}uGm9a2Zau^ z6}TuBC>)9w2Qd^N{~=p}q}GcZpIgYZ7*k_!9Mjyj@Nk_7T0+S?@g`{ z^De)J`3i4gz6rU4WZ{4onRg|w(R&Q@Nn)N%Y&D(Vfyqj^evQ}+Y={dl7Ay=`BO1!kyssD`s(CeUxEns>4@xThiQdW+1S-s85^+&SdtY@r9WL^y@(oAc zVUZ&$>QVM(FdRVJp(6W+44>B?27O+W|EidwNVIt7Tm4z5y_6>?yn`saU%;v0W9Z3$ z2|`%=QWi!9pW9IfpU8N|f5ZT*lCxNKC=51A>J>XR{5UcPk+Waa5{M0k#x$`aU--l3 zTyS3w6&(Z+-m@ZSAYwnfZ$(~T2qCBmP2Gh&5kWJdJ;bcSpw@G*{hxs> zaoX6);m9I5qoOk4&A_9Y*Yid%PG20NT{L?t);qerqEUabl5VeX10-3@-U=&tSPwD`q4MZn!8jQ0|7;Faxm2JusQa(KFuLhkG5iYe3+HTtnF8%Led0 zX8GVAAiNluYxLUj@qP07@!_77EY+2;whtSDr7 z<|Z_J5K(V8pz5S#P2mu70`)A&)YFii1yO z*-I)6P&YN?70EV{|N6(lu>2qYWidFR=Z^hr>tCD<`=`Et;nvikrIQd$H?=hm2)H-@ zLxG%qdXoQfbu|yggnsWBgR&UZ2@I-_0c93GfgNl+31YsR8hg8lUP5V$lPNkq_Zte? zLc4CeokCs(s#gMraW#sj0N>Jj1roB*OLTA~d>4@{+$XNhDoV0;RhoSPfK1`z@0**`>!Vv{_EjT2#_%0jKX@U`oGv<*RYMvEFFL z+s&nTYv&3+an, } +/// Authorization context for `create_contract` host function that creates a +/// new contract on behalf of authorizer address. +/// This is the same as `CreateContractHostFnContext`, but also has +/// contract constructor arguments. +#[derive(Clone)] +#[contracttype(crate_path = "crate", export = false)] +pub struct CreateContractWithConstructorHostFnContext { + pub executable: ContractExecutable, + pub salt: BytesN<32>, + pub constructor_args: Vec, +} + /// Contract executable used for creating a new contract and used in /// `CreateContractHostFnContext`. #[derive(Clone)] @@ -53,8 +69,12 @@ pub enum ContractExecutable { #[derive(Clone)] #[contracttype(crate_path = "crate", export = false)] pub enum InvokerContractAuthEntry { + /// Invoke a contract. Contract(SubContractInvocation), + /// Create a contract passing 0 arguments to constructor. CreateContractHostFn(CreateContractHostFnContext), + /// Create a contract passing 0 or more arguments to constructor. + CreateContractWithCtorHostFn(CreateContractWithConstructorHostFnContext), } /// Value of contract node in InvokerContractAuthEntry tree. diff --git a/soroban-sdk/src/deploy.rs b/soroban-sdk/src/deploy.rs index 2e3953b72..71646d5ef 100644 --- a/soroban-sdk/src/deploy.rs +++ b/soroban-sdk/src/deploy.rs @@ -11,39 +11,79 @@ //! //! ### Examples //! +//! #### Deploy a contract without constructor (or 0-argument constructor) +//! //! ``` -//! # use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol}; -//! # -//! # #[contract] -//! # pub struct Contract; -//! # -//! # #[contractimpl] -//! # impl Contract { -//! # pub fn f(env: Env, wasm_hash: BytesN<32>) { -//! # let salt = [0u8; 32]; -//! # let deployer = env.deployer().with_current_contract(salt); -//! # // Deployed contract address is deterministic and can be accessed -//! # // before deploying the contract. -//! # let _ = deployer.deployed_address(); -//! # let contract_address = deployer.deploy(wasm_hash); -//! # } +//! use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol}; +//! +//! const DEPLOYED_WASM: &[u8] = include_bytes!("../doctest_fixtures/contract.wasm"); +//! #[contract] +//! pub struct Contract; +//! #[contractimpl] +//! impl Contract { +//! pub fn deploy(env: Env, wasm_hash: BytesN<32>) { +//! let salt = [0u8; 32]; +//! let deployer = env.deployer().with_current_contract(salt); +//! // Deployed contract address is deterministic and can be accessed +//! // before deploying the contract. +//! let _ = deployer.deployed_address(); +//! let contract_address = deployer.deploy(wasm_hash); +//! } +//! } +//! #[test] +//! fn test() { //! # } -//! # //! # #[cfg(feature = "testutils")] //! # fn main() { -//! # let env = Env::default(); -//! # let contract_address = env.register_contract(None, Contract); -//! # // Install the contract code before deploying its instance. -//! # let mock_wasm = [0u8; 0]; -//! # let wasm_hash = env.deployer().upload_contract_wasm(mock_wasm.as_slice()); -//! # ContractClient::new(&env, &contract_address).f(&wasm_hash); +//! let env = Env::default(); +//! let contract_address = env.register_contract(None, Contract); +//! let contract = ContractClient::new(&env, &contract_address); +//! // Upload the contract code before deploying its instance. +//! let wasm_hash = env.deployer().upload_contract_wasm(DEPLOYED_WASM); +//! contract.deploy(&wasm_hash); +//! } +//! # #[cfg(not(feature = "testutils"))] +//! # fn main() { } +//! ``` +//! +//! //! #### Deploy a contract with a multi-argument constructor +//! +//! ``` +//! use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol, IntoVal}; +//! const DEPLOYED_WASM_WITH_CTOR: &[u8] = include_bytes!("../doctest_fixtures/contract_with_constructor.wasm"); +//! #[contract] +//! pub struct Contract; +//! #[contractimpl] +//! impl Contract { +//! pub fn deploy_with_constructor(env: Env, wasm_hash: BytesN<32>) { +//! let salt = [1u8; 32]; +//! let deployer = env.deployer().with_current_contract(salt); +//! // Deployed contract address is deterministic and can be accessed +//! // before deploying the contract. +//! let _ = deployer.deployed_address(); +//! let contract_address = deployer.deploy_with_constructor( +//! wasm_hash, (1_u32, 2_i64).into_val(&env)); +//! } +//! } +//! #[test] +//! fn test() { //! # } +//! # #[cfg(feature = "testutils")] +//! # fn main() { +//! let env = Env::default(); +//! let contract_address = env.register_contract(None, Contract); +//! let contract = ContractClient::new(&env, &contract_address); +//! // Upload the contract code before deploying its instance. +//! let wasm_hash = env.deployer().upload_contract_wasm(DEPLOYED_WASM_WITH_CTOR); +//! contract.deploy_with_constructor(&wasm_hash); +//! } //! # #[cfg(not(feature = "testutils"))] //! # fn main() { } //! ``` use crate::{ - env::internal::Env as _, unwrap::UnwrapInfallible, Address, Bytes, BytesN, Env, IntoVal, + env::internal::Env as _, unwrap::UnwrapInfallible, Address, Bytes, BytesN, Env, IntoVal, Val, + Vec, }; /// Deployer provides access to deploying contracts. @@ -229,6 +269,31 @@ impl DeployerWithAddress { .unwrap_infallible(); unsafe { Address::unchecked_new(env.clone(), address_obj) } } + + /// Deploy a contract that uses Wasm executable with provided hash. + /// + /// `constructor_args` will be passed to the contract's constructor. + /// + /// The address of the deployed contract is defined by the deployer address + /// and provided salt. + /// + /// Returns the deployed contract's address. + pub fn deploy_with_constructor( + &self, + wasm_hash: impl IntoVal>, + constructor_args: Vec, + ) -> Address { + let env = &self.env; + let address_obj = env + .create_contract_with_constructor( + self.address.to_object(), + wasm_hash.into_val(env).to_object(), + self.salt.to_object(), + constructor_args.to_object(), + ) + .unwrap_infallible(); + unsafe { Address::unchecked_new(env.clone(), address_obj) } + } } pub struct DeployerWithAsset { diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 0b815e1ca..685621af5 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -504,7 +504,7 @@ impl Env { let rf = Rc::new(EmptySnapshotSource()); let info = internal::LedgerInfo { - protocol_version: 21, + protocol_version: 22, sequence_number: 0, timestamp: 0, network_id: [0; 32], @@ -582,9 +582,18 @@ impl Env { /// with that contract ID. Providing `None` causes the Env to generate a new /// contract ID that is assigned to the contract. /// + /// If a contract has a constructor defined, then it will be called with + /// no arguments. If a constructor takes arguments, use + /// `register_contract_with_constructor`. + /// /// Registering a contract that is already registered replaces it. + /// Use re-registration with caution as it does not exist in the real + /// (on-chain) environment. Specifically, the new contract's constructor + /// will be called again during re-registration. That behavior only exists + /// for this test utility and is not reproducible on-chain, where contract + /// Wasm updates don't cause constructor to be called. /// - /// Returns the contract ID of the registered contract. + /// Returns the address of the registered contract. /// /// ### Examples /// ``` @@ -612,6 +621,55 @@ impl Env { &self, contract_id: impl Into>, contract: T, + ) -> Address { + self.register_contract_with_constructor(contract_id, contract, crate::vec![&self]) + } + + /// Register a contract with the [Env] for testing. + /// + /// This acts the in the same fashion as `register_contract`, but allows + /// passing arguments to the contract's constructor. + /// + /// Passing a contract ID for the first arguments registers the contract + /// with that contract ID. Providing `None` causes the Env to generate a new + /// contract ID that is assigned to the contract. + /// + /// Registering a contract that is already registered replaces it. + /// Use re-registration with caution as it does not exist in the real + /// (on-chain) environment. Specifically, the new contract's constructor + /// will be called again during re-registration. That behavior only exists + /// for this test utility and is not reproducible on-chain, where contract + /// Wasm updates don't cause constructor to be called. + /// + /// Returns the address of the registered contract. + /// + /// ### Examples + /// ``` + /// use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol, IntoVal}; + /// + /// #[contract] + /// pub struct Contract; + /// + /// #[contractimpl] + /// impl Contract { + /// pub fn __constructor(_env: Env, _input: u32) { + /// } + /// } + /// + /// #[test] + /// fn test() { + /// # } + /// # fn main() { + /// let env = Env::default(); + /// let contract_id = env.register_contract_with_constructor( + /// None, Contract, (123_u32,).into_val(&env)); + /// } + /// ``` + pub fn register_contract_with_constructor<'a, T: ContractFunctionSet + 'static>( + &self, + contract_id: impl Into>, + contract: T, + constructor_args: Vec, ) -> Address { struct InternalContractFunctionSet(pub(crate) T); impl internal::ContractFunctionSet for InternalContractFunctionSet { @@ -642,23 +700,29 @@ impl Env { Address::generate(self) }; self.env_impl - .register_test_contract( + .register_test_contract_with_constructor( contract_id.to_object(), Rc::new(InternalContractFunctionSet(contract)), + constructor_args.to_object(), ) .unwrap(); contract_id } - /// Register a contract in a WASM file with the [Env] for testing. + /// Register a contract in a Wasm file with the [Env] for testing. /// /// Passing a contract ID for the first arguments registers the contract /// with that contract ID. Providing `None` causes the Env to generate a new /// contract ID that is assigned to the contract. /// /// Registering a contract that is already registered replaces it. + /// Use re-registration with caution as it does not exist in the real + /// (on-chain) environment. Specifically, the new contract's constructor + /// will be called again during re-registration. That behavior only exists + /// for this test utility and is not reproducible on-chain, where contract + /// Wasm updates don't cause constructor to be called. /// - /// Returns the contract ID of the registered contract. + /// Returns the address of the registered contract. /// /// ### Examples /// ``` @@ -683,6 +747,54 @@ impl Env { self.register_contract_with_optional_contract_id_and_executable( contract_id, xdr::ContractExecutable::Wasm(xdr::Hash(wasm_hash.into())), + crate::vec![&self], + ) + } + + /// Register a contract in a Wasm file with the [Env] for testing. + /// + /// This acts the in the same fashion as `register_contract`, but allows + /// passing arguments to the contract's constructor. + /// + /// Passing a contract ID for the first arguments registers the contract + /// with that contract ID. Providing `None` causes the Env to generate a new + /// contract ID that is assigned to the contract. + /// + /// Registering a contract that is already registered replaces it. + /// Use re-registration with caution as it does not exist in the real + /// (on-chain) environment. Specifically, the new contract's constructor + /// will be called again during re-registration. That behavior only exists + /// for this test utility and is not reproducible on-chain, where contract + /// Wasm updates don't cause constructor to be called. + /// + /// Returns the address of the registered contract. + /// + /// ### Examples + /// ``` + /// use soroban_sdk::{BytesN, Env, IntoVal}; + /// // This is Wasm for `constructor` test contract from this repo. + /// const WASM: &[u8] = include_bytes!("../doctest_fixtures/contract_with_constructor.wasm"); + /// + /// #[test] + /// fn test() { + /// # } + /// # fn main() { + /// let env = Env::default(); + /// env.register_contract_wasm_with_constructor( + /// None, WASM, (10_u32, 100_i64).into_val(&env)); + /// } + /// ``` + pub fn register_contract_wasm_with_constructor<'a>( + &self, + contract_id: impl Into>, + contract_wasm: impl IntoVal, + constructor_args: Vec, + ) -> Address { + let wasm_hash: BytesN<32> = self.deployer().upload_contract_wasm(contract_wasm); + self.register_contract_with_optional_contract_id_and_executable( + contract_id, + xdr::ContractExecutable::Wasm(xdr::Hash(wasm_hash.into())), + constructor_args, ) } @@ -783,32 +895,45 @@ impl Env { &self, contract_id: impl Into>, executable: xdr::ContractExecutable, + constructor_args: Vec, ) -> Address { if let Some(contract_id) = contract_id.into() { - self.register_contract_with_contract_id_and_executable(contract_id, executable); + self.register_contract_with_contract_id_and_executable( + contract_id, + executable, + constructor_args, + ); contract_id.clone() } else { - self.register_contract_with_source(executable) + self.register_contract_with_source(executable, constructor_args) } } - fn register_contract_with_source(&self, executable: xdr::ContractExecutable) -> Address { + fn register_contract_with_source( + &self, + executable: xdr::ContractExecutable, + constructor_args: Vec, + ) -> Address { let prev_auth_manager = self.env_impl.snapshot_auth_manager().unwrap(); self.env_impl.switch_to_recording_auth(true).unwrap(); - + let args_vec: std::vec::Vec = + constructor_args.iter().map(|v| v.into_val(self)).collect(); let contract_id: Address = self .env_impl - .invoke_function(xdr::HostFunction::CreateContract(xdr::CreateContractArgs { - contract_id_preimage: xdr::ContractIdPreimage::Address( - xdr::ContractIdPreimageFromAddress { - address: xdr::ScAddress::Contract(xdr::Hash( - self.with_generator(|mut g| g.address()), - )), - salt: xdr::Uint256([0; 32]), - }, - ), - executable, - })) + .invoke_function(xdr::HostFunction::CreateContractV2( + xdr::CreateContractArgsV2 { + contract_id_preimage: xdr::ContractIdPreimage::Address( + xdr::ContractIdPreimageFromAddress { + address: xdr::ScAddress::Contract(xdr::Hash( + self.with_generator(|mut g| g.address()), + )), + salt: xdr::Uint256([0; 32]), + }, + ), + executable, + constructor_args: args_vec.try_into().unwrap(), + }, + )) .unwrap() .try_into_val(self) .unwrap(); @@ -1207,6 +1332,7 @@ impl Env { &self, contract_address: &Address, executable: xdr::ContractExecutable, + constructor_args: Vec, ) { let contract_id = contract_address.contract_id(); let data_key = xdr::ScVal::LedgerKeyContractInstance; @@ -1243,6 +1369,9 @@ impl Env { ) }) .unwrap(); + self.env_impl + .call_constructor_for_stored_contract_unsafe(&contract_id, constructor_args.to_object()) + .unwrap(); } /// Run the function as if executed by the given contract ID. diff --git a/soroban-sdk/src/tests/contractimport.rs b/soroban-sdk/src/tests/contractimport.rs index 338567992..064188346 100644 --- a/soroban-sdk/src/tests/contractimport.rs +++ b/soroban-sdk/src/tests/contractimport.rs @@ -10,6 +10,13 @@ mod addcontract { ); } +mod addcontract_u128 { + use crate as soroban_sdk; + soroban_sdk::contractimport!( + file = "../target/wasm32-unknown-unknown/release/test_add_u128.wasm" + ); +} + mod subcontract { use crate as soroban_sdk; #[soroban_sdk::contract] @@ -69,10 +76,7 @@ fn test_register_at_id() { #[test] fn test_reregister_wasm() { let e = Env::default(); - - // Register a contract with code that will fail, to ensure this code isn't - // the code that gets activated when invoked. - let add_contract_id = e.register_contract_wasm(None, []); + let add_contract_id = e.register_contract_wasm(None, addcontract_u128::WASM); // Reregister the contract with different code replacing the code. This is // the contract we expect to be executed. e.register_contract_wasm(&add_contract_id, addcontract::WASM); diff --git a/soroban-sdk/src/tests/env.rs b/soroban-sdk/src/tests/env.rs index 3eb4a1e0e..1042045d0 100644 --- a/soroban-sdk/src/tests/env.rs +++ b/soroban-sdk/src/tests/env.rs @@ -2,6 +2,7 @@ use crate::{ self as soroban_sdk, contract, contractimpl, env::EnvTestConfig, testutils::{Address as _, Logs as _}, + xdr::{ScErrorCode, ScErrorType}, Address, Env, Error, }; @@ -59,15 +60,15 @@ fn default_and_from_snapshot_same_settings() { assert_eq!( r1, Err(Ok(Error::from_type_and_code( - stellar_xdr::curr::ScErrorType::Context, - stellar_xdr::curr::ScErrorCode::InvalidAction + ScErrorType::Context, + ScErrorCode::InvalidAction ))) ); assert_eq!( r2, Err(Ok(Error::from_type_and_code( - stellar_xdr::curr::ScErrorType::Context, - stellar_xdr::curr::ScErrorCode::InvalidAction + ScErrorType::Context, + ScErrorCode::InvalidAction ))) ); @@ -115,8 +116,8 @@ fn test_snapshot_file() { .join("test_snapshot_file"); let p1 = p.with_extension("1.json"); let p2 = p.with_extension("2.json"); - assert!(!p1.exists()); - assert!(!p2.exists()); + let _ = std::fs::remove_file(&p1); + let _ = std::fs::remove_file(&p2); { let e1 = Env::default(); assert!(!p1.exists()); @@ -157,9 +158,9 @@ fn test_snapshot_file_disabled() { .join("env") .join("test_snapshot_file_disabled"); let p1 = p.with_extension("1.json"); - assert!(!p1.exists()); let p2 = p.with_extension("2.json"); - assert!(!p2.exists()); + let _ = std::fs::remove_file(&p1); + let _ = std::fs::remove_file(&p2); { let e1 = Env::default(); let _ = e1.register_contract(None, Contract); @@ -173,7 +174,6 @@ fn test_snapshot_file_disabled() { assert!(p1.exists()); assert!(!p2.exists()); let _ = std::fs::remove_file(&p1); - let _ = std::fs::remove_file(&p2); } /// Test that the test snapshot file is not written when disabled after @@ -185,9 +185,9 @@ fn test_snapshot_file_disabled_after_creation() { .join("env") .join("test_snapshot_file_disabled_after_creation"); let p1 = p.with_extension("1.json"); - assert!(!p1.exists()); let p2 = p.with_extension("2.json"); - assert!(!p2.exists()); + let _ = std::fs::remove_file(&p1); + let _ = std::fs::remove_file(&p2); { let e1 = Env::default(); let _ = e1.register_contract(None, Contract); @@ -202,5 +202,4 @@ fn test_snapshot_file_disabled_after_creation() { assert!(p1.exists()); assert!(!p2.exists()); let _ = std::fs::remove_file(&p1); - let _ = std::fs::remove_file(&p2); } diff --git a/soroban-sdk/src/tests/token_spec.rs b/soroban-sdk/src/tests/token_spec.rs index d1df16e13..62e2d28ed 100644 --- a/soroban-sdk/src/tests/token_spec.rs +++ b/soroban-sdk/src/tests/token_spec.rs @@ -2,10 +2,8 @@ use crate as soroban_sdk; use soroban_sdk::{ token::{StellarAssetSpec, SPEC_XDR_INPUT, SPEC_XDR_LEN}, - xdr::{Error, ReadXdr, ScSpecEntry}, + xdr::{Error, Limited, Limits, ReadXdr, ScSpecEntry}, }; -use stellar_xdr::curr as stellar_xdr; -use stellar_xdr::{Limited, Limits}; extern crate std; diff --git a/soroban-sdk/src/testutils/mock_auth.rs b/soroban-sdk/src/testutils/mock_auth.rs index 1dc4b006f..ba2446d93 100644 --- a/soroban-sdk/src/testutils/mock_auth.rs +++ b/soroban-sdk/src/testutils/mock_auth.rs @@ -98,6 +98,9 @@ pub enum AuthorizedFunction { /// Create contract host function with arguments specified as the respective /// XDR. CreateContractHostFn(xdr::CreateContractArgs), + /// Create contract host function with arguments specified as the respective + /// XDR. Supports passing constructor arguments. + CreateContractV2HostFn(xdr::CreateContractArgsV2), } impl AuthorizedFunction { @@ -121,6 +124,9 @@ impl AuthorizedFunction { xdr::SorobanAuthorizedFunction::CreateContractHostFn(create_contract) => { Self::CreateContractHostFn(create_contract.clone()) } + xdr::SorobanAuthorizedFunction::CreateContractV2HostFn(create_contract) => { + Self::CreateContractV2HostFn(create_contract.clone()) + } } } } diff --git a/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json index 027f84d50..06c5515c0 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json index da2725b91..21793fb33 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json b/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json index a9484f33a..213e18be8 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json index da303c7a4..e78f65366 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json index da303c7a4..e78f65366 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json index cce06fe84..21d95ad18 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json b/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json index 7a5a85ab4..4d23c1f9d 100644 --- a/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json +++ b/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json b/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json index 478043979..18d58098c 100644 --- a/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json +++ b/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json b/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json index 1087c18af..ae81a7271 100644 --- a/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json +++ b/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json b/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json index 478043979..18d58098c 100644 --- a/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json +++ b/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json index 0bc673cab..ce85fe717 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json @@ -4,6 +4,8 @@ "nonce": 2 }, "auth": [ + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -29,6 +31,7 @@ } ] ], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -56,7 +59,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -219,6 +222,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", @@ -379,6 +430,30 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json index ecc3fd3cd..9c0b44e05 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json @@ -4,6 +4,9 @@ "nonce": 2 }, "auth": [ + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -54,7 +57,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -217,6 +220,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json index d49547637..2beb38f86 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json @@ -4,6 +4,9 @@ "nonce": 2 }, "auth": [ + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -31,7 +34,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -161,6 +164,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json index fa6af8b71..c9a06c04e 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json @@ -4,6 +4,9 @@ "nonce": 1 }, "auth": [ + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -25,7 +28,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -187,6 +190,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json index 50a5f4fc8..a91ddf4a4 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json @@ -4,10 +4,13 @@ "nonce": 1 }, "auth": [ + [], + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -136,6 +139,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json index 64b33dbb6..09a1053f4 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json @@ -4,6 +4,10 @@ "nonce": 2 }, "auth": [ + [], + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -42,7 +46,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -237,6 +241,102 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json index 50a5f4fc8..a91ddf4a4 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json @@ -4,10 +4,13 @@ "nonce": 1 }, "auth": [ + [], + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -136,6 +139,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json index 64b33dbb6..09a1053f4 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json @@ -4,6 +4,10 @@ "nonce": 2 }, "auth": [ + [], + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -42,7 +46,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -237,6 +241,102 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json index 50a5f4fc8..a91ddf4a4 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json @@ -4,10 +4,13 @@ "nonce": 1 }, "auth": [ + [], + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -136,6 +139,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json index a1631f20d..bad4a1c67 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json @@ -4,6 +4,9 @@ "nonce": 1 }, "auth": [ + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -40,7 +43,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -202,6 +205,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json index 10192dacb..f1a5cd6c4 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json @@ -4,10 +4,14 @@ "nonce": 2 }, "auth": [ + [], + [], + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -136,6 +140,102 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json b/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json index eff0c9a3d..a68dc04fe 100644 --- a/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json +++ b/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json index 527824c83..9de7e0839 100644 --- a/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json b/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json index 2f7ca74cd..61fea5bac 100644 --- a/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json b/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json index 3ada95c7a..3fac9a80e 100644 --- a/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_constructor/test_constructor.1.json b/soroban-sdk/test_snapshots/tests/contract_constructor/test_constructor.1.json new file mode 100644 index 000000000..330634091 --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/contract_constructor/test_constructor.1.json @@ -0,0 +1,572 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [], + [], + [], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 100 + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 100 + } + ] + }, + "durability": "persistent", + "val": { + "i64": 1000 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 200 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 200 + } + ] + }, + "durability": "temporary", + "val": { + "i64": 2000 + } + } + }, + "ext": "v0" + }, + 15 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 300 + } + ] + }, + "val": { + "i64": 3000 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": { + "vec": [ + { + "u32": 100 + }, + { + "i64": 1000 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 100 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": { + "i64": 1000 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 200 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": { + "i64": 2000 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 300 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": { + "i64": 3000 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 10 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 20 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 30 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json index 4dc2bfde5..af8f11937 100644 --- a/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json index c17018e5c..5be49b012 100644 --- a/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json index 527824c83..9de7e0839 100644 --- a/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json index 39bd24f50..501d34616 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json index 39bd24f50..501d34616 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json index 68ad1f6cb..878894489 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json index a8163c6df..4a9e1cecc 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json @@ -4,10 +4,12 @@ "nonce": 0 }, "auth": [ + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +106,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json index 96d34f578..94f207a1b 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json @@ -4,10 +4,12 @@ "nonce": 0 }, "auth": [ + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +106,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json index a6e9fcfbf..a726de9f8 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json @@ -4,10 +4,12 @@ "nonce": 0 }, "auth": [ + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +106,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json index 84b82a808..49002b38e 100644 --- a/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json index 8168b7713..a6c18a73d 100644 --- a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -103,6 +104,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json index b1d4826ac..98956a678 100644 --- a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json +++ b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +105,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json b/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json index 96ae62905..2353d179d 100644 --- a/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json @@ -37,10 +37,11 @@ [], [], [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -316,6 +317,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json b/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json index 678ebbf76..cfdc8b328 100644 --- a/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -118,6 +119,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json index 6105e64e0..3ff893143 100644 --- a/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json index cbea43c52..346661af3 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json index a6d5533a1..1164081d0 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json index d20344a9a..571fc657e 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json index e4257ad18..4f11f5976 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json index a2193ae62..92ff9f77f 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json index 07703559f..bf78f8aa1 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json index 146bb84ba..ade4aa57a 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json b/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json index 91da61ac2..4b402aa40 100644 --- a/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json +++ b/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json index f05af2ab7..08e8df210 100644 --- a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json +++ b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json index f05af2ab7..08e8df210 100644 --- a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json +++ b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json index da87fad36..eeba6aaa8 100644 --- a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json +++ b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json @@ -3,9 +3,11 @@ "address": 3, "nonce": 0 }, - "auth": [], + "auth": [ + [] + ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -133,5 +135,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json index 8e89d5f7a..f5d8d693b 100644 --- a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json +++ b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json @@ -3,9 +3,13 @@ "address": 3, "nonce": 0 }, - "auth": [], + "auth": [ + [], + [], + [] + ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -133,5 +137,78 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json index 8e89d5f7a..f5d8d693b 100644 --- a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json +++ b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json @@ -3,9 +3,13 @@ "address": 3, "nonce": 0 }, - "auth": [], + "auth": [ + [], + [], + [] + ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -133,5 +137,78 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json b/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json index c7b77d6a8..b99642f31 100644 --- a/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json +++ b/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 1, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json index 48fb8a082..ba887f196 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json @@ -3,9 +3,11 @@ "address": 1, "nonce": 0 }, - "auth": [], + "auth": [ + [] + ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -70,6 +72,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json index 4a934efea..61bf62183 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -71,5 +72,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json index af654ea29..8bc8cc04d 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,5 +73,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json b/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json index af654ea29..8bc8cc04d 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,5 +73,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json index 1fd4d130b..1623c9bfa 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -211,5 +212,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json index 0f6ac424c..7282f9d39 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 2000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -102,5 +103,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json index 887578848..fea6c0bf6 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json @@ -3,9 +3,11 @@ "address": 1, "nonce": 0 }, - "auth": [], + "auth": [ + [] + ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 1100, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -101,6 +103,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json index 9bfeafb32..b3e4a5f66 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json @@ -12,10 +12,12 @@ [], [], [], + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -235,5 +237,54 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json index 680eeac45..24d5bedfe 100644 --- a/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json +++ b/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json @@ -25,7 +25,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json index f1f70a18d..656edbec9 100644 --- a/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json +++ b/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json @@ -27,6 +27,7 @@ [], [], [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", @@ -61,7 +62,7 @@ [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -590,6 +591,30 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json index 3e380b061..39be11258 100644 --- a/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json +++ b/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json @@ -26,6 +26,8 @@ [], [], [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", @@ -60,7 +62,7 @@ [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -621,6 +623,30 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", @@ -762,6 +788,30 @@ }, "failed_call": false }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000004" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json index 7a5a85ab4..4d23c1f9d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json index 69499ccea..6817fc85d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json index 69499ccea..6817fc85d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json b/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json index 7a5a85ab4..4d23c1f9d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json b/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json index 7a5a85ab4..4d23c1f9d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json index 69499ccea..6817fc85d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json index 69499ccea..6817fc85d 100644 --- a/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json +++ b/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json @@ -5,7 +5,7 @@ }, "auth": [], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", diff --git a/tests/account/test_snapshots/test/test.1.json b/tests/account/test_snapshots/test/test.1.json index cf124af58..85d5a7be0 100644 --- a/tests/account/test_snapshots/test/test.1.json +++ b/tests/account/test_snapshots/test/test.1.json @@ -4,6 +4,8 @@ "nonce": 1 }, "auth": [ + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -21,7 +23,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -151,6 +153,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/add_i128/test_snapshots/test/test_add.1.json b/tests/add_i128/test_snapshots/test/test_add.1.json index b67eb63f9..d6e20d3c9 100644 --- a/tests/add_i128/test_snapshots/test/test_add.1.json +++ b/tests/add_i128/test_snapshots/test/test_add.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/add_u128/test_snapshots/test/test_add.1.json b/tests/add_u128/test_snapshots/test/test_add.1.json index bff12f920..c64d76c67 100644 --- a/tests/add_u128/test_snapshots/test/test_add.1.json +++ b/tests/add_u128/test_snapshots/test/test_add.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/add_u64/test_snapshots/test/test_add.1.json b/tests/add_u64/test_snapshots/test/test_add.1.json index 606b3638f..f499591f5 100644 --- a/tests/add_u64/test_snapshots/test/test_add.1.json +++ b/tests/add_u64/test_snapshots/test/test_add.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/alloc/test_snapshots/test/test_add.1.json b/tests/alloc/test_snapshots/test/test_add.1.json index 42f0b0c15..be04b5177 100644 --- a/tests/alloc/test_snapshots/test/test_add.1.json +++ b/tests/alloc/test_snapshots/test/test_add.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json b/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json index c13cd551f..5f5678503 100644 --- a/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json @@ -4,6 +4,7 @@ "nonce": 0 }, "auth": [ + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -25,7 +26,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -123,6 +124,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json b/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json index b751d418e..610171372 100644 --- a/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json @@ -4,6 +4,8 @@ "nonce": 1 }, "auth": [ + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -25,7 +27,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -155,6 +157,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json index 5d7cf6747..a2d217a92 100644 --- a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json @@ -4,6 +4,8 @@ "nonce": 0 }, "auth": [ + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", @@ -25,7 +27,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -155,6 +157,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json index 2ca569b28..0778898d1 100644 --- a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json @@ -4,10 +4,12 @@ "nonce": 0 }, "auth": [ + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +106,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json b/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json index 41feb264a..15fa5011d 100644 --- a/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json @@ -4,6 +4,8 @@ "nonce": 0 }, "auth": [ + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -43,7 +45,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -173,6 +175,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json b/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json index 253f9b48e..9453770f6 100644 --- a/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json @@ -4,6 +4,9 @@ "nonce": 1 }, "auth": [ + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -43,7 +46,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -205,6 +208,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json index 7243c9a81..4141e6ef8 100644 --- a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json @@ -4,6 +4,9 @@ "nonce": 0 }, "auth": [ + [], + [], + [], [ [ "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", @@ -43,7 +46,7 @@ ] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -205,6 +208,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json index 3df3cc2b3..c609c75ec 100644 --- a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json @@ -4,10 +4,13 @@ "nonce": 0 }, "auth": [ + [], + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -136,6 +139,78 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000003" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/constructor/Cargo.toml b/tests/constructor/Cargo.toml new file mode 100644 index 000000000..ea1bf21a1 --- /dev/null +++ b/tests/constructor/Cargo.toml @@ -0,0 +1,18 @@ +[package] +name = "test_constructor" +version.workspace = true +authors = ["Stellar Development Foundation "] +license = "Apache-2.0" +edition = "2021" +publish = false +rust-version.workspace = true + +[lib] +crate-type = ["cdylib"] +doctest = false + +[dependencies] +soroban-sdk = {path = "../../soroban-sdk"} + +[dev-dependencies] +soroban-sdk = {path = "../../soroban-sdk", features = ["testutils"]} diff --git a/tests/constructor/src/lib.rs b/tests/constructor/src/lib.rs new file mode 100644 index 000000000..dd7a82eab --- /dev/null +++ b/tests/constructor/src/lib.rs @@ -0,0 +1,85 @@ +#![no_std] +#[cfg(test)] +use soroban_sdk::IntoVal; +use soroban_sdk::{contract, contractimpl, contracttype, Env}; + +#[contract] +pub struct Contract; + +#[contracttype] +pub enum DataKey { + Persistent(u32), + Temp(u32), + Instance(u32), +} + +#[contractimpl] +impl Contract { + pub fn __constructor(env: Env, init_key: u32, init_value: i64) { + env.storage() + .persistent() + .set(&DataKey::Persistent(init_key), &init_value); + env.storage() + .temporary() + .set(&DataKey::Temp(init_key * 2), &(init_value * 2)); + env.storage() + .instance() + .set(&DataKey::Instance(init_key * 3), &(init_value * 3)); + } + + pub fn get_data(env: Env, key: DataKey) -> Option { + match key { + DataKey::Persistent(_) => env.storage().persistent().get(&key), + DataKey::Temp(_) => env.storage().temporary().get(&key), + DataKey::Instance(_) => env.storage().instance().get(&key), + } + } +} + +#[test] +fn test_constructor() { + let env = Env::default(); + let contract_id = + env.register_contract_with_constructor(None, Contract, (100_u32, 1000_i64).into_val(&env)); + let client = ContractClient::new(&env, &contract_id); + assert_eq!(client.get_data(&DataKey::Persistent(100)), Some(1000)); + assert_eq!(client.get_data(&DataKey::Temp(200)), Some(2000)); + assert_eq!(client.get_data(&DataKey::Instance(300)), Some(3000)); + + assert_eq!(client.get_data(&DataKey::Persistent(10)), None); + assert_eq!(client.get_data(&DataKey::Temp(20)), None); + assert_eq!(client.get_data(&DataKey::Instance(30)), None) +} + +#[test] +#[should_panic(expected = "constructor invocation has failed with error")] +fn test_passing_no_constructor_arguments_causes_panic() { + let env = Env::default(); + let _ = env.register_contract(None, Contract); +} + +#[test] +#[should_panic(expected = "constructor invocation has failed with error")] +fn test_missing_constructor_arguments_causes_panic() { + let env = Env::default(); + let _ = env.register_contract_with_constructor(None, Contract, (100_u32,).into_val(&env)); +} + +#[test] +#[should_panic(expected = "constructor invocation has failed with error")] +fn test_passing_extra_constructor_arguments_causes_panic() { + let env = Env::default(); + let _ = env.register_contract_with_constructor( + None, + Contract, + (100_u32, 1000_i64, 123_u32).into_val(&env), + ); +} + +#[test] +#[should_panic(expected = "constructor invocation has failed with error")] +fn test_passing_incorrectly_typed_constructor_arguments_causes_panic() { + let env = Env::default(); + let _ = + env.register_contract_with_constructor(None, Contract, (100_u32, 1000_u32).into_val(&env)); +} diff --git a/tests/constructor/test_snapshots/test/test_constructor.1.json b/tests/constructor/test_snapshots/test/test_constructor.1.json new file mode 100644 index 000000000..330634091 --- /dev/null +++ b/tests/constructor/test_snapshots/test/test_constructor.1.json @@ -0,0 +1,572 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [], + [], + [], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 100 + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 100 + } + ] + }, + "durability": "persistent", + "val": { + "i64": 1000 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 200 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 200 + } + ] + }, + "durability": "temporary", + "val": { + "i64": 2000 + } + } + }, + "ext": "v0" + }, + 15 + ] + ], + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 300 + } + ] + }, + "val": { + "i64": 3000 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": { + "vec": [ + { + "u32": 100 + }, + { + "i64": 1000 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 100 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": { + "i64": 1000 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 200 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": { + "i64": 2000 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 300 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": { + "i64": 3000 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 10 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 20 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "get_data" + } + ], + "data": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 30 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "get_data" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json new file mode 100644 index 000000000..bd6313155 --- /dev/null +++ b/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json @@ -0,0 +1,188 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": { + "u32": 100 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "log" + } + ], + "data": { + "vec": [ + { + "string": "caught panic 'invalid number of input arguments: 2 expected, got 1' from contract function 'Symbol(obj#7)'" + }, + { + "u32": 100 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "context": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "constructor invocation has failed with error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json new file mode 100644 index 000000000..d2902128a --- /dev/null +++ b/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json @@ -0,0 +1,204 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": { + "vec": [ + { + "u32": 100 + }, + { + "i64": 1000 + }, + { + "u32": 123 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "log" + } + ], + "data": { + "vec": [ + { + "string": "caught panic 'invalid number of input arguments: 2 expected, got 3' from contract function 'Symbol(obj#7)'" + }, + { + "u32": 100 + }, + { + "i64": 1000 + }, + { + "u32": 123 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "context": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "constructor invocation has failed with error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json new file mode 100644 index 000000000..704a91992 --- /dev/null +++ b/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json @@ -0,0 +1,198 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": { + "vec": [ + { + "u32": 100 + }, + { + "u32": 1000 + } + ] + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "log" + } + ], + "data": { + "vec": [ + { + "string": "caught panic 'called `Result::unwrap()` on an `Err` value: Error(Value, UnexpectedType)' from contract function 'Symbol(obj#7)'" + }, + { + "u32": 100 + }, + { + "u32": 1000 + } + ] + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "context": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "constructor invocation has failed with error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json new file mode 100644 index 000000000..84b708ad5 --- /dev/null +++ b/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json @@ -0,0 +1,179 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "log" + } + ], + "data": { + "string": "caught panic 'invalid number of input arguments: 2 expected, got 0' from contract function 'Symbol(obj#7)'" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ], + "data": { + "string": "caught error from function" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "context": "invalid_action" + } + } + ], + "data": { + "vec": [ + { + "string": "constructor invocation has failed with error" + }, + { + "error": { + "wasm_vm": "invalid_action" + } + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/tests/empty/test_snapshots/test/test_hello.1.json b/tests/empty/test_snapshots/test/test_hello.1.json index 21049c75b..a1bc290f8 100644 --- a/tests/empty/test_snapshots/test/test_hello.1.json +++ b/tests/empty/test_snapshots/test/test_hello.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/empty2/test_snapshots/test/test_hello.1.json b/tests/empty2/test_snapshots/test/test_hello.1.json index a9c9276f9..b2f09122b 100644 --- a/tests/empty2/test_snapshots/test/test_hello.1.json +++ b/tests/empty2/test_snapshots/test/test_hello.1.json @@ -3,9 +3,11 @@ "address": 1, "nonce": 0 }, - "auth": [], + "auth": [ + [] + ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -69,5 +71,30 @@ ] ] }, - "events": [] + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/hello_ok.1.json b/tests/errors/test_snapshots/test/hello_ok.1.json index 09d9d3ab0..9040706b0 100644 --- a/tests/errors/test_snapshots/test/hello_ok.1.json +++ b/tests/errors/test_snapshots/test/hello_ok.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +105,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/errors/test_snapshots/test/try_hello_error.1.json b/tests/errors/test_snapshots/test/try_hello_error.1.json index bc8d10299..d30e75747 100644 --- a/tests/errors/test_snapshots/test/try_hello_error.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/errors/test_snapshots/test/try_hello_error_panic.1.json b/tests/errors/test_snapshots/test/try_hello_error_panic.1.json index 89b76c30b..2a64a0242 100644 --- a/tests/errors/test_snapshots/test/try_hello_error_panic.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error_panic.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json b/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json index ed3afa788..05af76eee 100644 --- a/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json b/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json index 6825a47bb..076431c14 100644 --- a/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/errors/test_snapshots/test/try_hello_ok.1.json b/tests/errors/test_snapshots/test/try_hello_ok.1.json index 09d9d3ab0..9040706b0 100644 --- a/tests/errors/test_snapshots/test/try_hello_ok.1.json +++ b/tests/errors/test_snapshots/test/try_hello_ok.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +105,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/events/test_snapshots/test/test_pub_event.1.json b/tests/events/test_snapshots/test/test_pub_event.1.json index f113fabe9..a5f4a020d 100644 --- a/tests/events/test_snapshots/test/test_pub_event.1.json +++ b/tests/events/test_snapshots/test/test_pub_event.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/invoke_contract/test_snapshots/test/test_add.1.json b/tests/invoke_contract/test_snapshots/test/test_add.1.json index c1a85ba11..d4b21d010 100644 --- a/tests/invoke_contract/test_snapshots/test/test_add.1.json +++ b/tests/invoke_contract/test_snapshots/test/test_add.1.json @@ -4,10 +4,12 @@ "nonce": 0 }, "auth": [ + [], + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -104,6 +106,54 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000002" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/logging/test_snapshots/test/test_logging.1.json b/tests/logging/test_snapshots/test/test_logging.1.json index 882b2bf42..b6e6e2f64 100644 --- a/tests/logging/test_snapshots/test/test_logging.1.json +++ b/tests/logging/test_snapshots/test/test_logging.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/modular/test_snapshots/test/test.1.json b/tests/modular/test_snapshots/test/test.1.json index d3cd4a318..7a98167ea 100644 --- a/tests/modular/test_snapshots/test/test.1.json +++ b/tests/modular/test_snapshots/test/test.1.json @@ -4,12 +4,13 @@ "nonce": 0 }, "auth": [ + [], [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -74,6 +75,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/multiimpl/test_snapshots/test/test_hello.1.json b/tests/multiimpl/test_snapshots/test/test_hello.1.json index 5cd9dc09b..bc2819204 100644 --- a/tests/multiimpl/test_snapshots/test/test_hello.1.json +++ b/tests/multiimpl/test_snapshots/test/test_hello.1.json @@ -4,12 +4,13 @@ "nonce": 0 }, "auth": [ + [], [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -74,6 +75,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/udt/test_snapshots/test/test_add.1.json b/tests/udt/test_snapshots/test/test_add.1.json index 42b5be82c..14d487e1e 100644 --- a/tests/udt/test_snapshots/test/test_add.1.json +++ b/tests/udt/test_snapshots/test/test_add.1.json @@ -4,11 +4,12 @@ "nonce": 0 }, "auth": [ + [], [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,6 +74,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", diff --git a/tests/workspace_contract/test_snapshots/test/test_add.1.json b/tests/workspace_contract/test_snapshots/test/test_add.1.json index 7bfe976a6..972d82299 100644 --- a/tests/workspace_contract/test_snapshots/test/test_add.1.json +++ b/tests/workspace_contract/test_snapshots/test/test_add.1.json @@ -4,10 +4,11 @@ "nonce": 0 }, "auth": [ + [], [] ], "ledger": { - "protocol_version": 21, + "protocol_version": 22, "sequence_number": 0, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -72,6 +73,30 @@ ] }, "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, { "event": { "ext": "v0", From f314be9d0e301f9855ba4b264283cfe06ed2a118 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 19 Sep 2024 02:36:45 +1000 Subject: [PATCH 29/57] Add Address::from_str (#1342) ### What Add `Address::from_str`. ### Why For convenient conversions directly from a &str to an Address in tests: ```rust Address::from_str(&env, "C...") ``` It is possible to do the same with: ```rust Address::from_string(String::from_str(&env, "C...")) ``` But that is so verbose, the nested fn calls often get rustfmted to span multiple lines. --- soroban-sdk/src/address.rs | 12 ++++++++++++ soroban-sdk/src/tests/address.rs | 13 +++++++++++++ 2 files changed, 25 insertions(+) diff --git a/soroban-sdk/src/address.rs b/soroban-sdk/src/address.rs index 46196c7f5..dfed7f87a 100644 --- a/soroban-sdk/src/address.rs +++ b/soroban-sdk/src/address.rs @@ -223,6 +223,18 @@ impl Address { self.env.require_auth(self); } + /// Creates an `Address` corresponding to the provided Stellar strkey. + /// + /// The only supported strkey types are account keys (`G...`) and contract keys (`C...`). Any + /// other valid or invalid strkey will cause this to panic. + /// + /// Prefer using the `Address` directly as input or output argument. Only + /// use this in special cases when addresses need to be shared between + /// different environments (e.g. different chains). + pub fn from_str(env: &Env, strkey: &str) -> Address { + Address::from_string(&String::from_str(env, strkey)) + } + /// Creates an `Address` corresponding to the provided Stellar strkey. /// /// The only supported strkey types are account keys (`G...`) and contract keys (`C...`). Any diff --git a/soroban-sdk/src/tests/address.rs b/soroban-sdk/src/tests/address.rs index 196112cd5..82008392b 100644 --- a/soroban-sdk/src/tests/address.rs +++ b/soroban-sdk/src/tests/address.rs @@ -1,5 +1,18 @@ use crate::{Address, Bytes, Env, String, TryIntoVal}; +#[test] +fn test_account_address_str_conversions() { + let env = Env::default(); + + let strkey = "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ"; + + let address = Address::from_str(&env, &strkey); + assert_eq!( + address.to_string().to_string(), + "GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ" + ); +} + #[test] fn test_account_address_conversions() { let env = Env::default(); From b75dd585ff037028f1672e6725b5c021b5b96bf4 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 19 Sep 2024 07:00:57 +1000 Subject: [PATCH 30/57] Support calling ctors with tuples (#1340) ### What Support calling ctors with tuples directly. ### Why This is a pattern we used with event publishing which also accepts tuples directly. It allows a user to call: ```rust env.register_contract_with_constructor(None, Contract, (a, b, c)) ``` Instead of: ```rust env.register_contract_with_constructor(None, Contract, (a, b, c).into_val(&env)); ``` --- soroban-sdk/src/env.rs | 22 +- soroban-sdk/src/testutils.rs | 33 +- tests/constructor/src/lib.rs | 16 +- .../test/test_constructor.1.json | 572 ------------------ .../test_snapshots}/test_constructor.1.json | 0 5 files changed, 49 insertions(+), 594 deletions(-) delete mode 100644 tests/constructor/test_snapshots/test/test_constructor.1.json rename {soroban-sdk/test_snapshots/tests/contract_constructor => tests/constructor/test_snapshots}/test_constructor.1.json (100%) diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 685621af5..bc4ffec17 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -453,9 +453,9 @@ impl Env { use crate::{ auth, testutils::{ - budget::Budget, Address as _, AuthSnapshot, AuthorizedInvocation, ContractFunctionSet, - EventsSnapshot, Generators, Ledger as _, MockAuth, MockAuthContract, Snapshot, - StellarAssetContract, StellarAssetIssuer, + budget::Budget, Address as _, AuthSnapshot, AuthorizedInvocation, ConstructorArgs, + ContractFunctionSet, EventsSnapshot, Generators, Ledger as _, MockAuth, MockAuthContract, + Snapshot, StellarAssetContract, StellarAssetIssuer, }, Bytes, BytesN, }; @@ -622,7 +622,7 @@ impl Env { contract_id: impl Into>, contract: T, ) -> Address { - self.register_contract_with_constructor(contract_id, contract, crate::vec![&self]) + self.register_contract_with_constructor(contract_id, contract, ()) } /// Register a contract with the [Env] for testing. @@ -645,7 +645,7 @@ impl Env { /// /// ### Examples /// ``` - /// use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol, IntoVal}; + /// use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol}; /// /// #[contract] /// pub struct Contract; @@ -662,14 +662,18 @@ impl Env { /// # fn main() { /// let env = Env::default(); /// let contract_id = env.register_contract_with_constructor( - /// None, Contract, (123_u32,).into_val(&env)); + /// None, Contract, (123_u32,)); /// } /// ``` - pub fn register_contract_with_constructor<'a, T: ContractFunctionSet + 'static>( + pub fn register_contract_with_constructor< + 'a, + T: ContractFunctionSet + 'static, + A: ConstructorArgs, + >( &self, contract_id: impl Into>, contract: T, - constructor_args: Vec, + constructor_args: A, ) -> Address { struct InternalContractFunctionSet(pub(crate) T); impl internal::ContractFunctionSet for InternalContractFunctionSet { @@ -703,7 +707,7 @@ impl Env { .register_test_contract_with_constructor( contract_id.to_object(), Rc::new(InternalContractFunctionSet(contract)), - constructor_args.to_object(), + constructor_args.into_val(self).to_object(), ) .unwrap(); contract_id diff --git a/soroban-sdk/src/testutils.rs b/soroban-sdk/src/testutils.rs index 7df726f64..61b7e0ef3 100644 --- a/soroban-sdk/src/testutils.rs +++ b/soroban-sdk/src/testutils.rs @@ -18,11 +18,42 @@ use soroban_env_host::TryIntoVal; pub mod storage; -use crate::{xdr, Env, Val, Vec}; +use crate::{xdr, Env, IntoVal, Val, Vec}; use soroban_ledger_snapshot::LedgerSnapshot; pub use crate::env::EnvTestConfig; +pub trait ConstructorArgs: IntoVal> {} + +impl ConstructorArgs for Vec {} + +macro_rules! impl_constructor_args_for_tuple { + ( $($typ:ident $idx:tt)* ) => { + impl<$($typ),*> ConstructorArgs for ($($typ,)*) + where + $($typ: IntoVal),* + { + } + }; +} + +// 0 topics +impl ConstructorArgs for () {} +// 1-13 topics +impl_constructor_args_for_tuple! { T0 0 } +impl_constructor_args_for_tuple! { T0 0 T1 1 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 T11 11 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 T11 11 T12 12 } + #[derive(Default, Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] pub struct Snapshot { diff --git a/tests/constructor/src/lib.rs b/tests/constructor/src/lib.rs index dd7a82eab..cdaa2a33f 100644 --- a/tests/constructor/src/lib.rs +++ b/tests/constructor/src/lib.rs @@ -1,6 +1,4 @@ #![no_std] -#[cfg(test)] -use soroban_sdk::IntoVal; use soroban_sdk::{contract, contractimpl, contracttype, Env}; #[contract] @@ -39,8 +37,7 @@ impl Contract { #[test] fn test_constructor() { let env = Env::default(); - let contract_id = - env.register_contract_with_constructor(None, Contract, (100_u32, 1000_i64).into_val(&env)); + let contract_id = env.register_contract_with_constructor(None, Contract, (100_u32, 1000_i64)); let client = ContractClient::new(&env, &contract_id); assert_eq!(client.get_data(&DataKey::Persistent(100)), Some(1000)); assert_eq!(client.get_data(&DataKey::Temp(200)), Some(2000)); @@ -62,24 +59,19 @@ fn test_passing_no_constructor_arguments_causes_panic() { #[should_panic(expected = "constructor invocation has failed with error")] fn test_missing_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = env.register_contract_with_constructor(None, Contract, (100_u32,).into_val(&env)); + let _ = env.register_contract_with_constructor(None, Contract, (100_u32,)); } #[test] #[should_panic(expected = "constructor invocation has failed with error")] fn test_passing_extra_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = env.register_contract_with_constructor( - None, - Contract, - (100_u32, 1000_i64, 123_u32).into_val(&env), - ); + let _ = env.register_contract_with_constructor(None, Contract, (100_u32, 1000_i64, 123_u32)); } #[test] #[should_panic(expected = "constructor invocation has failed with error")] fn test_passing_incorrectly_typed_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = - env.register_contract_with_constructor(None, Contract, (100_u32, 1000_u32).into_val(&env)); + let _ = env.register_contract_with_constructor(None, Contract, (100_u32, 1000_u32)); } diff --git a/tests/constructor/test_snapshots/test/test_constructor.1.json b/tests/constructor/test_snapshots/test/test_constructor.1.json deleted file mode 100644 index 330634091..000000000 --- a/tests/constructor/test_snapshots/test/test_constructor.1.json +++ /dev/null @@ -1,572 +0,0 @@ -{ - "generators": { - "address": 1, - "nonce": 0 - }, - "auth": [ - [], - [], - [], - [], - [], - [], - [] - ], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 100 - } - ] - }, - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 100 - } - ] - }, - "durability": "persistent", - "val": { - "i64": 1000 - } - } - }, - "ext": "v0" - }, - 4095 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 200 - } - ] - }, - "durability": "temporary" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 200 - } - ] - }, - "durability": "temporary", - "val": { - "i64": 2000 - } - } - }, - "ext": "v0" - }, - 15 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Instance" - }, - { - "u32": 300 - } - ] - }, - "val": { - "i64": 3000 - } - } - ] - } - } - } - }, - "ext": "v0" - }, - 4095 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" - }, - 4095 - ] - ] - ] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": { - "vec": [ - { - "u32": 100 - }, - { - "i64": 1000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 100 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": { - "i64": 1000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": { - "i64": 2000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Instance" - }, - { - "u32": 300 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": { - "i64": 3000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 10 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 20 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Instance" - }, - { - "u32": 30 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_constructor/test_constructor.1.json b/tests/constructor/test_snapshots/test_constructor.1.json similarity index 100% rename from soroban-sdk/test_snapshots/tests/contract_constructor/test_constructor.1.json rename to tests/constructor/test_snapshots/test_constructor.1.json From 1367be1ad293e8b75cb6de5814a88391a69562b8 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:33:52 +1000 Subject: [PATCH 31/57] Fix warnings on contract and contractimpl macros (#1344) ### What Fix and disable warnings on contract and contractimpl macros for misformatted item names, and missing fns. ### Why Starting with the last release warnings started to display on the contract and contractimpl macros because of generated code not following the naming conventions for some items. In one case it is easier to fix the naming convention, and so that is what was done. In the other case it is easier to silence the warning, and so that is what was done. One of the warnings was about a missing function. In this case I think there's an issue with rust-analyzer and how we were generating two dependent parts of code different ways. In one are we were always generating the code feature gated, in the other we were generating it only based on the feature. Rust-analyzer doesn't rebuild proc-macros frequently, and so I think caching of generated code that then had the feature off was to blame. ### Backporting This change should be backported to the 21 versions as a patch on 21.7 after merging to main. --- soroban-sdk-macros/src/derive_fn.rs | 2 ++ soroban-sdk-macros/src/derive_spec_fn.rs | 2 ++ soroban-sdk-macros/src/lib.rs | 18 ++++++++---------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/soroban-sdk-macros/src/derive_fn.rs b/soroban-sdk-macros/src/derive_fn.rs index a980cb0f3..73c4d50b3 100644 --- a/soroban-sdk-macros/src/derive_fn.rs +++ b/soroban-sdk-macros/src/derive_fn.rs @@ -193,7 +193,9 @@ pub fn derive_contract_function_registration_ctor<'a>( quote! { #[doc(hidden)] + #[cfg(any(test, feature = "testutils"))] #[#crate_path::reexports_for_macros::ctor::ctor] + #[allow(non_snake_case)] fn #ctor_ident() { #( <#ty as #crate_path::testutils::ContractFunctionRegister>::register( diff --git a/soroban-sdk-macros/src/derive_spec_fn.rs b/soroban-sdk-macros/src/derive_spec_fn.rs index a759cc477..2c0afe999 100644 --- a/soroban-sdk-macros/src/derive_spec_fn.rs +++ b/soroban-sdk-macros/src/derive_spec_fn.rs @@ -166,11 +166,13 @@ pub fn derive_fn_spec( Ok(quote! { #[doc(hidden)] #[allow(non_snake_case)] + #[allow(non_upper_case_globals)] #(#attrs)* #export_attr pub static #spec_ident: [u8; #spec_xdr_len] = #ty::#spec_fn_ident(); impl #ty { + #[allow(non_snake_case)] #(#attrs)* pub const fn #spec_fn_ident() -> [u8; #spec_xdr_len] { *#spec_xdr_lit diff --git a/soroban-sdk-macros/src/lib.rs b/soroban-sdk-macros/src/lib.rs index b66c1da63..69231f92c 100644 --- a/soroban-sdk-macros/src/lib.rs +++ b/soroban-sdk-macros/src/lib.rs @@ -133,7 +133,7 @@ pub fn contract(metadata: TokenStream, input: TokenStream) -> TokenStream { let ty_str = quote!(#ty).to_string(); let client_ident = format!("{ty_str}Client"); - let fn_set_registry_ident = format_ident!("__{ty_str}_fn_set_registry"); + let fn_set_registry_ident = format_ident!("__{}_fn_set_registry", ty_str.to_lowercase()); let crate_path = &args.crate_path; let client = derive_client_type(&args.crate_path, &ty_str, &client_ident); let mut output = quote! { @@ -244,15 +244,13 @@ pub fn contractimpl(metadata: TokenStream, input: TokenStream) -> TokenStream { #imp #derived_ok }; - if cfg!(feature = "testutils") { - let cfs = derive_contract_function_registration_ctor( - crate_path, - ty, - trait_ident, - pub_methods.into_iter(), - ); - output.extend(quote! { #cfs }); - } + let cfs = derive_contract_function_registration_ctor( + crate_path, + ty, + trait_ident, + pub_methods.into_iter(), + ); + output.extend(quote! { #cfs }); output.into() } Err(derived_err) => quote! { From 9507fc4e68677199171a8a7b263458d435ae15a2 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 24 Sep 2024 17:57:50 +1000 Subject: [PATCH 32/57] Add `register` and `register_at` fns to replace `register_contract`, `register_contract_with_constructor`, `register_contract_wasm`, `register_contract_wasm_with_constructor` (#1343) ### What Add `register` and `register_at` fns. Deprecate `register_contract` and `register_contract_wasm`. Unexport `register_contract_with_constructor` and `register_contract_wasm_with_constructor`. ### Why To reorient the register functions around what we expect the common cases to be: - registering without a contract id specified - registering with a constructor specified It's always been odd that the first parameter to most `register_contract` calls is `None`. It's confusing to look at the first time you see it, and for the most part most developers do not need to set a value for the contract id. Most contracts need initialization, and therefore I think most contracts over time will gain constructors. To do so in a way that is backwards compatible with previous releases. Close https://github.com/stellar/rs-soroban-sdk/issues/1341 ### Known limitations It would be better imo if we could add the constructor arguments to the existing `register_contract` and `register_contract_wasm` fns, but that would be a breaking change. The `deploy_with_constructor` functions still exist which is inconsistent, but harder to align because to change the `deploy` function to always accept constructor args would be a breaking change. It's possible to update code that uses the existing register functions using a regex find and replace, but it's not the most trivial regex to work out. If folks wish to resolve the deprecation warning they'll need to update potentially every test they've written. That in itself is not a great developer experience. The old and new way don't look that different, and so for existing Soroban developers, the change from the old to new way may be confusing at a glance. This PR doesn't touch the register stellar asset contract functions at all. Ideas? --- soroban-sdk/README.md | 2 +- soroban-sdk/src/deploy.rs | 4 +- soroban-sdk/src/env.rs | 198 +++++++++++++----- soroban-sdk/src/events.rs | 2 +- soroban-sdk/src/ledger.rs | 2 +- soroban-sdk/src/lib.rs | 20 +- soroban-sdk/src/prng.rs | 14 +- soroban-sdk/src/storage.rs | 2 +- soroban-sdk/src/tests/auth/auth_10_one.rs | 2 +- .../src/tests/auth/auth_15_one_repeat.rs | 2 +- .../auth/auth_17_no_consume_requirement.rs | 2 +- .../tests/auth/auth_20_deep_one_address.rs | 8 +- .../auth/auth_30_deep_one_address_repeat.rs | 8 +- ...auth_35_deep_one_address_repeat_grouped.rs | 8 +- .../tests/auth/auth_40_multi_one_address.rs | 8 +- soroban-sdk/src/tests/budget.rs | 2 +- soroban-sdk/src/tests/contract_add_i32.rs | 2 +- soroban-sdk/src/tests/contract_assert.rs | 4 +- soroban-sdk/src/tests/contract_docs.rs | 2 +- soroban-sdk/src/tests/contract_duration.rs | 2 +- soroban-sdk/src/tests/contract_fn.rs | 2 +- soroban-sdk/src/tests/contract_invoke.rs | 6 +- .../src/tests/contract_invoke_arg_count.rs | 12 +- .../contract_overlapping_type_fn_names.rs | 2 +- soroban-sdk/src/tests/contract_snapshot.rs | 4 +- soroban-sdk/src/tests/contract_store.rs | 4 +- soroban-sdk/src/tests/contract_timepoint.rs | 2 +- soroban-sdk/src/tests/contract_udt_enum.rs | 2 +- soroban-sdk/src/tests/contract_udt_option.rs | 2 +- soroban-sdk/src/tests/contract_udt_struct.rs | 4 +- .../src/tests/contract_udt_struct_tuple.rs | 2 +- soroban-sdk/src/tests/contractimport.rs | 20 +- .../src/tests/contractimport_with_error.rs | 4 +- soroban-sdk/src/tests/env.rs | 30 +-- soroban-sdk/src/tests/max_ttl.rs | 2 +- soroban-sdk/src/tests/prng.rs | 30 +-- soroban-sdk/src/tests/storage_testutils.rs | 10 +- soroban-sdk/src/tests/token_client.rs | 4 +- soroban-sdk/src/testutils.rs | 30 +++ tests/account/src/lib.rs | 4 +- tests/add_i128/src/lib.rs | 2 +- tests/add_u128/src/lib.rs | 2 +- tests/add_u64/src/lib.rs | 2 +- tests/alloc/src/lib.rs | 2 +- tests/auth/src/lib.rs | 32 +-- tests/constructor/src/lib.rs | 10 +- tests/empty/src/lib.rs | 2 +- tests/empty2/src/lib.rs | 2 +- tests/errors/src/lib.rs | 12 +- tests/events/src/lib.rs | 2 +- tests/fuzz/fuzz/fuzz_targets/fuzz_target_1.rs | 7 +- tests/import_contract/src/lib.rs | 4 +- tests/invoke_contract/src/lib.rs | 4 +- tests/logging/src/lib.rs | 2 +- tests/modular/src/test.rs | 2 +- tests/multiimpl/src/lib.rs | 2 +- tests/udt/src/lib.rs | 2 +- tests/workspace_contract/src/lib.rs | 2 +- 58 files changed, 344 insertions(+), 219 deletions(-) diff --git a/soroban-sdk/README.md b/soroban-sdk/README.md index 2aef6d4c3..83953317f 100644 --- a/soroban-sdk/README.md +++ b/soroban-sdk/README.md @@ -26,7 +26,7 @@ fn test() { # #[cfg(feature = "testutils")] # fn main() { let env = Env::default(); - let contract_id = env.register_contract(None, HelloContract); + let contract_id = env.register(HelloContract, ()); let client = HelloContractClient::new(&env, &contract_id); let words = client.hello(&symbol_short!("Dev")); diff --git a/soroban-sdk/src/deploy.rs b/soroban-sdk/src/deploy.rs index 71646d5ef..640b9399e 100644 --- a/soroban-sdk/src/deploy.rs +++ b/soroban-sdk/src/deploy.rs @@ -36,7 +36,7 @@ //! # #[cfg(feature = "testutils")] //! # fn main() { //! let env = Env::default(); -//! let contract_address = env.register_contract(None, Contract); +//! let contract_address = env.register(Contract, ()); //! let contract = ContractClient::new(&env, &contract_address); //! // Upload the contract code before deploying its instance. //! let wasm_hash = env.deployer().upload_contract_wasm(DEPLOYED_WASM); @@ -71,7 +71,7 @@ //! # #[cfg(feature = "testutils")] //! # fn main() { //! let env = Env::default(); -//! let contract_address = env.register_contract(None, Contract); +//! let contract_address = env.register(Contract, ()); //! let contract = ContractClient::new(&env, &contract_address); //! // Upload the contract code before deploying its instance. //! let wasm_hash = env.deployer().upload_contract_wasm(DEPLOYED_WASM_WITH_CTOR); diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index bc4ffec17..1d04b3a56 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -455,7 +455,7 @@ use crate::{ testutils::{ budget::Budget, Address as _, AuthSnapshot, AuthorizedInvocation, ConstructorArgs, ContractFunctionSet, EventsSnapshot, Generators, Ledger as _, MockAuth, MockAuthContract, - Snapshot, StellarAssetContract, StellarAssetIssuer, + Register, Snapshot, StellarAssetContract, StellarAssetIssuer, }, Bytes, BytesN, }; @@ -576,6 +576,136 @@ impl Env { env } + /// Register a contract with the [Env] for testing. + /// + /// Pass the contract type when the contract is defined in the current crate + /// and is being registered natively. Pass the contract wasm bytes when the + /// contract has been loaded as wasm. + /// + /// Pass the arguments for the contract's constructor, or `()` if none. + /// + /// Returns the address of the registered contract that is the same as the + /// contract id passed in. + /// + /// If you need to specify the address the contract should be registered at, + /// use [`register_at`]. + /// + /// ### Examples + /// Register a contract defined in the current crate, by specifying the type + /// name: + /// ``` + /// use soroban_sdk::{contract, contractimpl, testutils::Address as _, Address, BytesN, Env, Symbol}; + /// + /// #[contract] + /// pub struct Contract; + /// + /// #[contractimpl] + /// impl Contract { + /// pub fn __constructor(_env: Env, _input: u32) { + /// } + /// } + /// + /// #[test] + /// fn test() { + /// # } + /// # fn main() { + /// let env = Env::default(); + /// let contract_id = env.register(Contract, (123_u32,)); + /// } + /// ``` + /// Register a contract wasm, by specifying the wasm bytes: + /// ``` + /// use soroban_sdk::{testutils::Address as _, Address, BytesN, Env}; + /// + /// const WASM: &[u8] = include_bytes!("../doctest_fixtures/contract.wasm"); + /// + /// #[test] + /// fn test() { + /// # } + /// # fn main() { + /// let env = Env::default(); + /// let contract_id = env.register(WASM, ()); + /// } + /// ``` + pub fn register<'a, C, A>(&self, contract: C, constructor_args: A) -> Address + where + C: Register, + A: ConstructorArgs, + { + contract.register(self, None, constructor_args) + } + + /// Register a contract with the [Env] for testing. + /// + /// Passing a contract ID for the first arguments registers the contract + /// with that contract ID. + /// + /// Registering a contract that is already registered replaces it. + /// Use re-registration with caution as it does not exist in the real + /// (on-chain) environment. Specifically, the new contract's constructor + /// will be called again during re-registration. That behavior only exists + /// for this test utility and is not reproducible on-chain, where contract + /// Wasm updates don't cause constructor to be called. + /// + /// Pass the contract type when the contract is defined in the current crate + /// and is being registered natively. Pass the contract wasm bytes when the + /// contract has been loaded as wasm. + /// + /// Returns the address of the registered contract that is the same as the + /// contract id passed in. + /// + /// ### Examples + /// Register a contract defined in the current crate, by specifying the type + /// name: + /// ``` + /// use soroban_sdk::{contract, contractimpl, testutils::Address as _, Address, BytesN, Env, Symbol}; + /// + /// #[contract] + /// pub struct Contract; + /// + /// #[contractimpl] + /// impl Contract { + /// pub fn __constructor(_env: Env, _input: u32) { + /// } + /// } + /// + /// #[test] + /// fn test() { + /// # } + /// # fn main() { + /// let env = Env::default(); + /// let contract_id = Address::generate(&env); + /// env.register_at(&contract_id, Contract, (123_u32,)); + /// } + /// ``` + /// Register a contract wasm, by specifying the wasm bytes: + /// ``` + /// use soroban_sdk::{testutils::Address as _, Address, BytesN, Env}; + /// + /// const WASM: &[u8] = include_bytes!("../doctest_fixtures/contract.wasm"); + /// + /// #[test] + /// fn test() { + /// # } + /// # fn main() { + /// let env = Env::default(); + /// let contract_id = Address::generate(&env); + /// env.register_at(&contract_id, WASM, ()); + /// } + /// ``` + pub fn register_at( + &self, + contract_id: &Address, + contract: C, + constructor_args: A, + ) -> Address + where + C: Register, + A: ConstructorArgs, + { + contract.register(self, contract_id, constructor_args) + } + /// Register a contract with the [Env] for testing. /// /// Passing a contract ID for the first arguments registers the contract @@ -583,8 +713,7 @@ impl Env { /// contract ID that is assigned to the contract. /// /// If a contract has a constructor defined, then it will be called with - /// no arguments. If a constructor takes arguments, use - /// `register_contract_with_constructor`. + /// no arguments. If a constructor takes arguments, use `register`. /// /// Registering a contract that is already registered replaces it. /// Use re-registration with caution as it does not exist in the real @@ -617,6 +746,7 @@ impl Env { /// let contract_id = env.register_contract(None, HelloContract); /// } /// ``` + #[deprecated(note = "use `register`")] pub fn register_contract<'a, T: ContractFunctionSet + 'static>( &self, contract_id: impl Into>, @@ -642,30 +772,7 @@ impl Env { /// Wasm updates don't cause constructor to be called. /// /// Returns the address of the registered contract. - /// - /// ### Examples - /// ``` - /// use soroban_sdk::{contract, contractimpl, BytesN, Env, Symbol}; - /// - /// #[contract] - /// pub struct Contract; - /// - /// #[contractimpl] - /// impl Contract { - /// pub fn __constructor(_env: Env, _input: u32) { - /// } - /// } - /// - /// #[test] - /// fn test() { - /// # } - /// # fn main() { - /// let env = Env::default(); - /// let contract_id = env.register_contract_with_constructor( - /// None, Contract, (123_u32,)); - /// } - /// ``` - pub fn register_contract_with_constructor< + pub(crate) fn register_contract_with_constructor< 'a, T: ContractFunctionSet + 'static, A: ConstructorArgs, @@ -742,6 +849,7 @@ impl Env { /// env.register_contract_wasm(None, WASM); /// } /// ``` + #[deprecated(note = "use `register`")] pub fn register_contract_wasm<'a>( &self, contract_id: impl Into>, @@ -772,33 +880,17 @@ impl Env { /// Wasm updates don't cause constructor to be called. /// /// Returns the address of the registered contract. - /// - /// ### Examples - /// ``` - /// use soroban_sdk::{BytesN, Env, IntoVal}; - /// // This is Wasm for `constructor` test contract from this repo. - /// const WASM: &[u8] = include_bytes!("../doctest_fixtures/contract_with_constructor.wasm"); - /// - /// #[test] - /// fn test() { - /// # } - /// # fn main() { - /// let env = Env::default(); - /// env.register_contract_wasm_with_constructor( - /// None, WASM, (10_u32, 100_i64).into_val(&env)); - /// } - /// ``` - pub fn register_contract_wasm_with_constructor<'a>( + pub(crate) fn register_contract_wasm_with_constructor<'a>( &self, contract_id: impl Into>, contract_wasm: impl IntoVal, - constructor_args: Vec, + constructor_args: impl ConstructorArgs, ) -> Address { let wasm_hash: BytesN<32> = self.deployer().upload_contract_wasm(contract_wasm); self.register_contract_with_optional_contract_id_and_executable( contract_id, xdr::ContractExecutable::Wasm(xdr::Hash(wasm_hash.into())), - constructor_args, + constructor_args.into_val(self), ) } @@ -995,7 +1087,7 @@ impl Env { /// # } /// # fn main() { /// let env = Env::default(); - /// let contract_id = env.register_contract(None, HelloContract); + /// let contract_id = env.register(HelloContract, ()); /// /// let client = HelloContractClient::new(&env, &contract_id); /// let addr = Address::generate(&env); @@ -1014,7 +1106,7 @@ impl Env { /// ``` pub fn mock_auths(&self, auths: &[MockAuth]) { for a in auths { - self.register_contract(a.address, MockAuthContract); + self.register_at(a.address, MockAuthContract, ()); } let auths = auths .iter() @@ -1064,7 +1156,7 @@ impl Env { /// # } /// # fn main() { /// let env = Env::default(); - /// let contract_id = env.register_contract(None, HelloContract); + /// let contract_id = env.register(HelloContract, ()); /// /// env.mock_all_auths(); /// @@ -1117,8 +1209,8 @@ impl Env { /// # } /// # fn main() { /// let env = Env::default(); - /// let contract_a = env.register_contract(None, ContractA); - /// let contract_b = env.register_contract(None, ContractB); + /// let contract_a = env.register(ContractA, ()); + /// let contract_b = env.register(ContractB, ()); /// // The regular `env.mock_all_auths()` would result in the call /// // failure. /// env.mock_all_auths_allowing_non_root_auth(); @@ -1178,7 +1270,7 @@ impl Env { /// # fn main() { /// extern crate std; /// let env = Env::default(); - /// let contract_id = env.register_contract(None, Contract); + /// let contract_id = env.register(Contract, ()); /// let client = ContractClient::new(&env, &contract_id); /// env.mock_all_auths(); /// let address = Address::generate(&env); @@ -1282,7 +1374,7 @@ impl Env { /// # } /// # fn main() { /// let e: Env = Default::default(); - /// let account_contract = NoopAccountContractClient::new(&e, &e.register_contract(None, NoopAccountContract)); + /// let account_contract = NoopAccountContractClient::new(&e, &e.register(NoopAccountContract, ())); /// // Non-succesful call of `__check_auth` with a `contracterror` error. /// assert_eq!( /// e.try_invoke_contract_check_auth::( diff --git a/soroban-sdk/src/events.rs b/soroban-sdk/src/events.rs index 241779357..6d6e9a986 100644 --- a/soroban-sdk/src/events.rs +++ b/soroban-sdk/src/events.rs @@ -43,7 +43,7 @@ const TOPIC_BYTES_LENGTH_LIMIT: u32 = 32; /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); -/// # let contract_id = env.register_contract(None, Contract); +/// # let contract_id = env.register(Contract, ()); /// # ContractClient::new(&env, &contract_id).f(); /// # } /// # #[cfg(not(feature = "testutils"))] diff --git a/soroban-sdk/src/ledger.rs b/soroban-sdk/src/ledger.rs index a91801610..4b6b5a5a0 100644 --- a/soroban-sdk/src/ledger.rs +++ b/soroban-sdk/src/ledger.rs @@ -31,7 +31,7 @@ use crate::{env::internal, unwrap::UnwrapInfallible, BytesN, Env, TryIntoVal}; /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); -/// # let contract_id = env.register_contract(None, Contract); +/// # let contract_id = env.register(Contract, ()); /// # ContractClient::new(&env, &contract_id).f(); /// # } /// # #[cfg(not(feature = "testutils"))] diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index c032484ea..a4b8aa5cb 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -26,7 +26,7 @@ //! # #[cfg(feature = "testutils")] //! # fn main() { //! let env = Env::default(); -//! let contract_id = env.register_contract(None, HelloContract); +//! let contract_id = env.register(HelloContract, ()); //! let client = HelloContractClient::new(&env, &contract_id); //! //! let words = client.hello(&symbol_short!("Dev")); @@ -197,7 +197,7 @@ pub use soroban_sdk_macros::symbol_short; /// let env = Env::default(); /// /// // Register the contract defined in this crate. -/// let contract_id = env.register_contract(None, Contract); +/// let contract_id = env.register(Contract, ()); /// /// // Create a client for calling the contract. /// let client = ContractClient::new(&env, &contract_id); @@ -244,7 +244,7 @@ pub use soroban_sdk_macros::symbol_short; /// let env = Env::default(); /// /// // Register the contract defined in this crate. -/// let contract_id = env.register_contract(None, Contract); +/// let contract_id = env.register(Contract, ()); /// /// // Create a client for calling the contract. /// let client = ContractClient::new(&env, &contract_id); @@ -296,7 +296,7 @@ pub use soroban_sdk_macros::contracterror; /// let contract_a_id = env.register_contract_wasm(None, contract_a::WASM); /// /// // Register contract B defined in this crate. -/// let contract_b_id = env.register_contract(None, ContractB); +/// let contract_b_id = env.register(ContractB, ()); /// /// // Create a client for calling contract B. /// let client = ContractBClient::new(&env, &contract_b_id); @@ -342,7 +342,7 @@ pub use soroban_sdk_macros::contractimport; /// # #[cfg(feature = "testutils")] /// # fn main() { /// let env = Env::default(); -/// let contract_id = env.register_contract(None, HelloContract); +/// let contract_id = env.register(HelloContract, ()); /// let client = HelloContractClient::new(&env, &contract_id); /// /// let words = client.hello(&symbol_short!("Dev")); @@ -383,7 +383,7 @@ pub use soroban_sdk_macros::contract; /// # #[cfg(feature = "testutils")] /// # fn main() { /// let env = Env::default(); -/// let contract_id = env.register_contract(None, HelloContract); +/// let contract_id = env.register(HelloContract, ()); /// let client = HelloContractClient::new(&env, &contract_id); /// /// let words = client.hello(&symbol_short!("Dev")); @@ -423,7 +423,7 @@ pub use soroban_sdk_macros::contractimpl; /// # #[cfg(feature = "testutils")] /// # fn main() { /// let env = Env::default(); -/// let contract_id = env.register_contract(None, HelloContract); +/// let contract_id = env.register(HelloContract, ()); /// let client = HelloContractClient::new(&env, &contract_id); /// /// let words = client.hello(&symbol_short!("Dev")); @@ -503,7 +503,7 @@ pub use soroban_sdk_macros::contractmeta; /// # #[cfg(feature = "testutils")] /// # fn main() { /// let env = Env::default(); -/// let contract_id = env.register_contract(None, Contract); +/// let contract_id = env.register(Contract, ()); /// let client = ContractClient::new(&env, &contract_id); /// /// assert_eq!(client.increment(&1), 1); @@ -577,7 +577,7 @@ pub use soroban_sdk_macros::contractmeta; /// # #[cfg(feature = "testutils")] /// # fn main() { /// let env = Env::default(); -/// let contract_id = env.register_contract(None, Contract); +/// let contract_id = env.register(Contract, ()); /// let client = ContractClient::new(&env, &contract_id); /// /// assert_eq!(client.get(), None); @@ -637,7 +637,7 @@ pub use soroban_sdk_macros::contracttype; /// let env = Env::default(); /// /// // Register the hello contract. -/// let contract_id = env.register_contract(None, HelloContract); +/// let contract_id = env.register(HelloContract, ()); /// /// // Create a client for the hello contract, that was constructed using /// // the trait. diff --git a/soroban-sdk/src/prng.rs b/soroban-sdk/src/prng.rs index 8b0425c9f..b91e0df1c 100644 --- a/soroban-sdk/src/prng.rs +++ b/soroban-sdk/src/prng.rs @@ -120,7 +120,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// let mut value: u64 = 0; @@ -143,7 +143,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// let mut value = [0u8; 32]; @@ -188,7 +188,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// let value: u64 = env.prng().gen(); @@ -210,7 +210,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// let value: [u8; 32] = env.prng().gen(); @@ -258,7 +258,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// // Get a value of length 32 bytes. @@ -307,7 +307,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// // Get a value in the range of 1 to 100, inclusive. @@ -347,7 +347,7 @@ impl Prng { /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); - /// # let contract_id = env.register_contract(None, Contract); + /// # let contract_id = env.register(Contract, ()); /// # env.as_contract(&contract_id, || { /// # env.prng().seed(Bytes::from_array(&env, &[1; 32])); /// // Get a value in the range of 1 to 100, inclusive. diff --git a/soroban-sdk/src/storage.rs b/soroban-sdk/src/storage.rs index 9bd0a3ea0..f2e74ec46 100644 --- a/soroban-sdk/src/storage.rs +++ b/soroban-sdk/src/storage.rs @@ -53,7 +53,7 @@ use crate::{ /// # #[cfg(feature = "testutils")] /// # fn main() { /// # let env = Env::default(); -/// # let contract_id = env.register_contract(None, Contract); +/// # let contract_id = env.register(Contract, ()); /// # ContractClient::new(&env, &contract_id).f(); /// # } /// # #[cfg(not(feature = "testutils"))] diff --git a/soroban-sdk/src/tests/auth/auth_10_one.rs b/soroban-sdk/src/tests/auth/auth_10_one.rs index f23ffecff..6de963a0b 100644 --- a/soroban-sdk/src/tests/auth/auth_10_one.rs +++ b/soroban-sdk/src/tests/auth/auth_10_one.rs @@ -22,7 +22,7 @@ impl Contract { #[test] fn test() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/auth/auth_15_one_repeat.rs b/soroban-sdk/src/tests/auth/auth_15_one_repeat.rs index d299b08b8..ba37f4e4d 100644 --- a/soroban-sdk/src/tests/auth/auth_15_one_repeat.rs +++ b/soroban-sdk/src/tests/auth/auth_15_one_repeat.rs @@ -26,7 +26,7 @@ impl Contract { #[test] fn test() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/auth/auth_17_no_consume_requirement.rs b/soroban-sdk/src/tests/auth/auth_17_no_consume_requirement.rs index 663f61063..f1d6a5cf8 100644 --- a/soroban-sdk/src/tests/auth/auth_17_no_consume_requirement.rs +++ b/soroban-sdk/src/tests/auth/auth_17_no_consume_requirement.rs @@ -31,7 +31,7 @@ impl Contract { #[test] fn test() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/auth/auth_20_deep_one_address.rs b/soroban-sdk/src/tests/auth/auth_20_deep_one_address.rs index 4adcdc7c8..99183ec29 100644 --- a/soroban-sdk/src/tests/auth/auth_20_deep_one_address.rs +++ b/soroban-sdk/src/tests/auth/auth_20_deep_one_address.rs @@ -31,8 +31,8 @@ impl ContractB { #[test] fn test() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); @@ -61,8 +61,8 @@ fn test() { #[should_panic = "HostError: Error(Auth, InvalidAction)"] fn test_auth_tree() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/auth/auth_30_deep_one_address_repeat.rs b/soroban-sdk/src/tests/auth/auth_30_deep_one_address_repeat.rs index 10a02ed61..b9c11140b 100644 --- a/soroban-sdk/src/tests/auth/auth_30_deep_one_address_repeat.rs +++ b/soroban-sdk/src/tests/auth/auth_30_deep_one_address_repeat.rs @@ -32,8 +32,8 @@ impl ContractB { #[test] fn test() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); @@ -76,8 +76,8 @@ fn test() { #[should_panic = "HostError: Error(Auth, InvalidAction)"] fn test_auth_tree() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/auth/auth_35_deep_one_address_repeat_grouped.rs b/soroban-sdk/src/tests/auth/auth_35_deep_one_address_repeat_grouped.rs index 7cd8e5cb9..e70448866 100644 --- a/soroban-sdk/src/tests/auth/auth_35_deep_one_address_repeat_grouped.rs +++ b/soroban-sdk/src/tests/auth/auth_35_deep_one_address_repeat_grouped.rs @@ -32,8 +32,8 @@ impl ContractB { #[test] fn test() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); @@ -76,8 +76,8 @@ fn test() { #[should_panic = "HostError: Error(Auth, InvalidAction)"] fn test_auth_tree() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/auth/auth_40_multi_one_address.rs b/soroban-sdk/src/tests/auth/auth_40_multi_one_address.rs index e9d151475..c797227f9 100644 --- a/soroban-sdk/src/tests/auth/auth_40_multi_one_address.rs +++ b/soroban-sdk/src/tests/auth/auth_40_multi_one_address.rs @@ -32,8 +32,8 @@ impl ContractB { #[test] fn test_auth_not_allowed_with_separated_tree() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); @@ -66,8 +66,8 @@ fn test_auth_not_allowed_with_separated_tree() { #[test] fn test_auth_as_tree() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractAClient::new(&e, &contract_a_id); let a = Address::generate(&e); diff --git a/soroban-sdk/src/tests/budget.rs b/soroban-sdk/src/tests/budget.rs index be8ba657c..8391b8990 100644 --- a/soroban-sdk/src/tests/budget.rs +++ b/soroban-sdk/src/tests/budget.rs @@ -18,7 +18,7 @@ impl Contract { #[test] fn test_budget() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); e.budget().reset_default(); diff --git a/soroban-sdk/src/tests/contract_add_i32.rs b/soroban-sdk/src/tests/contract_add_i32.rs index 813dcf9ac..9721f8cb3 100644 --- a/soroban-sdk/src/tests/contract_add_i32.rs +++ b/soroban-sdk/src/tests/contract_add_i32.rs @@ -18,7 +18,7 @@ impl Contract { #[test] fn test_functional() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let a = 10i32; let b = 12i32; diff --git a/soroban-sdk/src/tests/contract_assert.rs b/soroban-sdk/src/tests/contract_assert.rs index ffb295d8e..d92681331 100644 --- a/soroban-sdk/src/tests/contract_assert.rs +++ b/soroban-sdk/src/tests/contract_assert.rs @@ -22,7 +22,7 @@ impl Contract { #[should_panic(expected = "Error(Contract, #1")] fn test_invoke_expect_error() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); ContractClient::new(&e, &contract_id).assert(&0); } @@ -30,7 +30,7 @@ fn test_invoke_expect_error() { #[test] fn test_try_invoke() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let res = ContractClient::new(&e, &contract_id).try_assert(&0); assert_eq!(res, Err(Ok(soroban_sdk::Error::from_contract_error(1)))); diff --git a/soroban-sdk/src/tests/contract_docs.rs b/soroban-sdk/src/tests/contract_docs.rs index 89fbe201d..eeac38cc5 100644 --- a/soroban-sdk/src/tests/contract_docs.rs +++ b/soroban-sdk/src/tests/contract_docs.rs @@ -18,7 +18,7 @@ mod fn_ { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); client.add(); } diff --git a/soroban-sdk/src/tests/contract_duration.rs b/soroban-sdk/src/tests/contract_duration.rs index 8b991f4f4..03804c477 100644 --- a/soroban-sdk/src/tests/contract_duration.rs +++ b/soroban-sdk/src/tests/contract_duration.rs @@ -12,7 +12,7 @@ impl Contract { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let t: Duration = xdr::ScVal::Duration(xdr::Duration(0)).into_val(&env); diff --git a/soroban-sdk/src/tests/contract_fn.rs b/soroban-sdk/src/tests/contract_fn.rs index 352ded1b5..7eaf18164 100644 --- a/soroban-sdk/src/tests/contract_fn.rs +++ b/soroban-sdk/src/tests/contract_fn.rs @@ -18,7 +18,7 @@ impl Contract { #[test] fn test_functional() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let a = 10i32; let b = 12i32; diff --git a/soroban-sdk/src/tests/contract_invoke.rs b/soroban-sdk/src/tests/contract_invoke.rs index 7ce8ce29f..6567bfcc5 100644 --- a/soroban-sdk/src/tests/contract_invoke.rs +++ b/soroban-sdk/src/tests/contract_invoke.rs @@ -15,7 +15,7 @@ impl Contract { #[should_panic(expected = "I panicked")] fn test_invoke_expect_string() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); ContractClient::new(&e, &contract_id).panic(); } @@ -24,7 +24,7 @@ fn test_invoke_expect_string() { #[should_panic(expected = "Error(WasmVm, InvalidAction)")] fn test_invoke_expect_error() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); ContractClient::new(&e, &contract_id).panic(); } @@ -34,7 +34,7 @@ fn test_try_invoke() { use soroban_env_host::xdr::{ScErrorCode, ScErrorType}; let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let res = ContractClient::new(&e, &contract_id).try_panic(); assert_eq!( diff --git a/soroban-sdk/src/tests/contract_invoke_arg_count.rs b/soroban-sdk/src/tests/contract_invoke_arg_count.rs index 32cd30c09..ee5d43dc9 100644 --- a/soroban-sdk/src/tests/contract_invoke_arg_count.rs +++ b/soroban-sdk/src/tests/contract_invoke_arg_count.rs @@ -32,9 +32,9 @@ impl AddContract { fn test_correct_arg_count() { let e = Env::default(); - let add_contract_id = e.register_contract(None, AddContract); + let add_contract_id = e.register(AddContract, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10i32; @@ -48,9 +48,9 @@ fn test_correct_arg_count() { fn test_too_few_args() { let e = Env::default(); - let add_contract_id = e.register_contract(None, AddContract); + let add_contract_id = e.register(AddContract, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10i32; @@ -62,9 +62,9 @@ fn test_too_few_args() { fn test_too_many_args() { let e = Env::default(); - let add_contract_id = e.register_contract(None, AddContract); + let add_contract_id = e.register(AddContract, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10i32; diff --git a/soroban-sdk/src/tests/contract_overlapping_type_fn_names.rs b/soroban-sdk/src/tests/contract_overlapping_type_fn_names.rs index cc46c4475..ad3411993 100644 --- a/soroban-sdk/src/tests/contract_overlapping_type_fn_names.rs +++ b/soroban-sdk/src/tests/contract_overlapping_type_fn_names.rs @@ -20,7 +20,7 @@ impl Contract { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let s = client.state(); diff --git a/soroban-sdk/src/tests/contract_snapshot.rs b/soroban-sdk/src/tests/contract_snapshot.rs index 3a4086f71..8014cd62b 100644 --- a/soroban-sdk/src/tests/contract_snapshot.rs +++ b/soroban-sdk/src/tests/contract_snapshot.rs @@ -17,7 +17,7 @@ impl Contract { #[test] fn test() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let contract_id_xdr = xdr::ScAddress::try_from(&contract_id).unwrap(); let client = ContractClient::new(&e, &contract_id); @@ -28,7 +28,7 @@ fn test() { let e = Env::from_ledger_snapshot(snapshot); let contract_id = Address::try_from_val(&e, &contract_id_xdr).unwrap(); - e.register_contract(&contract_id, Contract); + e.register_at(&contract_id, Contract, ()); let client = ContractClient::new(&e, &contract_id); assert_eq!(client.get(&2), 4); diff --git a/soroban-sdk/src/tests/contract_store.rs b/soroban-sdk/src/tests/contract_store.rs index a8d8efac3..f929789f5 100644 --- a/soroban-sdk/src/tests/contract_store.rs +++ b/soroban-sdk/src/tests/contract_store.rs @@ -61,7 +61,7 @@ fn test_storage() { e.ledger().set_min_temp_entry_ttl(50); e.ledger().set_max_entry_ttl(20_000); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); // Smoke test instance bump before putting any data into it. @@ -186,7 +186,7 @@ fn test_temp_storage_extension_past_max_ttl_panics() { let e = Env::default(); e.ledger().set_min_temp_entry_ttl(50); e.ledger().set_max_entry_ttl(20_000); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); e.as_contract(&contract_id, || { e.storage().temporary().set(&DataKey::Key(11), &2222_i32); diff --git a/soroban-sdk/src/tests/contract_timepoint.rs b/soroban-sdk/src/tests/contract_timepoint.rs index ea1b6069a..19a777b04 100644 --- a/soroban-sdk/src/tests/contract_timepoint.rs +++ b/soroban-sdk/src/tests/contract_timepoint.rs @@ -12,7 +12,7 @@ impl Contract { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let t: Timepoint = xdr::ScVal::Timepoint(xdr::TimePoint(0)).into_val(&env); diff --git a/soroban-sdk/src/tests/contract_udt_enum.rs b/soroban-sdk/src/tests/contract_udt_enum.rs index 31f2275f2..7e194c236 100644 --- a/soroban-sdk/src/tests/contract_udt_enum.rs +++ b/soroban-sdk/src/tests/contract_udt_enum.rs @@ -34,7 +34,7 @@ impl Contract { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let a = Udt::Aaa; diff --git a/soroban-sdk/src/tests/contract_udt_option.rs b/soroban-sdk/src/tests/contract_udt_option.rs index 18cde33d2..ae55979c8 100644 --- a/soroban-sdk/src/tests/contract_udt_option.rs +++ b/soroban-sdk/src/tests/contract_udt_option.rs @@ -21,7 +21,7 @@ impl Contract { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let a = Udt { a: 5, b: None }; let b = Udt { a: 10, b: Some(1) }; diff --git a/soroban-sdk/src/tests/contract_udt_struct.rs b/soroban-sdk/src/tests/contract_udt_struct.rs index f602b5ec4..af6ce8363 100644 --- a/soroban-sdk/src/tests/contract_udt_struct.rs +++ b/soroban-sdk/src/tests/contract_udt_struct.rs @@ -47,7 +47,7 @@ impl Contract { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let a = Udt { a: 5, b: 7 }; let b = Udt { a: 10, b: 14 }; @@ -58,7 +58,7 @@ fn test_functional() { #[test] fn test_long_names_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let a = UdtWithLongName { this_is_a_very_long_name_12345: 1_000_000_000_000, diff --git a/soroban-sdk/src/tests/contract_udt_struct_tuple.rs b/soroban-sdk/src/tests/contract_udt_struct_tuple.rs index f7e623991..872a8221d 100644 --- a/soroban-sdk/src/tests/contract_udt_struct_tuple.rs +++ b/soroban-sdk/src/tests/contract_udt_struct_tuple.rs @@ -35,7 +35,7 @@ fn test_conversion() { #[test] fn test_functional() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let a = Udt(5, 7); let b = Udt(10, 14); diff --git a/soroban-sdk/src/tests/contractimport.rs b/soroban-sdk/src/tests/contractimport.rs index 064188346..bccd95dcc 100644 --- a/soroban-sdk/src/tests/contractimport.rs +++ b/soroban-sdk/src/tests/contractimport.rs @@ -46,9 +46,9 @@ impl Contract { fn test_functional() { let e = Env::default(); - let add_contract_id = e.register_contract_wasm(None, addcontract::WASM); + let add_contract_id = e.register(addcontract::WASM, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10u64; @@ -62,9 +62,9 @@ fn test_register_at_id() { let e = Env::default(); let add_contract_id = Address::from_contract_id(&e, [1; 32]); - e.register_contract_wasm(&add_contract_id, addcontract::WASM); + e.register_at(&add_contract_id, addcontract::WASM, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10u64; @@ -76,12 +76,12 @@ fn test_register_at_id() { #[test] fn test_reregister_wasm() { let e = Env::default(); - let add_contract_id = e.register_contract_wasm(None, addcontract_u128::WASM); + let add_contract_id = e.register(addcontract_u128::WASM, ()); // Reregister the contract with different code replacing the code. This is // the contract we expect to be executed. - e.register_contract_wasm(&add_contract_id, addcontract::WASM); + e.register_at(&add_contract_id, addcontract::WASM, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10u64; @@ -95,12 +95,12 @@ fn test_reregister_over_wasm_with_rust_impl() { let e = Env::default(); // Register a contract with wasm. - let other_contract_id = e.register_contract_wasm(None, addcontract::WASM); + let other_contract_id = e.register(addcontract::WASM, ()); // Reregister the contract with a rust impl instead that does something // different. - e.register_contract(&other_contract_id, subcontract::Contract); + e.register_at(&other_contract_id, subcontract::Contract, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 12u64; diff --git a/soroban-sdk/src/tests/contractimport_with_error.rs b/soroban-sdk/src/tests/contractimport_with_error.rs index 30da50697..13ab9e69b 100644 --- a/soroban-sdk/src/tests/contractimport_with_error.rs +++ b/soroban-sdk/src/tests/contractimport_with_error.rs @@ -22,9 +22,9 @@ impl Contract { fn test_functional() { let e = Env::default(); - let err_contract_id = e.register_contract_wasm(None, errcontract::WASM); + let err_contract_id = e.register(errcontract::WASM, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let z = client.hello_with(&err_contract_id, &0); diff --git a/soroban-sdk/src/tests/env.rs b/soroban-sdk/src/tests/env.rs index 1042045d0..d5adb0f07 100644 --- a/soroban-sdk/src/tests/env.rs +++ b/soroban-sdk/src/tests/env.rs @@ -44,8 +44,8 @@ fn default_and_from_snapshot_same_settings() { assert!(env1.host().source_account_address().unwrap().is_some()); assert!(env2.host().source_account_address().unwrap().is_some()); - let c1addr = env1.register_contract(None, Contract); - let c2addr = env2.register_contract(None, Contract); + let c1addr = env1.register(Contract, ()); + let c2addr = env2.register(Contract, ()); let c1client = ContractClient::new(&env1, &c1addr); let c2client = ContractClient::new(&env2, &c2addr); @@ -83,21 +83,21 @@ fn register_contract_deploys_predictable_contract_ids() { let env1 = Env::default(); let env2 = Env::from_snapshot(env1.to_snapshot()); - let env1addr1 = env1.register_contract(None, Contract); + let env1addr1 = env1.register(Contract, ()); println!("env1 addr1 {:?}", env1addr1.contract_id()); - let env1addr2 = env1.register_contract(None, Contract); + let env1addr2 = env1.register(Contract, ()); println!("env1 addr2 {:?}", env1addr2.contract_id()); - let env2addr1 = env2.register_contract(None, Contract); + let env2addr1 = env2.register(Contract, ()); println!("env2 addr1 {:?}", env2addr1.contract_id()); - let env2addr2 = env2.register_contract(None, Contract); + let env2addr2 = env2.register(Contract, ()); println!("env2 addr2 {:?}", env2addr2.contract_id()); let env3 = Env::from_snapshot(env1.to_snapshot()); - let env1addr3 = env1.register_contract(None, Contract); + let env1addr3 = env1.register(Contract, ()); println!("env1 addr3 {:?}", env1addr3.contract_id()); - let env2addr3 = env2.register_contract(None, Contract); + let env2addr3 = env2.register(Contract, ()); println!("env2 addr3 {:?}", env2addr3.contract_id()); - let env3addr3 = env3.register_contract(None, Contract); + let env3addr3 = env3.register(Contract, ()); println!("env3 addr3 {:?}", env3addr3.contract_id()); // Check that contracts deployed in the envs are consistent and predictable. @@ -132,9 +132,9 @@ fn test_snapshot_file() { assert!(!p2.exists()); { let e3 = Env::default(); // When dropped will be written to p1. - let _ = e3.register_contract(None, Contract); + let _ = e3.register(Contract, ()); } // Env dropped, written to p1. - let c = e1.register_contract(None, Contract); + let c = e1.register(Contract, ()); assert!(p1.exists()); assert!(!p2.exists()); e1.as_contract(&c, || {}); @@ -163,11 +163,11 @@ fn test_snapshot_file_disabled() { let _ = std::fs::remove_file(&p2); { let e1 = Env::default(); - let _ = e1.register_contract(None, Contract); + let _ = e1.register(Contract, ()); let e2 = Env::new_with_config(EnvTestConfig { capture_snapshot_at_drop: false, }); - let _ = e2.register_contract(None, Contract); + let _ = e2.register(Contract, ()); assert!(!p1.exists()); assert!(!p2.exists()); } @@ -190,12 +190,12 @@ fn test_snapshot_file_disabled_after_creation() { let _ = std::fs::remove_file(&p2); { let e1 = Env::default(); - let _ = e1.register_contract(None, Contract); + let _ = e1.register(Contract, ()); let mut e2 = Env::default(); e2.set_config(EnvTestConfig { capture_snapshot_at_drop: false, }); - let _ = e2.register_contract(None, Contract); + let _ = e2.register(Contract, ()); assert!(!p1.exists()); assert!(!p2.exists()); } diff --git a/soroban-sdk/src/tests/max_ttl.rs b/soroban-sdk/src/tests/max_ttl.rs index 1cab646de..3f4c41763 100644 --- a/soroban-sdk/src/tests/max_ttl.rs +++ b/soroban-sdk/src/tests/max_ttl.rs @@ -7,7 +7,7 @@ pub struct Contract; #[test] fn max() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); e.ledger().set_sequence_number(1); e.ledger().set_max_entry_ttl(5); diff --git a/soroban-sdk/src/tests/prng.rs b/soroban-sdk/src/tests/prng.rs index 28213b859..ac8790a98 100644 --- a/soroban-sdk/src/tests/prng.rs +++ b/soroban-sdk/src/tests/prng.rs @@ -9,7 +9,7 @@ pub struct TestPrngContract; fn test_prng_seed() { let e = Env::default(); e.host().set_base_prng_seed([0; 32]).unwrap(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { e.prng().seed(bytes!( &e, @@ -19,7 +19,7 @@ fn test_prng_seed() { }); let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.host().set_base_prng_seed([2; 32]).unwrap(); e.as_contract(&id, || { e.prng().seed(bytes!( @@ -33,7 +33,7 @@ fn test_prng_seed() { #[test] fn test_prng_shuffle() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let v = vec![&e, 1, 2, 3]; @@ -49,7 +49,7 @@ fn test_prng_shuffle() { #[test] fn test_vec_shuffle() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let v = vec![&e, 1, 2, 3]; @@ -69,7 +69,7 @@ fn test_vec_shuffle() { #[test] fn test_prng_fill_u64() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let mut v: u64 = 0; @@ -83,7 +83,7 @@ fn test_prng_fill_u64() { #[test] fn test_prng_gen_u64() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { assert_eq!(e.prng().gen::(), 6775509081846337106); @@ -94,7 +94,7 @@ fn test_prng_gen_u64() { #[test] fn test_prng_gen_range_u64() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { assert_eq!(e.prng().gen_range::(..), 6775509081846337106); @@ -114,7 +114,7 @@ fn test_prng_gen_range_u64() { #[should_panic(expected = "Error(Value, InvalidInput)")] fn test_prng_gen_range_u64_panic_on_invalid_range() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { e.prng().gen_range::(u64::MAX..u64::MAX); @@ -124,7 +124,7 @@ fn test_prng_gen_range_u64_panic_on_invalid_range() { #[test] fn test_prng_fill_bytes() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let mut v = Bytes::from_array(&e, &[0u8; 32]); @@ -156,7 +156,7 @@ fn test_prng_fill_bytes() { #[test] fn test_prng_gen_len_bytes() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { assert_eq!( @@ -185,7 +185,7 @@ fn test_prng_gen_len_bytes() { #[test] fn test_prng_fill_bytesn() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let mut v = BytesN::from_array(&e, &[0u8; 32]); @@ -217,7 +217,7 @@ fn test_prng_fill_bytesn() { #[test] fn test_prng_gen_bytesn() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { assert_eq!( @@ -246,7 +246,7 @@ fn test_prng_gen_bytesn() { #[test] fn test_prng_fill_slice() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let mut buf = [0u8; 32]; @@ -273,7 +273,7 @@ fn test_prng_fill_slice() { #[test] fn test_prng_fill_array() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { let mut v = [0u8; 32]; @@ -299,7 +299,7 @@ fn test_prng_fill_array() { #[test] fn test_prng_gen_array() { let e = Env::default(); - let id = e.register_contract(None, TestPrngContract); + let id = e.register(TestPrngContract, ()); e.as_contract(&id, || { assert_eq!( diff --git a/soroban-sdk/src/tests/storage_testutils.rs b/soroban-sdk/src/tests/storage_testutils.rs index 0c730cef7..411f8a231 100644 --- a/soroban-sdk/src/tests/storage_testutils.rs +++ b/soroban-sdk/src/tests/storage_testutils.rs @@ -12,7 +12,7 @@ pub struct Contract; #[test] fn all() { let e = Env::default(); - let id = e.register_contract(None, Contract); + let id = e.register(Contract, ()); e.as_contract(&id, || { e.storage().instance().set(&1, &2); @@ -49,8 +49,8 @@ fn ttl_getters() { e.ledger().set_min_persistent_entry_ttl(100); e.ledger().set_min_temp_entry_ttl(10); - let contract_a = e.register_contract(None, Contract); - let contract_b = e.register_contract(None, Contract); + let contract_a = e.register(Contract, ()); + let contract_b = e.register(Contract, ()); let setup = || { e.storage().persistent().set(&1, &3); e.storage().temporary().set(&2, &4); @@ -113,7 +113,7 @@ fn temp_entry_expiration() { let e = Env::default(); e.ledger().set_sequence_number(1000); e.ledger().set_min_temp_entry_ttl(100); - let contract = e.register_contract(None, Contract); + let contract = e.register(Contract, ()); e.as_contract(&contract, || { e.storage().temporary().set(&1, &2); @@ -145,7 +145,7 @@ fn test_persistent_entry_expiration() { e.ledger().set_sequence_number(1000); e.ledger().set_min_persistent_entry_ttl(100); - let contract = e.register_contract(None, Contract); + let contract = e.register(Contract, ()); e.as_contract(&contract, || { e.storage().persistent().set(&1, &2); diff --git a/soroban-sdk/src/tests/token_client.rs b/soroban-sdk/src/tests/token_client.rs index bf12fa2ef..9d4ab68f0 100644 --- a/soroban-sdk/src/tests/token_client.rs +++ b/soroban-sdk/src/tests/token_client.rs @@ -73,7 +73,7 @@ fn test_mock_all_auth() { let sac = env.register_stellar_asset_contract_v2(admin); let token_contract_id = sac.address(); - let contract_id = env.register_contract(None, TestContract); + let contract_id = env.register(TestContract, ()); let client = TestContractClient::new(&env, &contract_id); client.init(&token_contract_id); @@ -121,7 +121,7 @@ fn test_mock_auth() { let admin = Address::generate(&env); let token_contract_id = env.register_stellar_asset_contract_v2(admin).address(); - let contract_id = env.register_contract(None, TestContract); + let contract_id = env.register(TestContract, ()); let client = TestContractClient::new(&env, &contract_id); client.init(&token_contract_id); diff --git a/soroban-sdk/src/testutils.rs b/soroban-sdk/src/testutils.rs index 61b7e0ef3..8aa6e0c3b 100644 --- a/soroban-sdk/src/testutils.rs +++ b/soroban-sdk/src/testutils.rs @@ -23,6 +23,36 @@ use soroban_ledger_snapshot::LedgerSnapshot; pub use crate::env::EnvTestConfig; +pub trait Register { + fn register<'i, I, A>(self, env: &Env, id: I, args: A) -> crate::Address + where + I: Into>, + A: ConstructorArgs; +} + +impl Register for C +where + C: ContractFunctionSet + 'static, +{ + fn register<'i, I, A>(self, env: &Env, id: I, args: A) -> crate::Address + where + I: Into>, + A: ConstructorArgs, + { + env.register_contract_with_constructor(id, self, args) + } +} + +impl<'w> Register for &'w [u8] { + fn register<'i, I, A>(self, env: &Env, id: I, args: A) -> crate::Address + where + I: Into>, + A: ConstructorArgs, + { + env.register_contract_wasm_with_constructor(id, self, args) + } +} + pub trait ConstructorArgs: IntoVal> {} impl ConstructorArgs for Vec {} diff --git a/tests/account/src/lib.rs b/tests/account/src/lib.rs index bce7c204b..7ddbe9026 100644 --- a/tests/account/src/lib.rs +++ b/tests/account/src/lib.rs @@ -44,8 +44,8 @@ mod test { #[test] fn test() { let e = Env::default(); - let test_contract_id = e.register_contract(None, TestContract); - let contract_id = e.register_contract(None, Contract); + let test_contract_id = e.register(TestContract, ()); + let contract_id = e.register(Contract, ()); e.set_auths(&[MockAuth { address: &contract_id, diff --git a/tests/add_i128/src/lib.rs b/tests/add_i128/src/lib.rs index a611b5820..765c743f2 100644 --- a/tests/add_i128/src/lib.rs +++ b/tests/add_i128/src/lib.rs @@ -20,7 +20,7 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 2i128.pow(70); diff --git a/tests/add_u128/src/lib.rs b/tests/add_u128/src/lib.rs index 9f20679cd..595ff53c2 100644 --- a/tests/add_u128/src/lib.rs +++ b/tests/add_u128/src/lib.rs @@ -20,7 +20,7 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 2u128.pow(70); diff --git a/tests/add_u64/src/lib.rs b/tests/add_u64/src/lib.rs index 3a2bcd97e..78dc60692 100644 --- a/tests/add_u64/src/lib.rs +++ b/tests/add_u64/src/lib.rs @@ -20,7 +20,7 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10u64; diff --git a/tests/alloc/src/lib.rs b/tests/alloc/src/lib.rs index 49e722fd5..99953bea0 100644 --- a/tests/alloc/src/lib.rs +++ b/tests/alloc/src/lib.rs @@ -30,7 +30,7 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let list = client.num_list(&5); diff --git a/tests/auth/src/lib.rs b/tests/auth/src/lib.rs index ffd7f3ae9..175207c33 100644 --- a/tests/auth/src/lib.rs +++ b/tests/auth/src/lib.rs @@ -33,7 +33,7 @@ mod test_a { fn test_with_mock_all_auth() { let e = Env::default(); - let contract_id = e.register_contract(None, ContractA); + let contract_id = e.register(ContractA, ()); let client = ContractAClient::new(&e, &contract_id); let a = Address::generate(&e); @@ -60,7 +60,7 @@ mod test_a { fn test_with_mock_auth() { let e = Env::default(); - let contract_id = e.register_contract(None, ContractA); + let contract_id = e.register(ContractA, ()); let client = ContractAClient::new(&e, &contract_id); let a = Address::generate(&e); @@ -97,10 +97,10 @@ mod test_a { fn test_with_real_contract_auth_approve() { let e = Env::default(); - let contract_id = e.register_contract(None, ContractA); + let contract_id = e.register(ContractA, ()); let client = ContractAClient::new(&e, &contract_id); - let a = e.register_contract(None, auth_approve::Contract); + let a = e.register(auth_approve::Contract, ()); let a_xdr: ScAddress = (&a).try_into().unwrap(); let r = client @@ -143,10 +143,10 @@ mod test_a { fn test_with_real_contract_auth_decline() { let e = Env::default(); - let contract_id = e.register_contract(None, ContractA); + let contract_id = e.register(ContractA, ()); let client = ContractAClient::new(&e, &contract_id); - let a = e.register_contract(None, auth_decline::Contract); + let a = e.register(auth_decline::Contract, ()); let a_xdr: ScAddress = (&a).try_into().unwrap(); let r = client @@ -251,8 +251,8 @@ mod test_b { fn test_with_mock_all_auth() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractBClient::new(&e, &contract_b_id); let a = Address::generate(&e); @@ -286,8 +286,8 @@ mod test_b { fn test_with_mock_auth() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractBClient::new(&e, &contract_b_id); let a = Address::generate(&e); @@ -336,11 +336,11 @@ mod test_b { fn test_with_real_contract_auth_approve() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractBClient::new(&e, &contract_b_id); - let a = e.register_contract(None, auth_approve::Contract); + let a = e.register(auth_approve::Contract, ()); let a_xdr: ScAddress = (&a).try_into().unwrap(); let r = client @@ -399,11 +399,11 @@ mod test_b { fn test_with_real_contract_auth_decline() { let e = Env::default(); - let contract_a_id = e.register_contract(None, ContractA); - let contract_b_id = e.register_contract(None, ContractB); + let contract_a_id = e.register(ContractA, ()); + let contract_b_id = e.register(ContractB, ()); let client = ContractBClient::new(&e, &contract_b_id); - let a = e.register_contract(None, auth_decline::Contract); + let a = e.register(auth_decline::Contract, ()); let a_xdr: ScAddress = (&a).try_into().unwrap(); let r = client diff --git a/tests/constructor/src/lib.rs b/tests/constructor/src/lib.rs index cdaa2a33f..3868bf933 100644 --- a/tests/constructor/src/lib.rs +++ b/tests/constructor/src/lib.rs @@ -37,7 +37,7 @@ impl Contract { #[test] fn test_constructor() { let env = Env::default(); - let contract_id = env.register_contract_with_constructor(None, Contract, (100_u32, 1000_i64)); + let contract_id = env.register(Contract, (100_u32, 1000_i64)); let client = ContractClient::new(&env, &contract_id); assert_eq!(client.get_data(&DataKey::Persistent(100)), Some(1000)); assert_eq!(client.get_data(&DataKey::Temp(200)), Some(2000)); @@ -52,26 +52,26 @@ fn test_constructor() { #[should_panic(expected = "constructor invocation has failed with error")] fn test_passing_no_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = env.register_contract(None, Contract); + let _ = env.register(Contract, ()); } #[test] #[should_panic(expected = "constructor invocation has failed with error")] fn test_missing_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = env.register_contract_with_constructor(None, Contract, (100_u32,)); + let _ = env.register(Contract, (100_u32,)); } #[test] #[should_panic(expected = "constructor invocation has failed with error")] fn test_passing_extra_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = env.register_contract_with_constructor(None, Contract, (100_u32, 1000_i64, 123_u32)); + let _ = env.register(Contract, (100_u32, 1000_i64, 123_u32)); } #[test] #[should_panic(expected = "constructor invocation has failed with error")] fn test_passing_incorrectly_typed_constructor_arguments_causes_panic() { let env = Env::default(); - let _ = env.register_contract_with_constructor(None, Contract, (100_u32, 1000_u32)); + let _ = env.register(Contract, (100_u32, 1000_u32)); } diff --git a/tests/empty/src/lib.rs b/tests/empty/src/lib.rs index f8912a36d..27638b625 100644 --- a/tests/empty/src/lib.rs +++ b/tests/empty/src/lib.rs @@ -18,7 +18,7 @@ mod test { #[test] fn test_hello() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); client.empty(); diff --git a/tests/empty2/src/lib.rs b/tests/empty2/src/lib.rs index eac8bc747..e86d9cd36 100644 --- a/tests/empty2/src/lib.rs +++ b/tests/empty2/src/lib.rs @@ -16,7 +16,7 @@ mod test { #[test] fn test_hello() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let _client = ContractClient::new(&e, &contract_id); } } diff --git a/tests/errors/src/lib.rs b/tests/errors/src/lib.rs index 4091cca10..dd18ece77 100644 --- a/tests/errors/src/lib.rs +++ b/tests/errors/src/lib.rs @@ -51,7 +51,7 @@ mod test { #[test] fn hello_ok() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let res = client.hello(&0); @@ -62,7 +62,7 @@ mod test { #[test] fn try_hello_ok() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let res = client.try_hello(&0); @@ -73,7 +73,7 @@ mod test { #[test] fn try_hello_error() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let res = client.try_hello(&1); @@ -84,7 +84,7 @@ mod test { #[test] fn try_hello_error_panic() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let res = client.try_hello(&2); @@ -95,7 +95,7 @@ mod test { #[test] fn try_hello_error_panic_string() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let res = client.try_hello(&3); @@ -106,7 +106,7 @@ mod test { #[test] fn try_hello_error_unexpected_contract_error() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let res = client.try_hello(&4); diff --git a/tests/events/src/lib.rs b/tests/events/src/lib.rs index c0b2b41f6..00748d182 100644 --- a/tests/events/src/lib.rs +++ b/tests/events/src/lib.rs @@ -28,7 +28,7 @@ mod test { #[test] fn test_pub_event() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); client.hello(); diff --git a/tests/fuzz/fuzz/fuzz_targets/fuzz_target_1.rs b/tests/fuzz/fuzz/fuzz_targets/fuzz_target_1.rs index 9cfed4463..04025122e 100644 --- a/tests/fuzz/fuzz/fuzz_targets/fuzz_target_1.rs +++ b/tests/fuzz/fuzz/fuzz_targets/fuzz_target_1.rs @@ -2,7 +2,10 @@ use libfuzzer_sys::fuzz_target; -use soroban_sdk::{testutils::arbitrary::{arbitrary,Arbitrary,SorobanArbitrary}, Env, IntoVal, U256}; +use soroban_sdk::{ + testutils::arbitrary::{arbitrary, Arbitrary, SorobanArbitrary}, + Env, IntoVal, U256, +}; use test_fuzz::{Contract, ContractClient}; @@ -18,7 +21,7 @@ fuzz_target!(|input: Input| { let a: U256 = input.a.into_val(&env); let b: U256 = input.b.into_val(&env); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); let _ = client.run(&a, &b); diff --git a/tests/import_contract/src/lib.rs b/tests/import_contract/src/lib.rs index 7ce18bafa..19daa3de2 100644 --- a/tests/import_contract/src/lib.rs +++ b/tests/import_contract/src/lib.rs @@ -26,9 +26,9 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let add_contract_id = e.register_contract_wasm(None, addcontract::WASM); + let add_contract_id = e.register(addcontract::WASM, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10u64; diff --git a/tests/invoke_contract/src/lib.rs b/tests/invoke_contract/src/lib.rs index c1e1801f4..7450bd6c0 100644 --- a/tests/invoke_contract/src/lib.rs +++ b/tests/invoke_contract/src/lib.rs @@ -36,9 +36,9 @@ mod test { fn test_add() { let e = Env::default(); - let add_contract_id = e.register_contract(None, AddContract); + let add_contract_id = e.register(AddContract, ()); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let x = 10i32; diff --git a/tests/logging/src/lib.rs b/tests/logging/src/lib.rs index 83b4c8a08..99d498bdd 100644 --- a/tests/logging/src/lib.rs +++ b/tests/logging/src/lib.rs @@ -37,7 +37,7 @@ mod test { #[test] fn test_logging() { let env = Env::default(); - let contract_id = env.register_contract(None, Contract); + let contract_id = env.register(Contract, ()); let client = ContractClient::new(&env, &contract_id); client.hello(); diff --git a/tests/modular/src/test.rs b/tests/modular/src/test.rs index 74988fe18..c8677d5ff 100644 --- a/tests/modular/src/test.rs +++ b/tests/modular/src/test.rs @@ -7,7 +7,7 @@ use soroban_sdk::Env; fn test() { let env = Env::default(); - let id = env.register_contract(None, Contract); + let id = env.register(Contract, ()); let client = ContractClient::new(&env, &id); assert_eq!(client.zero(), 0); diff --git a/tests/multiimpl/src/lib.rs b/tests/multiimpl/src/lib.rs index e9c578ef5..976f911ae 100644 --- a/tests/multiimpl/src/lib.rs +++ b/tests/multiimpl/src/lib.rs @@ -32,7 +32,7 @@ mod test { #[test] fn test_hello() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); client.empty(); diff --git a/tests/udt/src/lib.rs b/tests/udt/src/lib.rs index 2b4c640b2..7ac903344 100644 --- a/tests/udt/src/lib.rs +++ b/tests/udt/src/lib.rs @@ -79,7 +79,7 @@ mod test { #[test] fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let udt = UdtStruct { diff --git a/tests/workspace_contract/src/lib.rs b/tests/workspace_contract/src/lib.rs index 864c51c54..a62c353a9 100644 --- a/tests/workspace_contract/src/lib.rs +++ b/tests/workspace_contract/src/lib.rs @@ -22,7 +22,7 @@ mod test { fn test_add() { let e = Env::default(); - let contract_id = e.register_contract(None, Contract); + let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); let z = client.value(); From 8fc9f5334dece34b6baab31261a7773295746235 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 27 Sep 2024 07:40:11 +1000 Subject: [PATCH 33/57] Add infallible From conversions for types to ScVal (#1338) ### What Add infallible From conversions for types to ScVal, replacing the existing fallible TryFrom conversions. ### Why When I look through tests I see lots of `try_into().unwrap()` when converting types to their ScVal values. This is unnecessary, we know that the conversions will succeed because the host won't give the SDK types that aren't valid and couldn't be converted. It's just a result of the way the Rust types are setup we can't guarantee the type is always convertible, but in practice they are. Note that this is _not_ really a breaking change, because in the Rust core lib there is a blanket impl for all From conversions to also provide a TryFrom conversion. The only behaviour change is that if there were cases that would fail conversion previously a panic will occur instead of an error when using a TryFrom to do the conversion. In all cases there is no expected failure because the Env guarantees valid host types to be created and we're converting host types to ScVal types. --- soroban-sdk/src/address.rs | 37 ++++++++++++++++---------------- soroban-sdk/src/bytes.rs | 19 +++++++++------- soroban-sdk/src/map.rs | 21 ++++++++++-------- soroban-sdk/src/num.rs | 21 ++++++++++-------- soroban-sdk/src/string.rs | 19 +++++++++------- soroban-sdk/src/symbol.rs | 25 ++++++++++++---------- soroban-sdk/src/vec.rs | 44 +++++++++++++++++++------------------- 7 files changed, 101 insertions(+), 85 deletions(-) diff --git a/soroban-sdk/src/address.rs b/soroban-sdk/src/address.rs index dfed7f87a..e735a6f23 100644 --- a/soroban-sdk/src/address.rs +++ b/soroban-sdk/src/address.rs @@ -124,18 +124,21 @@ impl TryFromVal for Val { } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Address> for ScVal { - type Error = ConversionError; - fn try_from(v: &Address) -> Result { - Ok(ScVal::try_from_val(&v.env, &v.obj.to_val())?) +impl From<&Address> for ScVal { + fn from(v: &Address) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. + ScVal::try_from_val(&v.env, &v.obj.to_val()).unwrap() } } #[cfg(not(target_family = "wasm"))] -impl TryFrom
for ScVal { - type Error = ConversionError; - fn try_from(v: Address) -> Result { - (&v).try_into() +impl From
for ScVal { + fn from(v: Address) -> Self { + (&v).into() } } @@ -152,21 +155,19 @@ impl TryFromVal for Address { } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Address> for ScAddress { - type Error = ConversionError; - fn try_from(v: &Address) -> Result { - match ScVal::try_from_val(&v.env, &v.obj.to_val())? { - ScVal::Address(a) => Ok(a), - _ => Err(ConversionError), +impl From<&Address> for ScAddress { + fn from(v: &Address) -> Self { + match ScVal::try_from_val(&v.env, &v.obj.to_val()).unwrap() { + ScVal::Address(a) => a, + _ => panic!("expected ScVal::Address"), } } } #[cfg(not(target_family = "wasm"))] -impl TryFrom
for ScAddress { - type Error = ConversionError; - fn try_from(v: Address) -> Result { - (&v).try_into() +impl From
for ScAddress { + fn from(v: Address) -> Self { + (&v).into() } } diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index 1605341bd..b654d66a9 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -232,18 +232,21 @@ impl From<&Bytes> for Bytes { } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Bytes> for ScVal { - type Error = ConversionError; - fn try_from(v: &Bytes) -> Result { - Ok(ScVal::try_from_val(&v.env, &v.obj.to_val())?) +impl From<&Bytes> for ScVal { + fn from(v: &Bytes) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. + ScVal::try_from_val(&v.env, &v.obj.to_val()).unwrap() } } #[cfg(not(target_family = "wasm"))] -impl TryFrom for ScVal { - type Error = ConversionError; - fn try_from(v: Bytes) -> Result { - (&v).try_into() +impl From for ScVal { + fn from(v: Bytes) -> Self { + (&v).into() } } diff --git a/soroban-sdk/src/map.rs b/soroban-sdk/src/map.rs index cf0f3877f..05582a77f 100644 --- a/soroban-sdk/src/map.rs +++ b/soroban-sdk/src/map.rs @@ -225,18 +225,21 @@ where } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Map> for ScVal { - type Error = ConversionError; - fn try_from(v: &Map) -> Result { - Ok(ScVal::try_from_val(&v.env, &v.obj.to_val())?) +impl From<&Map> for ScVal { + fn from(v: &Map) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. + ScVal::try_from_val(&v.env, &v.obj.to_val()).unwrap() } } #[cfg(not(target_family = "wasm"))] -impl TryFrom> for ScVal { - type Error = ConversionError; - fn try_from(v: Map) -> Result { - (&v).try_into() +impl From> for ScVal { + fn from(v: Map) -> Self { + (&v).into() } } @@ -244,7 +247,7 @@ impl TryFrom> for ScVal { impl TryFromVal> for ScVal { type Error = ConversionError; fn try_from_val(_e: &Env, v: &Map) -> Result { - v.try_into() + Ok(v.into()) } } diff --git a/soroban-sdk/src/num.rs b/soroban-sdk/src/num.rs index 1071943e6..d3f69cbde 100644 --- a/soroban-sdk/src/num.rs +++ b/soroban-sdk/src/num.rs @@ -89,22 +89,25 @@ macro_rules! impl_num_wrapping_val_type { } #[cfg(not(target_family = "wasm"))] - impl TryFrom<&$wrapper> for ScVal { - type Error = ConversionError; - fn try_from(v: &$wrapper) -> Result { + impl From<&$wrapper> for ScVal { + fn from(v: &$wrapper) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. if let Ok(ss) = <$small>::try_from(v.val) { - ScVal::try_from(ss) + ScVal::try_from(ss).unwrap() } else { - Ok(ScVal::try_from_val(&v.env, &v.to_val())?) + ScVal::try_from_val(&v.env, &v.to_val()).unwrap() } } } #[cfg(not(target_family = "wasm"))] - impl TryFrom<$wrapper> for ScVal { - type Error = ConversionError; - fn try_from(v: $wrapper) -> Result { - (&v).try_into() + impl From<$wrapper> for ScVal { + fn from(v: $wrapper) -> Self { + (&v).into() } } diff --git a/soroban-sdk/src/string.rs b/soroban-sdk/src/string.rs index 1c48ecb30..671624865 100644 --- a/soroban-sdk/src/string.rs +++ b/soroban-sdk/src/string.rs @@ -137,18 +137,21 @@ impl From<&String> for String { } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&String> for ScVal { - type Error = ConversionError; - fn try_from(v: &String) -> Result { - Ok(ScVal::try_from_val(&v.env, &v.obj.to_val())?) +impl From<&String> for ScVal { + fn from(v: &String) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. + ScVal::try_from_val(&v.env, &v.obj.to_val()).unwrap() } } #[cfg(not(target_family = "wasm"))] -impl TryFrom for ScVal { - type Error = ConversionError; - fn try_from(v: String) -> Result { - (&v).try_into() +impl From for ScVal { + fn from(v: String) -> Self { + (&v).into() } } diff --git a/soroban-sdk/src/symbol.rs b/soroban-sdk/src/symbol.rs index 7f11fd3be..6389d382b 100644 --- a/soroban-sdk/src/symbol.rs +++ b/soroban-sdk/src/symbol.rs @@ -136,23 +136,26 @@ impl TryFromVal for Symbol { } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Symbol> for ScVal { - type Error = ConversionError; - fn try_from(v: &Symbol) -> Result { +impl From<&Symbol> for ScVal { + fn from(v: &Symbol) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. if let Ok(ss) = SymbolSmall::try_from(v.val) { - Ok(ScVal::try_from(ss)?) + ScVal::try_from(ss).unwrap() } else { - let e: Env = v.env.clone().try_into()?; - Ok(ScVal::try_from_val(&e, &v.to_val())?) + let e: Env = v.env.clone().try_into().unwrap(); + ScVal::try_from_val(&e, &v.to_val()).unwrap() } } } #[cfg(not(target_family = "wasm"))] -impl TryFrom for ScVal { - type Error = ConversionError; - fn try_from(v: Symbol) -> Result { - (&v).try_into() +impl From for ScVal { + fn from(v: Symbol) -> Self { + (&v).into() } } @@ -160,7 +163,7 @@ impl TryFrom for ScVal { impl TryFromVal for ScVal { type Error = ConversionError; fn try_from_val(_e: &Env, v: &Symbol) -> Result { - v.try_into() + Ok(v.into()) } } diff --git a/soroban-sdk/src/vec.rs b/soroban-sdk/src/vec.rs index 46f66bc9b..d7ae8eefb 100644 --- a/soroban-sdk/src/vec.rs +++ b/soroban-sdk/src/vec.rs @@ -231,46 +231,46 @@ where use super::xdr::{ScVal, ScVec, VecM}; #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Vec> for ScVal { - type Error = ConversionError; - fn try_from(v: &Vec) -> Result { - Ok(ScVal::try_from_val(&v.env, &v.obj.to_val())?) +impl From<&Vec> for ScVal { + fn from(v: &Vec) -> Self { + // This conversion occurs only in test utilities, and theoretically all + // values should convert to an ScVal because the Env won't let the host + // type to exist otherwise, unwrapping. Even if there are edge cases + // that don't, this is a trade off for a better test developer + // experience. + ScVal::try_from_val(&v.env, &v.obj.to_val()).unwrap() } } #[cfg(not(target_family = "wasm"))] -impl TryFrom<&Vec> for ScVec { - type Error = ConversionError; - fn try_from(v: &Vec) -> Result { - if let ScVal::Vec(Some(vec)) = ScVal::try_from(v)? { - Ok(vec) +impl From<&Vec> for ScVec { + fn from(v: &Vec) -> Self { + if let ScVal::Vec(Some(vec)) = ScVal::try_from(v).unwrap() { + vec } else { - Err(ConversionError) + panic!("expected ScVec") } } } #[cfg(not(target_family = "wasm"))] -impl TryFrom> for VecM { - type Error = ConversionError; - fn try_from(v: Vec) -> Result { - Ok(ScVec::try_from(v)?.0) +impl From> for VecM { + fn from(v: Vec) -> Self { + ScVec::from(v).0 } } #[cfg(not(target_family = "wasm"))] -impl TryFrom> for ScVal { - type Error = ConversionError; - fn try_from(v: Vec) -> Result { - (&v).try_into() +impl From> for ScVal { + fn from(v: Vec) -> Self { + (&v).into() } } #[cfg(not(target_family = "wasm"))] -impl TryFrom> for ScVec { - type Error = ConversionError; - fn try_from(v: Vec) -> Result { - (&v).try_into() +impl From> for ScVec { + fn from(v: Vec) -> Self { + (&v).into() } } From 627e1643cabb49ec2d2648937a4d2a5e5c2cab3b Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 27 Sep 2024 10:49:49 +1000 Subject: [PATCH 34/57] Remove need for Copy on error enums (#1292) ### What Remove need for Copy/Clone/etc on error enums and int enums. ### Why Less compiler errors for folks just getting started. The generated code currently requires that error enums impl the Copy trait because they use a copy within. That copy is unnecessary and this change removes it, removing the need for Copy to be derived on error enums. I was confident that the copy had been put there as an optimisation, but when I looked into the code that was relying on it I found not optimisation was in use. When I tried to add the optimisation, I couldn't find a contract size difference. A while ago we in https://github.com/stellar/rs-soroban-sdk/pull/1293 added better error messages for needing copy, which was a good fix at the time, I just think we can remove the need for this all together. Close #630 --- soroban-sdk-macros/src/derive_enum_int.rs | 9 +- .../src/derive_error_enum_int.rs | 17 +- soroban-sdk/src/tests.rs | 1 + .../src/tests/contract_udt_enum_error.rs | 57 +++++ .../src/tests/contractimport_with_error.rs | 4 +- .../contract_udt_enum_error/test_error.1.json | 216 ++++++++++++++++++ .../test_success.1.json | 148 ++++++++++++ tests/errors/src/lib.rs | 41 ++-- 8 files changed, 464 insertions(+), 29 deletions(-) create mode 100644 soroban-sdk/src/tests/contract_udt_enum_error.rs create mode 100644 soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json create mode 100644 soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json diff --git a/soroban-sdk-macros/src/derive_enum_int.rs b/soroban-sdk-macros/src/derive_enum_int.rs index 6cc326c16..27e68b01a 100644 --- a/soroban-sdk-macros/src/derive_enum_int.rs +++ b/soroban-sdk-macros/src/derive_enum_int.rs @@ -94,7 +94,6 @@ pub fn derive_type_enum_int( // Output. let mut output = quote! { #spec_gen - const _: () = { fn assert_copy(v: #enum_ident) -> impl Copy { v } }; impl #path::TryFromVal<#path::Env, #path::Val> for #enum_ident { type Error = #path::ConversionError; @@ -144,7 +143,9 @@ pub fn derive_type_enum_int( type Error = #path::xdr::Error; #[inline(always)] fn try_into(self) -> Result<#path::xdr::ScVal, #path::xdr::Error> { - Ok((*self as u32).into()) + Ok(match self { + #(#try_intos,)* + }) } } @@ -152,7 +153,9 @@ pub fn derive_type_enum_int( type Error = #path::xdr::Error; #[inline(always)] fn try_into(self) -> Result<#path::xdr::ScVal, #path::xdr::Error> { - Ok((self as u32).into()) + Ok(match self { + #(#try_intos,)* + }) } } diff --git a/soroban-sdk-macros/src/derive_error_enum_int.rs b/soroban-sdk-macros/src/derive_error_enum_int.rs index bfa45f301..fd1dd9016 100644 --- a/soroban-sdk-macros/src/derive_error_enum_int.rs +++ b/soroban-sdk-macros/src/derive_error_enum_int.rs @@ -92,7 +92,6 @@ pub fn derive_type_error_enum_int( // Output. quote! { #spec_gen - const _: () = { fn assert_copy(v: #enum_ident) -> impl Copy { v } }; impl TryFrom<#path::Error> for #enum_ident { type Error = #path::Error; @@ -121,16 +120,16 @@ pub fn derive_type_error_enum_int( impl From<#enum_ident> for #path::Error { #[inline(always)] fn from(val: #enum_ident) -> #path::Error { - match val { - #(#into_errors,)* - } + <_ as From<&#enum_ident>>::from(&val) } } impl From<&#enum_ident> for #path::Error { #[inline(always)] fn from(val: &#enum_ident) -> #path::Error { - <_ as From<#enum_ident>>::from(*val) + match val { + #(#into_errors,)* + } } } @@ -159,16 +158,16 @@ pub fn derive_type_error_enum_int( impl From<#enum_ident> for #path::InvokeError { #[inline(always)] fn from(val: #enum_ident) -> #path::InvokeError { - match val { - #(#into_invoke_errors,)* - } + <_ as From<&#enum_ident>>::from(&val) } } impl From<&#enum_ident> for #path::InvokeError { #[inline(always)] fn from(val: &#enum_ident) -> #path::InvokeError { - <_ as From<#enum_ident>>::from(*val) + match val { + #(#into_invoke_errors,)* + } } } diff --git a/soroban-sdk/src/tests.rs b/soroban-sdk/src/tests.rs index 6cb330d43..468ee5111 100644 --- a/soroban-sdk/src/tests.rs +++ b/soroban-sdk/src/tests.rs @@ -17,6 +17,7 @@ mod contract_snapshot; mod contract_store; mod contract_timepoint; mod contract_udt_enum; +mod contract_udt_enum_error; mod contract_udt_option; mod contract_udt_struct; mod contract_udt_struct_tuple; diff --git a/soroban-sdk/src/tests/contract_udt_enum_error.rs b/soroban-sdk/src/tests/contract_udt_enum_error.rs new file mode 100644 index 000000000..fbe61034f --- /dev/null +++ b/soroban-sdk/src/tests/contract_udt_enum_error.rs @@ -0,0 +1,57 @@ +use crate::{self as soroban_sdk}; +use soroban_sdk::{contract, contracterror, contractimpl, contracttype, Env}; + +#[contract] +pub struct Contract; + +#[contracttype] +pub enum Flag { + A = 0, + B = 1, +} + +#[contracterror] +pub enum Error { + AnError = 1, +} + +#[contractimpl] +impl Contract { + pub fn f(flag: Flag) -> Result<(), Error> { + match flag { + Flag::A => Ok(()), + Flag::B => Err(Error::AnError), + } + } +} + +// The assertions in the following tests intentionally don't use assert_eq, and +// unwraps the object using Rust's pattern matching, so that no derives like +// Debug, Eq, PartialEq, etc are required on the error enum type because this +// test serves to ensure that none of the generated code for the error type or +// the client that uses it is dependent on derives that may or may not be +// available. + +#[test] +fn test_success() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + + // See comment above about why this assertion is a match. + let Ok(Ok(())) = client.try_f(&Flag::A) else { + panic!("unexpected value returned"); + }; +} + +#[test] +fn test_error() { + let env = Env::default(); + let contract_id = env.register(Contract, ()); + let client = ContractClient::new(&env, &contract_id); + + // See comment above about why this assertion is a match. + let Err(Ok(Error::AnError)) = client.try_f(&Flag::B) else { + panic!("unexpected value returned"); + }; +} diff --git a/soroban-sdk/src/tests/contractimport_with_error.rs b/soroban-sdk/src/tests/contractimport_with_error.rs index 13ab9e69b..fba3aa1f3 100644 --- a/soroban-sdk/src/tests/contractimport_with_error.rs +++ b/soroban-sdk/src/tests/contractimport_with_error.rs @@ -13,7 +13,7 @@ pub struct Contract; #[contractimpl] impl Contract { - pub fn hello_with(env: Env, contract_id: Address, flag: u32) -> Symbol { + pub fn hello_with(env: Env, contract_id: Address, flag: errcontract::Flag) -> Symbol { errcontract::Client::new(&env, &contract_id).hello(&flag) } } @@ -27,6 +27,6 @@ fn test_functional() { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let z = client.hello_with(&err_contract_id, &0); + let z = client.hello_with(&err_contract_id, &errcontract::Flag::A); assert!(z == symbol_short!("hello")); } diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json new file mode 100644 index 000000000..4d0c8fda5 --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json @@ -0,0 +1,216 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "f" + } + ], + "data": { + "u32": 1 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "f" + } + ], + "data": { + "error": { + "contract": 1 + } + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" + } + } + } + }, + "failed_call": true + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "error" + }, + { + "error": { + "contract": 1 + } + } + ], + "data": { + "vec": [ + { + "string": "contract try_call failed" + }, + { + "symbol": "f" + }, + { + "vec": [ + { + "u32": 1 + } + ] + } + ] + } + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json new file mode 100644 index 000000000..17ed13020 --- /dev/null +++ b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json @@ -0,0 +1,148 @@ +{ + "generators": { + "address": 1, + "nonce": 0 + }, + "auth": [ + [], + [] + ], + "ledger": { + "protocol_version": 22, + "sequence_number": 0, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + [ + { + "contract_data": { + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": null + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [ + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "__constructor" + } + ], + "data": "void" + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": null, + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_call" + }, + { + "bytes": "0000000000000000000000000000000000000000000000000000000000000001" + }, + { + "symbol": "f" + } + ], + "data": { + "u32": 0 + } + } + } + }, + "failed_call": false + }, + { + "event": { + "ext": "v0", + "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", + "type_": "diagnostic", + "body": { + "v0": { + "topics": [ + { + "symbol": "fn_return" + }, + { + "symbol": "f" + } + ], + "data": "void" + } + } + }, + "failed_call": false + } + ] +} \ No newline at end of file diff --git a/tests/errors/src/lib.rs b/tests/errors/src/lib.rs index dd18ece77..a18757674 100644 --- a/tests/errors/src/lib.rs +++ b/tests/errors/src/lib.rs @@ -1,32 +1,43 @@ #![no_std] use soroban_sdk::{ - contract, contracterror, contractimpl, panic_with_error, symbol_short, Env, Symbol, + contract, contracterror, contractimpl, contracttype, panic_with_error, symbol_short, Env, + Symbol, }; #[contract] pub struct Contract; +#[contracttype] +#[derive(PartialEq)] +pub enum Flag { + A = 0, + B = 1, + C = 2, + D = 3, + E = 4, +} + #[contracterror] -#[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[derive(Debug, Eq, PartialEq)] pub enum Error { AnError = 1, } #[contractimpl] impl Contract { - pub fn hello(env: Env, flag: u32) -> Result { + pub fn hello(env: Env, flag: Flag) -> Result { env.storage() .persistent() .set(&symbol_short!("persisted"), &true); - if flag == 0 { + if flag == Flag::A { Ok(symbol_short!("hello")) - } else if flag == 1 { + } else if flag == Flag::B { Err(Error::AnError) - } else if flag == 2 { + } else if flag == Flag::C { panic_with_error!(&env, Error::AnError) - } else if flag == 3 { + } else if flag == Flag::D { panic!("an error") - } else if flag == 4 { + } else if flag == Flag::E { panic_with_error!(&env, soroban_sdk::Error::from_contract_error(9)) } else { unimplemented!() @@ -46,7 +57,7 @@ impl Contract { mod test { use soroban_sdk::{symbol_short, xdr, Env, InvokeError}; - use crate::{Contract, ContractClient, Error}; + use crate::{Contract, ContractClient, Error, Flag}; #[test] fn hello_ok() { @@ -54,7 +65,7 @@ mod test { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let res = client.hello(&0); + let res = client.hello(&Flag::A); assert_eq!(res, symbol_short!("hello")); assert!(client.persisted()); } @@ -65,7 +76,7 @@ mod test { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let res = client.try_hello(&0); + let res = client.try_hello(&Flag::A); assert_eq!(res, Ok(Ok(symbol_short!("hello")))); assert!(client.persisted()); } @@ -76,7 +87,7 @@ mod test { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let res = client.try_hello(&1); + let res = client.try_hello(&Flag::B); assert_eq!(res, Err(Ok(Error::AnError))); assert!(!client.persisted()); } @@ -87,7 +98,7 @@ mod test { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let res = client.try_hello(&2); + let res = client.try_hello(&Flag::C); assert_eq!(res, Err(Ok(Error::AnError))); assert!(!client.persisted()); } @@ -98,7 +109,7 @@ mod test { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let res = client.try_hello(&3); + let res = client.try_hello(&Flag::D); assert_eq!(res, Err(Err(InvokeError::Abort))); assert!(!client.persisted()); } @@ -109,7 +120,7 @@ mod test { let contract_id = e.register(Contract, ()); let client = ContractClient::new(&e, &contract_id); - let res = client.try_hello(&4); + let res = client.try_hello(&Flag::E); assert_eq!(res, Err(Err(InvokeError::Contract(9)))); assert!(!client.persisted()); } From abbba125c6a3bd1708cb695e29b33225022c9392 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 27 Sep 2024 14:20:00 +1000 Subject: [PATCH 35/57] Update env, xdr (#1351) ### What Update env, xdr ### Why Routine. And required by the stellar-cli. --- Cargo.lock | 327 ++++++++++++++++++++++------------ Cargo.toml | 10 +- deny.toml | 3 +- soroban-sdk-macros/Cargo.toml | 2 +- 4 files changed, 223 insertions(+), 119 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5cd71e27..0e0e67143 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,21 +2,6 @@ # It is not intended for manual editing. version = 3 -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "ahash" version = "0.8.11" @@ -54,43 +39,140 @@ dependencies = [ ] [[package]] -name = "arrayvec" -version = "0.7.6" +name = "ark-bls12-381" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] [[package]] -name = "autocfg" -version = "1.1.0" +name = "ark-ec" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits", + "zeroize", +] [[package]] -name = "backtrace" -version = "0.3.69" +name = "ark-ff" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", ] [[package]] -name = "base16ct" -version = "0.2.0" +name = "ark-ff-asm" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] [[package]] -name = "base32" +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -161,7 +243,7 @@ dependencies = [ "num-bigint", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -253,7 +335,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -280,7 +362,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -304,7 +386,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.39", ] [[package]] @@ -315,9 +397,15 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.39", ] +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + [[package]] name = "der" version = "0.7.8" @@ -338,6 +426,17 @@ dependencies = [ "serde", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_arbitrary" version = "1.3.2" @@ -346,7 +445,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -375,9 +474,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest", @@ -515,12 +614,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - [[package]] name = "group" version = "0.13.0" @@ -538,6 +631,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -630,9 +732,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "itertools" -version = "0.11.0" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -654,9 +756,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -703,21 +805,6 @@ version = "0.4.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" -[[package]] -name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", -] - [[package]] name = "multi-stash" version = "0.2.0" @@ -743,7 +830,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -766,15 +853,6 @@ dependencies = [ "libm", ] -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.18.0" @@ -838,7 +916,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.39", ] [[package]] @@ -968,12 +1046,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustc_version" version = "0.4.0" @@ -1050,7 +1122,7 @@ checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1090,7 +1162,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1133,18 +1205,18 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "soroban-env-common" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" dependencies = [ "arbitrary", "crate-git-revision", @@ -1162,7 +1234,7 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" dependencies = [ "soroban-env-common", "static_assertions", @@ -1171,9 +1243,12 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" dependencies = [ - "backtrace", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", "curve25519-dalek", "ecdsa", "ed25519-dalek", @@ -1203,7 +1278,7 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=75b782119942a4c8be8003f2901db38b30b6db2d#75b782119942a4c8be8003f2901db38b30b6db2d" +source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" dependencies = [ "itertools", "proc-macro2", @@ -1211,7 +1286,7 @@ dependencies = [ "serde", "serde_json", "stellar-xdr", - "syn", + "syn 2.0.39", ] [[package]] @@ -1266,7 +1341,7 @@ dependencies = [ "soroban-spec", "soroban-spec-rust", "stellar-xdr", - "syn", + "syn 2.0.39", ] [[package]] @@ -1291,7 +1366,7 @@ dependencies = [ "sha2", "soroban-spec", "stellar-xdr", - "syn", + "syn 2.0.39", "thiserror", ] @@ -1304,8 +1379,9 @@ dependencies = [ [[package]] name = "soroban-wasmi" -version = "0.36.0-soroban.22.0.0" -source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +version = "0.36.1-soroban.22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7044ea0ee6ff67039df1f232f0d3d98121f69a0409e944774912fc5f043c280f" dependencies = [ "arrayvec", "multi-stash", @@ -1342,19 +1418,19 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stellar-strkey" -version = "0.0.8" +version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" +checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" dependencies = [ - "base32", "crate-git-revision", + "data-encoding", "thiserror", ] [[package]] name = "stellar-xdr" version = "22.0.0" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=39d7dbb0c12bd422ee43a6e2e3277789da4eaac8#39d7dbb0c12bd422ee43a6e2e3277789da4eaac8" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=67be5955a15f1d3a4df83fe86e6ae107f687141b#67be5955a15f1d3a4df83fe86e6ae107f687141b" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1389,6 +1465,17 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.39" @@ -1578,7 +1665,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1670,7 +1757,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -1692,7 +1779,7 @@ checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1705,8 +1792,9 @@ checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wasmi_collections" -version = "0.36.0-soroban.22.0.0" -source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d1ff23df2c456c8b5d9a0ae7eed03a40f0c4520466b4aa87135c5fc557476e8" dependencies = [ "ahash", "hashbrown 0.14.3", @@ -1715,8 +1803,9 @@ dependencies = [ [[package]] name = "wasmi_core" -version = "0.36.0-soroban.22.0.0" -source = "git+https://github.com/stellar/wasmi?rev=122a74a7c491929e5ac9de876099154ef7c06d06#122a74a7c491929e5ac9de876099154ef7c06d06" +version = "0.36.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac1b21ded145eb313d44a5895442c28e18904fb95718dc83893779f55945d342" dependencies = [ "downcast-rs", "libm", @@ -1907,7 +1996,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1915,3 +2004,17 @@ name = "zeroize" version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] diff --git a/Cargo.toml b/Cargo.toml index 8ac1707fb..b0ffc52f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,27 +26,27 @@ soroban-token-sdk = { version = "22.0.0-rc.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "75b782119942a4c8be8003f2901db38b30b6db2d" +rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-guest] version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "75b782119942a4c8be8003f2901db38b30b6db2d" +rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-host] version = "=22.0.0" git = "https://github.com/stellar/rs-soroban-env" -rev = "75b782119942a4c8be8003f2901db38b30b6db2d" +rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.stellar-strkey] -version = "=0.0.8" +version = "=0.0.9" [workspace.dependencies.stellar-xdr] version = "=22.0.0" default-features = false features = ["curr"] git = "https://github.com/stellar/rs-stellar-xdr" -rev = "39d7dbb0c12bd422ee43a6e2e3277789da4eaac8" +rev = "67be5955a15f1d3a4df83fe86e6ae107f687141b" #[patch."https://github.com/stellar/rs-soroban-env"] #soroban-env-common = { path = "../rs-soroban-env/soroban-env-common" } diff --git a/deny.toml b/deny.toml index b18f9481b..bfb266ad9 100644 --- a/deny.toml +++ b/deny.toml @@ -243,7 +243,8 @@ deny = [ # Certain crates/versions that will be skipped when doing duplicate detection. skip = [ - #{ name = "ansi_term", version = "=0.11.0" }, + { name = "hashbrown", version = "=0.13.2" }, + { name = "syn", version = "=1.0.109" }, ] # Similarly to `skip` allows you to skip certain crates during duplicate # detection. Unlike skip, it also includes the entire tree of transitive diff --git a/soroban-sdk-macros/Cargo.toml b/soroban-sdk-macros/Cargo.toml index 927ce56c5..3eb14e68a 100644 --- a/soroban-sdk-macros/Cargo.toml +++ b/soroban-sdk-macros/Cargo.toml @@ -26,7 +26,7 @@ stellar-xdr = { workspace = true, features = ["curr", "std"] } syn = {version="2.0",features=["full"]} quote = "1.0" proc-macro2 = "1.0" -itertools = "0.11.0" +itertools = "0.10.0" darling = "0.20.0" sha2 = "0.10.7" From 9b7ac44e93de9cf851e9c42227b84d2e24f546a7 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Fri, 27 Sep 2024 19:52:21 -0400 Subject: [PATCH 36/57] implement bls12-381 functions (#1345) Corresponding env change: https://github.com/stellar/rs-soroban-env/pull/1456 --------- Co-authored-by: Siddharth Suresh Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --- Cargo.lock | 524 ++++++++++------------ soroban-sdk-macros/Cargo.toml | 2 +- soroban-sdk/src/bytes.rs | 96 ++++ soroban-sdk/src/crypto.rs | 11 +- soroban-sdk/src/crypto/bls12_381.rs | 375 ++++++++++++++++ soroban-sdk/src/num.rs | 21 + soroban-sdk/src/tests.rs | 1 + soroban-sdk/src/tests/crypto_bls12_381.rs | 148 ++++++ 8 files changed, 896 insertions(+), 282 deletions(-) create mode 100644 soroban-sdk/src/crypto/bls12_381.rs create mode 100644 soroban-sdk/src/tests/crypto_bls12_381.rs diff --git a/Cargo.lock b/Cargo.lock index 0e0e67143..b1368f2c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -164,9 +164,9 @@ checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "base16ct" @@ -182,9 +182,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -209,15 +209,9 @@ checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -230,9 +224,15 @@ 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 = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes-lit" @@ -243,16 +243,16 @@ dependencies = [ "num-bigint", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "cc" -version = "1.0.83" +version = "1.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "07b1695e2c7e8fc85310cde85aeaab7e3097f593c91d209d3f9df76c928100f0" dependencies = [ - "libc", + "shlex", ] [[package]] @@ -263,34 +263,34 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets 0.48.5", + "windows-targets", ] [[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 = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] @@ -330,12 +330,12 @@ dependencies = [ [[package]] name = "ctor" -version = "0.2.5" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" +checksum = "edb49164822f3ee45b17acd4a208cfc1251410cf0cad9a833234c9890774dd9f" dependencies = [ "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -362,14 +362,14 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "darling" -version = "0.20.3" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -377,27 +377,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.3" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "177e3443818124b357d8e76f53be906d60937f0d3a90773a664fa63fa253e621" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "darling_macro" -version = "0.20.3" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -408,9 +408,9 @@ checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[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", @@ -418,9 +418,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", @@ -445,7 +445,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -468,9 +468,9 @@ 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" @@ -512,9 +512,9 @@ dependencies = [ [[package]] name = "either" -version = "1.9.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -542,9 +542,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -564,9 +564,9 @@ checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" [[package]] name = "fastrand" -version = "2.0.1" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "ff" @@ -580,9 +580,9 @@ dependencies = [ [[package]] name = "fiat-crypto" -version = "0.2.5" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27573eac26f4dd11e2b1916c3fe1baa56407c83c71a773a8ba17ec0bca03b6b7" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" [[package]] name = "fnv" @@ -603,9 +603,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -642,9 +642,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", ] @@ -675,9 +675,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -715,12 +715,12 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.1.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] @@ -741,24 +741,24 @@ 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.66" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] [[package]] name = "k256" -version = "0.13.4" +version = "0.13.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" dependencies = [ "cfg-if", "ecdsa", @@ -768,24 +768,24 @@ dependencies = [ [[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 = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.150" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libm" @@ -795,15 +795,21 @@ checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" [[package]] name = "linux-raw-sys" -version = "0.4.12" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4cd1a83af159aa67994778be9070f0ae1bd732942279cabb14f86f986a21456" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "log" -version = "0.4.20" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "memchr" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "multi-stash" @@ -813,41 +819,45 @@ checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "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" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -855,9 +865,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "p256" @@ -873,9 +883,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pkcs8" @@ -895,15 +905,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "pretty_assertions" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7cee1a6c8a5b9208b3cb1061f10c0cb689087b3d8ce85fb9d2dd7a29b6ba66" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" dependencies = [ "diff", "yansi", @@ -911,12 +924,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.15" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" dependencies = [ "proc-macro2", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -930,22 +943,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.69" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.4.1", + "bitflags", "lazy_static", "num-traits", "rand", @@ -975,9 +988,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.33" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1021,20 +1034,11 @@ dependencies = [ "rand_core", ] -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "rfc6979" @@ -1048,20 +1052,20 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.26" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9470c4bf8246c8daf25f9598dca807fb6510347b1e1cfa55749113850c79d88a" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ - "bitflags 2.4.1", + "bitflags", "errno", "libc", "linux-raw-sys", @@ -1082,15 +1086,15 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "sec1" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", @@ -1101,53 +1105,55 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.192" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] [[package]] name = "serde_with" -version = "3.4.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ - "base64 0.21.5", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.1.0", + "indexmap 2.5.0", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -1155,14 +1161,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "3.4.0" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93634eb5f75a2323b16de4748022ac4297f9e76b6dced2be287a099f41b5e788" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -1186,11 +1192,17 @@ dependencies = [ "keccak", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signature" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", "rand_core", @@ -1210,7 +1222,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -1286,7 +1298,7 @@ dependencies = [ "serde", "serde_json", "stellar-xdr", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -1341,7 +1353,7 @@ dependencies = [ "soroban-spec", "soroban-spec-rust", "stellar-xdr", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] @@ -1366,7 +1378,7 @@ dependencies = [ "sha2", "soroban-spec", "stellar-xdr", - "syn 2.0.39", + "syn 2.0.77", "thiserror", ] @@ -1449,21 +1461,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" dependencies = [ "cfg-if", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "serde", ] [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1478,9 +1490,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -1489,15 +1501,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "once_cell", "rustix", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -1650,32 +1662,33 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "time" -version = "0.3.30" +version = "0.3.36" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", "itoa", + "num-conv", "powerfmt", "serde", "time-core", @@ -1690,10 +1703,11 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" dependencies = [ + "num-conv", "time-core", ] @@ -1711,15 +1725,15 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "wait-timeout" @@ -1738,34 +1752,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1773,22 +1788,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.89" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasmi_collections" @@ -1797,7 +1812,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d1ff23df2c456c8b5d9a0ae7eed03a40f0c4520466b4aa87135c5fc557476e8" dependencies = [ "ahash", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "string-interner", ] @@ -1819,7 +1834,7 @@ version = "0.116.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a58e28b80dd8340cb07b8242ae654756161f6fc8d0038123d679b7b99964fa50" dependencies = [ - "indexmap 2.1.0", + "indexmap 2.5.0", "semver", ] @@ -1834,20 +1849,11 @@ dependencies = [ [[package]] name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets", ] [[package]] @@ -1856,128 +1862,87 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets", ] [[package]] -name = "windows-targets" -version = "0.48.5" +name = "windows-sys" +version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", + "windows-targets", ] [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] -name = "windows_i686_gnu" -version = "0.52.0" +name = "windows_i686_gnullvm" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" -version = "0.48.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "yansi" -version = "0.5.1" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" [[package]] name = "zerocopy" @@ -1985,6 +1950,7 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] @@ -1996,14 +1962,14 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -2016,5 +1982,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.77", ] diff --git a/soroban-sdk-macros/Cargo.toml b/soroban-sdk-macros/Cargo.toml index 3eb14e68a..24fa1e82e 100644 --- a/soroban-sdk-macros/Cargo.toml +++ b/soroban-sdk-macros/Cargo.toml @@ -26,7 +26,7 @@ stellar-xdr = { workspace = true, features = ["curr", "std"] } syn = {version="2.0",features=["full"]} quote = "1.0" proc-macro2 = "1.0" -itertools = "0.10.0" +itertools = "0.10.5" darling = "0.20.0" sha2 = "0.10.7" diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index b654d66a9..af4094a25 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -102,6 +102,102 @@ macro_rules! bytesn { }; } +#[macro_export] +macro_rules! impl_bytesn_repr { + ($elem: ident, $size: literal) => { + impl $elem { + pub fn from_bytes(bytes: BytesN<$size>) -> Self { + Self(bytes) + } + + pub fn to_bytes(&self) -> BytesN<$size> { + self.0.clone() + } + + pub fn as_bytes(&self) -> &BytesN<$size> { + &self.0 + } + + pub fn to_array(&self) -> [u8; $size] { + self.0.to_array() + } + + pub fn from_array(&self, env: &Env, array: &[u8; $size]) -> Self { + Self(>::from_array(env, array)) + } + + pub fn as_val(&self) -> &Val { + self.0.as_val() + } + + pub fn to_val(&self) -> Val { + self.0.to_val() + } + + pub fn as_object(&self) -> &BytesObject { + self.0.as_object() + } + + pub fn to_object(&self) -> BytesObject { + self.0.to_object() + } + } + + impl IntoVal for $elem { + fn into_val(&self, e: &Env) -> Val { + self.0.into_val(e) + } + } + + impl TryFromVal for $elem { + type Error = ConversionError; + + fn try_from_val(env: &Env, val: &Val) -> Result { + let bytes = >::try_from_val(env, val)?; + Ok($elem(bytes)) + } + } + + impl IntoVal> for $elem { + fn into_val(&self, _e: &Env) -> BytesN<$size> { + self.0.clone() + } + } + + impl From<$elem> for Bytes { + fn from(v: $elem) -> Self { + v.0.into() + } + } + + impl From<$elem> for BytesN<$size> { + fn from(v: $elem) -> Self { + v.0 + } + } + + impl Into<[u8; $size]> for $elem { + fn into(self) -> [u8; $size] { + self.0.into() + } + } + + impl Eq for $elem {} + + impl PartialEq for $elem { + fn eq(&self, other: &Self) -> bool { + self.0.partial_cmp(other.as_bytes()) == Some(Ordering::Equal) + } + } + + impl Debug for $elem { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "{}({:?})", stringify!($elem), self.to_array()) + } + } + }; +} + /// Bytes is a contiguous growable array type containing `u8`s. /// /// The array is stored in the Host and available to the Guest through the diff --git a/soroban-sdk/src/crypto.rs b/soroban-sdk/src/crypto.rs index 731f26b8b..c725ebcf0 100644 --- a/soroban-sdk/src/crypto.rs +++ b/soroban-sdk/src/crypto.rs @@ -1,10 +1,12 @@ //! Crypto contains functions for cryptographic functions. use crate::{ - env::internal, env::internal::BytesObject, unwrap::UnwrapInfallible, Bytes, BytesN, - ConversionError, Env, IntoVal, TryFromVal, Val, + env::internal::{self, BytesObject}, + unwrap::UnwrapInfallible, + Bytes, BytesN, ConversionError, Env, IntoVal, TryFromVal, Val, }; +pub mod bls12_381; /// A BytesN generated by a cryptographic hash function. /// /// The `Hash` type contains a `BytesN` and can only be constructed in @@ -174,6 +176,11 @@ impl Crypto { let env = self.env(); CryptoHazmat::new(env).secp256r1_verify(public_key, &message_digest.0, signature) } + + /// Get a [Bls12_381] for accessing the bls12-381 functions. + pub fn bls12_381(&self) -> bls12_381::Bls12_381 { + bls12_381::Bls12_381::new(self.env()) + } } /// # ⚠️ Hazardous Materials diff --git a/soroban-sdk/src/crypto/bls12_381.rs b/soroban-sdk/src/crypto/bls12_381.rs new file mode 100644 index 000000000..cbfe9d41c --- /dev/null +++ b/soroban-sdk/src/crypto/bls12_381.rs @@ -0,0 +1,375 @@ +use crate::{ + env::internal::{self, BytesObject, U64Val}, + impl_bytesn_repr, + unwrap::{UnwrapInfallible, UnwrapOptimized}, + Bytes, BytesN, ConversionError, Env, IntoVal, TryFromVal, Val, Vec, U256, +}; +use core::{cmp::Ordering, fmt::Debug}; + +/// Bls12_381 provides access to curve and field arithmetics on the BLS12-381 +/// curve. +pub struct Bls12_381 { + env: Env, +} + +/// `G1Affine` is a point in the G1 group (subgroup defined over the base field +/// `Fq`) of the BLS12-381 elliptic curve +/// +/// # Serialization: +/// - The 96 bytes represent the **uncompressed encoding** of a point in G1. The +/// Bytes consist of `be_byte(X) || be_byte(Y)` (`||` is concatenation), +/// where 'X' and 'Y' are the two coordinates, each being a base field element +/// `Fp` +/// - The most significant three bits (bits 0-3) of the first byte are reserved +/// for encoding flags: +/// - compression_flag (bit 0): Must always be set (1), as only uncompressed +/// points are supported. +/// - infinity_flag (bit 1): Set if the point is the point at infinity (zero +/// point), in which case all other bits must be zero. +/// - sort_flag (bit 2): Must always be unset (0). +/// +/// # Example Usage: +/// ```rust +/// use soroban_sdk::{Env, bytesn, crypto::bls12_381::{Bls12_381, G1Affine}}; +/// let env = Env::default(); +/// let bls12_381 = env.crypto().bls12_381(); +/// let zero = G1Affine::from_bytes(bytesn!(&env, 0x400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)); +/// let one = G1Affine::from_bytes(bytesn!(&env, 0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1)); +/// let res = bls12_381.g1_add(&zero, &one); +/// assert_eq!(res, one); +/// ``` +#[derive(Clone)] +#[repr(transparent)] +pub struct G1Affine(BytesN<96>); + +/// `G2Affine` is a point in the G2 group (subgroup defined over the quadratic +/// extension field `Fq2`) of the BLS12-381 elliptic curve +/// +/// # Serialization: +/// - The 192 bytes represent the **uncompressed encoding** of a point in G2. +/// The bytes consist of `be_bytes(X_c1) || be_bytes(X_c0) || be_bytes(Y_c1) +/// || be_bytes(Y_c0)` (`||` is concatenation), where 'X' and 'Y' are the two +/// coordinates, each being an extension field element `Fp2` and `c0`, `c1` +/// are components of `Fp2` (each being `Fp`). +/// - The most significant three bits (bits 0-3) of the first byte are reserved +/// for encoding flags: +/// - compression_flag (bit 0): Must always be set (1), as only uncompressed +/// points are supported. +/// - infinity_flag (bit 1): Set if the point is the point at infinity (zero +/// point), in which case all other bits must be zero. +/// - sort_flag (bit 2): Must always be unset (0). +#[derive(Clone)] +#[repr(transparent)] +pub struct G2Affine(BytesN<192>); + +/// `Fp` represents an element of the base field `Fq` of the BLS12-381 elliptic +/// curve +/// +/// # Serialization: +/// - The 48 bytes represent the **big-endian encoding** of an element in the +/// field `Fp`. The value is serialized as a big-endian integer. +#[derive(Clone)] +#[repr(transparent)] +pub struct Fp(BytesN<48>); + +/// `Fp2` represents an element of the quadratic extension field `Fq2` of the +/// BLS12-381 elliptic curve +/// +/// # Serialization: +/// - The 96 bytes represent the **big-endian encoding** of an element in the +/// field `Fp2`. The bytes consist of `be_bytes(c1) || be_bytes(c0)` (`||` is +/// concatenation), where `c0` and `c1` are the two `Fp` elements (the real +/// and imaginary components). +#[derive(Clone)] +#[repr(transparent)] +pub struct Fp2(BytesN<96>); + +impl_bytesn_repr!(G1Affine, 96); +impl_bytesn_repr!(G2Affine, 192); +impl_bytesn_repr!(Fp, 48); +impl_bytesn_repr!(Fp2, 96); + +impl G1Affine { + pub fn env(&self) -> &Env { + self.0.env() + } + + pub fn is_in_subgroup(&self) -> bool { + self.env().crypto().bls12_381().g1_is_in_subgroup(self) + } + + pub fn checked_add(&self, rhs: &Self) -> Option { + self.env().crypto().bls12_381().g1_checked_add(self, rhs) + } +} + +impl core::ops::Add for G1Affine { + type Output = G1Affine; + + fn add(self, rhs: Self) -> Self::Output { + self.env().crypto().bls12_381().g1_add(&self, &rhs) + } +} + +impl core::ops::Mul for G1Affine { + type Output = G1Affine; + + fn mul(self, rhs: U256) -> Self::Output { + self.env().crypto().bls12_381().g1_mul(&self, &rhs) + } +} + +impl G2Affine { + pub fn env(&self) -> &Env { + self.0.env() + } + + pub fn is_in_subgroup(&self) -> bool { + self.env().crypto().bls12_381().g2_is_in_subgroup(self) + } + + pub fn checked_add(&self, rhs: &Self) -> Option { + self.env().crypto().bls12_381().g2_checked_add(self, rhs) + } +} + +impl core::ops::Add for G2Affine { + type Output = G2Affine; + + fn add(self, rhs: Self) -> Self::Output { + self.env().crypto().bls12_381().g2_add(&self, &rhs) + } +} + +impl core::ops::Mul for G2Affine { + type Output = G2Affine; + + fn mul(self, rhs: U256) -> Self::Output { + self.env().crypto().bls12_381().g2_mul(&self, &rhs) + } +} + +impl Fp { + pub fn env(&self) -> &Env { + self.0.env() + } + + pub fn map_to_g1(&self) -> G1Affine { + self.env().crypto().bls12_381().map_fp_to_g1(self) + } +} + +impl Fp2 { + pub fn env(&self) -> &Env { + self.0.env() + } + + pub fn map_to_g2(&self) -> G2Affine { + self.env().crypto().bls12_381().map_fp2_to_g2(self) + } +} + +impl Bls12_381 { + pub(crate) fn new(env: &Env) -> Bls12_381 { + Bls12_381 { env: env.clone() } + } + + pub fn env(&self) -> &Env { + &self.env + } + + // g1 + + /// Checks if a point `p` in G1 is in the correct subgroup. + pub fn g1_is_in_subgroup(&self, p: &G1Affine) -> bool { + let env = self.env(); + let res = internal::Env::bls12_381_check_g1_is_in_subgroup(env, p.to_object()) + .unwrap_infallible(); + res.into() + } + + /// Adds two points `p0` and `p1` in G1. + pub fn g1_add(&self, p0: &G1Affine, p1: &G1Affine) -> G1Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_g1_add(env, p0.to_object(), p1.to_object()) + .unwrap_infallible(); + unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Adds two points `p0` and `p1` in G1, ensuring that the result is in the + /// correct subgroup. Note the subgroup check is computationally expensive, + /// so if want to perform a series of additions i.e. `agg = p0 + p1 + .. + pn`, + /// it may make sense to only call g1_checked_add on the final addition, + /// while using `g1_add` (non-checked version) on the intermediate ones. + pub fn g1_checked_add(&self, p0: &G1Affine, p1: &G1Affine) -> Option { + let env = self.env(); + let bin = internal::Env::bls12_381_g1_add(env, p0.to_object(), p1.to_object()) + .unwrap_infallible(); + let res = unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) }; + let is_in_correct_subgroup: bool = + internal::Env::bls12_381_check_g1_is_in_subgroup(env, res.to_object()) + .unwrap_optimized() + .into(); + match is_in_correct_subgroup { + true => Some(res), + false => None, + } + } + + /// Multiplies a point `p0` in G1 by a scalar. + pub fn g1_mul(&self, p0: &G1Affine, scalar: &U256) -> G1Affine { + let env = self.env(); + let bin = + internal::Env::bls12_381_g1_mul(env, p0.to_object(), scalar.into()).unwrap_infallible(); + unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Performs a multi-scalar multiplication (MSM) operation in G1. + pub fn g1_msm(&self, vp: Vec, vs: Vec) -> G1Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_g1_msm(env, vp.into(), vs.into()).unwrap_infallible(); + unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Maps an element in the base field `Fp` to a point in G1. + pub fn map_fp_to_g1(&self, fp: &Fp) -> G1Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_map_fp_to_g1(env, fp.to_object()).unwrap_infallible(); + unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Hashes a message `msg` to a point in G1, using a domain separation tag `dst`. + pub fn hash_to_g1(&self, msg: &Bytes, dst: &Bytes) -> G1Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_hash_to_g1(env, msg.into(), dst.to_object()) + .unwrap_infallible(); + unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + // g2 + + /// Checks if a point `p` in G2 is in the correct subgroup. + pub fn g2_is_in_subgroup(&self, p: &G2Affine) -> bool { + let env = self.env(); + let res = internal::Env::bls12_381_check_g2_is_in_subgroup(env, p.to_object()) + .unwrap_infallible(); + res.into() + } + + /// Adds two points `p0` and `p1` in G2. + pub fn g2_add(&self, p0: &G2Affine, p1: &G2Affine) -> G2Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_g2_add(env, p0.to_object(), p1.to_object()) + .unwrap_infallible(); + unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Adds two points `p0` and `p1` in G2, ensuring that the result is in the + /// correct subgroup. Note the subgroup check is computationally expensive, + /// so if want to perform a series of additions i.e. `agg = p0 + p1 + .. +pn`, + /// it may make sense to only call g2_checked_add on the final addition, + /// while using `g2_add` (non-checked version) on the intermediate ones. + pub fn g2_checked_add(&self, p0: &G2Affine, p1: &G2Affine) -> Option { + let env = self.env(); + let bin = internal::Env::bls12_381_g2_add(env, p0.to_object(), p1.to_object()) + .unwrap_infallible(); + let res = unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) }; + let is_in_correct_subgroup: bool = + internal::Env::bls12_381_check_g2_is_in_subgroup(env, res.to_object()) + .unwrap_optimized() + .into(); + match is_in_correct_subgroup { + true => Some(res), + false => None, + } + } + + /// Multiplies a point `p0` in G2 by a scalar. + pub fn g2_mul(&self, p0: &G2Affine, scalar: &U256) -> G2Affine { + let env = self.env(); + let bin = + internal::Env::bls12_381_g2_mul(env, p0.to_object(), scalar.into()).unwrap_infallible(); + unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Performs a multi-scalar multiplication (MSM) operation in G2. + pub fn g2_msm(&self, vp: Vec, vs: Vec) -> G2Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_g2_msm(env, vp.into(), vs.into()).unwrap_infallible(); + unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Maps an element in the base field `Fp2` to a point in G2. + pub fn map_fp2_to_g2(&self, fp2: &Fp2) -> G2Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_map_fp2_to_g2(env, fp2.to_object()).unwrap_infallible(); + unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + /// Hashes a message `msg` to a point in G2, using a domain separation tag `dst`. + pub fn hash_to_g2(&self, msg: &Bytes, dst: &Bytes) -> G2Affine { + let env = self.env(); + let bin = internal::Env::bls12_381_hash_to_g2(env, msg.into(), dst.to_object()) + .unwrap_infallible(); + unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } + } + + // pairing + + /// Performs a pairing check between vectors of points in G1 and G2. + /// + /// This function computes the pairing for each pair of points in the + /// provided vectors `vp1` (G1 points) and `vp2` (G2 points) and verifies if + /// the overall pairing result is equal to the identity in the target group. + /// + /// # Returns: + /// - `true` if the pairing check holds (i.e., the pairing result is valid + /// and equal to the identity element), otherwise `false`. + /// + /// # Panics: + /// - If the lengths of `vp1` and `vp2` are not equal or if they are empty. + pub fn pairing_check(&self, vp1: Vec, vp2: Vec) -> bool { + let env = self.env(); + internal::Env::bls12_381_multi_pairing_check(env, vp1.into(), vp2.into()) + .unwrap_infallible() + .into() + } + + // scalar arithmetic + + /// Adds two scalars in the BLS12-381 scalar field `Fr`. + pub fn fr_add(&self, lhs: &U256, rhs: &U256) -> U256 { + let env = self.env(); + let v = internal::Env::bls12_381_fr_add(env, lhs.into(), rhs.into()).unwrap_infallible(); + U256::try_from_val(env, &v).unwrap_infallible() + } + + /// Subtracts one scalar from another in the BLS12-381 scalar field `Fr`. + pub fn fr_sub(&self, lhs: &U256, rhs: &U256) -> U256 { + let env = self.env(); + let v = internal::Env::bls12_381_fr_sub(env, lhs.into(), rhs.into()).unwrap_infallible(); + U256::try_from_val(env, &v).unwrap_infallible() + } + + /// Multiplies two scalars in the BLS12-381 scalar field `Fr`. + pub fn fr_mul(&self, lhs: &U256, rhs: &U256) -> U256 { + let env = self.env(); + let v = internal::Env::bls12_381_fr_mul(env, lhs.into(), rhs.into()).unwrap_infallible(); + U256::try_from_val(env, &v).unwrap_infallible() + } + + /// Raises a scalar to the power of a given exponent in the BLS12-381 scalar field `Fr`. + pub fn fr_pow(&self, lhs: &U256, rhs: u64) -> U256 { + let env = self.env(); + let rhs = U64Val::try_from_val(env, &rhs).unwrap_optimized(); + let v = internal::Env::bls12_381_fr_pow(env, lhs.into(), rhs).unwrap_infallible(); + U256::try_from_val(env, &v).unwrap_infallible() + } + + /// Computes the multiplicative inverse of a scalar in the BLS12-381 scalar field `Fr`. + pub fn fr_inv(&self, lhs: &U256) -> U256 { + let env = self.env(); + let v = internal::Env::bls12_381_fr_inv(env, lhs.into()).unwrap_infallible(); + U256::try_from_val(env, &v).unwrap_infallible() + } +} diff --git a/soroban-sdk/src/num.rs b/soroban-sdk/src/num.rs index d3f69cbde..a3ed92ac6 100644 --- a/soroban-sdk/src/num.rs +++ b/soroban-sdk/src/num.rs @@ -54,6 +54,27 @@ macro_rules! impl_num_wrapping_val_type { } } + impl From<$wrapper> for $val { + #[inline(always)] + fn from(v: $wrapper) -> Self { + v.val + } + } + + impl From<&$wrapper> for $val { + #[inline(always)] + fn from(v: &$wrapper) -> Self { + v.val + } + } + + impl From<&$wrapper> for $wrapper { + #[inline(always)] + fn from(v: &$wrapper) -> Self { + v.clone() + } + } + impl TryFromVal for $wrapper { type Error = Infallible; diff --git a/soroban-sdk/src/tests.rs b/soroban-sdk/src/tests.rs index 468ee5111..9d6c0a962 100644 --- a/soroban-sdk/src/tests.rs +++ b/soroban-sdk/src/tests.rs @@ -23,6 +23,7 @@ mod contract_udt_struct; mod contract_udt_struct_tuple; mod contractimport; mod contractimport_with_error; +mod crypto_bls12_381; mod crypto_ed25519; mod crypto_keccak256; mod crypto_secp256k1; diff --git a/soroban-sdk/src/tests/crypto_bls12_381.rs b/soroban-sdk/src/tests/crypto_bls12_381.rs new file mode 100644 index 000000000..04d03ac47 --- /dev/null +++ b/soroban-sdk/src/tests/crypto_bls12_381.rs @@ -0,0 +1,148 @@ +use crate::{ + bytes, bytesn, + crypto::bls12_381::{Bls12_381, Fp, Fp2, G1Affine, G2Affine}, + vec, Bytes, Env, Vec, U256, +}; + +#[test] +fn test_bls_g1() { + let env = Env::default(); + let bls12_381 = Bls12_381::new(&env); + const DST_G1: &str = "QUUX-V01-CS02-with-BLS12381G1_XMD:SHA-256_SSWU_RO_"; + let zero = G1Affine::from_bytes(bytesn!(&env, 0x400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)); + let one = G1Affine::from_bytes(bytesn!(&env, 0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb08b3f481e3aaa0f1a09e30ed741d8ae4fcf5e095d5d00af600db18cb2c04b3edd03cc744a2888ae40caa232946c5e7e1)); + + // subgroup check + assert!(bls12_381.g1_is_in_subgroup(&zero)); + assert!(bls12_381.g1_is_in_subgroup(&one)); + + // add + let res = bls12_381.g1_add(&zero, &one); + assert_eq!(res, one); + + // checked_add + let res = bls12_381.g1_checked_add(&zero, &one); + assert!(res.is_some_and(|v| v == one)); + + // mul + let res = bls12_381.g1_mul(&one, &U256::from_u32(&env, 0)); + assert_eq!(res, zero); + + // msm + let vp: Vec = vec![&env, one.clone(), one.clone()]; + let vs: Vec = vec![&env, U256::from_u32(&env, 1), U256::from_u32(&env, 0)]; + let res = bls12_381.g1_msm(vp, vs); + assert_eq!(res, one); + + // map to curve (test case from https://datatracker.ietf.org/doc/html/rfc9380) + let dst = Bytes::from_slice(&env, DST_G1.as_bytes()); + let fp = Fp::from_bytes(bytesn!(&env, 0x0d921c33f2bad966478a03ca35d05719bdf92d347557ea166e5bba579eea9b83e9afa5c088573c2281410369fbd32951)); + let expected = G1Affine::from_bytes(bytesn!(&env, 0x125435adce8e1cbd1c803e7123f45392dc6e326d292499c2c45c5865985fd74fe8f042ecdeeec5ecac80680d04317d800e8828948c989126595ee30e4f7c931cbd6f4570735624fd25aef2fa41d3f79cfb4b4ee7b7e55a8ce013af2a5ba20bf2)); + let res = bls12_381.map_fp_to_g1(&fp); + assert_eq!(res, expected); + + // hash msg to curve (test case from https://datatracker.ietf.org/doc/html/rfc9380) + let msg = Bytes::from_slice(&env, "abc".as_bytes()); + let expected = G1Affine::from_bytes(bytesn!(&env, 0x03567bc5ef9c690c2ab2ecdf6a96ef1c139cc0b2f284dca0a9a7943388a49a3aee664ba5379a7655d3c68900be2f69030b9c15f3fe6e5cf4211f346271d7b01c8f3b28be689c8429c85b67af215533311f0b8dfaaa154fa6b88176c229f2885d)); + let res = bls12_381.hash_to_g1(&msg, &dst); + assert_eq!(res, expected); +} + +#[test] +fn test_bls_g2() { + let env = Env::default(); + let bls12_381 = Bls12_381::new(&env); + const DST_G2: &str = "QUUX-V01-CS02-with-BLS12381G2_XMD:SHA-256_SSWU_RO_"; + let zero = G2Affine::from_bytes(bytesn!(&env, 0x400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)); + let one = G2Affine::from_bytes(bytesn!(&env, 0x13e02b6052719f607dacd3a088274f65596bd0d09920b61ab5da61bbdc7f5049334cf11213945d57e5ac7d055d042b7e024aa2b2f08f0a91260805272dc51051c6e47ad4fa403b02b4510b647ae3d1770bac0326a805bbefd48056c8c121bdb80606c4a02ea734cc32acd2b02bc28b99cb3e287e85a763af267492ab572e99ab3f370d275cec1da1aaa9075ff05f79be0ce5d527727d6e118cc9cdc6da2e351aadfd9baa8cbdd3a76d429a695160d12c923ac9cc3baca289e193548608b82801)); + + // subgroup check + assert!(bls12_381.g2_is_in_subgroup(&zero)); + assert!(bls12_381.g2_is_in_subgroup(&one)); + + // add + let res = bls12_381.g2_add(&zero, &one); + assert_eq!(res, one); + + // checked_add + let res = bls12_381.g2_checked_add(&zero, &one); + assert!(res.is_some_and(|v| v == one)); + + // mul + let res = bls12_381.g2_mul(&one, &U256::from_u32(&env, 0)); + assert_eq!(res, zero); + + // msm + let vp: Vec = vec![&env, one.clone(), one.clone()]; + let vs: Vec = vec![&env, U256::from_u32(&env, 1), U256::from_u32(&env, 0)]; + let res = bls12_381.g2_msm(vp, vs); + assert_eq!(res, one); + + // map to curve (test case from https://datatracker.ietf.org/doc/html/rfc9380) + let dst = Bytes::from_slice(&env, DST_G2.as_bytes()); + let fp2 = Fp2::from_bytes(bytesn!(&env, 0x01c8067bf4c0ba709aa8b9abc3d1cef589a4758e09ef53732d670fd8739a7274e111ba2fcaa71b3d33df2a3a0c8529dd15f7c0aa8f6b296ab5ff9c2c7581ade64f4ee6f1bf18f55179ff44a2cf355fa53dd2a2158c5ecb17d7c52f63e7195771)); + let expected = G2Affine::from_bytes(bytesn!(&env, 0x05d8a724db78e570e34100c0bc4a5fa84ad5839359b40398151f37cff5a51de945c563463c9efbdda569850ee5a53e7712b2e525281b5f4d2276954e84ac4f42cf4e13b6ac4228624e17760faf94ce5706d53f0ca1952f1c5ef75239aeed55ad04bbe48bfd5814648d0b9e30f0717b34015d45a861425fabc1ee06fdfce36384ae2c808185e693ae97dcde118f34de4102eacdc556d0bdb5d18d22f23dcb086dd106cad713777c7e6407943edbe0b3d1efe391eedf11e977fac55f9b94f2489c)); + let res = bls12_381.map_fp2_to_g2(&fp2); + assert_eq!(res, expected); + + // hash msg to curve (test case from https://datatracker.ietf.org/doc/html/rfc9380) + let msg = Bytes::from_slice(&env, "abc".as_bytes()); + let expected = G2Affine::from_bytes(bytesn!(&env, 0x139cddbccdc5e91b9623efd38c49f81a6f83f175e80b06fc374de9eb4b41dfe4ca3a230ed250fbe3a2acf73a41177fd802c2d18e033b960562aae3cab37a27ce00d80ccd5ba4b7fe0e7a210245129dbec7780ccc7954725f4168aff2787776e600aa65dae3c8d732d10ecd2c50f8a1baf3001578f71c694e03866e9f3d49ac1e1ce70dd94a733534f106d4cec0eddd161787327b68159716a37440985269cf584bcb1e621d3a7202be6ea05c4cfe244aeb197642555a0645fb87bf7466b2ba48)); + let res = bls12_381.hash_to_g2(&msg, &dst); + assert_eq!(res, expected); +} + +#[test] +fn test_pairing() { + let env = Env::default(); + let bls12_381 = Bls12_381::new(&env); + // test case from one of the ethereum tests "verify_valid_case_195246ee3bd3b6ec.json" + const DST_ETHEREUM: &str = "BLS_SIG_BLS12381G2_XMD:SHA-256_SSWU_RO_POP_"; + let dst = Bytes::from_slice(&env, DST_ETHEREUM.as_bytes()); + let neg_g1 = G1Affine::from_bytes(bytesn!(&env, 0x17f1d3a73197d7942695638c4fa9ac0fc3688c4f9774b905a14e3a3f171bac586c55e83ff97a1aeffb3af00adb22c6bb114d1d6855d545a8aa7d76c8cf2e21f267816aef1db507c96655b9d5caac42364e6f38ba0ecb751bad54dcd6b939c2ca)); + let pk = G1Affine::from_bytes(bytesn!(&env, 0x153d21a4cfd562c469cc81514d4ce5a6b577d8403d32a394dc265dd190b47fa9f829fdd7963afdf972e5e77854051f6f14e22fd412a826a329fb40cbdc01b5e4e2f931ed84d8e45932ec62a039f9d61a9dbf2c6eedc5db6fa585b6e0bdde100c)); + let msg = bytes!( + &env, + 0xabababababababababababababababababababababababababababababababab + ); + let msg = bls12_381.hash_to_g2(&msg, &dst); + let sig = G2Affine::from_bytes(bytesn!(&env, 0x0e82747ddeefe4fd64cf9cedb9b04ae3e8a43420cd255e3c7cd06a8d88b7c7f8638543719981c5d16fa3527c468c25f0026704a6951bde891360c7e8d12ddee0559004ccdbe6046b55bae1b257ee97f7cdb955773d7cf29adf3ccbb9975e4eb915e60d5b66a43e074b801a07df931a17505048f7f96dc80f857b638e505868dc008cc9c26ed5b8495e9c181b67dc4c2317d9d447337a9cc6d2956b9c6dd7c23c0bfb73855e902061bcb9cb9d40e43c38140091e638ffcffc7261366018900047)); + + let vp1 = vec![&env, pk, neg_g1]; + let vp2 = vec![&env, msg, sig]; + assert!(bls12_381.pairing_check(vp1, vp2)) +} + +#[test] +fn test_fr_arithmetic() { + let env = Env::default(); + let bls12_381 = Bls12_381::new(&env); + let modulus = U256::from_be_bytes( + &env, + &bytes!( + &env, + 0x73eda753299d7d483339d80809a1d80553bda402fffe5bfeffffffff00000001 + ), + ); + assert_eq!( + bls12_381.fr_add(&U256::from_u32(&env, 2), &U256::from_u32(&env, 3)), + U256::from_u32(&env, 5) + ); + assert_eq!( + bls12_381.fr_sub(&U256::from_u32(&env, 2), &U256::from_u32(&env, 3)), + modulus.sub(&U256::from_u32(&env, 1)) + ); + assert_eq!( + bls12_381.fr_mul(&U256::from_u32(&env, 2), &U256::from_u32(&env, 3)), + U256::from_u32(&env, 6) + ); + assert_eq!( + bls12_381.fr_pow(&U256::from_u32(&env, 5), 2), + U256::from_u32(&env, 25) + ); + let inverse_13 = bls12_381.fr_inv(&U256::from_u32(&env, 13)); + assert_eq!( + bls12_381.fr_mul(&inverse_13, &U256::from_u32(&env, 13)), + U256::from_u32(&env, 1) + ); +} From 01f27c11df18ca85eb9b33cef58639a27070f3bd Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Sat, 28 Sep 2024 19:47:28 +1000 Subject: [PATCH 37/57] Use ConstructorArgs trait for args on deploy with constructor (#1349) ### What Use ConstructorArgs trait for args on deploy with constructor, and rename deploy with constructor to deploy_v2. ### Why So that types can be passed directly to the deploy function like they can now be passed to the register function since #1343. I renamed the function to deploy_v2 for consistency with what we did when we added a second register for stellar asset contract function. I considered merging with the deploy function which would have been a breaking change, that I think we agreed would be worthwhile, but breaking is just such a bad experience and I think a _v2 is almost as good. We can consider merging the deploy functions at a later date. Close #1347 --- soroban-sdk/src/constructor_args.rs | 32 ++++++++++++++++++++++++++++ soroban-sdk/src/deploy.rs | 28 +++++++++++++++--------- soroban-sdk/src/env.rs | 10 ++++----- soroban-sdk/src/lib.rs | 3 +++ soroban-sdk/src/testutils.rs | 33 +---------------------------- 5 files changed, 59 insertions(+), 47 deletions(-) create mode 100644 soroban-sdk/src/constructor_args.rs diff --git a/soroban-sdk/src/constructor_args.rs b/soroban-sdk/src/constructor_args.rs new file mode 100644 index 000000000..e49359458 --- /dev/null +++ b/soroban-sdk/src/constructor_args.rs @@ -0,0 +1,32 @@ +use crate::{Env, IntoVal, Val, Vec}; + +pub trait ConstructorArgs: IntoVal> {} + +impl ConstructorArgs for Vec {} + +macro_rules! impl_constructor_args_for_tuple { + ( $($typ:ident $idx:tt)* ) => { + impl<$($typ),*> ConstructorArgs for ($($typ,)*) + where + $($typ: IntoVal),* + { + } + }; +} + +// 0 topics +impl ConstructorArgs for () {} +// 1-13 topics +impl_constructor_args_for_tuple! { T0 0 } +impl_constructor_args_for_tuple! { T0 0 T1 1 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 T11 11 } +impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 T11 11 T12 12 } diff --git a/soroban-sdk/src/deploy.rs b/soroban-sdk/src/deploy.rs index 640b9399e..b47d33edd 100644 --- a/soroban-sdk/src/deploy.rs +++ b/soroban-sdk/src/deploy.rs @@ -27,7 +27,7 @@ //! // Deployed contract address is deterministic and can be accessed //! // before deploying the contract. //! let _ = deployer.deployed_address(); -//! let contract_address = deployer.deploy(wasm_hash); +//! let contract_address = deployer.deploy_v2(wasm_hash, ()); //! } //! } //! #[test] @@ -61,8 +61,10 @@ //! // Deployed contract address is deterministic and can be accessed //! // before deploying the contract. //! let _ = deployer.deployed_address(); -//! let contract_address = deployer.deploy_with_constructor( -//! wasm_hash, (1_u32, 2_i64).into_val(&env)); +//! let contract_address = deployer.deploy_v2( +//! wasm_hash, +//! (1_u32, 2_i64), +//! ); //! } //! } //! #[test] @@ -82,8 +84,8 @@ //! ``` use crate::{ - env::internal::Env as _, unwrap::UnwrapInfallible, Address, Bytes, BytesN, Env, IntoVal, Val, - Vec, + env::internal::Env as _, unwrap::UnwrapInfallible, Address, Bytes, BytesN, ConstructorArgs, + Env, IntoVal, }; /// Deployer provides access to deploying contracts. @@ -258,6 +260,7 @@ impl DeployerWithAddress { /// and provided salt. /// /// Returns the deployed contract's address. + #[deprecated(note = "use deploy_v2")] pub fn deploy(&self, wasm_hash: impl IntoVal>) -> Address { let env = &self.env; let address_obj = env @@ -272,24 +275,29 @@ impl DeployerWithAddress { /// Deploy a contract that uses Wasm executable with provided hash. /// - /// `constructor_args` will be passed to the contract's constructor. + /// The constructor args will be passed to the contract's constructor. Pass + /// `()` for contract's with no constructor or a constructor with zero + /// arguments. /// /// The address of the deployed contract is defined by the deployer address /// and provided salt. /// /// Returns the deployed contract's address. - pub fn deploy_with_constructor( + pub fn deploy_v2( &self, wasm_hash: impl IntoVal>, - constructor_args: Vec, - ) -> Address { + constructor_args: A, + ) -> Address + where + A: ConstructorArgs, + { let env = &self.env; let address_obj = env .create_contract_with_constructor( self.address.to_object(), wasm_hash.into_val(env).to_object(), self.salt.to_object(), - constructor_args.to_object(), + constructor_args.into_val(env).to_object(), ) .unwrap_infallible(); unsafe { Address::unchecked_new(env.clone(), address_obj) } diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 1d04b3a56..067211ab8 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -453,11 +453,11 @@ impl Env { use crate::{ auth, testutils::{ - budget::Budget, Address as _, AuthSnapshot, AuthorizedInvocation, ConstructorArgs, - ContractFunctionSet, EventsSnapshot, Generators, Ledger as _, MockAuth, MockAuthContract, - Register, Snapshot, StellarAssetContract, StellarAssetIssuer, + budget::Budget, Address as _, AuthSnapshot, AuthorizedInvocation, ContractFunctionSet, + EventsSnapshot, Generators, Ledger as _, MockAuth, MockAuthContract, Register, Snapshot, + StellarAssetContract, StellarAssetIssuer, }, - Bytes, BytesN, + Bytes, BytesN, ConstructorArgs, }; #[cfg(any(test, feature = "testutils"))] use core::{cell::RefCell, cell::RefMut}; @@ -588,7 +588,7 @@ impl Env { /// contract id passed in. /// /// If you need to specify the address the contract should be registered at, - /// use [`register_at`]. + /// use [`Env::register_at`]. /// /// ### Examples /// Register a contract defined in the current crate, by specifying the type diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index a4b8aa5cb..95207d7a9 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -813,6 +813,9 @@ mod string; pub use string::String; mod tuple; +mod constructor_args; +pub use constructor_args::ConstructorArgs; + pub mod xdr; pub mod testutils; diff --git a/soroban-sdk/src/testutils.rs b/soroban-sdk/src/testutils.rs index 8aa6e0c3b..55ba0b221 100644 --- a/soroban-sdk/src/testutils.rs +++ b/soroban-sdk/src/testutils.rs @@ -18,7 +18,7 @@ use soroban_env_host::TryIntoVal; pub mod storage; -use crate::{xdr, Env, IntoVal, Val, Vec}; +use crate::{xdr, ConstructorArgs, Env, Val, Vec}; use soroban_ledger_snapshot::LedgerSnapshot; pub use crate::env::EnvTestConfig; @@ -53,37 +53,6 @@ impl<'w> Register for &'w [u8] { } } -pub trait ConstructorArgs: IntoVal> {} - -impl ConstructorArgs for Vec {} - -macro_rules! impl_constructor_args_for_tuple { - ( $($typ:ident $idx:tt)* ) => { - impl<$($typ),*> ConstructorArgs for ($($typ,)*) - where - $($typ: IntoVal),* - { - } - }; -} - -// 0 topics -impl ConstructorArgs for () {} -// 1-13 topics -impl_constructor_args_for_tuple! { T0 0 } -impl_constructor_args_for_tuple! { T0 0 T1 1 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 T11 11 } -impl_constructor_args_for_tuple! { T0 0 T1 1 T2 2 T3 3 T4 4 T5 5 T6 6 T7 7 T8 8 T9 9 T10 10 T11 11 T12 12 } - #[derive(Default, Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)] #[serde(rename_all = "snake_case")] pub struct Snapshot { From 6c45fb952d61e5e7f519b3d729c91c667639eda1 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 1 Oct 2024 10:48:13 +1000 Subject: [PATCH 38/57] Add compile errors when built with unsupported wasm features (#1353) ### What Add compile errors when built with unsupported wasm features reference-types and multivalue. ### Why Rust 1.82 is likely to ship with target feature reference-types and multivalue enabled on wasm builds. These target features are not supported by the Soroban Env in the current protocol 21 or next planned protocol 22. It's not trivial for developers to disable target features because of how the rustc compiler only exposes the ability to buildstd with nightly. These compile errors will prevent someone from building .wasm files with the sdk when either of those target features are enabled. A Rust version check is not being done because it's actually easier to do a target feature check, and in the off chain somehow Rust 1.82 shipped without the target features enabled then the sdk could still be used with 1.82. Links: - https://discord.com/channels/897514728459468821/1289090985569026048 - https://github.com/stellar/rs-soroban-env/issues/1469 - https://github.com/WebAssembly/tool-conventions/issues/233 ### Releasing This change will be merged to `main` targeting v22, then should be backported to a v21 patch release immediately following. --- soroban-sdk/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index 95207d7a9..0a3d43874 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -47,6 +47,12 @@ #[cfg(all(target_family = "wasm", feature = "testutils"))] compile_error!("'testutils' feature is not supported on 'wasm' target"); +#[cfg(all(target_family = "wasm", target_feature = "reference-types"))] +compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: reference-types. Use Rust 1.81 or older to get a compatible default configuration."); + +#[cfg(all(target_family = "wasm", target_feature = "multivalue"))] +compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: multivalue. Use Rust 1.81 or older to get a compatible default configuration."); + // When used in a no_std contract, provide a panic handler as one is required. #[cfg(all(not(feature = "alloc"), target_family = "wasm"))] #[panic_handler] From b84c6e660724dc93171907622c4feadfb7a0b868 Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Tue, 1 Oct 2024 10:04:46 -0700 Subject: [PATCH 39/57] Update dependencies to 22.0.0-rc.1 (#1356) ### What Update dependencies for the release --- Cargo.lock | 30 ++++++++++++++++++------------ Cargo.toml | 24 ++++++++++++------------ 2 files changed, 30 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b1368f2c8..e46637cec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1216,8 +1216,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "22.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be386d7dac0fa8420ea769716fbb73077b6c0e50e55068d69be97bd97424072f" dependencies = [ "itertools", "proc-macro2", @@ -1227,8 +1228,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "22.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5bc59f0172caff4867ea71e0b65ff8a532d10612ff78c791a01e23fc33521a9a" dependencies = [ "arbitrary", "crate-git-revision", @@ -1245,8 +1247,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "22.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08f608c23236e1c5ee28fbeef406b6fcf2dc089e784311811c7dd55e23927f3d" dependencies = [ "soroban-env-common", "static_assertions", @@ -1254,8 +1257,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "22.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ed9a8d688939f86e38c90dea03ff6f0bf4917f1b3aee510794133e58070c568" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1289,8 +1293,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-soroban-env?rev=60e9be87a157cc9b5132056e1314faabd485b5fb#60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "22.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ed871b77a7e06adb5b61f792aac3d23c5180c56b4c9bba59ecdc38d5f468cf5" dependencies = [ "itertools", "proc-macro2", @@ -1441,8 +1446,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "22.0.0" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=67be5955a15f1d3a4df83fe86e6ae107f687141b#67be5955a15f1d3a4df83fe86e6ae107f687141b" +version = "22.0.0-rc.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1946827903a221bf052e24e18f0ed6fb10ca350c9281911f24b7d7a9726ab181" dependencies = [ "arbitrary", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index b0ffc52f4..c609f42ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,29 +24,29 @@ soroban-ledger-snapshot = { version = "22.0.0-rc.1", path = "soroban-ledger-snap soroban-token-sdk = { version = "22.0.0-rc.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=22.0.0" -git = "https://github.com/stellar/rs-soroban-env" -rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "=22.0.0-rc.1" +#git = "https://github.com/stellar/rs-soroban-env" +#rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-guest] -version = "=22.0.0" -git = "https://github.com/stellar/rs-soroban-env" -rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "=22.0.0-rc.1" +#git = "https://github.com/stellar/rs-soroban-env" +#rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-host] -version = "=22.0.0" -git = "https://github.com/stellar/rs-soroban-env" -rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" +version = "=22.0.0-rc.1" +#git = "https://github.com/stellar/rs-soroban-env" +#rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.stellar-strkey] version = "=0.0.9" [workspace.dependencies.stellar-xdr] -version = "=22.0.0" +version = "=22.0.0-rc.1" default-features = false features = ["curr"] -git = "https://github.com/stellar/rs-stellar-xdr" -rev = "67be5955a15f1d3a4df83fe86e6ae107f687141b" +#git = "https://github.com/stellar/rs-stellar-xdr" +#rev = "67be5955a15f1d3a4df83fe86e6ae107f687141b" #[patch."https://github.com/stellar/rs-soroban-env"] #soroban-env-common = { path = "../rs-soroban-env/soroban-env-common" } From 9bc822f6f81431ce361b09013e0868ccfc0b8c80 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 3 Oct 2024 03:30:55 +1000 Subject: [PATCH 40/57] Update env and xdr (#1357) ### What Update env and xdr ### Why Routine. So that cli can use the latest xdr lib. --- Cargo.lock | 24 ++++++++++++------------ Cargo.toml | 8 ++++---- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e46637cec..4f39dd240 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1216,9 +1216,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be386d7dac0fa8420ea769716fbb73077b6c0e50e55068d69be97bd97424072f" +checksum = "6e4c8668199d95e3061cd42e1b96a91451c656a238a607fa53f96f0a3fdcf5f3" dependencies = [ "itertools", "proc-macro2", @@ -1228,9 +1228,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bc59f0172caff4867ea71e0b65ff8a532d10612ff78c791a01e23fc33521a9a" +checksum = "6bdf1d66133d6b29e2834acea79decb57c47c71aa01885cae2b9ad621d67525c" dependencies = [ "arbitrary", "crate-git-revision", @@ -1247,9 +1247,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f608c23236e1c5ee28fbeef406b6fcf2dc089e784311811c7dd55e23927f3d" +checksum = "fa9610ac8a4a900e6f35b2ed171bc325c7e9883929f5e9da758e85f1226dd284" dependencies = [ "soroban-env-common", "static_assertions", @@ -1257,9 +1257,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed9a8d688939f86e38c90dea03ff6f0bf4917f1b3aee510794133e58070c568" +checksum = "0c695d22888ede1f98c016a4a690be307817d133be0e0f32a25fd6e53bb6c929" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1293,9 +1293,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ed871b77a7e06adb5b61f792aac3d23c5180c56b4c9bba59ecdc38d5f468cf5" +checksum = "d926d0daa3ba798cd70ce962ea10012e630d75088352369a6d248b2644dd7a2c" dependencies = [ "itertools", "proc-macro2", @@ -1446,9 +1446,9 @@ dependencies = [ [[package]] name = "stellar-xdr" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1946827903a221bf052e24e18f0ed6fb10ca350c9281911f24b7d7a9726ab181" +checksum = "c88dc0e928b9cb65ea43836b52560bb4ead3e32895f5019ca223dc7cd1966cbf" dependencies = [ "arbitrary", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index c609f42ef..bf8828757 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,17 +24,17 @@ soroban-ledger-snapshot = { version = "22.0.0-rc.1", path = "soroban-ledger-snap soroban-token-sdk = { version = "22.0.0-rc.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=22.0.0-rc.1" +version = "=22.0.0-rc.1.1" #git = "https://github.com/stellar/rs-soroban-env" #rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-guest] -version = "=22.0.0-rc.1" +version = "=22.0.0-rc.1.1" #git = "https://github.com/stellar/rs-soroban-env" #rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-host] -version = "=22.0.0-rc.1" +version = "=22.0.0-rc.1.1" #git = "https://github.com/stellar/rs-soroban-env" #rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" @@ -42,7 +42,7 @@ version = "=22.0.0-rc.1" version = "=0.0.9" [workspace.dependencies.stellar-xdr] -version = "=22.0.0-rc.1" +version = "=22.0.0-rc.1.1" default-features = false features = ["curr"] #git = "https://github.com/stellar/rs-stellar-xdr" From 6d430672aed26473bef5fb4dac219a8adf99f280 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 2 Oct 2024 20:53:48 +0000 Subject: [PATCH 41/57] Bump version to 22.0.0-rc.1.1 (#1358) ### What Bump version to 22.0.0-rc.1.1, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/11151162865. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v22.0.0-rc.1.1` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.1.1&title=22.0.0-rc.1.1 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.1.1&title=22.0.0-rc.1.1&target=release/v22.0.0-rc.1.1 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 54 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f39dd240..217037271 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1308,7 +1308,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "pretty_assertions", "serde", @@ -1321,7 +1321,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1345,7 +1345,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "crate-git-revision", "darling", @@ -1363,7 +1363,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1374,7 +1374,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "pretty_assertions", "prettyplease", @@ -1389,7 +1389,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] @@ -1520,140 +1520,140 @@ dependencies = [ [[package]] name = "test_account" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_constructor" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1661,7 +1661,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index bf8828757..eb8ea7df7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "22.0.0-rc.1" +version = "22.0.0-rc.1.1" rust-version = "1.79.0" [workspace.dependencies] -soroban-sdk = { version = "22.0.0-rc.1", path = "soroban-sdk" } -soroban-sdk-macros = { version = "22.0.0-rc.1", path = "soroban-sdk-macros" } -soroban-spec = { version = "22.0.0-rc.1", path = "soroban-spec" } -soroban-spec-rust = { version = "22.0.0-rc.1", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "22.0.0-rc.1", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "22.0.0-rc.1", path = "soroban-token-sdk" } +soroban-sdk = { version = "22.0.0-rc.1.1", path = "soroban-sdk" } +soroban-sdk-macros = { version = "22.0.0-rc.1.1", path = "soroban-sdk-macros" } +soroban-spec = { version = "22.0.0-rc.1.1", path = "soroban-spec" } +soroban-spec-rust = { version = "22.0.0-rc.1.1", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "22.0.0-rc.1.1", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "22.0.0-rc.1.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=22.0.0-rc.1.1" From f0e653e364b19a7bf23bcb6b1cb2427ba12cee44 Mon Sep 17 00:00:00 2001 From: Siddharth Suresh Date: Wed, 2 Oct 2024 18:28:27 -0700 Subject: [PATCH 42/57] Bump to latest env (#1359) ### What Pickup env rc-2 --- Cargo.lock | 125 +++++++++++++++++++---------------------------------- Cargo.toml | 20 ++++----- 2 files changed, 55 insertions(+), 90 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 217037271..41220bd50 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -156,12 +156,6 @@ dependencies = [ "rand", ] -[[package]] -name = "arrayvec" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" - [[package]] name = "autocfg" version = "1.3.0" @@ -645,9 +639,6 @@ name = "hashbrown" version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" -dependencies = [ - "ahash", -] [[package]] name = "hex" @@ -811,12 +802,6 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" -[[package]] -name = "multi-stash" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a9ac4b61f4e728e1d2c6a7844609c16527aeb5e6c865915c08e619c16410f" - [[package]] name = "num-bigint" version = "0.4.6" @@ -1216,9 +1201,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4c8668199d95e3061cd42e1b96a91451c656a238a607fa53f96f0a3fdcf5f3" +checksum = "8cdb13e8f4556fe89d2b1c8f529a66997e1d90fd6f10440dc5a1717f5f733251" dependencies = [ "itertools", "proc-macro2", @@ -1228,9 +1213,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdf1d66133d6b29e2834acea79decb57c47c71aa01885cae2b9ad621d67525c" +checksum = "984c9a1a84c05599f5c9cb17d5fbb75fe1c7106598659a34d9da8a8f16d2c23f" dependencies = [ "arbitrary", "crate-git-revision", @@ -1247,9 +1232,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa9610ac8a4a900e6f35b2ed171bc325c7e9883929f5e9da758e85f1226dd284" +checksum = "570dfaa0f35b373a2f9793b89a1864caf68e9071c5c8a4100654aa3434b4fde1" dependencies = [ "soroban-env-common", "static_assertions", @@ -1257,9 +1242,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c695d22888ede1f98c016a4a690be307817d133be0e0f32a25fd6e53bb6c929" +checksum = "e59d22359f8d372872b7630fc0dc6884c36356d5d33d3fca83d2b76e572c2a32" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1293,9 +1278,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d926d0daa3ba798cd70ce962ea10012e630d75088352369a6d248b2644dd7a2c" +checksum = "76184b736ac2ce144461efbe7c3551ac2c2973fa144e32957bb2ae2d80467f64" dependencies = [ "itertools", "proc-macro2", @@ -1308,7 +1293,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "pretty_assertions", "serde", @@ -1321,7 +1306,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "arbitrary", "bytes-lit", @@ -1345,7 +1330,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "crate-git-revision", "darling", @@ -1363,7 +1348,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1374,7 +1359,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "pretty_assertions", "prettyplease", @@ -1389,24 +1374,20 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "soroban-wasmi" -version = "0.36.1-soroban.22.0.0" +version = "0.31.1-soroban.20.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7044ea0ee6ff67039df1f232f0d3d98121f69a0409e944774912fc5f043c280f" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" dependencies = [ - "arrayvec", - "multi-stash", - "num-derive", - "num-traits", "smallvec", "spin", - "wasmi_collections", + "wasmi_arena", "wasmi_core", "wasmparser-nostd", ] @@ -1460,17 +1441,6 @@ dependencies = [ "stellar-strkey", ] -[[package]] -name = "string-interner" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c6a0d765f5807e98a091107bae0a56ea3799f66a5de47b2c84c94a39c09974e" -dependencies = [ - "cfg-if", - "hashbrown 0.14.5", - "serde", -] - [[package]] name = "strsim" version = "0.11.1" @@ -1520,140 +1490,140 @@ dependencies = [ [[package]] name = "test_account" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_constructor" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1661,7 +1631,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" dependencies = [ "soroban-sdk", ] @@ -1812,21 +1782,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] -name = "wasmi_collections" -version = "0.36.1" +name = "wasmi_arena" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d1ff23df2c456c8b5d9a0ae7eed03a40f0c4520466b4aa87135c5fc557476e8" -dependencies = [ - "ahash", - "hashbrown 0.14.5", - "string-interner", -] +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" [[package]] name = "wasmi_core" -version = "0.36.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac1b21ded145eb313d44a5895442c28e18904fb95718dc83893779f55945d342" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" dependencies = [ "downcast-rs", "libm", diff --git a/Cargo.toml b/Cargo.toml index eb8ea7df7..d25a13d88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,29 +12,29 @@ members = [ ] [workspace.package] -version = "22.0.0-rc.1.1" +version = "22.0.0-rc.2" rust-version = "1.79.0" [workspace.dependencies] -soroban-sdk = { version = "22.0.0-rc.1.1", path = "soroban-sdk" } -soroban-sdk-macros = { version = "22.0.0-rc.1.1", path = "soroban-sdk-macros" } -soroban-spec = { version = "22.0.0-rc.1.1", path = "soroban-spec" } -soroban-spec-rust = { version = "22.0.0-rc.1.1", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "22.0.0-rc.1.1", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "22.0.0-rc.1.1", path = "soroban-token-sdk" } +soroban-sdk = { version = "22.0.0-rc.2", path = "soroban-sdk" } +soroban-sdk-macros = { version = "22.0.0-rc.2", path = "soroban-sdk-macros" } +soroban-spec = { version = "22.0.0-rc.2", path = "soroban-spec" } +soroban-spec-rust = { version = "22.0.0-rc.2", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "22.0.0-rc.2", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "22.0.0-rc.2", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=22.0.0-rc.1.1" +version = "=22.0.0-rc.2" #git = "https://github.com/stellar/rs-soroban-env" #rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-guest] -version = "=22.0.0-rc.1.1" +version = "=22.0.0-rc.2" #git = "https://github.com/stellar/rs-soroban-env" #rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" [workspace.dependencies.soroban-env-host] -version = "=22.0.0-rc.1.1" +version = "=22.0.0-rc.2" #git = "https://github.com/stellar/rs-soroban-env" #rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" From 2320068258325a5d214914cd9b0f3bd6355db4a9 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Mon, 7 Oct 2024 20:07:48 -0400 Subject: [PATCH 43/57] Add &Bytes->Val conversions. (#1362) ### What Add &Bytes->Val conversions. ### Why These were missing. ### Known limitations N/A --- soroban-sdk/src/bytes.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index af4094a25..2e427f1ed 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -299,6 +299,14 @@ impl TryFromVal for Val { } } +impl TryFromVal for Val { + type Error = ConversionError; + + fn try_from_val(_env: &Env, v: &&Bytes) -> Result { + Ok(v.to_val()) + } +} + impl From for Val { #[inline(always)] fn from(v: Bytes) -> Self { @@ -1013,6 +1021,14 @@ impl TryFromVal> for Val { } } +impl TryFromVal> for Val { + type Error = ConversionError; + + fn try_from_val(_env: &Env, v: &&BytesN) -> Result { + Ok(v.to_val()) + } +} + impl TryFrom for BytesN { type Error = ConversionError; From 1eaa5d892f16eb9e24742dd29e2802776988063e Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:20:35 +1000 Subject: [PATCH 44/57] Fix importing contract crates into other crates for testing (#1364) ### What Change two locations of the soroban-sdk-macros which were gated on the contract crates `testutils` feature, to be gated on the SDK's `testutils` feature. ### Why Recently I introduced a bug into the sdk across two changes: - https://github.com/stellar/rs-soroban-sdk/pull/1344 - https://github.com/stellar/rs-soroban-sdk/pull/1336 The bug was that I changed how some code was gated to be gated on whether the contract's `testutils` feature was enabled, rather than on the SDKs. Sometime ago in the following issue I changed how all of a contract's testutils are enabled/disabled, by being enabled/disabled by the SDK's testutils feature: - https://github.com/stellar/rs-soroban-sdk/pull/1301 That change was good, it fixed a horrid issue with testing contracts where you could have some contracts in testutils mode, and others not, leading to strange errors when importing native contracts for testing. However, when I worked on the two issues above, I inadvertently forgot that we had changed the structure of how testutils code got enabled, and I introduced across those two PRs two new locations where we followed the old pattern and gated on the contract feature set, not the SDKs. For most users this will have presented no issues because there all of these testutilities are always enabled in a contract's own tests. This masked the issue in all of our own tests, but broke setups like fuzzing where the contract gets imported. All of our fuzz projects unfortunately don't currently build the fuzz components, and so this got missed until someone (me) tried to use them. ### Known limitations This change doesn't introduce a test to detect this type of breakage. I think the way we can detect this in the future is have our pre-existing test vector build as part of CI. This issue is tracking that follow up work: - https://github.com/stellar/rs-soroban-sdk/issues/1363 ### Merging This fix is targeting main, but we need a similar fix to target v21, because part of this bug was introduced into v21.7.2. Once this change merges to main, I will partially cherry-pick it into a backport patch release. --- soroban-sdk-macros/src/derive_fn.rs | 36 ++++++++++++++++++----------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/soroban-sdk-macros/src/derive_fn.rs b/soroban-sdk-macros/src/derive_fn.rs index 73c4d50b3..0c24bfe72 100644 --- a/soroban-sdk-macros/src/derive_fn.rs +++ b/soroban-sdk-macros/src/derive_fn.rs @@ -126,6 +126,24 @@ pub fn derive_pub_fn( return Err(quote! { #(#compile_errors)* }); } + let testutils_only_code = if cfg!(feature = "testutils") { + Some(quote! { + #[deprecated(note = #deprecated_note)] + pub fn invoke_raw_slice( + env: #crate_path::Env, + args: &[#crate_path::Val], + ) -> #crate_path::Val { + if args.len() != #arg_count { + panic!("invalid number of input arguments: {} expected, got {}", #arg_count, args.len()); + } + #[allow(deprecated)] + invoke_raw(env, #(#slice_args),*) + } + }) + } else { + None + }; + // Generated code. Ok(quote! { #[doc(hidden)] @@ -146,18 +164,7 @@ pub fn derive_pub_fn( ) } - #[cfg(any(test, feature = "testutils"))] - #[deprecated(note = #deprecated_note)] - pub fn invoke_raw_slice( - env: #crate_path::Env, - args: &[#crate_path::Val], - ) -> #crate_path::Val { - if args.len() != #arg_count { - panic!("invalid number of input arguments: {} expected, got {}", #arg_count, args.len()); - } - #[allow(deprecated)] - invoke_raw(env, #(#slice_args),*) - } + #testutils_only_code #[deprecated(note = #deprecated_note)] #[cfg_attr(target_family = "wasm", export_name = #wrap_export_name)] @@ -178,6 +185,10 @@ pub fn derive_contract_function_registration_ctor<'a>( trait_ident: Option<&Ident>, methods: impl Iterator, ) -> TokenStream2 { + if cfg!(not(feature = "testutils")) { + return quote!(); + } + let (idents, wrap_idents): (Vec<_>, Vec<_>) = methods .map(|m| { let ident = format!("{}", m.sig.ident); @@ -193,7 +204,6 @@ pub fn derive_contract_function_registration_ctor<'a>( quote! { #[doc(hidden)] - #[cfg(any(test, feature = "testutils"))] #[#crate_path::reexports_for_macros::ctor::ctor] #[allow(non_snake_case)] fn #ctor_ident() { From 1cd3d5b04e3ae4e9fd793a761483b939b1c79f9c Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Wed, 9 Oct 2024 09:30:56 +1000 Subject: [PATCH 45/57] Deprecate fuzz_catch_panic (#1365) ### What Deprecate `fuzz_catch_panic`, encouraging developers to use the `try_` invoke functions instead. ### Why The fuzz_catch_panic function catches panics that occur when the contract fails and generates a panic. It is necessary to often catch panics when testing contracts because contract errors are populated up to the test as a panic when called from their regular client invoking function. However, contract clients, and the env, also have `try_` variants of each function for calling a contract. When the try variant is used, panics and contract errors are caught and molded into a `Result, Result<_,_>>` developers can assert on. Developers in tests can then assert did the contract: 1. Succeed and return the expected type, `Ok(Ok(_))` 2. Error and return an expected contract error type as defined by a `contracterror` enum, `Err(Ok(_))` 3. Succeed and return an unexpected type, `Ok(Err(_))` 4. Error and return an abort (panic), or system / host error, or a contract error not included in the `contracterror` enum, `Err(Err(_))` ### Known limitations As far as I can tell the purposes of `fuzz_catch_panic` can be served by the `Env` `try_invoke` and the generated contract client `try_` functions, but I'd be interested to hear from @brson to confirm if I'm missing any case where we'd want to keep `fuzz_catch_panic`. ### Docs The stellar-docs need updating as well. --- soroban-sdk/src/testutils/arbitrary.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/soroban-sdk/src/testutils/arbitrary.rs b/soroban-sdk/src/testutils/arbitrary.rs index 1389f77e0..a48b03a7e 100644 --- a/soroban-sdk/src/testutils/arbitrary.rs +++ b/soroban-sdk/src/testutils/arbitrary.rs @@ -11,7 +11,6 @@ //! This module //! //! - defines the [`SorobanArbitrary`] trait, -//! - defines the [`fuzz_catch_panic`] helper, //! - reexports the [`arbitrary`] crate and the [`Arbitrary`] type. //! //! This module is only available when the "testutils" Cargo feature is defined. @@ -1249,11 +1248,10 @@ mod fuzz_test_helpers { /// let contract = ExampleContract::new(env, &env.register_contract(None, ExampleContract {})); /// /// let addresses: Address = input.deposit_address.into_val(&env); - /// let r = fuzz_catch_panic(|| { - /// contract.deposit(deposit_address, input.deposit_amount); - /// }); + /// let r = contract.try_deposit(deposit_address, input.deposit_amount); /// }); /// ``` + #[deprecated(note = "use [Env::try_invoke] or the try_ functions on a contract client")] pub fn fuzz_catch_panic(f: F) -> std::thread::Result where F: FnOnce() -> R, From 1b32566148766930debed848a42b4664906ea0fd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 12:11:44 +0000 Subject: [PATCH 46/57] Bump version to 22.0.0-rc.2.1 (#1366) ### What Bump version to 22.0.0-rc.2.1, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/11254301089. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v22.0.0-rc.2.1` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.2.1&title=22.0.0-rc.2.1 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.2.1&title=22.0.0-rc.2.1&target=release/v22.0.0-rc.2.1 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 54 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 41220bd50..08241f035 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "pretty_assertions", "serde", @@ -1306,7 +1306,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1330,7 +1330,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "crate-git-revision", "darling", @@ -1348,7 +1348,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1359,7 +1359,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "pretty_assertions", "prettyplease", @@ -1374,7 +1374,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] @@ -1490,140 +1490,140 @@ dependencies = [ [[package]] name = "test_account" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_constructor" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1631,7 +1631,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index d25a13d88..14fa23ddf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "22.0.0-rc.2" +version = "22.0.0-rc.2.1" rust-version = "1.79.0" [workspace.dependencies] -soroban-sdk = { version = "22.0.0-rc.2", path = "soroban-sdk" } -soroban-sdk-macros = { version = "22.0.0-rc.2", path = "soroban-sdk-macros" } -soroban-spec = { version = "22.0.0-rc.2", path = "soroban-spec" } -soroban-spec-rust = { version = "22.0.0-rc.2", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "22.0.0-rc.2", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "22.0.0-rc.2", path = "soroban-token-sdk" } +soroban-sdk = { version = "22.0.0-rc.2.1", path = "soroban-sdk" } +soroban-sdk-macros = { version = "22.0.0-rc.2.1", path = "soroban-sdk-macros" } +soroban-spec = { version = "22.0.0-rc.2.1", path = "soroban-spec" } +soroban-spec-rust = { version = "22.0.0-rc.2.1", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "22.0.0-rc.2.1", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "22.0.0-rc.2.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=22.0.0-rc.2" From b92471770d94cfe6b3b281bba2ffe9461e0e5476 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 11 Oct 2024 14:03:27 +1000 Subject: [PATCH 47/57] Filter events the env exposes in test snapshots to contracts to contract events (#1361) ### What Filter events the env exposes in test snapshots to contracts to contract events. ### Why The main thing we need to test in test snapshots is that non-diagnostic events are consistent and captured. Diagnostic events are noise here. ### Notes There's no good time to make this change. Ideally the change is made at a major version because it's breaking. But at a major version is the ideal time to avoid the change so that people see only meaningful diffs on their test snapshots. --- soroban-sdk/src/env.rs | 11 + .../test/test_first_unchecked_panics.1.json | 70 -- .../test/test_get_unchecked_panics.1.json | 77 -- .../bytes/test/test_insert_panic.1.json | 77 -- .../test/test_last_unchecked_panics.1.json | 70 -- .../test/test_pop_unchecked_panics.1.json | 70 -- .../test/test_remove_unchecked_panics.1.json | 77 -- .../bytes/test/test_slice_panic.1.json | 77 -- ...checked_panics_on_key_type_mismatch.1.json | 89 -- .../test/test_remove_unchecked_panic.1.json | 121 -- ...checked_panics_on_key_type_mismatch.1.json | 89 -- .../tests/auth/auth_10_one/test.1.json | 395 +----- .../tests/auth/auth_15_one_repeat/test.1.json | 336 +---- .../test.1.json | 235 +--- .../auth/auth_20_deep_one_address/test.1.json | 275 +---- .../test_auth_tree.1.json | 372 +----- .../test.1.json | 394 +----- .../test_auth_tree.1.json | 372 +----- .../test.1.json | 394 +----- .../test_auth_tree.1.json | 372 +----- .../test_auth_as_tree.1.json | 314 +---- ...uth_not_allowed_with_separated_tree.1.json | 466 +------ .../tests/budget/test_budget.1.json | 91 +- .../contract_add_i32/test_functional.1.json | 83 +- .../test_invoke_expect_error.1.json | 199 +-- .../contract_assert/test_try_invoke.1.json | 174 +-- .../contract_docs/fn_/test_functional.1.json | 72 +- .../contract_duration/test_functional.1.json | 74 +- .../tests/contract_fn/test_functional.1.json | 83 +- .../test_invoke_expect_error.1.json | 156 +-- .../test_invoke_expect_string.1.json | 156 +-- .../contract_invoke/test_try_invoke.1.json | 131 +- .../test_correct_arg_count.1.json | 167 +-- .../test_too_few_args.1.json | 322 +---- .../test_too_many_args.1.json | 352 +----- .../test_functional.1.json | 83 +- .../tests/contract_snapshot/test.1.json | 76 +- .../tests/contract_snapshot/test.2.json | 130 +- .../tests/contract_store/test_storage.1.json | 1082 +---------------- ...orage_extension_past_max_ttl_panics.1.json | 209 +--- .../contract_timepoint/test_functional.1.json | 74 +- .../contract_udt_enum/test_functional.1.json | 112 +- .../contract_udt_enum_error/test_error.1.json | 142 +-- .../test_success.1.json | 74 +- .../test_functional.1.json | 154 +-- .../test_error_on_partial_decode.1.json | 45 - .../test_functional.1.json | 158 +-- .../test_long_names_functional.1.json | 101 +- .../test_error_on_partial_decode.1.json | 45 - .../test_functional.1.json | 118 +- ...test_verify_sig_ed25519_invalid_sig.1.json | 70 -- ...ult_and_from_snapshot_same_settings.1.json | 239 +--- ...ult_and_from_snapshot_same_settings.2.json | 239 +--- ...ct_deploys_predictable_contract_ids.1.json | 27 +- ...ct_deploys_predictable_contract_ids.2.json | 75 +- ...ct_deploys_predictable_contract_ids.3.json | 75 +- .../test_snapshots/tests/max_ttl/max.1.json | 27 +- .../tests/prng/test_prng_fill_array.1.json | 27 +- .../tests/prng/test_prng_fill_bytes.1.json | 27 +- .../tests/prng/test_prng_fill_bytesn.1.json | 27 +- .../tests/prng/test_prng_fill_slice.1.json | 27 +- .../tests/prng/test_prng_fill_u64.1.json | 27 +- .../tests/prng/test_prng_gen_array.1.json | 27 +- .../tests/prng/test_prng_gen_bytesn.1.json | 27 +- .../tests/prng/test_prng_gen_len_bytes.1.json | 27 +- .../tests/prng/test_prng_gen_range_u64.1.json | 27 +- ...en_range_u64_panic_on_invalid_range.1.json | 52 +- .../tests/prng/test_prng_gen_u64.1.json | 27 +- .../tests/prng/test_prng_seed.1.json | 27 +- .../tests/prng/test_prng_seed.2.json | 27 +- .../tests/prng/test_prng_shuffle.1.json | 27 +- .../tests/prng/test_vec_shuffle.1.json | 27 +- .../tests/storage_testutils/all.1.json | 27 +- .../temp_entry_expiration.1.json | 27 +- .../test_persistent_entry_expiration.1.json | 87 +- .../storage_testutils/ttl_getters.1.json | 51 +- .../token_client/test_issuer_flags.1.json | 94 -- .../token_client/test_mock_all_auth.1.json | 781 +----------- .../tests/token_client/test_mock_auth.1.json | 634 ---------- ...t_unchecked_panics_on_out_of_bounds.1.json | 77 -- ...k_unchecked_panics_on_out_of_bounds.1.json | 45 - ...t_unchecked_panics_on_out_of_bounds.1.json | 45 - .../test/test_remove_unchecked_panics.1.json | 77 -- .../test/test_try_get_unchecked_panics.1.json | 77 -- ...k_unchecked_panics_on_out_of_bounds.1.json | 45 - ...t_unchecked_panics_on_out_of_bounds.1.json | 45 - tests/account/test_snapshots/test/test.1.json | 142 +-- .../test_snapshots/test/test_add.1.json | 92 +- .../test_snapshots/test/test_add.1.json | 92 +- .../test_snapshots/test/test_add.1.json | 83 +- .../alloc/test_snapshots/test/test_add.1.json | 92 +- .../test_a/test_with_mock_all_auth.1.json | 76 +- .../test_a/test_with_mock_auth.1.json | 195 +-- ...est_with_real_contract_auth_approve.1.json | 195 +-- ...est_with_real_contract_auth_decline.1.json | 327 +---- .../test_b/test_with_mock_all_auth.1.json | 156 +-- .../test_b/test_with_mock_auth.1.json | 317 +---- ...est_with_real_contract_auth_approve.1.json | 317 +---- ...est_with_real_contract_auth_decline.1.json | 403 +----- .../test_snapshots/test_constructor.1.json | 387 +----- ..._constructor_arguments_causes_panic.1.json | 115 +- ..._constructor_arguments_causes_panic.1.json | 131 +- ..._constructor_arguments_causes_panic.1.json | 125 +- ..._constructor_arguments_causes_panic.1.json | 106 +- .../test_snapshots/test/test_hello.1.json | 72 +- .../test_snapshots/test/test_hello.1.json | 27 +- .../test_snapshots/test/hello_ok.1.json | 123 +- .../test/try_hello_error.1.json | 189 +-- .../test/try_hello_error_panic.1.json | 221 +--- .../test/try_hello_error_panic_string.1.json | 191 +-- ...llo_error_unexpected_contract_error.1.json | 221 +--- .../test_snapshots/test/try_hello_ok.1.json | 123 +- .../test_snapshots/test/test_pub_event.1.json | 69 -- .../test_snapshots/test/test_add.1.json | 166 +-- .../test_snapshots/test/test_logging.1.json | 226 +--- tests/modular/test_snapshots/test/test.1.json | 168 +-- .../test_snapshots/test/test_hello.1.json | 162 +-- tests/udt/test_snapshots/test/test_add.1.json | 207 +--- .../test_snapshots/test/test_add.1.json | 83 +- 119 files changed, 110 insertions(+), 18199 deletions(-) delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json delete mode 100644 soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json delete mode 100644 soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json delete mode 100644 soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json delete mode 100644 soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json delete mode 100644 soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json delete mode 100644 soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json delete mode 100644 soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 067211ab8..21167c62b 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -1587,6 +1587,17 @@ impl Env { .unwrap() .0 .into_iter() + .filter(|e| match e.event.type_ { + // Keep only system and contract events, because event + // snapshots are used in test snapshots, and intended to be + // stable over time because the goal is to record meaningful + // observable behaviors. Diagnostic events are observable, + // but events have no stability guarantees and are intended + // to be used by developers when debugging, tracing, and + // observing, not by systems that integrate. + xdr::ContractEventType::System | xdr::ContractEventType::Contract => true, + xdr::ContractEventType::Diagnostic => false, + }) .map(Into::into) .collect(), ) diff --git a/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json deleted file mode 100644 index 06c5515c0..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_first_unchecked_panics.1.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "bytes_front out of bounds" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json deleted file mode 100644 index 21793fb33..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_get_unchecked_panics.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "bytes_get out of bounds" - }, - { - "u32": 0 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json b/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json deleted file mode 100644 index 213e18be8..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_insert_panic.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "object index out of bounds" - }, - { - "u32": 80 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json deleted file mode 100644 index e78f65366..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_last_unchecked_panics.1.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "bytes_back out of bounds" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json deleted file mode 100644 index e78f65366..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_pop_unchecked_panics.1.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "bytes_back out of bounds" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json b/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json deleted file mode 100644 index 21d95ad18..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_remove_unchecked_panics.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "object index out of bounds" - }, - { - "u32": 4 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json b/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json deleted file mode 100644 index 4d23c1f9d..000000000 --- a/soroban-sdk/test_snapshots/bytes/test/test_slice_panic.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "object index out of bounds" - }, - { - "u32": 6 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json b/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json deleted file mode 100644 index 18d58098c..000000000 --- a/soroban-sdk/test_snapshots/map/test/test_get_unchecked_panics_on_key_type_mismatch.1.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "missing_value" - } - } - ], - "data": { - "vec": [ - { - "string": "map key not found in map_get" - }, - { - "map": [ - { - "key": { - "i64": 1 - }, - "val": { - "i32": 2 - } - } - ] - }, - { - "i32": 1 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "missing_value" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json b/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json deleted file mode 100644 index ae81a7271..000000000 --- a/soroban-sdk/test_snapshots/map/test/test_remove_unchecked_panic.1.json +++ /dev/null @@ -1,121 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "missing_value" - } - } - ], - "data": { - "vec": [ - { - "string": "map key not found in map_del" - }, - { - "map": [ - { - "key": { - "u32": 0 - }, - "val": { - "u32": 0 - } - }, - { - "key": { - "u32": 1 - }, - "val": { - "u32": 10 - } - }, - { - "key": { - "u32": 2 - }, - "val": { - "u32": 20 - } - }, - { - "key": { - "u32": 3 - }, - "val": { - "u32": 30 - } - }, - { - "key": { - "u32": 4 - }, - "val": { - "u32": 40 - } - } - ] - }, - { - "u32": 100 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "missing_value" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json b/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json deleted file mode 100644 index 18d58098c..000000000 --- a/soroban-sdk/test_snapshots/map/test/test_try_get_unchecked_panics_on_key_type_mismatch.1.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "missing_value" - } - } - ], - "data": { - "vec": [ - { - "string": "map key not found in map_get" - }, - { - "map": [ - { - "key": { - "i64": 1 - }, - "val": { - "i32": 2 - } - } - ] - }, - { - "i32": 1 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "missing_value" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json index ce85fe717..2a1c4c9e0 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_10_one/test.1.json @@ -221,398 +221,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 11 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "8b787aeb5ada99ba36ec7a06bd664b1025cf1b7ffed054140fec9b75975a3e2b" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 11 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "add" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 21 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 13 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "10413525b172dbdea26e9f27e81a8338b79ec99ca2fd8f62ea03a867c17cd983" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 13 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "add" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 23 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json index 9c0b44e05..70b4d6805 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_15_one_repeat/test.1.json @@ -219,339 +219,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "8ba380e191a7102cb7eaaeb20f5c158bacfaf4fd9839303c68efd3b205add1a8" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "add" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "43715dd7be2b478884e9cf9c1647b50647374a68bd0419749349cf1a3103612b" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "add" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json index 2beb38f86..50da3e693 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_17_no_consume_requirement/test.1.json @@ -163,238 +163,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "8ba380e191a7102cb7eaaeb20f5c158bacfaf4fd9839303c68efd3b205add1a8" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "add" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json index c9a06c04e..2147fad7e 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test.1.json @@ -189,278 +189,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "649656704d5f34ee6e3bceb21e2ae67fe34b0444ff46ae00c011829f828efbe2" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fnb" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fnb" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fna" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json index a91ddf4a4..3883d48b8 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_20_deep_one_address/test_auth_tree.1.json @@ -138,375 +138,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "Unauthorized function call for address" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fnb" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fna" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json index 09a1053f4..8df49f93f 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test.1.json @@ -240,397 +240,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "649656704d5f34ee6e3bceb21e2ae67fe34b0444ff46ae00c011829f828efbe2" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fnb" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "2e1c76645141f8e4d490f71747edd57513ac869359fcd1de85b6ac491640139e" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fnb" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fnb" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fna" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json index a91ddf4a4..3883d48b8 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_30_deep_one_address_repeat/test_auth_tree.1.json @@ -138,375 +138,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "Unauthorized function call for address" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fnb" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fna" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json index 09a1053f4..8df49f93f 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test.1.json @@ -240,397 +240,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "649656704d5f34ee6e3bceb21e2ae67fe34b0444ff46ae00c011829f828efbe2" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fnb" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "2e1c76645141f8e4d490f71747edd57513ac869359fcd1de85b6ac491640139e" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fnb" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fnb" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fna" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json index a91ddf4a4..3883d48b8 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_35_deep_one_address_repeat_grouped/test_auth_tree.1.json @@ -138,375 +138,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "Unauthorized function call for address" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fnb" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fna" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json index bad4a1c67..44f2a90b6 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_as_tree.1.json @@ -204,317 +204,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "06cdea969bb3c2dd1e8312bb433f97ddb0af1b632a18d5220a30a4fa2f6f2064" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fna" - } - } - ] - } - ] - }, - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fnb" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fnb" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fna" - } - ], - "data": { - "i32": 1 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json index f1a5cd6c4..9bf1a2869 100644 --- a/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json +++ b/soroban-sdk/test_snapshots/tests/auth/auth_40_multi_one_address/test_auth_not_allowed_with_separated_tree.1.json @@ -139,469 +139,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fna" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "fe6209c80b8298e7246c52b6d7318213a474bb463e4a3e3cad84663aab6072c8" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fna" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fnb" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "Unauthorized function call for address" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "fnb" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "fna" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json b/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json index a68dc04fe..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json +++ b/soroban-sdk/test_snapshots/tests/budget/test_budget.1.json @@ -72,94 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "map": [ - { - "key": { - "i32": 1 - }, - "val": { - "i32": 10 - } - }, - { - "key": { - "i32": 2 - }, - "val": { - "i32": 20 - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json index 9de7e0839..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_add_i32/test_functional.1.json @@ -72,86 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json b/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json index 61fea5bac..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_assert/test_invoke_expect_error.1.json @@ -72,202 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "assert" - } - ], - "data": { - "u32": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "failing with contract error" - }, - { - "u32": 1 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "assert" - }, - { - "vec": [ - { - "u32": 0 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json b/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json index 3fac9a80e..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_assert/test_try_invoke.1.json @@ -72,177 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "assert" - } - ], - "data": { - "u32": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "failing with contract error" - }, - { - "u32": 1 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "assert" - }, - { - "vec": [ - { - "u32": 0 - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json index af8f11937..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_docs/fn_/test_functional.1.json @@ -72,75 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json index 5be49b012..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_duration/test_functional.1.json @@ -72,77 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "exec" - } - ], - "data": { - "duration": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "exec" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json index 9de7e0839..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_fn/test_functional.1.json @@ -72,86 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json index 501d34616..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_error.1.json @@ -72,159 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "panic" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "caught panic 'I panicked' from contract function 'Symbol(panic)'" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "panic" - }, - { - "vec": [] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json index 501d34616..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke/test_invoke_expect_string.1.json @@ -72,159 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "panic" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "caught panic 'I panicked' from contract function 'Symbol(panic)'" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "panic" - }, - { - "vec": [] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json index 878894489..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke/test_try_invoke.1.json @@ -72,134 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "panic" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "caught panic 'I panicked' from contract function 'Symbol(panic)'" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "panic" - }, - { - "vec": [] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json index 4a9e1cecc..bb544e617 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_correct_arg_count.1.json @@ -105,170 +105,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "add_with" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - }, - "void", - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add_with" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json index 94f207a1b..bb544e617 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_few_args.1.json @@ -105,325 +105,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "add_with" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - "void", - "void", - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 10 - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "caught panic 'invalid number of input arguments: 2 expected, got 1' from contract function 'Symbol(add)'" - }, - { - "i32": 10 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "add" - }, - { - "vec": [ - { - "i32": 10 - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "add_with" - }, - { - "vec": [ - { - "i32": 10 - }, - "void", - "void", - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json index a726de9f8..bb544e617 100644 --- a/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_invoke_arg_count/test_too_many_args.1.json @@ -105,355 +105,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "add_with" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - }, - { - "i32": 1 - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - }, - { - "i32": 1 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "caught panic 'invalid number of input arguments: 2 expected, got 3' from contract function 'Symbol(add)'" - }, - { - "i32": 10 - }, - { - "i32": 12 - }, - { - "i32": 1 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "add" - }, - { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - }, - { - "i32": 1 - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "add_with" - }, - { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - }, - { - "i32": 1 - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json index 49002b38e..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_overlapping_type_fn_names/test_functional.1.json @@ -72,86 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "state" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "state" - } - ], - "data": { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 1 - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json index a6c18a73d..9bebac8e0 100644 --- a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.1.json @@ -103,79 +103,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get" - } - ], - "data": { - "i32": 2 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get" - } - ], - "data": { - "i32": 4 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json index 98956a678..933916850 100644 --- a/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json +++ b/soroban-sdk/test_snapshots/tests/contract_snapshot/test.2.json @@ -104,133 +104,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "store" - } - ], - "data": { - "vec": [ - { - "i32": 2 - }, - { - "i32": 4 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "store" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get" - } - ], - "data": { - "i32": 2 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get" - } - ], - "data": { - "i32": 4 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json b/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json index 2353d179d..9f7aa0dc3 100644 --- a/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_store/test_storage.1.json @@ -316,1085 +316,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": { - "u32": 1000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_persistent" - } - ], - "data": { - "i32": 11 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_persistent" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_temporary" - } - ], - "data": { - "i32": 11 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_temporary" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_instance" - } - ], - "data": { - "i32": 11 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_instance" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_persistent" - } - ], - "data": { - "i32": 11 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_persistent" - } - ], - "data": { - "i32": 1111 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_temporary" - } - ], - "data": { - "i32": 11 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_temporary" - } - ], - "data": { - "i32": 2222 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_instance" - } - ], - "data": { - "i32": 11 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_instance" - } - ], - "data": { - "i32": 3333 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "set_persistent" - } - ], - "data": { - "vec": [ - { - "i32": 22 - }, - { - "i32": 111 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "set_persistent" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_persistent" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_persistent" - } - ], - "data": { - "i32": 111 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "set_temporary" - } - ], - "data": { - "vec": [ - { - "i32": 22 - }, - { - "i32": 222 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "set_temporary" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_temporary" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_temporary" - } - ], - "data": { - "i32": 222 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "set_instance" - } - ], - "data": { - "vec": [ - { - "i32": 22 - }, - { - "i32": 333 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "set_instance" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_instance" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_instance" - } - ], - "data": { - "i32": 333 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_persistent" - } - ], - "data": { - "vec": [ - { - "i32": 11 - }, - { - "u32": 10000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_persistent" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_persistent" - } - ], - "data": { - "vec": [ - { - "i32": 11 - }, - { - "u32": 20000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_persistent" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_persistent" - } - ], - "data": { - "vec": [ - { - "i32": 11 - }, - { - "u32": 21000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_persistent" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_temporary" - } - ], - "data": { - "vec": [ - { - "i32": 11 - }, - { - "u32": 5000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_temporary" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_temporary" - } - ], - "data": { - "vec": [ - { - "i32": 11 - }, - { - "u32": 20000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_temporary" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": { - "u32": 2000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": { - "u32": 20000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": { - "u32": 21000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "extend_ttl_instance" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json b/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json index cfdc8b328..1ca0ec786 100644 --- a/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_store/test_temp_storage_extension_past_max_ttl_panics.1.json @@ -118,212 +118,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "extend_ttl_temporary" - } - ], - "data": { - "vec": [ - { - "i32": 11 - }, - { - "u32": 20001 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "trying to extend past max live_until ledger" - }, - { - "u32": 20001 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "extend_ttl_temporary" - }, - { - "vec": [ - { - "i32": 11 - }, - { - "u32": 20001 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json index 3ff893143..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_timepoint/test_functional.1.json @@ -72,77 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "exec" - } - ], - "data": { - "timepoint": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "exec" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json index 346661af3..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_enum/test_functional.1.json @@ -72,115 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "vec": [ - { - "symbol": "Aaa" - } - ] - }, - { - "vec": [ - { - "symbol": "Bbb" - }, - { - "i32": 3 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "vec": [ - { - "symbol": "Aaa" - } - ] - }, - { - "vec": [ - { - "symbol": "Bbb" - }, - { - "i32": 3 - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json index 4d0c8fda5..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_error.1.json @@ -72,145 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "f" - } - ], - "data": { - "u32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "f" - } - ], - "data": { - "error": { - "contract": 1 - } - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "f" - }, - { - "vec": [ - { - "u32": 1 - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json index 17ed13020..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_enum_error/test_success.1.json @@ -72,77 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "f" - } - ], - "data": { - "u32": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "f" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json index 1164081d0..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_option/test_functional.1.json @@ -72,157 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 5 - } - }, - { - "key": { - "symbol": "b" - }, - "val": "void" - } - ] - }, - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 10 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i32": 1 - } - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 5 - } - }, - { - "key": { - "symbol": "b" - }, - "val": "void" - } - ] - }, - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 10 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i32": 1 - } - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json deleted file mode 100644 index 571fc657e..000000000 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_error_on_partial_decode.1.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "unexpected_size" - } - } - ], - "data": { - "string": "differing host map and output slice lengths when unpacking map to slice" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json index 4f11f5976..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_functional.1.json @@ -72,161 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 5 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i32": 7 - } - } - ] - }, - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 10 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i32": 14 - } - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 5 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i32": 7 - } - } - ] - }, - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i32": 10 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i32": 14 - } - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json index 92ff9f77f..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct/test_long_names_functional.1.json @@ -72,104 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add_udt_with_long_name" - } - ], - "data": { - "vec": [ - { - "map": [ - { - "key": { - "symbol": "this_is_a_very_long_name_12345" - }, - "val": { - "u64": 1000000000000 - } - } - ] - }, - { - "map": [ - { - "key": { - "symbol": "this_is_a_very_long_name_12345" - }, - "val": { - "u64": 5000000000000 - } - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add_udt_with_long_name" - } - ], - "data": { - "u64": 6000000000000 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json deleted file mode 100644 index bf78f8aa1..000000000 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_error_on_partial_decode.1.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "unexpected_size" - } - } - ], - "data": { - "string": "differing host vector and output vector lengths when unpacking vec to slice" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json index ade4aa57a..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json +++ b/soroban-sdk/test_snapshots/tests/contract_udt_struct_tuple/test_functional.1.json @@ -72,121 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "vec": [ - { - "i32": 5 - }, - { - "i32": 7 - } - ] - }, - { - "vec": [ - { - "i32": 10 - }, - { - "i32": 14 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "vec": [ - { - "i32": 5 - }, - { - "i32": 7 - } - ] - }, - { - "vec": [ - { - "i32": 10 - }, - { - "i32": 14 - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json b/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json deleted file mode 100644 index 4b402aa40..000000000 --- a/soroban-sdk/test_snapshots/tests/crypto_ed25519/test_verify_sig_ed25519_invalid_sig.1.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "crypto": "invalid_input" - } - } - ], - "data": { - "string": "failed ED25519 verification" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "crypto": "invalid_input" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json index 08e8df210..64688eee3 100644 --- a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json +++ b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.1.json @@ -73,242 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "test" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "test" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "test" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "need_auth" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "Unauthorized function call for address" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "need_auth" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json index 08e8df210..64688eee3 100644 --- a/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json +++ b/soroban-sdk/test_snapshots/tests/env/default_and_from_snapshot_same_settings.2.json @@ -73,242 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "test" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "test" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "test" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "need_auth" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "Unauthorized function call for address" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "need_auth" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json index eeba6aaa8..52e20fa60 100644 --- a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json +++ b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.1.json @@ -135,30 +135,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json index f5d8d693b..1f466fb4f 100644 --- a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json +++ b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.2.json @@ -137,78 +137,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json index f5d8d693b..1f466fb4f 100644 --- a/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json +++ b/soroban-sdk/test_snapshots/tests/env/register_contract_deploys_predictable_contract_ids.3.json @@ -137,78 +137,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json b/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json index b99642f31..619bd9239 100644 --- a/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json +++ b/soroban-sdk/test_snapshots/tests/max_ttl/max.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_array.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytes.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_bytesn.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_slice.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_fill_u64.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_array.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_bytesn.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_len_bytes.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json index ba887f196..2d0a0a650 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_range_u64_panic_on_invalid_range.1.json @@ -71,55 +71,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "value": "invalid_input" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_gen_u64.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.1.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json index 61bf62183..a90f00a84 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_seed.2.json @@ -72,30 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json b/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json index 8bc8cc04d..90577a38c 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_prng_shuffle.1.json @@ -73,30 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json b/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json index 8bc8cc04d..90577a38c 100644 --- a/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json +++ b/soroban-sdk/test_snapshots/tests/prng/test_vec_shuffle.1.json @@ -73,30 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json index 1623c9bfa..8a13c9b8b 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/all.1.json @@ -212,30 +212,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json index 7282f9d39..8b6b22881 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/temp_entry_expiration.1.json @@ -103,30 +103,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json index fea6c0bf6..0b577008d 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/test_persistent_entry_expiration.1.json @@ -102,90 +102,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "internal_error" - } - } - ], - "data": { - "vec": [ - { - "string": "[testing-only] Accessed contract data key key that has been archived. Important: this error may only appear in tests; in the real network contracts aren't called at all if any archived entry is accessed." - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - }, - { - "i32": 1 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "storage": "internal_error" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json b/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json index b3e4a5f66..2202dd2c6 100644 --- a/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json +++ b/soroban-sdk/test_snapshots/tests/storage_testutils/ttl_getters.1.json @@ -237,54 +237,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json index 24d5bedfe..c18c0afb0 100644 --- a/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json +++ b/soroban-sdk/test_snapshots/tests/token_client/test_issuer_flags.1.json @@ -210,79 +210,6 @@ ] }, "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "init_asset" - } - ], - "data": { - "bytes": "0000000161616100000000000000000000000000000000000000000000000000000000000000000000000002" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "init_asset" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "set_admin" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - } - } - }, - "failed_call": false - }, { "event": { "ext": "v0", @@ -308,27 +235,6 @@ } }, "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "set_admin" - } - ], - "data": "void" - } - } - }, - "failed_call": false } ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json index 656edbec9..245d5fdc9 100644 --- a/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json +++ b/soroban-sdk/test_snapshots/tests/token_client/test_mock_all_auth.1.json @@ -471,79 +471,6 @@ ] }, "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "init_asset" - } - ], - "data": { - "bytes": "0000000161616100000000000000000000000000000000000000000000000000000000000000000000000002" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "init_asset" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "set_admin" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - } - } - }, - "failed_call": false - }, { "event": { "ext": "v0", @@ -574,256 +501,25 @@ "event": { "ext": "v0", "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "set_admin" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "init" - } - ], - "data": { - "address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "init" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "get_token" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_token" - } - ], - "data": { - "address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "decimals" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "decimals" - } - ], - "data": { - "u32": 7 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", + "type_": "contract", "body": { "v0": { "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, { "symbol": "approve" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ + }, { - "symbol": "fn_call" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" }, { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" }, { - "symbol": "approve" + "string": "aaa:GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF" } ], "data": { "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, { "i128": { "hi": 0, @@ -838,473 +534,6 @@ } } }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "[recording authorization only] encountered authorization not tied to the root contract invocation for an address. Use `require_auth()` in the top invocation or enable non-root authorization." - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract call failed" - }, - { - "symbol": "approve" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "approve" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "approve" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "approve" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "contract", - "body": { - "v0": { - "topics": [ - { - "symbol": "approve" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "string": "aaa:GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEGWF" - } - ], - "data": { - "vec": [ - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "approve" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "approve" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "allowance" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "allowance" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "allowance" - } - ], - "data": { - "i128": { - "hi": 0, - "lo": 20 - } - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "allowance" - } - ], - "data": { - "i128": { - "hi": 0, - "lo": 20 - } - } - } - } - }, "failed_call": false } ] diff --git a/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json b/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json index 39be11258..523006dfe 100644 --- a/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json +++ b/soroban-sdk/test_snapshots/tests/token_client/test_mock_auth.1.json @@ -503,79 +503,6 @@ ] }, "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "init_asset" - } - ], - "data": { - "bytes": "0000000161616100000000000000000000000000000000000000000000000000000000000000000000000002" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "init_asset" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "set_admin" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - } - } - }, - "failed_call": false - }, { "event": { "ext": "v0", @@ -602,407 +529,6 @@ }, "failed_call": false }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "set_admin" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "init" - } - ], - "data": { - "address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "init" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "get_token" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_token" - } - ], - "data": { - "address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "decimals" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "decimals" - } - ], - "data": { - "u32": 7 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000004" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "approve" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "approve" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000004" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "ff5521e7c87659add3015fe505bd577884466c06e1e9951a41c6d0f8705470dd" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - }, - { - "i128": { - "hi": 0, - "lo": 20 - } - }, - { - "u32": 200 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CBEPDNVYXQGWB5YUBXKJWYJA7OXTZW5LFLNO5JRRGE6Z6C5OSUZPCCEL" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "approve" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000004", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, { "event": { "ext": "v0", @@ -1041,166 +567,6 @@ } }, "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "approve" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "approve" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "allowance" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1" - }, - { - "symbol": "allowance" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "48f1b6b8bc0d60f7140dd49b6120fbaf3cdbab2adaeea631313d9f0bae9532f1", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "allowance" - } - ], - "data": { - "i128": { - "hi": 0, - "lo": 20 - } - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "allowance" - } - ], - "data": { - "i128": { - "hi": 0, - "lo": 20 - } - } - } - } - }, - "failed_call": false } ] } \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json deleted file mode 100644 index 4d23c1f9d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_get_unchecked_panics_on_out_of_bounds.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "object index out of bounds" - }, - { - "u32": 6 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json deleted file mode 100644 index 6817fc85d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_pop_back_unchecked_panics_on_out_of_bounds.1.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json deleted file mode 100644 index 6817fc85d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_pop_front_unchecked_panics_on_out_of_bounds.1.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json b/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json deleted file mode 100644 index 4d23c1f9d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_remove_unchecked_panics.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "object index out of bounds" - }, - { - "u32": 6 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json b/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json deleted file mode 100644 index 4d23c1f9d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_try_get_unchecked_panics.1.json +++ /dev/null @@ -1,77 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "vec": [ - { - "string": "object index out of bounds" - }, - { - "u32": 6 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json deleted file mode 100644 index 6817fc85d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_try_pop_back_unchecked_panics_on_out_of_bounds.1.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json b/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json deleted file mode 100644 index 6817fc85d..000000000 --- a/soroban-sdk/test_snapshots/vec/test/test_try_pop_front_unchecked_panics_on_out_of_bounds.1.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "generators": { - "address": 0, - "nonce": 0 - }, - "auth": [], - "ledger": { - "protocol_version": 22, - "sequence_number": 0, - "timestamp": 0, - "network_id": "0000000000000000000000000000000000000000000000000000000000000000", - "base_reserve": 0, - "min_persistent_entry_ttl": 4096, - "min_temp_entry_ttl": 16, - "max_entry_ttl": 6312000, - "ledger_entries": [] - }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "object": "index_bounds" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": false - } - ] -} \ No newline at end of file diff --git a/tests/account/test_snapshots/test/test.1.json b/tests/account/test_snapshots/test/test.1.json index 85d5a7be0..e3e6d1bc4 100644 --- a/tests/account/test_snapshots/test/test.1.json +++ b/tests/account/test_snapshots/test/test.1.json @@ -152,145 +152,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "5eae5e76e50f6cd05ea99bc99c9e19a8cbee2c497eefd008eb25392f8057f876" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/add_i128/test_snapshots/test/test_add.1.json b/tests/add_i128/test_snapshots/test/test_add.1.json index d6e20d3c9..a90f00a84 100644 --- a/tests/add_i128/test_snapshots/test/test_add.1.json +++ b/tests/add_i128/test_snapshots/test/test_add.1.json @@ -72,95 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "i128": { - "hi": 64, - "lo": 0 - } - }, - { - "i128": { - "hi": 0, - "lo": 1099511627776 - } - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i128": { - "hi": 64, - "lo": 1099511627776 - } - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/add_u128/test_snapshots/test/test_add.1.json b/tests/add_u128/test_snapshots/test/test_add.1.json index c64d76c67..a90f00a84 100644 --- a/tests/add_u128/test_snapshots/test/test_add.1.json +++ b/tests/add_u128/test_snapshots/test/test_add.1.json @@ -72,95 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "u128": { - "hi": 64, - "lo": 0 - } - }, - { - "u128": { - "hi": 0, - "lo": 1099511627776 - } - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "u128": { - "hi": 64, - "lo": 1099511627776 - } - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/add_u64/test_snapshots/test/test_add.1.json b/tests/add_u64/test_snapshots/test/test_add.1.json index f499591f5..a90f00a84 100644 --- a/tests/add_u64/test_snapshots/test/test_add.1.json +++ b/tests/add_u64/test_snapshots/test/test_add.1.json @@ -72,86 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "u64": 10 - }, - { - "u64": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "u64": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/alloc/test_snapshots/test/test_add.1.json b/tests/alloc/test_snapshots/test/test_add.1.json index be04b5177..a90f00a84 100644 --- a/tests/alloc/test_snapshots/test/test_add.1.json +++ b/tests/alloc/test_snapshots/test/test_add.1.json @@ -72,95 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "num_list" - } - ], - "data": { - "u32": 5 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "num_list" - } - ], - "data": { - "vec": [ - { - "u32": 0 - }, - { - "u32": 1 - }, - { - "u32": 2 - }, - { - "u32": 3 - }, - { - "u32": 4 - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json b/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json index 5f5678503..b4d9cb0cf 100644 --- a/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_mock_all_auth.1.json @@ -123,79 +123,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn1" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json b/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json index 610171372..cf9b2a898 100644 --- a/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_mock_auth.1.json @@ -156,198 +156,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "2f1a9e5e5956f9b1d22cf7a548f3c0f4cae98ea0d3108dc4ca9bba25cfef6eac" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn1" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn1" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json index a2d217a92..2df03be4a 100644 --- a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_approve.1.json @@ -156,198 +156,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "38ed2f33de58e21662a5d7fb80ce86613f85d9bef1f2372b27cdec9fe776cc01" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn1" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn1" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json index 0778898d1..bb544e617 100644 --- a/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json +++ b/tests/auth/test_snapshots/test_a/test_with_real_contract_auth_decline.1.json @@ -105,330 +105,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "313868a6a7739646d9bfdb5141931176a4476c513315f0650dc7ac2ded2c14a3" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn1" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "error": { - "contract": 1 - } - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "failed account authentication with error" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - }, - { - "error": { - "contract": 1 - } - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "fn1" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json b/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json index 15fa5011d..d126247aa 100644 --- a/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_mock_all_auth.1.json @@ -174,159 +174,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fn2" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn1" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn2" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json b/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json index 9453770f6..497c095e4 100644 --- a/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_mock_auth.1.json @@ -207,320 +207,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fn2" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "810f5530238c3305c68d1cd86f2971b0b5222199769001987cd5805fc6174357" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "i32": 1 - }, - { - "i32": 2 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn2" - } - } - ] - } - ] - }, - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn1" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn1" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn2" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json index 4141e6ef8..f6da660e2 100644 --- a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_approve.1.json @@ -207,320 +207,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fn2" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "330aae00a444a28a57a0f6c95f59a86c1ec3238de3d0aa527104b4f574d92260" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "i32": 1 - }, - { - "i32": 2 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn2" - } - } - ] - } - ] - }, - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn1" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "fn1" - } - ], - "data": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn1" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "fn2" - } - ], - "data": { - "u64": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json index c609c75ec..e6e7bdee7 100644 --- a/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json +++ b/tests/auth/test_snapshots/test_b/test_with_real_contract_auth_decline.1.json @@ -138,406 +138,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "fn2" - } - ], - "data": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000003" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "vec": [ - { - "bytes": "3b86eaa5f082488f8063fd4b90d5044420a66d5f4428bd6e21454f26031b9bc6" - }, - "void", - { - "vec": [ - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "i32": 1 - }, - { - "i32": 2 - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn2" - } - } - ] - } - ] - }, - { - "vec": [ - { - "symbol": "Contract" - }, - { - "map": [ - { - "key": { - "symbol": "args" - }, - "val": { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } - ] - } - }, - { - "key": { - "symbol": "contract" - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "symbol": "fn_name" - }, - "val": { - "symbol": "fn1" - } - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__check_auth" - } - ], - "data": { - "error": { - "contract": 1 - } - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000003", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "failed account authentication with error" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - { - "error": { - "contract": 1 - } - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "auth": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "fn2" - }, - { - "vec": [ - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_constructor.1.json b/tests/constructor/test_snapshots/test_constructor.1.json index 330634091..38ce7f9ac 100644 --- a/tests/constructor/test_snapshots/test_constructor.1.json +++ b/tests/constructor/test_snapshots/test_constructor.1.json @@ -183,390 +183,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": { - "vec": [ - { - "u32": 100 - }, - { - "i64": 1000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 100 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": { - "i64": 1000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 200 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": { - "i64": 2000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Instance" - }, - { - "u32": 300 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": { - "i64": 3000 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 10 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 20 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "get_data" - } - ], - "data": { - "vec": [ - { - "symbol": "Instance" - }, - { - "u32": 30 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "get_data" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json index bd6313155..2d0a0a650 100644 --- a/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json +++ b/tests/constructor/test_snapshots/test_missing_constructor_arguments_causes_panic.1.json @@ -71,118 +71,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": { - "u32": 100 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "caught panic 'invalid number of input arguments: 2 expected, got 1' from contract function 'Symbol(obj#7)'" - }, - { - "u32": 100 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "context": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "constructor invocation has failed with error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json index d2902128a..2d0a0a650 100644 --- a/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json +++ b/tests/constructor/test_snapshots/test_passing_extra_constructor_arguments_causes_panic.1.json @@ -71,134 +71,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": { - "vec": [ - { - "u32": 100 - }, - { - "i64": 1000 - }, - { - "u32": 123 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "caught panic 'invalid number of input arguments: 2 expected, got 3' from contract function 'Symbol(obj#7)'" - }, - { - "u32": 100 - }, - { - "i64": 1000 - }, - { - "u32": 123 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "context": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "constructor invocation has failed with error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json index 704a91992..2d0a0a650 100644 --- a/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json +++ b/tests/constructor/test_snapshots/test_passing_incorrectly_typed_constructor_arguments_causes_panic.1.json @@ -71,128 +71,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": { - "vec": [ - { - "u32": 100 - }, - { - "u32": 1000 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "caught panic 'called `Result::unwrap()` on an `Err` value: Error(Value, UnexpectedType)' from contract function 'Symbol(obj#7)'" - }, - { - "u32": 100 - }, - { - "u32": 1000 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "context": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "constructor invocation has failed with error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json b/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json index 84b708ad5..2d0a0a650 100644 --- a/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json +++ b/tests/constructor/test_snapshots/test_passing_no_constructor_arguments_causes_panic.1.json @@ -71,109 +71,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "caught panic 'invalid number of input arguments: 2 expected, got 0' from contract function 'Symbol(obj#7)'" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "context": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "constructor invocation has failed with error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/empty/test_snapshots/test/test_hello.1.json b/tests/empty/test_snapshots/test/test_hello.1.json index a1bc290f8..a90f00a84 100644 --- a/tests/empty/test_snapshots/test/test_hello.1.json +++ b/tests/empty/test_snapshots/test/test_hello.1.json @@ -72,75 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "empty" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "empty" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/empty2/test_snapshots/test/test_hello.1.json b/tests/empty2/test_snapshots/test/test_hello.1.json index b2f09122b..2d0a0a650 100644 --- a/tests/empty2/test_snapshots/test/test_hello.1.json +++ b/tests/empty2/test_snapshots/test/test_hello.1.json @@ -71,30 +71,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/hello_ok.1.json b/tests/errors/test_snapshots/test/hello_ok.1.json index 9040706b0..1897d709d 100644 --- a/tests/errors/test_snapshots/test/hello_ok.1.json +++ b/tests/errors/test_snapshots/test/hello_ok.1.json @@ -104,126 +104,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": { - "u32": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "hello" - } - ], - "data": { - "symbol": "hello" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "persisted" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "persisted" - } - ], - "data": { - "bool": true - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/try_hello_error.1.json b/tests/errors/test_snapshots/test/try_hello_error.1.json index d30e75747..90577a38c 100644 --- a/tests/errors/test_snapshots/test/try_hello_error.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error.1.json @@ -73,192 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": { - "u32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "hello" - } - ], - "data": { - "error": { - "contract": 1 - } - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating Ok(ScErrorType::Contract) frame-exit to Err" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "hello" - }, - { - "vec": [ - { - "u32": 1 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "persisted" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "persisted" - } - ], - "data": { - "bool": false - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/try_hello_error_panic.1.json b/tests/errors/test_snapshots/test/try_hello_error_panic.1.json index 2a64a0242..90577a38c 100644 --- a/tests/errors/test_snapshots/test/try_hello_error_panic.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error_panic.1.json @@ -73,224 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": { - "u32": 2 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "failing with contract error" - }, - { - "u32": 1 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 1 - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "hello" - }, - { - "vec": [ - { - "u32": 2 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "persisted" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "persisted" - } - ], - "data": { - "bool": false - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json b/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json index 05af76eee..90577a38c 100644 --- a/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error_panic_string.1.json @@ -73,194 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": { - "u32": 3 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "caught panic 'an error' from contract function 'Symbol(hello)'" - }, - { - "u32": 3 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "wasm_vm": "invalid_action" - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "hello" - }, - { - "vec": [ - { - "u32": 3 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "persisted" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "persisted" - } - ], - "data": { - "bool": false - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json b/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json index 076431c14..90577a38c 100644 --- a/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json +++ b/tests/errors/test_snapshots/test/try_hello_error_unexpected_contract_error.1.json @@ -73,224 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": { - "u32": 4 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 9 - } - } - ], - "data": { - "vec": [ - { - "string": "failing with contract error" - }, - { - "u32": 9 - } - ] - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 9 - } - } - ], - "data": { - "string": "escalating error to panic" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 9 - } - } - ], - "data": { - "string": "caught error from function" - } - } - } - }, - "failed_call": true - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "error" - }, - { - "error": { - "contract": 9 - } - } - ], - "data": { - "vec": [ - { - "string": "contract try_call failed" - }, - { - "symbol": "hello" - }, - { - "vec": [ - { - "u32": 4 - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "persisted" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "persisted" - } - ], - "data": { - "bool": false - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/errors/test_snapshots/test/try_hello_ok.1.json b/tests/errors/test_snapshots/test/try_hello_ok.1.json index 9040706b0..1897d709d 100644 --- a/tests/errors/test_snapshots/test/try_hello_ok.1.json +++ b/tests/errors/test_snapshots/test/try_hello_ok.1.json @@ -104,126 +104,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": { - "u32": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "hello" - } - ], - "data": { - "symbol": "hello" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "persisted" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "persisted" - } - ], - "data": { - "bool": true - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/events/test_snapshots/test/test_pub_event.1.json b/tests/events/test_snapshots/test/test_pub_event.1.json index a5f4a020d..d05cadca4 100644 --- a/tests/events/test_snapshots/test/test_pub_event.1.json +++ b/tests/events/test_snapshots/test/test_pub_event.1.json @@ -73,54 +73,6 @@ ] }, "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, { "event": { "ext": "v0", @@ -166,27 +118,6 @@ } }, "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "hello" - } - ], - "data": "void" - } - } - }, - "failed_call": false } ] } \ No newline at end of file diff --git a/tests/invoke_contract/test_snapshots/test/test_add.1.json b/tests/invoke_contract/test_snapshots/test/test_add.1.json index d4b21d010..bb544e617 100644 --- a/tests/invoke_contract/test_snapshots/test/test_add.1.json +++ b/tests/invoke_contract/test_snapshots/test/test_add.1.json @@ -105,169 +105,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000002" - }, - { - "symbol": "add_with" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - }, - { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "i32": 10 - }, - { - "i32": 12 - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000002", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add_with" - } - ], - "data": { - "i32": 22 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/logging/test_snapshots/test/test_logging.1.json b/tests/logging/test_snapshots/test/test_logging.1.json index b6e6e2f64..a90f00a84 100644 --- a/tests/logging/test_snapshots/test/test_logging.1.json +++ b/tests/logging/test_snapshots/test/test_logging.1.json @@ -72,229 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "hello" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "none" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "string": "none" - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "one:" - }, - { - "symbol": "one" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "one:" - }, - { - "symbol": "one" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "one and two:" - }, - { - "symbol": "one" - }, - { - "symbol": "two" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "log" - } - ], - "data": { - "vec": [ - { - "string": "one and two:" - }, - { - "symbol": "one" - }, - { - "symbol": "two" - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "hello" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/modular/test_snapshots/test/test.1.json b/tests/modular/test_snapshots/test/test.1.json index 7a98167ea..43a30bb2a 100644 --- a/tests/modular/test_snapshots/test/test.1.json +++ b/tests/modular/test_snapshots/test/test.1.json @@ -74,171 +74,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "zero" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "zero" - } - ], - "data": { - "u32": 0 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "one" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "one" - } - ], - "data": { - "u32": 1 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "two" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "two" - } - ], - "data": { - "u32": 2 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/multiimpl/test_snapshots/test/test_hello.1.json b/tests/multiimpl/test_snapshots/test/test_hello.1.json index bc2819204..43a30bb2a 100644 --- a/tests/multiimpl/test_snapshots/test/test_hello.1.json +++ b/tests/multiimpl/test_snapshots/test/test_hello.1.json @@ -74,165 +74,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "empty" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "empty" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "empty2" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "empty2" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "empty3" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "empty3" - } - ], - "data": "void" - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/udt/test_snapshots/test/test_add.1.json b/tests/udt/test_snapshots/test/test_add.1.json index 14d487e1e..90577a38c 100644 --- a/tests/udt/test_snapshots/test/test_add.1.json +++ b/tests/udt/test_snapshots/test/test_add.1.json @@ -73,210 +73,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "vec": [ - { - "symbol": "UdtA" - } - ] - }, - { - "vec": [ - { - "symbol": "UdtB" - }, - { - "map": [ - { - "key": { - "symbol": "a" - }, - "val": { - "i64": 10 - } - }, - { - "key": { - "symbol": "b" - }, - "val": { - "i64": 12 - } - }, - { - "key": { - "symbol": "c" - }, - "val": { - "vec": [ - { - "i64": 1 - } - ] - } - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i64": 22 - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "add" - } - ], - "data": { - "vec": [ - { - "vec": [ - { - "symbol": "UdtC" - }, - { - "u32": 10 - } - ] - }, - { - "vec": [ - { - "symbol": "UdtD" - }, - { - "vec": [ - { - "i64": 1 - }, - { - "vec": [ - { - "i64": 2 - }, - { - "i64": 3 - } - ] - } - ] - } - ] - } - ] - } - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "add" - } - ], - "data": { - "i64": 16 - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file diff --git a/tests/workspace_contract/test_snapshots/test/test_add.1.json b/tests/workspace_contract/test_snapshots/test/test_add.1.json index 972d82299..a90f00a84 100644 --- a/tests/workspace_contract/test_snapshots/test/test_add.1.json +++ b/tests/workspace_contract/test_snapshots/test/test_add.1.json @@ -72,86 +72,5 @@ ] ] }, - "events": [ - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "__constructor" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": null, - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_call" - }, - { - "bytes": "0000000000000000000000000000000000000000000000000000000000000001" - }, - { - "symbol": "value" - } - ], - "data": "void" - } - } - }, - "failed_call": false - }, - { - "event": { - "ext": "v0", - "contract_id": "0000000000000000000000000000000000000000000000000000000000000001", - "type_": "diagnostic", - "body": { - "v0": { - "topics": [ - { - "symbol": "fn_return" - }, - { - "symbol": "value" - } - ], - "data": { - "map": [ - { - "key": { - "symbol": "value" - }, - "val": { - "i32": 13 - } - } - ] - } - } - } - }, - "failed_call": false - } - ] + "events": [] } \ No newline at end of file From fdd836d7ce4131c64434b17c5f3385a5cc56cb2b Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 06:10:14 +1000 Subject: [PATCH 48/57] Fix breaking changes in latest stable and nightly rust (#1375) ### What Pin the version of nightly in builds and CI, and make a few minor changes. ### Why The version is pinned because there's a bug in the next version of nightly that we can't work around. The bug is: - https://github.com/rust-lang/rust/issues/131643 The other minor changes that are to prepare for updating to the next nightly and were required by it when using it. ### Known limitations N/A --- .github/workflows/rust.yml | 9 +- Makefile | 14 +- soroban-sdk/src/crypto.rs | 5 +- soroban-sdk/src/ledger.rs | 4 +- tests/fuzz/fuzz/Cargo.lock | 371 +++++++++++++++++++++++++------------ 5 files changed, 267 insertions(+), 136 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ebde4e671..c3216a244 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -131,7 +131,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: stellar/actions/rust-cache@main - - run: rustup install nightly + # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. + - run: rustup install nightly-2024-10-10 - uses: stellar/binaries@v15 with: name: cargo-fuzz @@ -143,7 +144,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: stellar/actions/rust-cache@main - - run: rustup install nightly + # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. + - run: rustup install nightly-2024-10-10 - run: make doc readme: @@ -151,7 +153,8 @@ jobs: steps: - uses: actions/checkout@v3 - uses: stellar/actions/rust-cache@main - - run: rustup install nightly + # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. + - run: rustup install nightly-2024-10-10 - run: make readme - run: git add -N . && git diff HEAD --exit-code diff --git a/Makefile b/Makefile index f358ff6ef..f21ac1d91 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ CARGO_DOC_ARGS?=--open doc: fmt cargo test --doc -p soroban-sdk -p soroban-sdk-macros --features testutils,hazmat - # TODO: Upgrade to latest nightly after problem that was introduced in nightly-2024-02-05 (https://github.com/dalek-cryptography/curve25519-dalek/issues/618) is resolved. - cargo +nightly doc -p soroban-sdk --no-deps --all-features $(CARGO_DOC_ARGS) + # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. + cargo +nightly-2024-10-10 doc -p soroban-sdk --no-deps --all-features $(CARGO_DOC_ARGS) test: fmt build cargo hack --feature-powerset --ignore-unknown-features --features testutils --exclude-features docs test @@ -24,20 +24,22 @@ check: build fmt cargo hack check --release --target wasm32-unknown-unknown build-fuzz: - cd tests/fuzz/fuzz && cargo +nightly fuzz check + # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. + cd tests/fuzz/fuzz && cargo +nightly-2024-10-10 fuzz check readme: + # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. cd soroban-sdk \ - && cargo +nightly rustdoc -- -Zunstable-options -wjson \ + && cargo +nightly-2024-10-10 rustdoc -- -Zunstable-options -wjson \ && cat ../target/doc/soroban_sdk.json \ - | jq -r '.index[.root].docs' \ + | jq -r '.index[.root|tostring].docs' \ > README.md watch: cargo watch --clear --watch-when-idle --shell '$(MAKE)' watch-doc: - cargo +nightly watch --clear --watch-when-idle --shell '$(MAKE) doc CARGO_DOC_ARGS=' + cargo +nightly-2024-10-10 watch --clear --watch-when-idle --shell '$(MAKE) doc CARGO_DOC_ARGS=' fmt: cargo fmt --all diff --git a/soroban-sdk/src/crypto.rs b/soroban-sdk/src/crypto.rs index c725ebcf0..d27cf1f0d 100644 --- a/soroban-sdk/src/crypto.rs +++ b/soroban-sdk/src/crypto.rs @@ -7,7 +7,7 @@ use crate::{ }; pub mod bls12_381; -/// A BytesN generated by a cryptographic hash function. +/// A `BytesN` generated by a cryptographic hash function. /// /// The `Hash` type contains a `BytesN` and can only be constructed in /// contexts where the value has been generated by a secure cryptographic @@ -177,7 +177,8 @@ impl Crypto { CryptoHazmat::new(env).secp256r1_verify(public_key, &message_digest.0, signature) } - /// Get a [Bls12_381] for accessing the bls12-381 functions. + /// Get a [Bls12_381][bls12_381::Bls12_381] for accessing the bls12-381 + /// functions. pub fn bls12_381(&self) -> bls12_381::Bls12_381 { bls12_381::Bls12_381::new(self.env()) } diff --git a/soroban-sdk/src/ledger.rs b/soroban-sdk/src/ledger.rs index 4b6b5a5a0..566b5d6dc 100644 --- a/soroban-sdk/src/ledger.rs +++ b/soroban-sdk/src/ledger.rs @@ -4,7 +4,7 @@ use crate::{env::internal, unwrap::UnwrapInfallible, BytesN, Env, TryIntoVal}; /// Ledger retrieves information about the current ledger. /// /// For more details about the ledger and the ledger header that the values in the Ledger are derived from, see: -/// - https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers +/// - /// /// ### Examples /// @@ -83,7 +83,7 @@ impl Ledger { /// 00:00:00 UTC. /// /// For more details see: - /// - https://developers.stellar.org/docs/learn/encyclopedia/network-configuration/ledger-headers#close-time + /// - pub fn timestamp(&self) -> u64 { internal::Env::get_ledger_timestamp(self.env()) .unwrap_infallible() diff --git a/tests/fuzz/fuzz/Cargo.lock b/tests/fuzz/fuzz/Cargo.lock index d108f1c43..dfbec92eb 100644 --- a/tests/fuzz/fuzz/Cargo.lock +++ b/tests/fuzz/fuzz/Cargo.lock @@ -1,22 +1,19 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] -name = "addr2line" -version = "0.21.0" +name = "ahash" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ - "gimli", + "cfg-if", + "once_cell", + "version_check", + "zerocopy", ] -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - [[package]] name = "android-tzdata" version = "0.1.1" @@ -42,37 +39,134 @@ dependencies = [ ] [[package]] -name = "autocfg" -version = "1.1.0" +name = "ark-bls12-381" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "c775f0d12169cba7aae4caeb547bb6a50781c7449a8aa53793827c9ec4abf488" +dependencies = [ + "ark-ec", + "ark-ff", + "ark-serialize", + "ark-std", +] [[package]] -name = "backtrace" -version = "0.3.69" +name = "ark-ec" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", + "ark-ff", + "ark-poly", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", + "itertools", + "num-traits", + "zeroize", ] [[package]] -name = "base16ct" -version = "0.2.0" +name = "ark-ff" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm", + "ark-ff-macros", + "ark-serialize", + "ark-std", + "derivative", + "digest", + "itertools", + "num-bigint", + "num-traits", + "paste", + "rustc_version", + "zeroize", +] [[package]] -name = "base32" +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff", + "ark-serialize", + "ark-std", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std", + "digest", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-std" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "autocfg" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -116,7 +210,7 @@ dependencies = [ "num-bigint", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -208,21 +302,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "37e366bff8cd32dd8754b0991fb66b279dc48f598c3a18914852a6673deef583" dependencies = [ "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "curve25519-dalek" -version = "4.1.2" +version = "4.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" dependencies = [ "cfg-if", "cpufeatures", "curve25519-dalek-derive", "digest", "fiat-crypto", - "platforms", "rustc_version", "subtle", "zeroize", @@ -236,7 +329,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -260,7 +353,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 2.0.39", ] [[package]] @@ -271,9 +364,15 @@ checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" dependencies = [ "darling_core", "quote", - "syn", + "syn 2.0.39", ] +[[package]] +name = "data-encoding" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" + [[package]] name = "der" version = "0.7.6" @@ -284,6 +383,17 @@ dependencies = [ "zeroize", ] +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "derive_arbitrary" version = "1.3.2" @@ -292,7 +402,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -315,9 +425,9 @@ checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" [[package]] name = "ecdsa" -version = "0.16.7" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", "digest", @@ -359,9 +469,9 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" -version = "0.13.5" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", @@ -439,12 +549,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "gimli" -version = "0.28.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" - [[package]] name = "group" version = "0.13.0" @@ -462,6 +566,15 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -551,9 +664,9 @@ checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" [[package]] name = "itertools" -version = "0.11.0" +version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" dependencies = [ "either", ] @@ -584,9 +697,9 @@ dependencies = [ [[package]] name = "k256" -version = "0.13.1" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -632,21 +745,6 @@ version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" -dependencies = [ - "adler", -] - [[package]] name = "num-bigint" version = "0.4.3" @@ -666,7 +764,7 @@ checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -688,15 +786,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "object" -version = "0.32.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" -dependencies = [ - "memchr", -] - [[package]] name = "once_cell" version = "1.18.0" @@ -731,12 +820,6 @@ dependencies = [ "spki", ] -[[package]] -name = "platforms" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14e6ab3f592e6fb464fc9712d8d6e6912de6473954635fd76a589d832cffcbb0" - [[package]] name = "ppv-lite86" version = "0.2.17" @@ -750,7 +833,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2b0377b720bde721213a46cda1289b2f34abf0a436907cad91578c20de0454d" dependencies = [ "proc-macro2", - "syn", + "syn 2.0.39", ] [[package]] @@ -820,12 +903,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - [[package]] name = "rustc_version" version = "0.4.0" @@ -877,7 +954,7 @@ checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -918,7 +995,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -960,21 +1037,21 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "soroban-builtin-sdk-macros" -version = "21.2.0" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44877373b3dc6c662377cb1600e3a62706d75e484b6064f9cd22e467c676b159" +checksum = "8cdb13e8f4556fe89d2b1c8f529a66997e1d90fd6f10440dc5a1717f5f733251" dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] name = "soroban-env-common" -version = "21.2.0" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "590add16843a61b01844e19e89bccaaee6aa21dc76809017b0662c17dc139ee9" +checksum = "984c9a1a84c05599f5c9cb17d5fbb75fe1c7106598659a34d9da8a8f16d2c23f" dependencies = [ "arbitrary", "crate-git-revision", @@ -991,9 +1068,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "21.2.0" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8dc43acdd6c7e7b371acf44fc1a7dac24934ae3b2f05fafd618818548176" +checksum = "570dfaa0f35b373a2f9793b89a1864caf68e9071c5c8a4100654aa3434b4fde1" dependencies = [ "soroban-env-common", "static_assertions", @@ -1001,11 +1078,14 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "21.2.0" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e25aaffe0c62eb65e0e349f725b4b8b13ad0764d78a15aab5bbccb5c4797726" +checksum = "e59d22359f8d372872b7630fc0dc6884c36356d5d33d3fca83d2b76e572c2a32" dependencies = [ - "backtrace", + "ark-bls12-381", + "ark-ec", + "ark-ff", + "ark-serialize", "curve25519-dalek", "ecdsa", "ed25519-dalek", @@ -1034,9 +1114,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "21.2.0" +version = "22.0.0-rc.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e16b761459fdf3c4b62b24df3941498d14e5246e6fadfb4774ed8114d243aa4" +checksum = "76184b736ac2ce144461efbe7c3551ac2c2973fa144e32957bb2ae2d80467f64" dependencies = [ "itertools", "proc-macro2", @@ -1044,12 +1124,12 @@ dependencies = [ "serde", "serde_json", "stellar-xdr", - "syn", + "syn 2.0.39", ] [[package]] name = "soroban-ledger-snapshot" -version = "21.5.0" +version = "22.0.0-rc.2.1" dependencies = [ "serde", "serde_json", @@ -1061,7 +1141,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "21.5.0" +version = "22.0.0-rc.2.1" dependencies = [ "arbitrary", "bytes-lit", @@ -1079,7 +1159,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "21.5.0" +version = "22.0.0-rc.2.1" dependencies = [ "crate-git-revision", "darling", @@ -1092,12 +1172,12 @@ dependencies = [ "soroban-spec", "soroban-spec-rust", "stellar-xdr", - "syn", + "syn 2.0.39", ] [[package]] name = "soroban-spec" -version = "21.5.0" +version = "22.0.0-rc.2.1" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -1107,7 +1187,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "21.5.0" +version = "22.0.0-rc.2.1" dependencies = [ "prettyplease", "proc-macro2", @@ -1115,7 +1195,7 @@ dependencies = [ "sha2", "soroban-spec", "stellar-xdr", - "syn", + "syn 2.0.39", "thiserror", ] @@ -1156,20 +1236,20 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stellar-strkey" -version = "0.0.8" +version = "0.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" +checksum = "5e3aa3ed00e70082cb43febc1c2afa5056b9bb3e348bbb43d0cd0aa88a611144" dependencies = [ - "base32", "crate-git-revision", + "data-encoding", "thiserror", ] [[package]] name = "stellar-xdr" -version = "21.2.0" +version = "22.0.0-rc.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2675a71212ed39a806e415b0dbf4702879ff288ec7f5ee996dda42a135512b50" +checksum = "c88dc0e928b9cb65ea43836b52560bb4ead3e32895f5019ca223dc7cd1966cbf" dependencies = [ "arbitrary", "base64 0.13.1", @@ -1193,6 +1273,17 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + [[package]] name = "syn" version = "2.0.39" @@ -1206,7 +1297,7 @@ dependencies = [ [[package]] name = "test_fuzz" -version = "21.5.0" +version = "22.0.0-rc.2.1" dependencies = [ "soroban-sdk", ] @@ -1237,7 +1328,7 @@ checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", ] [[package]] @@ -1312,7 +1403,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 2.0.39", "wasm-bindgen-shared", ] @@ -1334,7 +1425,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.39", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1470,8 +1561,42 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "zeroize" -version = "1.6.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.39", +] From 9e674f2e436b814350698d772d4570ce43be9f4f Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 07:27:05 +1000 Subject: [PATCH 49/57] Prevent use with rust 1.82+ (#1371) ### What Prevent use with rust 1.82+. And run CI builds with 1.81. ### Why https://github.com/stellar/rs-soroban-env/issues/1469 Discussion: https://stellarfoundation.slack.com/archives/C030Z9EHVQE/p1729217606684609 --- Cargo.lock | 1 + rust-toolchain.toml | 2 +- soroban-sdk/Cargo.toml | 3 +++ soroban-sdk/build.rs | 8 ++++++++ soroban-sdk/src/lib.rs | 6 ------ 5 files changed, 13 insertions(+), 7 deletions(-) create mode 100644 soroban-sdk/build.rs diff --git a/Cargo.lock b/Cargo.lock index 08241f035..3990b45a6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,6 +1317,7 @@ dependencies = [ "proptest", "proptest-arbitrary-interop", "rand", + "rustc_version", "serde", "serde_json", "soroban-env-guest", diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e340b7641..90ff24e80 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,4 +1,4 @@ [toolchain] -channel = "stable" +channel = "1.81" targets = ["wasm32-unknown-unknown"] components = ["rustc", "cargo", "rustfmt", "clippy", "rust-src"] diff --git a/soroban-sdk/Cargo.toml b/soroban-sdk/Cargo.toml index 2fbc0eb5f..5d7472bc6 100644 --- a/soroban-sdk/Cargo.toml +++ b/soroban-sdk/Cargo.toml @@ -15,6 +15,9 @@ exclude = ["test_snapshots/", "src/tests/"] [lib] doctest = false +[build-dependencies] +rustc_version = "0.4.1" + [dependencies] soroban-sdk-macros = { workspace = true } bytes-lit = "0.0.5" diff --git a/soroban-sdk/build.rs b/soroban-sdk/build.rs new file mode 100644 index 000000000..6bcb32fc6 --- /dev/null +++ b/soroban-sdk/build.rs @@ -0,0 +1,8 @@ +pub fn main() { + #[cfg(all(target_family = "wasm", target_os = "unknown"))] + if let Ok(version) = rustc_version::version() { + if version.major == 1 && version.minor >= 82 { + panic!("Rust compiler 1.82+ with target 'wasm32-unknown-unknown' is unsupported by the Soroban Environment, because the 'wasm32-unknown-unknown' target in Rust 1.82+ has features enabled that are not yet supported and not easily disabled: reference-types, multi-value. Use Rust 1.81 to build for the 'wasm32-unknown-unknown' target."); + } + } +} diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index 0a3d43874..95207d7a9 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -47,12 +47,6 @@ #[cfg(all(target_family = "wasm", feature = "testutils"))] compile_error!("'testutils' feature is not supported on 'wasm' target"); -#[cfg(all(target_family = "wasm", target_feature = "reference-types"))] -compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: reference-types. Use Rust 1.81 or older to get a compatible default configuration."); - -#[cfg(all(target_family = "wasm", target_feature = "multivalue"))] -compile_error!("Compiler configuration is unsupported by Soroban Environment, because a Wasm target-feature is enabled that is not yet supported: multivalue. Use Rust 1.81 or older to get a compatible default configuration."); - // When used in a no_std contract, provide a panic handler as one is required. #[cfg(all(not(feature = "alloc"), target_family = "wasm"))] #[panic_handler] From 38594285f147ac64825c089d875ab22b901ab9f8 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Wed, 23 Oct 2024 18:01:15 -0400 Subject: [PATCH 50/57] expose `Fr` into its own type (#1373) ### What Resolves https://github.com/stellar/rs-soroban-sdk/issues/1352 ### Why `Fr` is the 255-bit scalar with a fixed modulus (equal to the subgroup order `r`) and all its operations are modulo arithmetics. Exposing it as separate type (zero-sized wrapping of an `U256`) is better signaling that the two have different semantics and avoids potential footgun. ### Known limitations [TODO or N/A] --------- Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --- soroban-sdk/src/crypto/bls12_381.rs | 163 +++++++++++++++++++--- soroban-sdk/src/tests/crypto_bls12_381.rs | 57 +++++--- 2 files changed, 181 insertions(+), 39 deletions(-) diff --git a/soroban-sdk/src/crypto/bls12_381.rs b/soroban-sdk/src/crypto/bls12_381.rs index cbfe9d41c..ba66723a0 100644 --- a/soroban-sdk/src/crypto/bls12_381.rs +++ b/soroban-sdk/src/crypto/bls12_381.rs @@ -1,10 +1,14 @@ use crate::{ - env::internal::{self, BytesObject, U64Val}, + env::internal::{self, BytesObject, U256Val, U64Val}, impl_bytesn_repr, unwrap::{UnwrapInfallible, UnwrapOptimized}, Bytes, BytesN, ConversionError, Env, IntoVal, TryFromVal, Val, Vec, U256, }; -use core::{cmp::Ordering, fmt::Debug}; +use core::{ + cmp::Ordering, + fmt::Debug, + ops::{Add, Mul, Sub}, +}; /// Bls12_381 provides access to curve and field arithmetics on the BLS12-381 /// curve. @@ -84,6 +88,14 @@ pub struct Fp(BytesN<48>); #[repr(transparent)] pub struct Fp2(BytesN<96>); +/// `Fr` represents an element in the BLS12-381 scalar field, which is a prime +/// field of order `r` (the order of the G1 and G2 groups). The struct is +/// internally represented with an `U256`, all arithmetic operations follow +/// modulo `r`. +#[derive(Clone)] +#[repr(transparent)] +pub struct Fr(U256); + impl_bytesn_repr!(G1Affine, 96); impl_bytesn_repr!(G2Affine, 192); impl_bytesn_repr!(Fp, 48); @@ -103,7 +115,7 @@ impl G1Affine { } } -impl core::ops::Add for G1Affine { +impl Add for G1Affine { type Output = G1Affine; fn add(self, rhs: Self) -> Self::Output { @@ -111,10 +123,10 @@ impl core::ops::Add for G1Affine { } } -impl core::ops::Mul for G1Affine { +impl Mul for G1Affine { type Output = G1Affine; - fn mul(self, rhs: U256) -> Self::Output { + fn mul(self, rhs: Fr) -> Self::Output { self.env().crypto().bls12_381().g1_mul(&self, &rhs) } } @@ -133,7 +145,7 @@ impl G2Affine { } } -impl core::ops::Add for G2Affine { +impl Add for G2Affine { type Output = G2Affine; fn add(self, rhs: Self) -> Self::Output { @@ -141,10 +153,10 @@ impl core::ops::Add for G2Affine { } } -impl core::ops::Mul for G2Affine { +impl Mul for G2Affine { type Output = G2Affine; - fn mul(self, rhs: U256) -> Self::Output { + fn mul(self, rhs: Fr) -> Self::Output { self.env().crypto().bls12_381().g2_mul(&self, &rhs) } } @@ -169,6 +181,113 @@ impl Fp2 { } } +impl Fr { + pub fn env(&self) -> &Env { + self.0.env() + } + + pub fn from_u256(value: U256) -> Self { + value.into() + } + + pub fn to_u256(&self) -> U256 { + self.0.clone() + } + + pub fn as_u256(&self) -> &U256 { + &self.0 + } + + pub fn from_bytes(bytes: BytesN<32>) -> Self { + U256::from_be_bytes(bytes.env(), bytes.as_ref()).into() + } + + pub fn to_bytes(&self) -> BytesN<32> { + self.as_u256().to_be_bytes().try_into().unwrap_optimized() + } + + pub fn as_val(&self) -> &Val { + self.0.as_val() + } + + pub fn to_val(&self) -> Val { + self.0.to_val() + } + + pub fn pow(&self, rhs: u64) -> Self { + self.env().crypto().bls12_381().fr_pow(self, rhs) + } + + pub fn inv(&self) -> Self { + self.env().crypto().bls12_381().fr_inv(self) + } +} + +impl From for Fr { + fn from(value: U256) -> Self { + Self(value) + } +} + +impl From<&Fr> for U256Val { + fn from(value: &Fr) -> Self { + value.as_u256().into() + } +} + +impl IntoVal for Fr { + fn into_val(&self, e: &Env) -> Val { + self.0.into_val(e) + } +} + +impl TryFromVal for Fr { + type Error = ConversionError; + + fn try_from_val(env: &Env, val: &Val) -> Result { + let u = U256::try_from_val(env, val)?; + Ok(Fr(u)) + } +} + +impl Eq for Fr {} + +impl PartialEq for Fr { + fn eq(&self, other: &Self) -> bool { + self.as_u256().partial_cmp(other.as_u256()) == Some(Ordering::Equal) + } +} + +impl Debug for Fr { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + write!(f, "Fr({:?})", self.as_u256()) + } +} + +impl Add for Fr { + type Output = Fr; + + fn add(self, rhs: Self) -> Self::Output { + self.env().crypto().bls12_381().fr_add(&self, &rhs) + } +} + +impl Sub for Fr { + type Output = Fr; + + fn sub(self, rhs: Self) -> Self::Output { + self.env().crypto().bls12_381().fr_sub(&self, &rhs) + } +} + +impl Mul for Fr { + type Output = Fr; + + fn mul(self, rhs: Self) -> Self::Output { + self.env().crypto().bls12_381().fr_mul(&self, &rhs) + } +} + impl Bls12_381 { pub(crate) fn new(env: &Env) -> Bls12_381 { Bls12_381 { env: env.clone() } @@ -217,7 +336,7 @@ impl Bls12_381 { } /// Multiplies a point `p0` in G1 by a scalar. - pub fn g1_mul(&self, p0: &G1Affine, scalar: &U256) -> G1Affine { + pub fn g1_mul(&self, p0: &G1Affine, scalar: &Fr) -> G1Affine { let env = self.env(); let bin = internal::Env::bls12_381_g1_mul(env, p0.to_object(), scalar.into()).unwrap_infallible(); @@ -225,7 +344,7 @@ impl Bls12_381 { } /// Performs a multi-scalar multiplication (MSM) operation in G1. - pub fn g1_msm(&self, vp: Vec, vs: Vec) -> G1Affine { + pub fn g1_msm(&self, vp: Vec, vs: Vec) -> G1Affine { let env = self.env(); let bin = internal::Env::bls12_381_g1_msm(env, vp.into(), vs.into()).unwrap_infallible(); unsafe { G1Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } @@ -285,7 +404,7 @@ impl Bls12_381 { } /// Multiplies a point `p0` in G2 by a scalar. - pub fn g2_mul(&self, p0: &G2Affine, scalar: &U256) -> G2Affine { + pub fn g2_mul(&self, p0: &G2Affine, scalar: &Fr) -> G2Affine { let env = self.env(); let bin = internal::Env::bls12_381_g2_mul(env, p0.to_object(), scalar.into()).unwrap_infallible(); @@ -293,7 +412,7 @@ impl Bls12_381 { } /// Performs a multi-scalar multiplication (MSM) operation in G2. - pub fn g2_msm(&self, vp: Vec, vs: Vec) -> G2Affine { + pub fn g2_msm(&self, vp: Vec, vs: Vec) -> G2Affine { let env = self.env(); let bin = internal::Env::bls12_381_g2_msm(env, vp.into(), vs.into()).unwrap_infallible(); unsafe { G2Affine::from_bytes(BytesN::unchecked_new(env.clone(), bin)) } @@ -338,38 +457,38 @@ impl Bls12_381 { // scalar arithmetic /// Adds two scalars in the BLS12-381 scalar field `Fr`. - pub fn fr_add(&self, lhs: &U256, rhs: &U256) -> U256 { + pub fn fr_add(&self, lhs: &Fr, rhs: &Fr) -> Fr { let env = self.env(); let v = internal::Env::bls12_381_fr_add(env, lhs.into(), rhs.into()).unwrap_infallible(); - U256::try_from_val(env, &v).unwrap_infallible() + U256::try_from_val(env, &v).unwrap_infallible().into() } /// Subtracts one scalar from another in the BLS12-381 scalar field `Fr`. - pub fn fr_sub(&self, lhs: &U256, rhs: &U256) -> U256 { + pub fn fr_sub(&self, lhs: &Fr, rhs: &Fr) -> Fr { let env = self.env(); let v = internal::Env::bls12_381_fr_sub(env, lhs.into(), rhs.into()).unwrap_infallible(); - U256::try_from_val(env, &v).unwrap_infallible() + U256::try_from_val(env, &v).unwrap_infallible().into() } /// Multiplies two scalars in the BLS12-381 scalar field `Fr`. - pub fn fr_mul(&self, lhs: &U256, rhs: &U256) -> U256 { + pub fn fr_mul(&self, lhs: &Fr, rhs: &Fr) -> Fr { let env = self.env(); let v = internal::Env::bls12_381_fr_mul(env, lhs.into(), rhs.into()).unwrap_infallible(); - U256::try_from_val(env, &v).unwrap_infallible() + U256::try_from_val(env, &v).unwrap_infallible().into() } /// Raises a scalar to the power of a given exponent in the BLS12-381 scalar field `Fr`. - pub fn fr_pow(&self, lhs: &U256, rhs: u64) -> U256 { + pub fn fr_pow(&self, lhs: &Fr, rhs: u64) -> Fr { let env = self.env(); let rhs = U64Val::try_from_val(env, &rhs).unwrap_optimized(); let v = internal::Env::bls12_381_fr_pow(env, lhs.into(), rhs).unwrap_infallible(); - U256::try_from_val(env, &v).unwrap_infallible() + U256::try_from_val(env, &v).unwrap_infallible().into() } /// Computes the multiplicative inverse of a scalar in the BLS12-381 scalar field `Fr`. - pub fn fr_inv(&self, lhs: &U256) -> U256 { + pub fn fr_inv(&self, lhs: &Fr) -> Fr { let env = self.env(); let v = internal::Env::bls12_381_fr_inv(env, lhs.into()).unwrap_infallible(); - U256::try_from_val(env, &v).unwrap_infallible() + U256::try_from_val(env, &v).unwrap_infallible().into() } } diff --git a/soroban-sdk/src/tests/crypto_bls12_381.rs b/soroban-sdk/src/tests/crypto_bls12_381.rs index 04d03ac47..a8efef6ff 100644 --- a/soroban-sdk/src/tests/crypto_bls12_381.rs +++ b/soroban-sdk/src/tests/crypto_bls12_381.rs @@ -1,6 +1,6 @@ use crate::{ bytes, bytesn, - crypto::bls12_381::{Bls12_381, Fp, Fp2, G1Affine, G2Affine}, + crypto::bls12_381::{Bls12_381, Fp, Fp2, Fr, G1Affine, G2Affine}, vec, Bytes, Env, Vec, U256, }; @@ -25,12 +25,16 @@ fn test_bls_g1() { assert!(res.is_some_and(|v| v == one)); // mul - let res = bls12_381.g1_mul(&one, &U256::from_u32(&env, 0)); + let res = bls12_381.g1_mul(&one, &U256::from_u32(&env, 0).into()); assert_eq!(res, zero); // msm let vp: Vec = vec![&env, one.clone(), one.clone()]; - let vs: Vec = vec![&env, U256::from_u32(&env, 1), U256::from_u32(&env, 0)]; + let vs: Vec = vec![ + &env, + U256::from_u32(&env, 1).into(), + U256::from_u32(&env, 0).into(), + ]; let res = bls12_381.g1_msm(vp, vs); assert_eq!(res, one); @@ -69,13 +73,23 @@ fn test_bls_g2() { assert!(res.is_some_and(|v| v == one)); // mul - let res = bls12_381.g2_mul(&one, &U256::from_u32(&env, 0)); + let res = bls12_381.g2_mul(&one, &U256::from_u32(&env, 0).into()); assert_eq!(res, zero); // msm let vp: Vec = vec![&env, one.clone(), one.clone()]; - let vs: Vec = vec![&env, U256::from_u32(&env, 1), U256::from_u32(&env, 0)]; - let res = bls12_381.g2_msm(vp, vs); + let vs: Vec = vec![ + &env, + Fr::from_bytes(bytesn!( + &env, + 0x0000000000000000000000000000000000000000000000000000000000000001 + )), + Fr::from_bytes(bytesn!( + &env, + 0x0000000000000000000000000000000000000000000000000000000000000000 + )), + ]; + let res = bls12_381.g2_msm(vp.clone(), vs); assert_eq!(res, one); // map to curve (test case from https://datatracker.ietf.org/doc/html/rfc9380) @@ -125,24 +139,33 @@ fn test_fr_arithmetic() { ), ); assert_eq!( - bls12_381.fr_add(&U256::from_u32(&env, 2), &U256::from_u32(&env, 3)), - U256::from_u32(&env, 5) + bls12_381.fr_add( + &U256::from_u32(&env, 2).into(), + &U256::from_u32(&env, 3).into() + ), + U256::from_u32(&env, 5).into() ); assert_eq!( - bls12_381.fr_sub(&U256::from_u32(&env, 2), &U256::from_u32(&env, 3)), - modulus.sub(&U256::from_u32(&env, 1)) + bls12_381.fr_sub( + &U256::from_u32(&env, 2).into(), + &U256::from_u32(&env, 3).into() + ), + modulus.sub(&U256::from_u32(&env, 1)).into() ); assert_eq!( - bls12_381.fr_mul(&U256::from_u32(&env, 2), &U256::from_u32(&env, 3)), - U256::from_u32(&env, 6) + bls12_381.fr_mul( + &U256::from_u32(&env, 2).into(), + &U256::from_u32(&env, 3).into() + ), + U256::from_u32(&env, 6).into() ); assert_eq!( - bls12_381.fr_pow(&U256::from_u32(&env, 5), 2), - U256::from_u32(&env, 25) + bls12_381.fr_pow(&U256::from_u32(&env, 5).into(), 2), + U256::from_u32(&env, 25).into() ); - let inverse_13 = bls12_381.fr_inv(&U256::from_u32(&env, 13)); + let inverse_13 = bls12_381.fr_inv(&U256::from_u32(&env, 13).into()); assert_eq!( - bls12_381.fr_mul(&inverse_13, &U256::from_u32(&env, 13)), - U256::from_u32(&env, 1) + bls12_381.fr_mul(&inverse_13, &U256::from_u32(&env, 13).into()), + U256::from_u32(&env, 1).into() ); } From 5b79d7bcbdd8631adabffa4629c533100f345b23 Mon Sep 17 00:00:00 2001 From: Anup Pani <127880479+anupsdf@users.noreply.github.com> Date: Wed, 23 Oct 2024 15:51:10 -0700 Subject: [PATCH 51/57] Bump env version to 22.0.0-rc.3 (#1378) Bump env version to 22.0.0-rc.3 --- Cargo.lock | 20 ++++++++++---------- Cargo.toml | 12 ++++++------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3990b45a6..e33d50769 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1201,9 +1201,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cdb13e8f4556fe89d2b1c8f529a66997e1d90fd6f10440dc5a1717f5f733251" +checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1" dependencies = [ "itertools", "proc-macro2", @@ -1213,9 +1213,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984c9a1a84c05599f5c9cb17d5fbb75fe1c7106598659a34d9da8a8f16d2c23f" +checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" dependencies = [ "arbitrary", "crate-git-revision", @@ -1232,9 +1232,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570dfaa0f35b373a2f9793b89a1864caf68e9071c5c8a4100654aa3434b4fde1" +checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" dependencies = [ "soroban-env-common", "static_assertions", @@ -1242,9 +1242,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e59d22359f8d372872b7630fc0dc6884c36356d5d33d3fca83d2b76e572c2a32" +checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1278,9 +1278,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76184b736ac2ce144461efbe7c3551ac2c2973fa144e32957bb2ae2d80467f64" +checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7" dependencies = [ "itertools", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 14fa23ddf..25ec3363f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,19 +24,19 @@ soroban-ledger-snapshot = { version = "22.0.0-rc.2.1", path = "soroban-ledger-sn soroban-token-sdk = { version = "22.0.0-rc.2.1", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] -version = "=22.0.0-rc.2" +version = "=22.0.0-rc.3" #git = "https://github.com/stellar/rs-soroban-env" -#rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" +#rev = "8911531dfb9a4331bc308ff8934c2223bc4e81ed" [workspace.dependencies.soroban-env-guest] -version = "=22.0.0-rc.2" +version = "=22.0.0-rc.3" #git = "https://github.com/stellar/rs-soroban-env" -#rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" +#rev = "8911531dfb9a4331bc308ff8934c2223bc4e81ed" [workspace.dependencies.soroban-env-host] -version = "=22.0.0-rc.2" +version = "=22.0.0-rc.3" #git = "https://github.com/stellar/rs-soroban-env" -#rev = "60e9be87a157cc9b5132056e1314faabd485b5fb" +#rev = "8911531dfb9a4331bc308ff8934c2223bc4e81ed" [workspace.dependencies.stellar-strkey] version = "=0.0.9" From 050af58692493914c696f278a964a09520e92283 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 23 Oct 2024 23:42:42 +0000 Subject: [PATCH 52/57] Bump version to 22.0.0-rc.3.0 (#1376) ### What Bump version to 22.0.0-rc.3.0, creating release branch. ### Why Triggered by @anupsdf in https://github.com/stellar/rs-soroban-sdk/actions/runs/11484747941. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v22.0.0-rc.3.0` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.3.0&title=22.0.0-rc.3.0 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.3.0&title=22.0.0-rc.3.0&target=release/v22.0.0-rc.3.0 Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> --- Cargo.lock | 54 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e33d50769..15c6c448a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "pretty_assertions", "serde", @@ -1306,7 +1306,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "arbitrary", "bytes-lit", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "crate-git-revision", "darling", @@ -1349,7 +1349,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1360,7 +1360,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "pretty_assertions", "prettyplease", @@ -1375,7 +1375,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] @@ -1491,140 +1491,140 @@ dependencies = [ [[package]] name = "test_account" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_constructor" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1632,7 +1632,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 25ec3363f..7fa3ba037 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3.0" rust-version = "1.79.0" [workspace.dependencies] -soroban-sdk = { version = "22.0.0-rc.2.1", path = "soroban-sdk" } -soroban-sdk-macros = { version = "22.0.0-rc.2.1", path = "soroban-sdk-macros" } -soroban-spec = { version = "22.0.0-rc.2.1", path = "soroban-spec" } -soroban-spec-rust = { version = "22.0.0-rc.2.1", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "22.0.0-rc.2.1", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "22.0.0-rc.2.1", path = "soroban-token-sdk" } +soroban-sdk = { version = "22.0.0-rc.3.0", path = "soroban-sdk" } +soroban-sdk-macros = { version = "22.0.0-rc.3.0", path = "soroban-sdk-macros" } +soroban-spec = { version = "22.0.0-rc.3.0", path = "soroban-spec" } +soroban-spec-rust = { version = "22.0.0-rc.3.0", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "22.0.0-rc.3.0", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "22.0.0-rc.3.0", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=22.0.0-rc.3" From 2a78fb7af1b51a41d8ba0bab8ea76d744e5e47e2 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 09:49:31 +1000 Subject: [PATCH 53/57] Add test demonstrating issue with using Option inside an enum (#1380) ### What Add test demonstrating issue with using Option inside an enum. (cherry picked from commit 68411e7e92b11e6316c269d4f7ccae86cd37cfaf) ### Why This was added to a patch release recently and we should retain the test in main. --- soroban-sdk/src/tests.rs | 1 + soroban-sdk/src/tests/contract_udt_enum_option.rs | 8 ++++++++ 2 files changed, 9 insertions(+) create mode 100644 soroban-sdk/src/tests/contract_udt_enum_option.rs diff --git a/soroban-sdk/src/tests.rs b/soroban-sdk/src/tests.rs index 9d6c0a962..48fe80c97 100644 --- a/soroban-sdk/src/tests.rs +++ b/soroban-sdk/src/tests.rs @@ -18,6 +18,7 @@ mod contract_store; mod contract_timepoint; mod contract_udt_enum; mod contract_udt_enum_error; +mod contract_udt_enum_option; mod contract_udt_option; mod contract_udt_struct; mod contract_udt_struct_tuple; diff --git a/soroban-sdk/src/tests/contract_udt_enum_option.rs b/soroban-sdk/src/tests/contract_udt_enum_option.rs new file mode 100644 index 000000000..e7fb1ef08 --- /dev/null +++ b/soroban-sdk/src/tests/contract_udt_enum_option.rs @@ -0,0 +1,8 @@ +use crate::{self as soroban_sdk}; +use soroban_sdk::{contracttype, Address}; + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub enum Test { + Variant(Option
, Address, i128), +} From e7eccd3c857ef3e368a90ccf9b542eb4dfe852bd Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 24 Oct 2024 01:29:13 +0000 Subject: [PATCH 54/57] Bump version to 22.0.0-rc.3 (#1381) ### What Bump version to 22.0.0-rc.3, creating release branch. ### Why Triggered by @leighmcculloch in https://github.com/stellar/rs-soroban-sdk/actions/runs/11490681213. ### What is next See the release instructions for a full rundown on the release process: https://github.com/stellar/actions/blob/main/README-rust-release.md Commit any changes to the `release/v22.0.0-rc.3` branch that are needed in this release. If this is a regular release releasing from `main`, merge this PR when ready, and after merging, create a release for this version by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.3&title=22.0.0-rc.3 If this is a backport or patch release of a past version, see the release instructions. When ready to release this branch create a release by going to this link: https://github.com/stellar/rs-soroban-sdk/releases/new?tag=v22.0.0-rc.3&title=22.0.0-rc.3&target=release/v22.0.0-rc.3 --------- Co-authored-by: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- Cargo.lock | 54 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 14 +++++++------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 15c6c448a..ff8ae13a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1293,7 +1293,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "pretty_assertions", "serde", @@ -1306,7 +1306,7 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "arbitrary", "bytes-lit", @@ -1331,7 +1331,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "crate-git-revision", "darling", @@ -1349,7 +1349,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "base64 0.13.1", "pretty_assertions", @@ -1360,7 +1360,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "pretty_assertions", "prettyplease", @@ -1375,7 +1375,7 @@ dependencies = [ [[package]] name = "soroban-token-sdk" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] @@ -1491,140 +1491,140 @@ dependencies = [ [[package]] name = "test_account" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_i128" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u128" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_add_u64" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_alloc" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_auth" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_constructor" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_contract_data" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_empty2" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_errors" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_events" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_fuzz" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_import_contract" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_invoke_contract" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_logging" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_modular" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_multiimpl" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_udt" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] [[package]] name = "test_workspace_contract" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", "test_workspace_lib", @@ -1632,7 +1632,7 @@ dependencies = [ [[package]] name = "test_workspace_lib" -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] diff --git a/Cargo.toml b/Cargo.toml index 7fa3ba037..9cde3dd77 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,16 +12,16 @@ members = [ ] [workspace.package] -version = "22.0.0-rc.3.0" +version = "22.0.0-rc.3" rust-version = "1.79.0" [workspace.dependencies] -soroban-sdk = { version = "22.0.0-rc.3.0", path = "soroban-sdk" } -soroban-sdk-macros = { version = "22.0.0-rc.3.0", path = "soroban-sdk-macros" } -soroban-spec = { version = "22.0.0-rc.3.0", path = "soroban-spec" } -soroban-spec-rust = { version = "22.0.0-rc.3.0", path = "soroban-spec-rust" } -soroban-ledger-snapshot = { version = "22.0.0-rc.3.0", path = "soroban-ledger-snapshot" } -soroban-token-sdk = { version = "22.0.0-rc.3.0", path = "soroban-token-sdk" } +soroban-sdk = { version = "22.0.0-rc.3", path = "soroban-sdk" } +soroban-sdk-macros = { version = "22.0.0-rc.3", path = "soroban-sdk-macros" } +soroban-spec = { version = "22.0.0-rc.3", path = "soroban-spec" } +soroban-spec-rust = { version = "22.0.0-rc.3", path = "soroban-spec-rust" } +soroban-ledger-snapshot = { version = "22.0.0-rc.3", path = "soroban-ledger-snapshot" } +soroban-token-sdk = { version = "22.0.0-rc.3", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=22.0.0-rc.3" From 433ce5c3363762b4336cad837c9d6b188d16396c Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 25 Oct 2024 07:05:35 +1000 Subject: [PATCH 55/57] Add no-change check to build-fuzz and docs builds (#1383) ### What Add no-change checks to the build-fuzz and docs builds, that errors if there are any changes to the working directory after the builds run. ### Why To detect files that weren't generated or updated relating to builds. Also checks the lock file is up to date. We could alternative use options on cargo to freeze the lock file, which is another way to achieve same for that one file. However, this more general check will check any files that changes as part of build, so it's broader. --- .github/workflows/rust.yml | 4 ++++ tests/fuzz/fuzz/Cargo.lock | 37 +++++++++++++++++++------------------ 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index c3216a244..427c2fd78 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -138,6 +138,8 @@ jobs: name: cargo-fuzz version: 0.11.2 - run: make build-fuzz + - name: Check no diffs exist + run: git add -N . && git diff HEAD --exit-code docs: runs-on: ubuntu-latest @@ -147,6 +149,8 @@ jobs: # TODO: Unpin nightly version after https://github.com/rust-lang/rust/issues/131643 is fixed. - run: rustup install nightly-2024-10-10 - run: make doc + - name: Check no diffs exist + run: git add -N . && git diff HEAD --exit-code readme: runs-on: ubuntu-latest diff --git a/tests/fuzz/fuzz/Cargo.lock b/tests/fuzz/fuzz/Cargo.lock index dfbec92eb..dd7cef164 100644 --- a/tests/fuzz/fuzz/Cargo.lock +++ b/tests/fuzz/fuzz/Cargo.lock @@ -905,9 +905,9 @@ dependencies = [ [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] @@ -1037,9 +1037,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "soroban-builtin-sdk-macros" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cdb13e8f4556fe89d2b1c8f529a66997e1d90fd6f10440dc5a1717f5f733251" +checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1" dependencies = [ "itertools", "proc-macro2", @@ -1049,9 +1049,9 @@ dependencies = [ [[package]] name = "soroban-env-common" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "984c9a1a84c05599f5c9cb17d5fbb75fe1c7106598659a34d9da8a8f16d2c23f" +checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" dependencies = [ "arbitrary", "crate-git-revision", @@ -1068,9 +1068,9 @@ dependencies = [ [[package]] name = "soroban-env-guest" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "570dfaa0f35b373a2f9793b89a1864caf68e9071c5c8a4100654aa3434b4fde1" +checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" dependencies = [ "soroban-env-common", "static_assertions", @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "soroban-env-host" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e59d22359f8d372872b7630fc0dc6884c36356d5d33d3fca83d2b76e572c2a32" +checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1114,9 +1114,9 @@ dependencies = [ [[package]] name = "soroban-env-macros" -version = "22.0.0-rc.2" +version = "22.0.0-rc.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76184b736ac2ce144461efbe7c3551ac2c2973fa144e32957bb2ae2d80467f64" +checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7" dependencies = [ "itertools", "proc-macro2", @@ -1129,7 +1129,7 @@ dependencies = [ [[package]] name = "soroban-ledger-snapshot" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3" dependencies = [ "serde", "serde_json", @@ -1141,13 +1141,14 @@ dependencies = [ [[package]] name = "soroban-sdk" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3" dependencies = [ "arbitrary", "bytes-lit", "ctor", "ed25519-dalek", "rand", + "rustc_version", "serde", "serde_json", "soroban-env-guest", @@ -1159,7 +1160,7 @@ dependencies = [ [[package]] name = "soroban-sdk-macros" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3" dependencies = [ "crate-git-revision", "darling", @@ -1177,7 +1178,7 @@ dependencies = [ [[package]] name = "soroban-spec" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3" dependencies = [ "base64 0.13.1", "stellar-xdr", @@ -1187,7 +1188,7 @@ dependencies = [ [[package]] name = "soroban-spec-rust" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3" dependencies = [ "prettyplease", "proc-macro2", @@ -1297,7 +1298,7 @@ dependencies = [ [[package]] name = "test_fuzz" -version = "22.0.0-rc.2.1" +version = "22.0.0-rc.3" dependencies = [ "soroban-sdk", ] From 44ed5706699458267d6a9c572bac8d7935b68ed6 Mon Sep 17 00:00:00 2001 From: Jay Geng Date: Thu, 24 Oct 2024 19:15:12 -0400 Subject: [PATCH 56/57] fix argument list for `from_array` (#1384) ### What Simple fix up from for the previous BLS change. ### Why [TODO: Why this change is being made. Include any context required to understand the why.] ### Known limitations [TODO or N/A] --- soroban-sdk/src/bytes.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soroban-sdk/src/bytes.rs b/soroban-sdk/src/bytes.rs index 2e427f1ed..57df2963a 100644 --- a/soroban-sdk/src/bytes.rs +++ b/soroban-sdk/src/bytes.rs @@ -122,7 +122,7 @@ macro_rules! impl_bytesn_repr { self.0.to_array() } - pub fn from_array(&self, env: &Env, array: &[u8; $size]) -> Self { + pub fn from_array(env: &Env, array: &[u8; $size]) -> Self { Self(>::from_array(env, array)) } From b7b8255ab27dc0d85570b5deed697f4c90079661 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:35:35 +1000 Subject: [PATCH 57/57] Add wasm size to output (#1386) ### What Add wasm size to output ### Why So that it's easy to look at PRs to see how they change the size of the test vectors when built. --- .github/workflows/rust.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 427c2fd78..063cbc8b4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -113,6 +113,12 @@ jobs: run: rm -fr **/test_snapshots - name: Build for wasm run: cargo-hack hack build --target wasm32-unknown-unknown --profile release + - name: Wasm Size + run: | + cd target/wasm32-unknown-unknown/release/ && \ + for i in *.wasm ; do \ + ls -l "$i"; \ + done - if: "!matrix.sys.cdylib-cross-compile-workaround" name: Build for native run: cargo-hack hack --feature-powerset --exclude-features docs build --target ${{ matrix.sys.target }}