From c349f06bca0e4b8ff3f84b5865b1deccc28f91aa Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 14:05:31 +1000 Subject: [PATCH 01/20] Add ContractArgs for building function args --- Cargo.lock | 21 ++---- Cargo.toml | 8 +-- soroban-sdk-macros/src/derive_args.rs | 92 +++++++++++++++++++++++++ soroban-sdk-macros/src/derive_client.rs | 2 +- soroban-sdk-macros/src/lib.rs | 52 ++++++++++++++ soroban-sdk-macros/src/syn_ext.rs | 6 +- soroban-sdk/src/lib.rs | 5 ++ soroban-spec-rust/src/lib.rs | 1 + tests/constructor/src/lib.rs | 2 +- 9 files changed, 163 insertions(+), 26 deletions(-) create mode 100644 soroban-sdk-macros/src/derive_args.rs diff --git a/Cargo.lock b/Cargo.lock index ff8ae13a9..fe6606ed6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,8 +1202,6 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1" dependencies = [ "itertools", "proc-macro2", @@ -1214,8 +1212,6 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" dependencies = [ "arbitrary", "crate-git-revision", @@ -1233,8 +1229,6 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" dependencies = [ "soroban-env-common", "static_assertions", @@ -1243,8 +1237,6 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1279,8 +1271,6 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7" dependencies = [ "itertools", "proc-macro2", @@ -1383,8 +1373,7 @@ dependencies = [ [[package]] name = "soroban-wasmi" version = "0.31.1-soroban.20.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "smallvec", "spin", @@ -1784,15 +1773,13 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasmi_arena" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +version = "0.4.0" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" [[package]] name = "wasmi_core" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "downcast-rs", "libm", diff --git a/Cargo.toml b/Cargo.toml index 9cde3dd77..0a16670f2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,10 +48,10 @@ features = ["curr"] #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" } -#soroban-env-guest = { path = "../rs-soroban-env/soroban-env-guest" } -#soroban-env-host = { path = "../rs-soroban-env/soroban-env-host" } +[patch.crates-io] +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" } #[patch."https://github.com/stellar/rs-stellar-xdr"] #stellar-xdr = { path = "../rs-stellar-xdr/" } diff --git a/soroban-sdk-macros/src/derive_args.rs b/soroban-sdk-macros/src/derive_args.rs new file mode 100644 index 000000000..6d1763688 --- /dev/null +++ b/soroban-sdk-macros/src/derive_args.rs @@ -0,0 +1,92 @@ +use proc_macro2::{Span, TokenStream}; +use quote::{format_ident, quote}; +use syn::{Error, FnArg, Lifetime, Path, Type, TypePath, TypeReference}; + +use crate::syn_ext; + +pub fn derive_args_type(ty: &str, name: &str) -> TokenStream { + let ty_str = quote!(#ty).to_string(); + // Render the Client. + let args_doc = format!("{name} is a type for buildings function args defined in {ty_str}."); + let args_ident = format_ident!("{}", name); + quote! { + #[doc = #args_doc] + pub struct #args_ident; + } +} + +pub fn derive_args_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> TokenStream { + // Map the traits methods to methods for the Args. + let mut errors = Vec::::new(); + let fns: Vec<_> = fns + .iter() + .map(|f| { + let fn_ident = &f.ident; + + // Check for the Env argument. + let env_input = f.inputs.first().and_then(|a| match a { + FnArg::Typed(pat_type) => { + let mut ty = &*pat_type.ty; + if let Type::Reference(TypeReference { elem, .. }) = ty { + ty = elem; + } + if let Type::Path(TypePath { + path: syn::Path { segments, .. }, + .. + }) = ty + { + if segments.last().map_or(false, |s| s.ident == "Env") { + Some(()) + } else { + None + } + } else { + None + } + } + FnArg::Receiver(_) => None, + }); + + // Map all remaining inputs. + let fn_input_lifetime = Lifetime::new("'i", Span::call_site()); + let (fn_input_names, fn_input_types): (Vec<_>, Vec<_>) = f + .inputs + .iter() + .skip(if env_input.is_some() { 1 } else { 0 }) + .map(|t| { + let ident = match syn_ext::fn_arg_ident(t) { + Ok(ident) => ident, + Err(e) => { + errors.push(e); + format_ident!("_") + } + }; + (ident, syn_ext::fn_arg_make_ref(t, Some(&fn_input_lifetime))) + }) + .unzip(); + + quote! { + // TODO: Make the fn_input_types an impl Borrow + pub fn #fn_ident<#fn_input_lifetime>(#(#fn_input_types),*) + -> impl #crate_path::IntoVal<#crate_path::Env, #crate_path::Vec<#crate_path::Val>> + #fn_input_lifetime + { + (#(#fn_input_names,)*) + } + } + }) + .collect(); + + // If errors have occurred, render them instead. + if !errors.is_empty() { + let compile_errors = errors.iter().map(Error::to_compile_error); + return quote! { #(#compile_errors)* }; + } + + // Render the Client. + let args_ident = format_ident!("{}", name); + quote! { + impl #args_ident { + #(#fns)* + } + } +} diff --git a/soroban-sdk-macros/src/derive_client.rs b/soroban-sdk-macros/src/derive_client.rs index 07a0504e1..aa896c633 100644 --- a/soroban-sdk-macros/src/derive_client.rs +++ b/soroban-sdk-macros/src/derive_client.rs @@ -192,7 +192,7 @@ pub fn derive_client_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> format_ident!("_") } }; - (ident, syn_ext::fn_arg_make_ref(t)) + (ident, syn_ext::fn_arg_make_ref(t, None)) }) .unzip(); let fn_output = f.output(); diff --git a/soroban-sdk-macros/src/lib.rs b/soroban-sdk-macros/src/lib.rs index 69231f92c..60d9b264a 100644 --- a/soroban-sdk-macros/src/lib.rs +++ b/soroban-sdk-macros/src/lib.rs @@ -1,6 +1,7 @@ extern crate proc_macro; mod arbitrary; +mod derive_args; mod derive_client; mod derive_enum; mod derive_enum_int; @@ -15,6 +16,7 @@ mod path; mod symbol; mod syn_ext; +use derive_args::{derive_args_impl, derive_args_type}; use derive_client::{derive_client_impl, derive_client_type}; use derive_enum::derive_type_enum; use derive_enum_int::derive_type_enum_int; @@ -136,8 +138,11 @@ pub fn contract(metadata: TokenStream, input: TokenStream) -> TokenStream { 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 args_ident = format!("{ty_str}Args"); + let contract_args = derive_args_type(&ty_str, &args_ident); let mut output = quote! { #input2 + #contract_args #client }; if cfg!(feature = "testutils") { @@ -206,6 +211,18 @@ pub fn contractimpl(metadata: TokenStream, input: TokenStream) -> TokenStream { let ty = &imp.self_ty; let ty_str = quote!(#ty).to_string(); + // TODO: Use imp.trait_ in generating the args ident, to create a unique + // args for each trait impl for a contract, to avoid conflicts. + let args_ident = if let Type::Path(path) = &**ty { + path.path + .segments + .last() + .map(|name| format!("{}Args", name.ident)) + } else { + None + } + .unwrap_or_else(|| "Args".to_string()); + // TODO: Use imp.trait_ in generating the client ident, to create a unique // client for each trait impl for a contract, to avoid conflicts. let client_ident = if let Type::Path(path) = &**ty { @@ -239,6 +256,7 @@ pub fn contractimpl(metadata: TokenStream, input: TokenStream) -> TokenStream { match derived { Ok(derived_ok) => { let mut output = quote! { + #[#crate_path::contractargs(crate_path = #crate_path_str, name = #args_ident, impl_only = true)] #[#crate_path::contractclient(crate_path = #crate_path_str, name = #client_ident, impl_only = true)] #[#crate_path::contractspecfn(name = #ty_str)] #imp @@ -533,6 +551,40 @@ pub fn contractfile(metadata: TokenStream) -> TokenStream { quote! { #contents_lit }.into() } +#[derive(Debug, FromMeta)] +struct ContractArgsArgs { + #[darling(default = "default_crate_path")] + crate_path: Path, + name: String, + #[darling(default)] + impl_only: bool, +} + +#[proc_macro_attribute] +pub fn contractargs(metadata: TokenStream, input: TokenStream) -> TokenStream { + let args = match NestedMeta::parse_meta_list(metadata.into()) { + Ok(v) => v, + Err(e) => { + return TokenStream::from(darling::Error::from(e).write_errors()); + } + }; + let args = match ContractArgsArgs::from_list(&args) { + Ok(v) => v, + Err(e) => return e.write_errors().into(), + }; + let input2: TokenStream2 = input.clone().into(); + let item = parse_macro_input!(input as HasFnsItem); + let methods: Vec<_> = item.fns(); + let args_type = (!args.impl_only).then(|| derive_args_type(&item.name(), &args.name)); + let args_impl = derive_args_impl(&args.crate_path, &args.name, &methods); + quote! { + #input2 + #args_type + #args_impl + } + .into() +} + #[derive(Debug, FromMeta)] struct ContractClientArgs { #[darling(default = "default_crate_path")] diff --git a/soroban-sdk-macros/src/syn_ext.rs b/soroban-sdk-macros/src/syn_ext.rs index 71f91216c..fd515d5cd 100644 --- a/soroban-sdk-macros/src/syn_ext.rs +++ b/soroban-sdk-macros/src/syn_ext.rs @@ -9,7 +9,7 @@ use syn::{ }; use syn::{ spanned::Spanned, token::And, Error, FnArg, Ident, ImplItem, ImplItemFn, ItemImpl, ItemTrait, - Pat, PatType, TraitItem, TraitItemFn, Type, TypeReference, Visibility, + Lifetime, Pat, PatType, TraitItem, TraitItemFn, Type, TypeReference, Visibility, }; /// Gets methods from the implementation that have public visibility. For @@ -49,7 +49,7 @@ pub fn fn_arg_ident(arg: &FnArg) -> Result { /// Returns a clone of FnArg with the type as a reference if the arg is a typed /// arg and its type is not already a reference. -pub fn fn_arg_make_ref(arg: &FnArg) -> FnArg { +pub fn fn_arg_make_ref(arg: &FnArg, lifetime: Option<&Lifetime>) -> FnArg { if let FnArg::Typed(pat_type) = arg { if !matches!(*pat_type.ty, Type::Reference(_)) { return FnArg::Typed(PatType { @@ -58,7 +58,7 @@ pub fn fn_arg_make_ref(arg: &FnArg) -> FnArg { colon_token: pat_type.colon_token, ty: Box::new(Type::Reference(TypeReference { and_token: And::default(), - lifetime: None, + lifetime: lifetime.cloned(), mutability: None, elem: pat_type.ty.clone(), })), diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index 95207d7a9..a605a26df 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -593,6 +593,11 @@ pub use soroban_sdk_macros::contractmeta; /// ``` pub use soroban_sdk_macros::contracttype; +/// Generates a type that helps build function args for a contract trait. +/// +/// TODO: Docs and examples. +pub use soroban_sdk_macros::contractargs; + /// Generates a client for a contract trait. /// /// Can be used to create clients for contracts that live outside the current diff --git a/soroban-spec-rust/src/lib.rs b/soroban-spec-rust/src/lib.rs index 5e62c4172..83cc5d292 100644 --- a/soroban-spec-rust/src/lib.rs +++ b/soroban-spec-rust/src/lib.rs @@ -89,6 +89,7 @@ pub fn generate_without_file(specs: &[ScSpecEntry]) -> TokenStream { let error_enums = spec_error_enums.iter().map(|s| generate_error_enum(s)); quote! { + #[soroban_sdk::contractargs(name = "Args")] #[soroban_sdk::contractclient(name = "Client")] #trait_ diff --git a/tests/constructor/src/lib.rs b/tests/constructor/src/lib.rs index 3868bf933..e5e0230e7 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, (100_u32, 1000_i64)); + let contract_id = env.register(Contract, ContractArgs::__constructor(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)); From 1372912f77ea140dc99cd2abbdbc89da7a11a4a7 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 22:46:24 +1000 Subject: [PATCH 02/20] return the concrete types instead of generics --- soroban-sdk-macros/src/derive_args.rs | 32 ++++++++++++++++++--------- soroban-sdk-macros/src/lib.rs | 6 ++--- soroban-sdk-macros/src/syn_ext.rs | 21 ++++++++++++++++++ 3 files changed, 45 insertions(+), 14 deletions(-) diff --git a/soroban-sdk-macros/src/derive_args.rs b/soroban-sdk-macros/src/derive_args.rs index 6d1763688..5cc7bb5f2 100644 --- a/soroban-sdk-macros/src/derive_args.rs +++ b/soroban-sdk-macros/src/derive_args.rs @@ -1,21 +1,22 @@ +use itertools::MultiUnzip; use proc_macro2::{Span, TokenStream}; use quote::{format_ident, quote}; -use syn::{Error, FnArg, Lifetime, Path, Type, TypePath, TypeReference}; +use syn::{Error, FnArg, Lifetime, Type, TypePath, TypeReference}; use crate::syn_ext; pub fn derive_args_type(ty: &str, name: &str) -> TokenStream { let ty_str = quote!(#ty).to_string(); - // Render the Client. - let args_doc = format!("{name} is a type for buildings function args defined in {ty_str}."); - let args_ident = format_ident!("{}", name); + let args_doc = + format!("{name} is a type for building arg lists for functions defined in {ty_str}."); + let args_ident = format_ident!("{name}"); quote! { #[doc = #args_doc] pub struct #args_ident; } } -pub fn derive_args_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> TokenStream { +pub fn derive_args_impl(name: &str, fns: &[syn_ext::Fn]) -> TokenStream { // Map the traits methods to methods for the Args. let mut errors = Vec::::new(); let fns: Vec<_> = fns @@ -49,7 +50,7 @@ pub fn derive_args_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> T // Map all remaining inputs. let fn_input_lifetime = Lifetime::new("'i", Span::call_site()); - let (fn_input_names, fn_input_types): (Vec<_>, Vec<_>) = f + let (fn_input_names, fn_input_types, fn_input_fn_args): (Vec<_>, Vec<_>, Vec<_>) = f .inputs .iter() .skip(if env_input.is_some() { 1 } else { 0 }) @@ -61,14 +62,25 @@ pub fn derive_args_impl(crate_path: &Path, name: &str, fns: &[syn_ext::Fn]) -> T format_ident!("_") } }; - (ident, syn_ext::fn_arg_make_ref(t, Some(&fn_input_lifetime))) + let ty = match syn_ext::fn_arg_ref_type(t, Some(&fn_input_lifetime)) { + Ok(ty) => Some(ty), + Err(e) => { + errors.push(e); + None + } + }; + ( + ident, + ty, + syn_ext::fn_arg_make_ref(t, Some(&fn_input_lifetime)), + ) }) - .unzip(); + .multiunzip(); quote! { // TODO: Make the fn_input_types an impl Borrow - pub fn #fn_ident<#fn_input_lifetime>(#(#fn_input_types),*) - -> impl #crate_path::IntoVal<#crate_path::Env, #crate_path::Vec<#crate_path::Val>> + #fn_input_lifetime + pub fn #fn_ident<#fn_input_lifetime>(#(#fn_input_fn_args),*) + -> (#(#fn_input_types,)*) { (#(#fn_input_names,)*) } diff --git a/soroban-sdk-macros/src/lib.rs b/soroban-sdk-macros/src/lib.rs index 60d9b264a..efd2bf1d1 100644 --- a/soroban-sdk-macros/src/lib.rs +++ b/soroban-sdk-macros/src/lib.rs @@ -256,7 +256,7 @@ pub fn contractimpl(metadata: TokenStream, input: TokenStream) -> TokenStream { match derived { Ok(derived_ok) => { let mut output = quote! { - #[#crate_path::contractargs(crate_path = #crate_path_str, name = #args_ident, impl_only = true)] + #[#crate_path::contractargs(name = #args_ident, impl_only = true)] #[#crate_path::contractclient(crate_path = #crate_path_str, name = #client_ident, impl_only = true)] #[#crate_path::contractspecfn(name = #ty_str)] #imp @@ -553,8 +553,6 @@ pub fn contractfile(metadata: TokenStream) -> TokenStream { #[derive(Debug, FromMeta)] struct ContractArgsArgs { - #[darling(default = "default_crate_path")] - crate_path: Path, name: String, #[darling(default)] impl_only: bool, @@ -576,7 +574,7 @@ pub fn contractargs(metadata: TokenStream, input: TokenStream) -> TokenStream { let item = parse_macro_input!(input as HasFnsItem); let methods: Vec<_> = item.fns(); let args_type = (!args.impl_only).then(|| derive_args_type(&item.name(), &args.name)); - let args_impl = derive_args_impl(&args.crate_path, &args.name, &methods); + let args_impl = derive_args_impl(&args.name, &methods); quote! { #input2 #args_type diff --git a/soroban-sdk-macros/src/syn_ext.rs b/soroban-sdk-macros/src/syn_ext.rs index fd515d5cd..2d40104dc 100644 --- a/soroban-sdk-macros/src/syn_ext.rs +++ b/soroban-sdk-macros/src/syn_ext.rs @@ -47,6 +47,27 @@ pub fn fn_arg_ident(arg: &FnArg) -> Result { )) } +/// Returns a clone of the type from the FnArg. +pub fn fn_arg_ref_type(arg: &FnArg, lifetime: Option<&Lifetime>) -> Result { + if let FnArg::Typed(pat_type) = arg { + if !matches!(*pat_type.ty, Type::Reference(_)) { + Ok(Type::Reference(TypeReference { + and_token: And::default(), + lifetime: lifetime.cloned(), + mutability: None, + elem: pat_type.ty.clone(), + })) + } else { + Ok((*pat_type.ty).clone()) + } + } else { + Err(Error::new( + arg.span(), + "argument in this form is not supported, use simple named arguments only", + )) + } +} + /// Returns a clone of FnArg with the type as a reference if the arg is a typed /// arg and its type is not already a reference. pub fn fn_arg_make_ref(arg: &FnArg, lifetime: Option<&Lifetime>) -> FnArg { From 8cfc0c40bf62809e805fc68c73d4005e25312eac Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:28:19 +1000 Subject: [PATCH 03/20] fix --- tests/constructor/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/constructor/src/lib.rs b/tests/constructor/src/lib.rs index e5e0230e7..981b9ed72 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, ContractArgs::__constructor(100_u32, 1000_i64)); + let contract_id = env.register(Contract, ContractArgs::__constructor(&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)); From 16c5613ca414ef275900e45d0f6dddeae117552e Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:37:01 +1000 Subject: [PATCH 04/20] assorted fixes --- soroban-sdk-macros/src/derive_args.rs | 1 - soroban-spec-rust/src/lib.rs | 1 + tests/modular/src/feat1.rs | 1 + tests/modular/src/feat2.rs | 1 + 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/soroban-sdk-macros/src/derive_args.rs b/soroban-sdk-macros/src/derive_args.rs index 5cc7bb5f2..2024cbb0c 100644 --- a/soroban-sdk-macros/src/derive_args.rs +++ b/soroban-sdk-macros/src/derive_args.rs @@ -78,7 +78,6 @@ pub fn derive_args_impl(name: &str, fns: &[syn_ext::Fn]) -> TokenStream { .multiunzip(); quote! { - // TODO: Make the fn_input_types an impl Borrow pub fn #fn_ident<#fn_input_lifetime>(#(#fn_input_fn_args),*) -> (#(#fn_input_types,)*) { diff --git a/soroban-spec-rust/src/lib.rs b/soroban-spec-rust/src/lib.rs index 83cc5d292..be075710e 100644 --- a/soroban-spec-rust/src/lib.rs +++ b/soroban-spec-rust/src/lib.rs @@ -135,6 +135,7 @@ mod test { assert_eq!( rust, r#"pub const WASM: &[u8] = soroban_sdk::contractfile!(file = "", sha256 = ""); +#[soroban_sdk::contractargs(name = "Args")] #[soroban_sdk::contractclient(name = "Client")] pub trait Contract { fn add(env: soroban_sdk::Env, a: UdtEnum, b: UdtEnum) -> i64; diff --git a/tests/modular/src/feat1.rs b/tests/modular/src/feat1.rs index 49822a361..ea68d7b6e 100644 --- a/tests/modular/src/feat1.rs +++ b/tests/modular/src/feat1.rs @@ -1,6 +1,7 @@ use soroban_sdk::contractimpl; use crate::Contract; +use crate::ContractArgs; use crate::ContractClient; #[contractimpl] diff --git a/tests/modular/src/feat2.rs b/tests/modular/src/feat2.rs index b5b4aaccf..79c3a82f3 100644 --- a/tests/modular/src/feat2.rs +++ b/tests/modular/src/feat2.rs @@ -1,5 +1,6 @@ use soroban_sdk::contractimpl; +use crate::ContractArgs; use crate::ContractClient; #[contractimpl] From c3a91a850e1daa549d78b9938d23c97ac95abc2c Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:39:16 +1000 Subject: [PATCH 05/20] remove todo --- soroban-sdk/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/soroban-sdk/src/lib.rs b/soroban-sdk/src/lib.rs index a605a26df..0e218dfe5 100644 --- a/soroban-sdk/src/lib.rs +++ b/soroban-sdk/src/lib.rs @@ -594,8 +594,6 @@ pub use soroban_sdk_macros::contractmeta; pub use soroban_sdk_macros::contracttype; /// Generates a type that helps build function args for a contract trait. -/// -/// TODO: Docs and examples. pub use soroban_sdk_macros::contractargs; /// Generates a client for a contract trait. From aaa39481e1acbe0ec1b1b1a499768126eb7afd33 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:13:13 +1000 Subject: [PATCH 06/20] Add wasm size to output --- .github/workflows/rust.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 427c2fd78..8b3531c0e 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 }} From adca52d9bbc13600e00eec9569c8fab780fed9e6 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:15:45 +1000 Subject: [PATCH 07/20] fix --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 8b3531c0e..063cbc8b4 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -117,7 +117,7 @@ jobs: run: | cd target/wasm32-unknown-unknown/release/ && \ for i in *.wasm ; do \ - ls -l "$$i"; \ + ls -l "$i"; \ done - if: "!matrix.sys.cdylib-cross-compile-workaround" name: Build for native From dbd4647902865e2e064586dd595a74226619584e Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:19:13 +1000 Subject: [PATCH 08/20] Add inline always to args fns --- Cargo.lock | 33 +++++++++++++++++++++++---- soroban-sdk-macros/src/derive_args.rs | 1 + 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe6606ed6..619adca3f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,6 +1202,8 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1" dependencies = [ "itertools", "proc-macro2", @@ -1212,6 +1214,8 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" dependencies = [ "arbitrary", "crate-git-revision", @@ -1229,6 +1233,8 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "22.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" dependencies = [ "soroban-env-common", "static_assertions", @@ -1237,6 +1243,8 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1271,6 +1279,8 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0-rc.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7" dependencies = [ "itertools", "proc-macro2", @@ -1373,7 +1383,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", @@ -1773,13 +1784,15 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[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", @@ -1943,3 +1956,15 @@ dependencies = [ "quote", "syn 2.0.77", ] + +[[patch.unused]] +name = "soroban-env-common" +version = "21.2.2" + +[[patch.unused]] +name = "soroban-env-guest" +version = "21.2.2" + +[[patch.unused]] +name = "soroban-env-host" +version = "21.2.2" diff --git a/soroban-sdk-macros/src/derive_args.rs b/soroban-sdk-macros/src/derive_args.rs index 2024cbb0c..158f5aa6b 100644 --- a/soroban-sdk-macros/src/derive_args.rs +++ b/soroban-sdk-macros/src/derive_args.rs @@ -78,6 +78,7 @@ pub fn derive_args_impl(name: &str, fns: &[syn_ext::Fn]) -> TokenStream { .multiunzip(); quote! { + #[inline(always)] pub fn #fn_ident<#fn_input_lifetime>(#(#fn_input_fn_args),*) -> (#(#fn_input_types,)*) { From d167ee066990101385b6d91d55db2c83288711ce Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 25 Oct 2024 13:21:20 +1000 Subject: [PATCH 09/20] undo lock change --- Cargo.lock | 33 ++++----------------------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 619adca3f..fe6606ed6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,8 +1202,6 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1" dependencies = [ "itertools", "proc-macro2", @@ -1214,8 +1212,6 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" dependencies = [ "arbitrary", "crate-git-revision", @@ -1233,8 +1229,6 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" dependencies = [ "soroban-env-common", "static_assertions", @@ -1243,8 +1237,6 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1279,8 +1271,6 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7" dependencies = [ "itertools", "proc-macro2", @@ -1383,8 +1373,7 @@ dependencies = [ [[package]] name = "soroban-wasmi" version = "0.31.1-soroban.20.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "smallvec", "spin", @@ -1784,15 +1773,13 @@ checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasmi_arena" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +version = "0.4.0" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" [[package]] name = "wasmi_core" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "downcast-rs", "libm", @@ -1956,15 +1943,3 @@ dependencies = [ "quote", "syn 2.0.77", ] - -[[patch.unused]] -name = "soroban-env-common" -version = "21.2.2" - -[[patch.unused]] -name = "soroban-env-guest" -version = "21.2.2" - -[[patch.unused]] -name = "soroban-env-host" -version = "21.2.2" From cbdf45c1ad3994937edeebb149b7f3807c23c133 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:57:55 +1000 Subject: [PATCH 10/20] add test vector --- Cargo.lock | 8 + tests/deploy/Cargo.toml | 19 ++ tests/deploy/src/lib.rs | 38 +++ .../test_snapshots/test/test_deploy.1.json | 252 ++++++++++++++++++ 4 files changed, 317 insertions(+) create mode 100644 tests/deploy/Cargo.toml create mode 100644 tests/deploy/src/lib.rs create mode 100644 tests/deploy/test_snapshots/test/test_deploy.1.json diff --git a/Cargo.lock b/Cargo.lock index fe6606ed6..6a1c614bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1534,6 +1534,14 @@ dependencies = [ "soroban-sdk", ] +[[package]] +name = "test_deploy" +version = "22.0.0-rc.3" +dependencies = [ + "soroban-sdk", + "test_constructor", +] + [[package]] name = "test_empty" version = "22.0.0-rc.3" diff --git a/tests/deploy/Cargo.toml b/tests/deploy/Cargo.toml new file mode 100644 index 000000000..699f4778a --- /dev/null +++ b/tests/deploy/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "test_deploy" +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"} +test_constructor = {path = "../constructor"} + +[dev-dependencies] +soroban-sdk = {path = "../../soroban-sdk", features = ["testutils"]} diff --git a/tests/deploy/src/lib.rs b/tests/deploy/src/lib.rs new file mode 100644 index 000000000..49b715a87 --- /dev/null +++ b/tests/deploy/src/lib.rs @@ -0,0 +1,38 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, BytesN, Env}; + +mod deployable { + soroban_sdk::contractimport!( + file = "../../target/wasm32-unknown-unknown/release/test_constructor.wasm" + ); +} + +#[contract] +pub struct Contract; + +#[contractimpl] +impl Contract { + pub fn deploy(env: &Env) { + let hash = env.deployer().upload_contract_wasm(deployable::WASM); + env.deployer() + .with_current_contract(BytesN::from_array(env, &[0; 32])) + .deploy_v2(hash, deployable::Args::__constructor(&1, &2)); + // .deploy_v2(hash, (1u32, 2u64)); + } +} + +#[cfg(test)] +mod test { + use soroban_sdk::Env; + + use crate::{Contract, ContractClient}; + + #[test] + fn test_deploy() { + let e = Env::default(); + let contract_id = e.register(Contract, ()); + let client = ContractClient::new(&e, &contract_id); + + client.deploy(); + } +} diff --git a/tests/deploy/test_snapshots/test/test_deploy.1.json b/tests/deploy/test_snapshots/test/test_deploy.1.json new file mode 100644 index 000000000..3f08054f2 --- /dev/null +++ b/tests/deploy/test_snapshots/test/test_deploy.1.json @@ -0,0 +1,252 @@ +{ + "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_data": { + "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", + "key": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 1 + } + ] + }, + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", + "key": { + "vec": [ + { + "symbol": "Persistent" + }, + { + "u32": 1 + } + ] + }, + "durability": "persistent", + "val": { + "i64": 2 + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_data": { + "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", + "key": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 2 + } + ] + }, + "durability": "temporary" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", + "key": { + "vec": [ + { + "symbol": "Temp" + }, + { + "u32": 2 + } + ] + }, + "durability": "temporary", + "val": { + "i64": 4 + } + } + }, + "ext": "v0" + }, + 15 + ] + ], + [ + { + "contract_data": { + "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", + "key": "ledger_key_contract_instance", + "durability": "persistent" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "81b9295b1200c352b05ca3614256d595a4b221361c560f4b0610cbf0e8931cc2" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Instance" + }, + { + "u32": 3 + } + ] + }, + "val": { + "i64": 6 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "81b9295b1200c352b05ca3614256d595a4b221361c560f4b0610cbf0e8931cc2" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": { + "v1": { + "ext": "v0", + "cost_inputs": { + "ext": "v0", + "n_instructions": 733, + "n_functions": 15, + "n_globals": 3, + "n_table_entries": 0, + "n_types": 12, + "n_data_segments": 1, + "n_elem_segments": 0, + "n_imports": 10, + "n_exports": 6, + "n_data_segment_bytes": 48 + } + } + }, + "hash": "81b9295b1200c352b05ca3614256d595a4b221361c560f4b0610cbf0e8931cc2", + "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020176013100020176016700020162016a0002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841088808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010878080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410868080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d6574617630000000000000001600000000007b0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003a32322e302e302d72632e3323643136376565303636393930313031333835623664393164353564623263383332383837313163652d64697274790000" + } + }, + "ext": "v0" + }, + 4095 + ] + ], + [ + { + "contract_code": { + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + }, + [ + { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + 4095 + ] + ] + ] + }, + "events": [] +} \ No newline at end of file From 4885cbea4275532a59116bd5b053aa5e0c3f59a0 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 31 Oct 2024 10:58:07 +1000 Subject: [PATCH 11/20] remove commented code --- tests/deploy/src/lib.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/deploy/src/lib.rs b/tests/deploy/src/lib.rs index 49b715a87..9da3f8b4b 100644 --- a/tests/deploy/src/lib.rs +++ b/tests/deploy/src/lib.rs @@ -17,7 +17,6 @@ impl Contract { env.deployer() .with_current_contract(BytesN::from_array(env, &[0; 32])) .deploy_v2(hash, deployable::Args::__constructor(&1, &2)); - // .deploy_v2(hash, (1u32, 2u64)); } } From f4c6ea8cc237b7b634940f935e61b9ee7667b2c8 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:03:17 +1000 Subject: [PATCH 12/20] modify docs --- soroban-sdk/src/env.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 21167c62b..39ae10259 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -582,7 +582,10 @@ impl Env { /// 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. + /// Pass the arguments for the contract's constructor, or `()` if none. For + /// contracts with a constructor, use the contract's generated `Args` type + /// to construct the arguments with the appropropriate types for invoking + /// the constructor during registration. /// /// Returns the address of the registered contract that is the same as the /// contract id passed in. @@ -610,7 +613,7 @@ impl Env { /// # } /// # fn main() { /// let env = Env::default(); - /// let contract_id = env.register(Contract, (123_u32,)); + /// let contract_id = env.register(Contract, ContractArgs::_constructor(&123,)); /// } /// ``` /// Register a contract wasm, by specifying the wasm bytes: From 5e13f9fe4d78d83be768ebf7c5c9dee294e7d6b0 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Thu, 31 Oct 2024 11:04:36 +1000 Subject: [PATCH 13/20] fix --- soroban-sdk/src/env.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soroban-sdk/src/env.rs b/soroban-sdk/src/env.rs index 39ae10259..8fd002ba4 100644 --- a/soroban-sdk/src/env.rs +++ b/soroban-sdk/src/env.rs @@ -613,7 +613,7 @@ impl Env { /// # } /// # fn main() { /// let env = Env::default(); - /// let contract_id = env.register(Contract, ContractArgs::_constructor(&123,)); + /// let contract_id = env.register(Contract, ContractArgs::__constructor(&123,)); /// } /// ``` /// Register a contract wasm, by specifying the wasm bytes: From 4b7d278b0140db541a281fbec6c5afdaab2ee552 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 06:37:22 +1000 Subject: [PATCH 14/20] deps --- Cargo.lock | 5 +++++ Cargo.toml | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6a1c614bd..83cc2dac3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1202,6 +1202,7 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0-rc.3" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "itertools", "proc-macro2", @@ -1212,6 +1213,7 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0-rc.3" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "arbitrary", "crate-git-revision", @@ -1229,6 +1231,7 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "22.0.0-rc.3" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "soroban-env-common", "static_assertions", @@ -1237,6 +1240,7 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0-rc.3" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1271,6 +1275,7 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0-rc.3" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "itertools", "proc-macro2", diff --git a/Cargo.toml b/Cargo.toml index 0a16670f2..3ce474a28 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,18 +25,18 @@ soroban-token-sdk = { version = "22.0.0-rc.3", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "=22.0.0-rc.3" -#git = "https://github.com/stellar/rs-soroban-env" -#rev = "8911531dfb9a4331bc308ff8934c2223bc4e81ed" +git = "https://github.com/stellar/rs-soroban-env" +rev = "bd0c80a1fe171e75f8d745f17975a73927d44ecd" [workspace.dependencies.soroban-env-guest] version = "=22.0.0-rc.3" -#git = "https://github.com/stellar/rs-soroban-env" -#rev = "8911531dfb9a4331bc308ff8934c2223bc4e81ed" +git = "https://github.com/stellar/rs-soroban-env" +rev = "bd0c80a1fe171e75f8d745f17975a73927d44ecd" [workspace.dependencies.soroban-env-host] version = "=22.0.0-rc.3" -#git = "https://github.com/stellar/rs-soroban-env" -#rev = "8911531dfb9a4331bc308ff8934c2223bc4e81ed" +git = "https://github.com/stellar/rs-soroban-env" +rev = "bd0c80a1fe171e75f8d745f17975a73927d44ecd" [workspace.dependencies.stellar-strkey] version = "=0.0.9" @@ -48,10 +48,10 @@ features = ["curr"] #git = "https://github.com/stellar/rs-stellar-xdr" #rev = "67be5955a15f1d3a4df83fe86e6ae107f687141b" -[patch.crates-io] -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" } +#[patch.crates-io] +#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" } #[patch."https://github.com/stellar/rs-stellar-xdr"] #stellar-xdr = { path = "../rs-stellar-xdr/" } From 846c87b399a734bdac5b33b409f074600d8ca490 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 06:40:43 +1000 Subject: [PATCH 15/20] update fuzz cargo lock --- tests/fuzz/fuzz/Cargo.lock | 26 +++++++++----------------- 1 file changed, 9 insertions(+), 17 deletions(-) diff --git a/tests/fuzz/fuzz/Cargo.lock b/tests/fuzz/fuzz/Cargo.lock index dd7cef164..bbfdd3d0b 100644 --- a/tests/fuzz/fuzz/Cargo.lock +++ b/tests/fuzz/fuzz/Cargo.lock @@ -1038,8 +1038,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "soroban-builtin-sdk-macros" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c45d2492cd44f05cc79eeb857985f153f12a4423ce51b4b746b5925024c473b1" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "itertools", "proc-macro2", @@ -1050,8 +1049,7 @@ dependencies = [ [[package]] name = "soroban-env-common" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b6d2ec8955243394278e1fae88be3b367fcfed9cf74e5044799a90786a8642" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "arbitrary", "crate-git-revision", @@ -1069,8 +1067,7 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4002fc582cd20cc9b9fbb73959bc5d6b5b15feda11485cbfab0c28e78ecbab3e" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "soroban-env-common", "static_assertions", @@ -1079,8 +1076,7 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cb9be0260d39a648db0d33e1c6f8f494ec0c4f5be2b8a0a4e15ed4b7c6a92b0" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "ark-bls12-381", "ark-ec", @@ -1115,8 +1111,7 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "22.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a328297a568ae98999fdb06902e3362dfd8a2bfa9abea40beaeb7dc93a402fe7" +source = "git+https://github.com/stellar/rs-soroban-env?rev=bd0c80a1fe171e75f8d745f17975a73927d44ecd#bd0c80a1fe171e75f8d745f17975a73927d44ecd" dependencies = [ "itertools", "proc-macro2", @@ -1203,8 +1198,7 @@ dependencies = [ [[package]] name = "soroban-wasmi" version = "0.31.1-soroban.20.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "smallvec", "spin", @@ -1439,15 +1433,13 @@ checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasmi_arena" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" +version = "0.4.0" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" [[package]] name = "wasmi_core" version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +source = "git+https://github.com/stellar/wasmi?rev=0ed3f3dee30dc41ebe21972399e0a73a41944aa0#0ed3f3dee30dc41ebe21972399e0a73a41944aa0" dependencies = [ "downcast-rs", "libm", From 6d5c69674826b310ac5f267e4663f4b85917048c Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 07:04:08 +1000 Subject: [PATCH 16/20] upd test snapshots --- tests/deploy/test_snapshots/test/test_deploy.1.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/deploy/test_snapshots/test/test_deploy.1.json b/tests/deploy/test_snapshots/test/test_deploy.1.json index 3f08054f2..1bc085091 100644 --- a/tests/deploy/test_snapshots/test/test_deploy.1.json +++ b/tests/deploy/test_snapshots/test/test_deploy.1.json @@ -159,7 +159,7 @@ "val": { "contract_instance": { "executable": { - "wasm": "81b9295b1200c352b05ca3614256d595a4b221361c560f4b0610cbf0e8931cc2" + "wasm": "3acbc8c39aab068820a98a0703966e28e437d7b03119bd372ab462bebd1861a7" }, "storage": [ { @@ -190,7 +190,7 @@ [ { "contract_code": { - "hash": "81b9295b1200c352b05ca3614256d595a4b221361c560f4b0610cbf0e8931cc2" + "hash": "3acbc8c39aab068820a98a0703966e28e437d7b03119bd372ab462bebd1861a7" } }, [ @@ -216,8 +216,8 @@ } } }, - "hash": "81b9295b1200c352b05ca3614256d595a4b221361c560f4b0610cbf0e8931cc2", - "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020176013100020176016700020162016a0002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841088808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010878080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410868080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d6574617630000000000000001600000000007b0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003a32322e302e302d72632e3323643136376565303636393930313031333835623664393164353564623263383332383837313163652d64697274790000" + "hash": "3acbc8c39aab068820a98a0703966e28e437d7b03119bd372ab462bebd1861a7", + "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020162016a0002017601310002017601670002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841086808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010888080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410878080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d657461763000000000000000160000000000730e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003432322e302e302d72632e332338343663383762333939613733346264616335623333623430396630373436303064386361343930" } }, "ext": "v0" From c621381cbd971eee4109866605537be9b298927c Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 12:55:19 +1000 Subject: [PATCH 17/20] fix --- tests/deploy/test_snapshots/test/test_deploy.1.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/deploy/test_snapshots/test/test_deploy.1.json b/tests/deploy/test_snapshots/test/test_deploy.1.json index 1bc085091..3adfa6202 100644 --- a/tests/deploy/test_snapshots/test/test_deploy.1.json +++ b/tests/deploy/test_snapshots/test/test_deploy.1.json @@ -159,7 +159,7 @@ "val": { "contract_instance": { "executable": { - "wasm": "3acbc8c39aab068820a98a0703966e28e437d7b03119bd372ab462bebd1861a7" + "wasm": "26354a7b274da95f3d05568285a3c1e850a5b0c1330977e3f20a793b41e6872d" }, "storage": [ { @@ -190,7 +190,7 @@ [ { "contract_code": { - "hash": "3acbc8c39aab068820a98a0703966e28e437d7b03119bd372ab462bebd1861a7" + "hash": "26354a7b274da95f3d05568285a3c1e850a5b0c1330977e3f20a793b41e6872d" } }, [ @@ -216,8 +216,8 @@ } } }, - "hash": "3acbc8c39aab068820a98a0703966e28e437d7b03119bd372ab462bebd1861a7", - "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020162016a0002017601310002017601670002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841086808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010888080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410878080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d657461763000000000000000160000000000730e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003432322e302e302d72632e332338343663383762333939613733346264616335623333623430396630373436303064386361343930" + "hash": "26354a7b274da95f3d05568285a3c1e850a5b0c1330977e3f20a793b41e6872d", + "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020162016a0002017601310002017601670002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841086808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010888080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410878080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d657461763000000000000000160000000000730e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003432322e302e302d72632e332336643563363936373438323662333130616335663236376534363633663462383539313730343863" } }, "ext": "v0" From d6560af59b0c3c05fd65ee5d3ab982e39b17465f Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 14:38:56 +1000 Subject: [PATCH 18/20] fix --- tests/deploy/test_snapshots/test/test_deploy.1.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/deploy/test_snapshots/test/test_deploy.1.json b/tests/deploy/test_snapshots/test/test_deploy.1.json index 3adfa6202..cc013772e 100644 --- a/tests/deploy/test_snapshots/test/test_deploy.1.json +++ b/tests/deploy/test_snapshots/test/test_deploy.1.json @@ -159,7 +159,7 @@ "val": { "contract_instance": { "executable": { - "wasm": "26354a7b274da95f3d05568285a3c1e850a5b0c1330977e3f20a793b41e6872d" + "wasm": "a2def15909f3e9f05163a263f2a6008aefafc7a910e23a485c3efc9fbf7cba13" }, "storage": [ { @@ -190,7 +190,7 @@ [ { "contract_code": { - "hash": "26354a7b274da95f3d05568285a3c1e850a5b0c1330977e3f20a793b41e6872d" + "hash": "a2def15909f3e9f05163a263f2a6008aefafc7a910e23a485c3efc9fbf7cba13" } }, [ @@ -216,8 +216,8 @@ } } }, - "hash": "26354a7b274da95f3d05568285a3c1e850a5b0c1330977e3f20a793b41e6872d", - "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020162016a0002017601310002017601670002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841086808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010888080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410878080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d657461763000000000000000160000000000730e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003432322e302e302d72632e332336643563363936373438323662333130616335663236376534363633663462383539313730343863" + "hash": "a2def15909f3e9f05163a263f2a6008aefafc7a910e23a485c3efc9fbf7cba13", + "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020162016a0002017601310002017601670002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841086808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010888080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410878080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d657461763000000000000000160000000000730e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003432322e302e302d72632e332363363231333831636264393731656565343130393836363630353533376265396232393839323763" } }, "ext": "v0" From 7a6c71844c7ba726b5f3360a98952fb54abcac89 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:22:33 +1000 Subject: [PATCH 19/20] remove deploy test vector --- tests/deploy/Cargo.toml | 19 -- tests/deploy/src/lib.rs | 37 --- .../test_snapshots/test/test_deploy.1.json | 252 ------------------ 3 files changed, 308 deletions(-) delete mode 100644 tests/deploy/Cargo.toml delete mode 100644 tests/deploy/src/lib.rs delete mode 100644 tests/deploy/test_snapshots/test/test_deploy.1.json diff --git a/tests/deploy/Cargo.toml b/tests/deploy/Cargo.toml deleted file mode 100644 index 699f4778a..000000000 --- a/tests/deploy/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "test_deploy" -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"} -test_constructor = {path = "../constructor"} - -[dev-dependencies] -soroban-sdk = {path = "../../soroban-sdk", features = ["testutils"]} diff --git a/tests/deploy/src/lib.rs b/tests/deploy/src/lib.rs deleted file mode 100644 index 9da3f8b4b..000000000 --- a/tests/deploy/src/lib.rs +++ /dev/null @@ -1,37 +0,0 @@ -#![no_std] -use soroban_sdk::{contract, contractimpl, BytesN, Env}; - -mod deployable { - soroban_sdk::contractimport!( - file = "../../target/wasm32-unknown-unknown/release/test_constructor.wasm" - ); -} - -#[contract] -pub struct Contract; - -#[contractimpl] -impl Contract { - pub fn deploy(env: &Env) { - let hash = env.deployer().upload_contract_wasm(deployable::WASM); - env.deployer() - .with_current_contract(BytesN::from_array(env, &[0; 32])) - .deploy_v2(hash, deployable::Args::__constructor(&1, &2)); - } -} - -#[cfg(test)] -mod test { - use soroban_sdk::Env; - - use crate::{Contract, ContractClient}; - - #[test] - fn test_deploy() { - let e = Env::default(); - let contract_id = e.register(Contract, ()); - let client = ContractClient::new(&e, &contract_id); - - client.deploy(); - } -} diff --git a/tests/deploy/test_snapshots/test/test_deploy.1.json b/tests/deploy/test_snapshots/test/test_deploy.1.json deleted file mode 100644 index cc013772e..000000000 --- a/tests/deploy/test_snapshots/test/test_deploy.1.json +++ /dev/null @@ -1,252 +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": "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": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", - "key": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 1 - } - ] - }, - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", - "key": { - "vec": [ - { - "symbol": "Persistent" - }, - { - "u32": 1 - } - ] - }, - "durability": "persistent", - "val": { - "i64": 2 - } - } - }, - "ext": "v0" - }, - 4095 - ] - ], - [ - { - "contract_data": { - "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", - "key": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 2 - } - ] - }, - "durability": "temporary" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", - "key": { - "vec": [ - { - "symbol": "Temp" - }, - { - "u32": 2 - } - ] - }, - "durability": "temporary", - "val": { - "i64": 4 - } - } - }, - "ext": "v0" - }, - 15 - ] - ], - [ - { - "contract_data": { - "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CBKMUZNFQIAL775XBB2W2GP5CNHBM5YGH6C3XB7AY6SUVO2IBU3VYK2V", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "a2def15909f3e9f05163a263f2a6008aefafc7a910e23a485c3efc9fbf7cba13" - }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Instance" - }, - { - "u32": 3 - } - ] - }, - "val": { - "i64": 6 - } - } - ] - } - } - } - }, - "ext": "v0" - }, - 4095 - ] - ], - [ - { - "contract_code": { - "hash": "a2def15909f3e9f05163a263f2a6008aefafc7a910e23a485c3efc9fbf7cba13" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": { - "v1": { - "ext": "v0", - "cost_inputs": { - "ext": "v0", - "n_instructions": 733, - "n_functions": 15, - "n_globals": 3, - "n_table_entries": 0, - "n_types": 12, - "n_data_segments": 1, - "n_elem_segments": 0, - "n_imports": 10, - "n_exports": 6, - "n_data_segment_bytes": 48 - } - } - }, - "hash": "a2def15909f3e9f05163a263f2a6008aefafc7a910e23a485c3efc9fbf7cba13", - "code": "0061736d0100000001470c60017e017e60037e7e7e017e60027e7e017e60027f7e0060047f7f7e7e0060027f7f017e60037f7e7e0060000060027f7f0060027f7f017f60027e7e017f60057f7e7e7e7e00023d0a016901320000016901310000016c015f00010176013300000162016d0001016c013100020162016a0002017601310002017601670002016c0130000203100f03000405050602070008090a07070b05030100110619037f01418080c0000b7f0041b080c0000b7f0041b080c0000b074406066d656d6f727902000d5f5f636f6e7374727563746f720010086765745f646174610012015f00170a5f5f646174615f656e6403010b5f5f686561705f6261736503020a910d0f5d02017f017e024002402001a741ff0171220241c100460d00024020024107460d00420121034283908080800121010c020b20014208872101420021030c010b42002103200110808080800021010b20002001370308200020033703000b2f00024020004280808080808080407c4280808080808080807f540d0020004208864207840f0b20001081808080000b1d0020002001108d808080002002108b8080800020031082808080001a0b980102017f027e23808080800041106b22022480808080002001ad4220864204842103024002400240024020000e03000102000b418080c08000410a108e8080800021040c020b418a80c080004104108e8080800021040c010b418e80c080004108108e8080800021040b200220042003108f8080800002402002290300a7450d0000000b20022903082103200241106a24808080800020030bc60102017e047f0240200141094b0d00420021022001210320002104024003402003450d0141012105024020042d0000220641df00460d000240200641506a41ff0171410a490d000240200641bf7f6a41ff0171411a490d002006419f7f6a41ff017141194b0d05200641456a21050c020b2006414b6a21050c010b200641526a21050b20024206862005ad42ff01838421022003417f6a2103200441016a21040c000b0b2002420886420e840f0b2000ad4220864204842001ad4220864204841086808080000b4f01017f23808080800041106b2203248080808000200320023703082003200137030020002003ad42208642048442848080802010888080800037030820004200370300200341106a2480808080000bda0101027f23808080800041206b220224808080800002400240200042ff01834204520d00200241106a2001108a8080800020022802100d0041002000422088a72203200229031822014201108c8080800020004200530d012001428080808080808080c0007c4200530d014101200341017420014201864200108c808080002003ad42037e2200422088a70d01200220012001423f8742034200109880808000200229030820022903002201423f87520d0141022000a720014202108c80808000200241206a24808080800042020f0b00000b109180808000000b0900109680808000000bd50403017f017e017f2380808080004180016b22012480808080000240200042ff018342cb00520d00200010838080800021022001410036027820012000370370200120024220883e027c200141e0006a200141f0006a1093808080002001290360a70d00024020012903682200a741ff0171220341ca00460d002003410e470d010b024002400240024002402000419880c08000ad422086420484428480808030108480808000422088a70e03000102050b2001280278200128027c10948080800041014b0d04200141106a200141f0006a10938080800020012802100d042001290318220242ff01834204520d044202210041002002422088a7108d8080800022024201109580808000450d03200120024201108580808000108a808080002001290300a70d04200129030821000c020b2001280278200128027c10948080800041014b0d03200141306a200141f0006a10938080800020012802300d032001290338220242ff01834204520d034202210041012002422088a7108d8080800022024200109580808000450d02200141206a20024200108580808000108a808080002001290320a70d03200129032821000c010b2001280278200128027c10948080800041014b0d02200141d0006a200141f0006a10938080800020012802500d022001290358220242ff01834204520d024202210041022002422088a7108d8080800022024202109580808000450d01200141c0006a20024202108580808000108a808080002001290340a70d02200129034821000b2000108b8080800021000b20014180016a24808080800020000f0b00000b5302017f027e0240024020012802082202200128020c490d00420221030c010b20012903002002ad42208642048410878080800021042001200241016a360208420021030b20002004370308200020033703000b1900024020012000490d00200120006b0f0b109180808000000b0f00200020011089808080004201510b040000000b02000b6e01067e2000200342ffffffff0f832205200142ffffffff0f8322067e22072003422088220820067e22062005200142208822097e7c22054220867c220a3703002000200820097e2005200654ad4220862005422088847c200a200754ad7c200420017e200320027e7c7c3703080b0b390100418080c0000b3050657273697374656e7454656d70496e7374616e63650000000010000a0000000a001000040000000e00100008000000008f020e636f6e747261637473706563763000000002000000000000000000000007446174614b6579000000000300000001000000000000000a50657273697374656e740000000000010000000400000001000000000000000454656d700000000100000004000000010000000000000008496e7374616e6365000000010000000400000000000000000000000d5f5f636f6e7374727563746f72000000000000020000000000000008696e69745f6b657900000004000000000000000a696e69745f76616c7565000000000007000000000000000000000000000000086765745f646174610000000100000000000000036b657900000007d000000007446174614b65790000000001000003e800000007001e11636f6e7472616374656e766d657461763000000000000000160000000000730e636f6e74726163746d65746176300000000000000005727376657200000000000006312e38312e3000000000000000000008727373646b7665720000003432322e302e302d72632e332363363231333831636264393731656565343130393836363630353533376265396232393839323763" - } - }, - "ext": "v0" - }, - 4095 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" - }, - 4095 - ] - ] - ] - }, - "events": [] -} \ No newline at end of file From 5a5a9af6f8584023b47b70088d6fc0620df45d18 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Fri, 1 Nov 2024 21:24:00 +1000 Subject: [PATCH 20/20] fix --- Cargo.lock | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 83cc2dac3..abc19d659 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1539,14 +1539,6 @@ dependencies = [ "soroban-sdk", ] -[[package]] -name = "test_deploy" -version = "22.0.0-rc.3" -dependencies = [ - "soroban-sdk", - "test_constructor", -] - [[package]] name = "test_empty" version = "22.0.0-rc.3"