From 1adae311c442ac1bdc7b65b62f264f37c3a63c0d Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Wed, 26 Nov 2025 16:03:42 -0300 Subject: [PATCH 1/5] refactor: simpler e2e runtime tests style --- Cargo.toml | 2 +- crates/e2e/macro/src/config.rs | 167 ++++++++++++++++-- crates/e2e/macro/src/ir.rs | 6 +- crates/e2e/macro/src/lib.rs | 16 +- crates/runtime/src/client.rs | 2 +- .../internal/e2e-runtime-only-backend/lib.rs | 19 +- .../public/assets-precompile/lib.rs | 53 ++---- .../public/contract-transfer/lib.rs | 7 +- integration-tests/public/fuzz-testing/lib.rs | 17 +- .../custom-runtime/src/lib.rs | 4 +- .../public/runtime-call-contract/e2e_tests.rs | 7 +- 11 files changed, 195 insertions(+), 105 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2c6d8db1332..45eb927c5d6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -81,7 +81,7 @@ tracing-subscriber = { version = "0.3.20" } trybuild = { version = "1.0.110" } which = { version = "8.0.0" } xxhash-rust = { version = "0.8" } -const_env = { version = "0.1" } +const_env = { version = "0.1.4" } const-hex = { version = "1.17.0", default-features = false } # Substrate dependencies diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index 97dbea96f95..dc2fca0e392 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -12,6 +12,17 @@ // See the License for the specific language governing permissions and // limitations under the License. +use darling::{ + FromMeta, + ast::NestedMeta, +}; +use proc_macro2::TokenStream as TokenStream2; +use syn::{ + Meta, + punctuated::Punctuated, + spanned::Spanned, +}; + /// The type of the architecture that should be used to run test. #[derive(Clone, Eq, PartialEq, Debug, darling::FromMeta)] #[darling(rename_all = "snake_case")] @@ -129,25 +140,123 @@ impl E2EConfig { pub fn replace_test_attr(&self) -> Option { self.replace_test_attr.clone() } + + /// Parses the attribute arguments passed to `ink_e2e::test`. + pub fn from_attr_tokens(attr: TokenStream2) -> Result { + let nested_meta = NestedMeta::parse_meta_list(attr)?; + Self::from_nested_meta(nested_meta) + } + + /// Builds the configuration from already parsed meta items. + pub fn from_nested_meta(nested_meta: Vec) -> Result { + let normalized = normalize_runtime_meta(nested_meta)?; + Self::from_list(&normalized).map_err(syn::Error::from) + } +} + +fn normalize_runtime_meta( + nested_meta: Vec, +) -> Result, syn::Error> { + let mut args = Vec::with_capacity(nested_meta.len()); + let mut runtime = None; + + for meta in nested_meta { + if let Some(found) = RuntimeBackendArg::from_nested_meta(&meta)? { + if runtime.replace(found).is_some() { + return Err(syn::Error::new( + meta.span(), + "only a single `runtime` attribute is allowed", + )); + } + continue; + } + args.push(meta); + } + + if let Some(runtime) = runtime { + args.push(runtime.into_backend_meta()); + } + + Ok(args) +} + +struct RuntimeBackendArg { + runtime: Option, +} + +impl RuntimeBackendArg { + fn from_nested_meta(meta: &NestedMeta) -> Result, syn::Error> { + let meta = match meta { + NestedMeta::Meta(meta) if meta.path().is_ident("runtime") => meta, + _ => return Ok(None), + }; + + match meta { + Meta::Path(_) => Ok(Some(Self { runtime: None })), + Meta::List(list) => { + let nested: Punctuated = + list.parse_args_with(Punctuated::parse_terminated)?; + if nested.len() != 1 { + return Err(syn::Error::new( + list.span(), + "`runtime` expects zero or one runtime type", + )); + } + match nested.first().unwrap() { + NestedMeta::Meta(Meta::Path(path)) => { + Ok(Some(Self { + runtime: Some(path.clone()), + })) + } + other => { + Err(syn::Error::new( + other.span(), + "`runtime` expects a runtime type path", + )) + } + } + } + Meta::NameValue(name_value) => { + Err(syn::Error::new( + name_value.span(), + "`runtime` does not support name-value pairs", + )) + } + } + } + + fn runtime(&self) -> syn::Path { + self.runtime + .clone() + .unwrap_or_else(|| syn::parse_quote! { ::ink_runtime::DefaultRuntime }) + } + + fn into_backend_meta(self) -> NestedMeta { + let runtime = self.runtime(); + syn::parse_quote! { + backend(runtime_only(sandbox = #runtime, client = ::ink_runtime::RuntimeClient)) + } + } } #[cfg(test)] mod tests { use super::*; - use darling::{ - FromMeta, - ast::NestedMeta, - }; + use darling::ast::NestedMeta; use quote::quote; + fn parse_config(input: TokenStream2) -> E2EConfig { + let nested = NestedMeta::parse_meta_list(input).unwrap(); + E2EConfig::from_nested_meta(nested).unwrap() + } + #[test] fn config_works_backend_runtime_only() { let input = quote! { environment = crate::CustomEnvironment, backend(runtime_only(sandbox = ::ink_runtime::DefaultRuntime, client = ::ink_runtime::RuntimeClient)), }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); assert_eq!( config.environment(), @@ -169,8 +278,7 @@ mod tests { let input = quote! { backend(runtime_only(default)), }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); assert_eq!( config.backend(), @@ -186,8 +294,7 @@ mod tests { let input = quote! { backend(runtime_only(sandbox = ::ink_runtime::DefaultRuntime, client = ::ink_runtime::RuntimeClient)), }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); assert_eq!( config.backend(), @@ -198,13 +305,40 @@ mod tests { ); } + #[test] + fn runtime_keyword_defaults() { + let input = quote! { runtime }; + let config = parse_config(input); + + assert_eq!( + config.backend(), + Backend::RuntimeOnly(RuntimeOnly { + sandbox: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, + client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, + }) + ); + } + + #[test] + fn runtime_keyword_custom_runtime() { + let input = quote! { runtime(crate::CustomRuntime) }; + let config = parse_config(input); + + assert_eq!( + config.backend(), + Backend::RuntimeOnly(RuntimeOnly { + sandbox: syn::parse_quote! { crate::CustomRuntime }, + client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, + }) + ); + } + #[test] fn config_works_backend_node() { let input = quote! { backend(node), }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); assert_eq!(config.backend(), Backend::Node(Node::Auto)); @@ -236,8 +370,7 @@ mod tests { let input = quote! { backend(node(auto)), }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); assert_eq!(config.backend(), Backend::Node(Node::Auto)); } @@ -247,8 +380,7 @@ mod tests { let input = quote! { backend(node(url = "ws://0.0.0.0:9999")), }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); match config.backend() { Backend::Node(node_config) => { @@ -277,8 +409,7 @@ mod tests { let input = quote! { replace_test_attr = "#[quickcheck]" }; - let config = - E2EConfig::from_list(&NestedMeta::parse_meta_list(input).unwrap()).unwrap(); + let config = parse_config(input); assert_eq!(config.replace_test_attr(), Some("#[quickcheck]".to_owned())); } diff --git a/crates/e2e/macro/src/ir.rs b/crates/e2e/macro/src/ir.rs index 7cbc623e08b..0b92ec9a2c0 100644 --- a/crates/e2e/macro/src/ir.rs +++ b/crates/e2e/macro/src/ir.rs @@ -13,10 +13,6 @@ // limitations under the License. use crate::config::E2EConfig; -use darling::{ - FromMeta, - ast::NestedMeta, -}; use proc_macro2::TokenStream as TokenStream2; /// The End-to-End test with all required information. @@ -38,7 +34,7 @@ impl InkE2ETest { /// Returns `Ok` if the test matches all requirements for an /// ink! E2E test definition. pub fn new(attrs: TokenStream2, input: TokenStream2) -> Result { - let e2e_config = E2EConfig::from_list(&NestedMeta::parse_meta_list(attrs)?)?; + let e2e_config = E2EConfig::from_attr_tokens(attrs)?; let item_fn = syn::parse2::(input)?; let e2e_fn = E2EFn::from(item_fn); Ok(Self { diff --git a/crates/e2e/macro/src/lib.rs b/crates/e2e/macro/src/lib.rs index 2d26d7ac2d6..7f65bc2a64a 100644 --- a/crates/e2e/macro/src/lib.rs +++ b/crates/e2e/macro/src/lib.rs @@ -60,12 +60,15 @@ use syn::Result; /// ``` /// type E2EResult = std::result::Result>; /// -/// #[ink_runtime::test(backend(runtime_only(sandbox = ink_runtime::DefaultRuntime, client = ink_runtime::RuntimeClient)))] -/// async fn runtime_call_works() -> E2EResult<()> { +/// #[ink_e2e::test(runtime)] +/// async fn runtime_call_works(mut client: Client) -> E2EResult<()> { /// // ... /// } /// ``` /// +/// This defaults to `ink_runtime::DefaultRuntime` together with the built-in +/// `ink_runtime::RuntimeClient`. +/// /// In this configuration the test will not run against a node that is running in the /// background, but against an in-process slimmed down `pallet-revive` execution /// environment. @@ -74,6 +77,15 @@ use syn::Result; /// in our documentation for more details. /// For a full example [see here](https://github.com/use-ink/ink-examples/tree/v5.x.x/e2e-runtime-only-backend). /// +/// You can also provide a custom runtime: +/// +/// ``` +/// #[ink_e2e::test(runtime(crate::CustomRuntime))] +/// async fn runtime_call_works(mut client: Client) -> E2EResult<()> { +/// // ... +/// } +/// ``` +/// /// # Example /// /// ``` diff --git a/crates/runtime/src/client.rs b/crates/runtime/src/client.rs index 5133fef0d9b..62c5ba029b2 100644 --- a/crates/runtime/src/client.rs +++ b/crates/runtime/src/client.rs @@ -853,7 +853,7 @@ pub mod preset { /// with a mock network of relay chain and parachains. /// /// ```no_compile - /// #[ink_e2e::test(backend(runtime_only(sandbox = MockNetworkRuntime, client = ink_runtime::RuntimeClient)))] + /// #[ink_e2e::test(runtime(MockNetworkRuntime))] /// async fn my_test(mut client: Client) -> E2EResult<()> { /// // ... /// } diff --git a/integration-tests/internal/e2e-runtime-only-backend/lib.rs b/integration-tests/internal/e2e-runtime-only-backend/lib.rs index ace4d090515..5e89f22eb6e 100644 --- a/integration-tests/internal/e2e-runtime-only-backend/lib.rs +++ b/integration-tests/internal/e2e-runtime-only-backend/lib.rs @@ -56,11 +56,8 @@ pub mod flipper { /// - flip the flipper /// - get the flipper's value /// - assert that the value is `true` - #[ink_runtime::test(backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] - async fn it_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn it_works(mut client: Client) -> E2EResult<()> { // given const INITIAL_VALUE: bool = false; let mut constructor = FlipperRef::new(INITIAL_VALUE); @@ -98,10 +95,7 @@ pub mod flipper { /// - transfer some funds to the contract using runtime call /// - get the contract's balance again /// - assert that the contract's balance increased by the transferred amount - #[ink_runtime::test(backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] + #[ink_e2e::test(runtime)] async fn runtime_call_works() -> E2EResult<()> { // given let mut constructor = FlipperRef::new(false); @@ -155,11 +149,8 @@ pub mod flipper { } /// Just instantiate a contract using non-default runtime. - #[ink_runtime::test(backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] - async fn custom_runtime(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn custom_runtime(mut client: Client) -> E2EResult<()> { client .instantiate( "e2e-runtime-only-backend", diff --git a/integration-tests/public/assets-precompile/lib.rs b/integration-tests/public/assets-precompile/lib.rs index d752b32fcf6..54b8ab7457d 100644 --- a/integration-tests/public/assets-precompile/lib.rs +++ b/integration-tests/public/assets-precompile/lib.rs @@ -190,9 +190,7 @@ mod e2e_tests { bob, }; use ink_runtime::{ - DefaultRuntime, E2EError, - RuntimeClient, api::prelude::{ AssetsAPI, ContractAPI, @@ -204,11 +202,8 @@ mod e2e_tests { type E2EResult = std::result::Result; - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn deployment_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn deployment_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let mut constructor = AssetHubPrecompileRef::new(asset_id); @@ -229,11 +224,8 @@ mod e2e_tests { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn total_supply_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn total_supply_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let admin = alice(); @@ -259,11 +251,8 @@ mod e2e_tests { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn balance_of_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn balance_of_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let alice = alice(); let bob = bob(); @@ -299,11 +288,8 @@ mod e2e_tests { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn transfer_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn transfer_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let alice = alice(); let bob = bob(); @@ -363,11 +349,8 @@ mod e2e_tests { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn approve_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn approve_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let alice = alice(); let bob = bob(); @@ -418,11 +401,8 @@ mod e2e_tests { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn allowance_works(mut client: Client) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn allowance_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let alice = alice(); let bob = bob(); @@ -455,13 +435,8 @@ mod e2e_tests { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = DefaultRuntime, - client = RuntimeClient - )))] - async fn transfer_from_works( - mut client: Client, - ) -> E2EResult<()> { + #[ink_e2e::test(runtime)] + async fn transfer_from_works(mut client: Client) -> E2EResult<()> { let asset_id: u32 = 1; let alice = alice(); let bob = bob(); diff --git a/integration-tests/public/contract-transfer/lib.rs b/integration-tests/public/contract-transfer/lib.rs index f1ec51d1cdf..abce84a31bc 100644 --- a/integration-tests/public/contract-transfer/lib.rs +++ b/integration-tests/public/contract-transfer/lib.rs @@ -225,11 +225,8 @@ pub mod give_me { Ok(()) } - #[ink_runtime::test(backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] - async fn e2e_contract_must_transfer_value_to_sender( + #[ink_e2e::test(runtime)] + async fn e2e_contract_must_transfer_value_to_sender( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/fuzz-testing/lib.rs b/integration-tests/public/fuzz-testing/lib.rs index 655696d2c90..12d2ec523b0 100644 --- a/integration-tests/public/fuzz-testing/lib.rs +++ b/integration-tests/public/fuzz-testing/lib.rs @@ -42,15 +42,12 @@ pub mod fuzz_testing { use ink_e2e::ContractsBackend; use quickcheck_macros::quickcheck; - /// We use `backend(runtime_only)` here. It doesn't start a node for each test, + /// We use `#[ink_e2e::test(runtime)]` here. It doesn't start a node for each test, /// but instead interacts with a sandboxed `pallet-revive`. /// /// See /// for more details. - #[ink_runtime::test(replace_test_attr = "#[quickcheck]", backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] + #[ink_e2e::test(runtime, replace_test_attr = "#[quickcheck]")] async fn fuzzing_works_runtime(val: bool) -> bool { let mut constructor = FuzzTestingRef::new(val); let contract = client @@ -72,10 +69,7 @@ pub mod fuzz_testing { /// `CONTRACTS_NODE_URL`. But still, interactions with a real node will /// always be more heavy-weight than "just" interacting with a sandboxed /// `pallet-revive`. - #[ink_runtime::test(replace_test_attr = "#[quickcheck]", backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] + #[ink_e2e::test(runtime, replace_test_attr = "#[quickcheck]")] async fn fuzzing_works_node(val: bool) -> bool { let mut constructor = FuzzTestingRef::new(val); let contract = client @@ -105,10 +99,7 @@ pub mod fuzz_testing { } } - #[ink_runtime::test(replace_test_attr = "#[quickcheck]", backend(runtime_only( - sandbox = ink_runtime::DefaultRuntime, - client = ink_runtime::RuntimeClient - )))] + #[ink_e2e::test(runtime, replace_test_attr = "#[quickcheck]")] async fn fuzzing_custom_struct_works(val: Point) -> bool { ink_e2e::tracing::info!("fuzzing with value {val:?}"); diff --git a/integration-tests/public/runtime-call-contract/custom-runtime/src/lib.rs b/integration-tests/public/runtime-call-contract/custom-runtime/src/lib.rs index f730cd5928d..7e5eff32faa 100644 --- a/integration-tests/public/runtime-call-contract/custom-runtime/src/lib.rs +++ b/integration-tests/public/runtime-call-contract/custom-runtime/src/lib.rs @@ -4,8 +4,8 @@ #![cfg_attr(not(feature = "std"), no_std)] -ink_runtime::create_sandbox!(ContractCallerSandbox, ContractCallerSandboxRuntime, (), { +ink_runtime::create_runtime!(ContractCallerRuntime, ContractCallerRuntimeInner, (), { ContractCaller: pallet_revive_caller, }); -impl pallet_revive_caller::Config for ContractCallerSandboxRuntime {} +impl pallet_revive_caller::Config for ContractCallerRuntimeInner {} diff --git a/integration-tests/public/runtime-call-contract/e2e_tests.rs b/integration-tests/public/runtime-call-contract/e2e_tests.rs index c14e0a11813..4255363e7b1 100644 --- a/integration-tests/public/runtime-call-contract/e2e_tests.rs +++ b/integration-tests/public/runtime-call-contract/e2e_tests.rs @@ -7,11 +7,8 @@ use ink_e2e::{ type E2EResult = Result>; /// Just instantiate a contract using non-default runtime. -#[ink_runtime::test(backend(runtime_only( - sandbox = sandbox_runtime::ContractCallerSandbox, - client = ink_runtime::RuntimeClient -)))] -async fn instantiate_and_get(mut client: Client) -> E2EResult<()> { +#[ink_e2e::test(runtime(custom_runtime::ContractCallerRuntime))] +async fn instantiate_and_get(mut client: Client) -> E2EResult<()> { use flipper_traits::Flip; let initial_value = false; From eac34e7e4da4de909b12fa5ff77c63d91a06865c Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Wed, 26 Nov 2025 17:36:08 -0300 Subject: [PATCH 2/5] fix: fmt & external error change --- crates/e2e/macro/src/config.rs | 4 ++-- integration-tests/public/fuzz-testing/lib.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index dc2fca0e392..2266dd47054 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -273,7 +273,7 @@ mod tests { } #[test] - #[should_panic(expected = "ErrorUnknownField")] + #[should_panic(expected = "Unknown field")] fn config_backend_runtime_only_default_not_allowed() { let input = quote! { backend(runtime_only(default)), @@ -365,7 +365,7 @@ mod tests { } #[test] - #[should_panic(expected = "ErrorUnknownField")] + #[should_panic(expected = "Unknown field")] fn config_backend_node_auto_not_allowed() { let input = quote! { backend(node(auto)), diff --git a/integration-tests/public/fuzz-testing/lib.rs b/integration-tests/public/fuzz-testing/lib.rs index 12d2ec523b0..7334c2bd893 100644 --- a/integration-tests/public/fuzz-testing/lib.rs +++ b/integration-tests/public/fuzz-testing/lib.rs @@ -42,8 +42,8 @@ pub mod fuzz_testing { use ink_e2e::ContractsBackend; use quickcheck_macros::quickcheck; - /// We use `#[ink_e2e::test(runtime)]` here. It doesn't start a node for each test, - /// but instead interacts with a sandboxed `pallet-revive`. + /// We use `#[ink_e2e::test(runtime)]` here. It doesn't start a node for each + /// test, but instead interacts with a sandboxed `pallet-revive`. /// /// See /// for more details. From 5ccf13c88d3fe8069a725a9bb49db3cbe6641733 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Thu, 27 Nov 2025 12:28:34 -0300 Subject: [PATCH 3/5] refactor: remove left over sandbox usage --- ARCHITECTURE.md | 8 +- RELEASES_CHECKLIST.md | 8 +- crates/e2e/macro/src/config.rs | 22 +- crates/runtime/src/api/assets_api.rs | 98 +++---- crates/runtime/src/api/balance_api.rs | 10 +- crates/runtime/src/api/revive_api.rs | 36 +-- crates/runtime/src/api/system_api.rs | 62 ++--- crates/runtime/src/api/timestamp_api.rs | 10 +- crates/runtime/src/client.rs | 240 +++++++++--------- crates/runtime/src/macros.rs | 12 - .../public/assets-precompile/lib.rs | 54 ++-- .../public/debugging-strategies/lib.rs | 2 +- integration-tests/public/fuzz-testing/lib.rs | 4 +- .../sol-cross-contract/e2e_tests.rs | 40 +-- .../solidity-abi/sol-encoding/e2e_tests.rs | 36 +-- 15 files changed, 315 insertions(+), 327 deletions(-) diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md index 09b04784294..efc9b0d5c8b 100644 --- a/ARCHITECTURE.md +++ b/ARCHITECTURE.md @@ -60,11 +60,11 @@ ink! contracts are compiled to RISC-V bytecode for This is how ink! smart contracts are executed on a blockchain: they are uploaded to a blockchain that runs PolkaVM, PolkaVM then interprets them. -As contracts are executed in a sandbox execution environment on the +As contracts are executed in an isolated runtime environment on the blockchain itself we compile them to a `no_std` environment. More specifically they are executed by the [`pallet-revive`](https://github.com/paritytech/polkadot-sdk/tree/master/substrate/frame/revive), a module of the Polkadot SDK blockchain framework. This module takes ink! -smart contracts and runs them in a PolkaVM sandbox environment. +smart contracts and runs them in a PolkaVM execution environment. It also provides an API to smart contracts for anything a smart contract needs: storing + retrieving data, calling other contracts, sending value, fetching the block number, …. @@ -250,9 +250,9 @@ most smart-contract-specific events: `Called`, `ContractCodeUpdated, CodeStored` The `Instantiated` event was brought back in a later PR. (5) `pallet-revive` included `revm` as a non-optional dependency. As ink! has to -depend on `pallet-revive` for some features (e.g. sandboxed E2E testing), this +depend on `pallet-revive` for some features (e.g. runtime-only E2E testing), this results in over 75 more child dependencies having to be build now. This increased -build times for sandboxed E2E tests significantly. +build times for runtime-only E2E tests significantly. [We proposed](https://github.com/paritytech/polkadot-sdk/pull/9689) putting anything `revm` behind a feature flag, but Parity is not open to it. diff --git a/RELEASES_CHECKLIST.md b/RELEASES_CHECKLIST.md index b1e5d22bd48..4afd715585a 100644 --- a/RELEASES_CHECKLIST.md +++ b/RELEASES_CHECKLIST.md @@ -60,18 +60,18 @@ in the future. - Release `cargo-contract` crates. - Request update of `drink` client, which depends on the `cargo-contract` crates. - Release `ink_e2e`. -1. The `ink_sandbox` crate depends on a git commit of `polkadot-sdk`, hence it +1. The `ink_runtime` crate depends on a git commit of `polkadot-sdk`, hence it currently cannot be published to crates.io. 1. Do a dry run: ```bash fd Cargo.toml crates/ | \ grep -v e2e | \ - grep -v sandbox | \ + grep -v crates/runtime/ | \ xargs -n1 cargo no-dev-deps publish --allow-dirty --dry-run --manifest-path ``` - This command ignores the `e2e` and `sandbox` folder: The `e2e` crates depend on the `cargo-contract/contract-build` + This command ignores the `e2e` and `crates/runtime` folders: The `e2e` crates depend on the `cargo-contract/contract-build` crate, so if you want to publish those, you need to publish `cargo-contract/contract-build` first. - The `sandbox` is ignored, as it depends on some crates via their `git` ref. + The runtime emulator is ignored, as it depends on some crates via their `git` ref. It uses [`no-dev-deps`](https://crates.io/crates/cargo-no-dev-deps) for publishing, so that the `dev-dependencies` of ink! are ignored for publishing. They are not needed and due to a cycle it's also not possible to publish with them. diff --git a/crates/e2e/macro/src/config.rs b/crates/e2e/macro/src/config.rs index 2266dd47054..91ee38b5dd5 100644 --- a/crates/e2e/macro/src/config.rs +++ b/crates/e2e/macro/src/config.rs @@ -76,8 +76,8 @@ impl Node { /// The runtime emulator that should be used within `TestExternalities` #[derive(Clone, Eq, PartialEq, Debug, darling::FromMeta)] pub struct RuntimeOnly { - /// The sandbox runtime type (e.g., `ink_runtime::DefaultRuntime`) - pub sandbox: syn::Path, + /// The runtime type (e.g., `ink_runtime::DefaultRuntime`) + pub runtime: syn::Path, /// The client type implementing the backend traits (e.g., /// `ink_runtime::RuntimeClient`) pub client: syn::Path, @@ -85,7 +85,7 @@ pub struct RuntimeOnly { impl RuntimeOnly { pub fn runtime_path(&self) -> syn::Path { - self.sandbox.clone() + self.runtime.clone() } pub fn client_path(&self) -> syn::Path { self.client.clone() @@ -234,7 +234,7 @@ impl RuntimeBackendArg { fn into_backend_meta(self) -> NestedMeta { let runtime = self.runtime(); syn::parse_quote! { - backend(runtime_only(sandbox = #runtime, client = ::ink_runtime::RuntimeClient)) + backend(runtime_only(runtime = #runtime, client = ::ink_runtime::RuntimeClient)) } } } @@ -254,7 +254,7 @@ mod tests { fn config_works_backend_runtime_only() { let input = quote! { environment = crate::CustomEnvironment, - backend(runtime_only(sandbox = ::ink_runtime::DefaultRuntime, client = ::ink_runtime::RuntimeClient)), + backend(runtime_only(runtime = ::ink_runtime::DefaultRuntime, client = ::ink_runtime::RuntimeClient)), }; let config = parse_config(input); @@ -266,7 +266,7 @@ mod tests { assert_eq!( config.backend(), Backend::RuntimeOnly(RuntimeOnly { - sandbox: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, + runtime: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, }) ); @@ -283,7 +283,7 @@ mod tests { assert_eq!( config.backend(), Backend::RuntimeOnly(RuntimeOnly { - sandbox: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, + runtime: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, }) ); @@ -292,14 +292,14 @@ mod tests { #[test] fn config_works_runtime_only_with_custom_backend() { let input = quote! { - backend(runtime_only(sandbox = ::ink_runtime::DefaultRuntime, client = ::ink_runtime::RuntimeClient)), + backend(runtime_only(runtime = ::ink_runtime::DefaultRuntime, client = ::ink_runtime::RuntimeClient)), }; let config = parse_config(input); assert_eq!( config.backend(), Backend::RuntimeOnly(RuntimeOnly { - sandbox: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, + runtime: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, }) ); @@ -313,7 +313,7 @@ mod tests { assert_eq!( config.backend(), Backend::RuntimeOnly(RuntimeOnly { - sandbox: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, + runtime: syn::parse_quote! { ::ink_runtime::DefaultRuntime }, client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, }) ); @@ -327,7 +327,7 @@ mod tests { assert_eq!( config.backend(), Backend::RuntimeOnly(RuntimeOnly { - sandbox: syn::parse_quote! { crate::CustomRuntime }, + runtime: syn::parse_quote! { crate::CustomRuntime }, client: syn::parse_quote! { ::ink_runtime::RuntimeClient }, }) ); diff --git a/crates/runtime/src/api/assets_api.rs b/crates/runtime/src/api/assets_api.rs index cf63810dba4..3bb103e96eb 100644 --- a/crates/runtime/src/api/assets_api.rs +++ b/crates/runtime/src/api/assets_api.rs @@ -23,7 +23,7 @@ use frame_support::{ type AssetIdOf = >::AssetId; type AssetBalanceOf = >::Balance; -/// Assets API for the sandbox. +/// Assets API for the runtime. /// /// Provides methods to create, mint, and manage assets in `pallet-assets`. pub trait AssetsAPI @@ -327,52 +327,52 @@ mod tests { #[test] fn create_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; let min_balance = 1u128; - let result = sandbox.create(&asset_id, &admin, min_balance); + let result = runtime.create(&asset_id, &admin, min_balance); assert!(result.is_ok()); - assert!(sandbox.asset_exists(&asset_id)); + assert!(runtime.asset_exists(&asset_id)); } #[test] fn set_metadata_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); let name = b"Test Token".to_vec(); let symbol = b"TEST".to_vec(); let decimals = 18u8; - let result = sandbox.set_metadata(&asset_id, &admin, name, symbol, decimals); + let result = runtime.set_metadata(&asset_id, &admin, name, symbol, decimals); assert!(result.is_ok()); } #[test] fn metadata_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); let name = b"Test Token".to_vec(); let symbol = b"TEST".to_vec(); let decimals = 18u8; - sandbox + runtime .set_metadata(&asset_id, &admin, name.clone(), symbol.clone(), decimals) .unwrap(); let (retrieved_name, retrieved_symbol, retrieved_decimals) = - sandbox.metadata(&asset_id); + runtime.metadata(&asset_id); assert_eq!(retrieved_name, name); assert_eq!(retrieved_symbol, symbol); @@ -381,64 +381,64 @@ mod tests { #[test] fn approve_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let spender = ink_e2e::bob().into_account_id(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); - sandbox.mint_into(&asset_id, &admin, 1000u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); + runtime.mint_into(&asset_id, &admin, 1000u128).unwrap(); - let allowance_before = sandbox.allowance(&asset_id, &admin, &spender); + let allowance_before = runtime.allowance(&asset_id, &admin, &spender); assert_eq!(allowance_before, 0); - let result = sandbox.approve(&asset_id, &admin, &spender, 500u128); + let result = runtime.approve(&asset_id, &admin, &spender, 500u128); assert!(result.is_ok()); - let allowance_after = sandbox.allowance(&asset_id, &admin, &spender); + let allowance_after = runtime.allowance(&asset_id, &admin, &spender); assert_eq!(allowance_after, 500); } #[test] fn mint_into_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); - let balance_before = sandbox.balance_of(&asset_id, &admin); + let balance_before = runtime.balance_of(&asset_id, &admin); assert_eq!(balance_before, 0); - sandbox.mint_into(&asset_id, &admin, 100u128).unwrap(); + runtime.mint_into(&asset_id, &admin, 100u128).unwrap(); - let balance_after = sandbox.balance_of(&asset_id, &admin); + let balance_after = runtime.balance_of(&asset_id, &admin); assert_eq!(balance_after, 100); } #[test] fn transfer_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let recipient = ink_e2e::bob().into_account_id(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); - sandbox.mint_into(&asset_id, &admin, 1000u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); + runtime.mint_into(&asset_id, &admin, 1000u128).unwrap(); - let admin_balance_before = sandbox.balance_of(&asset_id, &admin); - let recipient_balance_before = sandbox.balance_of(&asset_id, &recipient); + let admin_balance_before = runtime.balance_of(&asset_id, &admin); + let recipient_balance_before = runtime.balance_of(&asset_id, &recipient); assert_eq!(admin_balance_before, 1000); assert_eq!(recipient_balance_before, 0); - let result = sandbox.transfer(&asset_id, &admin, &recipient, 300u128); + let result = runtime.transfer(&asset_id, &admin, &recipient, 300u128); assert!(result.is_ok()); - let admin_balance_after = sandbox.balance_of(&asset_id, &admin); - let recipient_balance_after = sandbox.balance_of(&asset_id, &recipient); + let admin_balance_after = runtime.balance_of(&asset_id, &admin); + let recipient_balance_after = runtime.balance_of(&asset_id, &recipient); assert_eq!(admin_balance_after, 700); assert_eq!(recipient_balance_after, 300); @@ -446,68 +446,68 @@ mod tests { #[test] fn balance_of_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); - let balance = sandbox.balance_of(&asset_id, &admin); + let balance = runtime.balance_of(&asset_id, &admin); assert_eq!(balance, 0); - sandbox.mint_into(&asset_id, &admin, 500u128).unwrap(); + runtime.mint_into(&asset_id, &admin, 500u128).unwrap(); - let balance = sandbox.balance_of(&asset_id, &admin); + let balance = runtime.balance_of(&asset_id, &admin); assert_eq!(balance, 500); } #[test] fn total_supply_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); - let supply_before = sandbox.total_supply(&asset_id); + let supply_before = runtime.total_supply(&asset_id); assert_eq!(supply_before, 0); - sandbox.mint_into(&asset_id, &admin, 1000u128).unwrap(); + runtime.mint_into(&asset_id, &admin, 1000u128).unwrap(); - let supply_after = sandbox.total_supply(&asset_id); + let supply_after = runtime.total_supply(&asset_id); assert_eq!(supply_after, 1000); } #[test] fn allowance_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let spender = ink_e2e::bob().into_account_id(); let asset_id = 1u32; - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); - let allowance = sandbox.allowance(&asset_id, &admin, &spender); + let allowance = runtime.allowance(&asset_id, &admin, &spender); assert_eq!(allowance, 0); - sandbox + runtime .approve(&asset_id, &admin, &spender, 250u128) .unwrap(); - let allowance = sandbox.allowance(&asset_id, &admin, &spender); + let allowance = runtime.allowance(&asset_id, &admin, &spender); assert_eq!(allowance, 250); } #[test] fn asset_exists_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let admin = DefaultRuntime::default_actor(); let asset_id = 1u32; - assert!(!sandbox.asset_exists(&asset_id)); + assert!(!runtime.asset_exists(&asset_id)); - sandbox.create(&asset_id, &admin, 1u128).unwrap(); + runtime.create(&asset_id, &admin, 1u128).unwrap(); - assert!(sandbox.asset_exists(&asset_id)); + assert!(runtime.asset_exists(&asset_id)); } } diff --git a/crates/runtime/src/api/balance_api.rs b/crates/runtime/src/api/balance_api.rs index a49a415468e..d74872c590f 100644 --- a/crates/runtime/src/api/balance_api.rs +++ b/crates/runtime/src/api/balance_api.rs @@ -11,7 +11,7 @@ use pallet_revive::sp_runtime::traits::StaticLookup; type BalanceOf = ::Balance; -/// Balance API for the sandbox. +/// Balance API for the runtime. pub trait BalanceAPI where T: RuntimeEnv, @@ -99,15 +99,15 @@ mod test { use crate::DefaultRuntime; #[test] fn mint_works() { - let mut sandbox = DefaultRuntime::default(); - let balance = sandbox.free_balance(&DefaultRuntime::default_actor()); + let mut runtime = DefaultRuntime::default(); + let balance = runtime.free_balance(&DefaultRuntime::default_actor()); - sandbox + runtime .mint_into(&DefaultRuntime::default_actor(), 100) .unwrap(); assert_eq!( - sandbox.free_balance(&DefaultRuntime::default_actor()), + runtime.free_balance(&DefaultRuntime::default_actor()), balance + 100 ); } diff --git a/crates/runtime/src/api/revive_api.rs b/crates/runtime/src/api/revive_api.rs index ce72ce613b0..73af49d6b2e 100644 --- a/crates/runtime/src/api/revive_api.rs +++ b/crates/runtime/src/api/revive_api.rs @@ -336,23 +336,23 @@ mod tests { /// /// This function funds the account with the existential deposit /// (i.e. minimum balance). - fn warm_up(sandbox: &mut T) + fn warm_up(runtime: &mut T) where ::Runtime: pallet_revive::Config + pallet_balances::Config, T: BalanceAPI + RuntimeEnv, { let acc = pallet_revive::Pallet::<::Runtime>::account_id(); let ed = pallet_balances::Pallet::<::Runtime>::minimum_balance(); - sandbox.mint_into(&acc, ed).unwrap_or_else(|_| { + runtime.mint_into(&acc, ed).unwrap_or_else(|_| { panic!("Failed to mint existential balance into `pallet-revive` account") }); } #[test] fn can_upload_code() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let contract_binary = compile_module("dummy"); - warm_up::(&mut sandbox); + warm_up::(&mut runtime); use sha3::{ Digest, @@ -363,7 +363,7 @@ mod tests { let origin = DefaultRuntime::convert_account_to_origin(DefaultRuntime::default_actor()); - let result = sandbox.upload_contract(contract_binary, origin, 100000000000000); + let result = runtime.upload_contract(contract_binary, origin, 100000000000000); assert!(result.is_ok()); assert_eq!(hash, result.unwrap().code_hash); @@ -371,18 +371,18 @@ mod tests { #[test] fn can_deploy_contract() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let contract_binary = compile_module("dummy"); - let events_before = sandbox.events(); + let events_before = runtime.events(); assert!(events_before.is_empty()); - warm_up::(&mut sandbox); + warm_up::(&mut runtime); let default_actor = DefaultRuntime::default_actor(); - sandbox.map_account(&default_actor).expect("cannot map"); + runtime.map_account(&default_actor).expect("cannot map"); let origin = DefaultRuntime::convert_account_to_origin(default_actor); - let result = sandbox.deploy_contract( + let result = runtime.deploy_contract( contract_binary.clone(), 0, vec![], @@ -395,7 +395,7 @@ mod tests { assert!(!result.result.unwrap().result.did_revert()); // deploying again must fail due to `DuplicateContract` - let result = sandbox.deploy_contract( + let result = runtime.deploy_contract( contract_binary, 0, vec![], @@ -411,15 +411,15 @@ mod tests { #[test] fn can_call_contract() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let _actor = DefaultRuntime::default_actor(); let contract_binary = compile_module("dummy"); - warm_up::(&mut sandbox); + warm_up::(&mut runtime); let default_actor = DefaultRuntime::default_actor(); - sandbox.map_account(&default_actor).expect("unable to map"); + runtime.map_account(&default_actor).expect("unable to map"); let origin = DefaultRuntime::convert_account_to_origin(default_actor); - let result = sandbox.deploy_contract( + let result = runtime.deploy_contract( contract_binary, 0, vec![], @@ -432,9 +432,9 @@ mod tests { let contract_address = result.result.expect("Contract should be deployed").addr; - sandbox.reset_events(); + runtime.reset_events(); - let result = sandbox.call_contract( + let result = runtime.call_contract( contract_address, 0, vec![], @@ -445,7 +445,7 @@ mod tests { assert!(result.result.is_ok()); assert!(!result.result.unwrap().did_revert()); - let events = sandbox.events(); + let events = runtime.events(); assert_eq!(events.len(), 1); assert_eq!( events[0].event, diff --git a/crates/runtime/src/api/system_api.rs b/crates/runtime/src/api/system_api.rs index 407c07d2a39..23ce373c7ee 100644 --- a/crates/runtime/src/api/system_api.rs +++ b/crates/runtime/src/api/system_api.rs @@ -12,7 +12,7 @@ use frame_support::sp_runtime::{ }; use frame_system::pallet_prelude::BlockNumberFor; -/// System API for the sandbox. +/// System API for the runtime. pub trait SystemAPI { /// The runtime system config. type T: frame_system::Config; @@ -114,7 +114,7 @@ mod tests { }; fn make_transfer( - sandbox: &mut DefaultRuntime, + runtime: &mut DefaultRuntime, dest: AccountId32, value: u128, ) -> DispatchResultWithInfo< @@ -125,7 +125,7 @@ mod tests { dest, "make_transfer should send to account different than default_actor" ); - sandbox.runtime_call( + runtime.runtime_call( RuntimeCall::>::Balances(pallet_balances::Call::< RuntimeOf, >::transfer_allow_death { @@ -138,43 +138,43 @@ mod tests { #[test] fn dry_run_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let actor = DefaultRuntime::default_actor(); - let initial_balance = sandbox.free_balance(&actor); + let initial_balance = runtime.free_balance(&actor); - sandbox.dry_run(|sandbox| { - crate::api::balance_api::BalanceAPI::mint_into(sandbox, &actor, 100).unwrap(); - assert_eq!(sandbox.free_balance(&actor), initial_balance + 100); + runtime.dry_run(|runtime| { + crate::api::balance_api::BalanceAPI::mint_into(runtime, &actor, 100).unwrap(); + assert_eq!(runtime.free_balance(&actor), initial_balance + 100); }); - assert_eq!(sandbox.free_balance(&actor), initial_balance); + assert_eq!(runtime.free_balance(&actor), initial_balance); } #[test] fn runtime_call_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); const RECIPIENT: AccountId32 = AccountId32::new([2u8; 32]); - let initial_balance = sandbox.free_balance(&RECIPIENT); + let initial_balance = runtime.free_balance(&RECIPIENT); - let result = make_transfer(&mut sandbox, RECIPIENT, 100); + let result = make_transfer(&mut runtime, RECIPIENT, 100); assert!(result.is_ok()); let expected_balance = initial_balance + 100; - assert_eq!(sandbox.free_balance(&RECIPIENT), expected_balance); + assert_eq!(runtime.free_balance(&RECIPIENT), expected_balance); } #[test] fn current_events() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); const RECIPIENT: AccountId32 = AccountId32::new([2u8; 32]); - let events_before = sandbox.events(); + let events_before = runtime.events(); assert!(events_before.is_empty()); - make_transfer(&mut sandbox, RECIPIENT, 1).expect("Failed to make transfer"); + make_transfer(&mut runtime, RECIPIENT, 1).expect("Failed to make transfer"); - let events_after = sandbox.events(); + let events_after = runtime.events(); assert!(!events_after.is_empty()); assert!(matches!( events_after.last().unwrap().event, @@ -184,39 +184,39 @@ mod tests { #[test] fn resetting_events() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); const RECIPIENT: AccountId32 = AccountId32::new([3u8; 32]); - make_transfer(&mut sandbox, RECIPIENT.clone(), 1) + make_transfer(&mut runtime, RECIPIENT.clone(), 1) .expect("Failed to make transfer"); - assert!(!sandbox.events().is_empty()); - sandbox.reset_events(); - assert!(sandbox.events().is_empty()); + assert!(!runtime.events().is_empty()); + runtime.reset_events(); + assert!(runtime.events().is_empty()); - make_transfer(&mut sandbox, RECIPIENT, 1).expect("Failed to make transfer"); - assert!(!sandbox.events().is_empty()); + make_transfer(&mut runtime, RECIPIENT, 1).expect("Failed to make transfer"); + assert!(!runtime.events().is_empty()); } #[test] fn snapshot_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); // Check state before - let block_before = sandbox.block_number(); - let snapshot_before = sandbox.take_snapshot(); + let block_before = runtime.block_number(); + let snapshot_before = runtime.take_snapshot(); // Advance some blocks to have some state change - let _ = sandbox.build_blocks(5); - let block_after = sandbox.block_number(); + let _ = runtime.build_blocks(5); + let block_after = runtime.block_number(); // Check block number and state after assert_eq!(block_before + 5, block_after); // Restore state - sandbox.restore_snapshot(snapshot_before); + runtime.restore_snapshot(snapshot_before); // Check state after restore - assert_eq!(block_before, sandbox.block_number()); + assert_eq!(block_before, runtime.block_number()); } } diff --git a/crates/runtime/src/api/timestamp_api.rs b/crates/runtime/src/api/timestamp_api.rs index 8de279b575e..ebbc8bb3f48 100644 --- a/crates/runtime/src/api/timestamp_api.rs +++ b/crates/runtime/src/api/timestamp_api.rs @@ -46,13 +46,13 @@ mod tests { #[test] fn getting_and_setting_timestamp_works() { - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); for timestamp in 0..10 { - assert_ne!(sandbox.get_timestamp(), timestamp); - sandbox.set_timestamp(timestamp); - assert_eq!(sandbox.get_timestamp(), timestamp); + assert_ne!(runtime.get_timestamp(), timestamp); + runtime.set_timestamp(timestamp); + assert_eq!(runtime.get_timestamp(), timestamp); - sandbox.build_block(); + runtime.build_block(); } } } diff --git a/crates/runtime/src/client.rs b/crates/runtime/src/client.rs index 62c5ba029b2..c63d0a7f23d 100644 --- a/crates/runtime/src/client.rs +++ b/crates/runtime/src/client.rs @@ -106,8 +106,8 @@ type BalanceOf = ::Balance; type ContractsBalanceOf = <::Currency as Inspect>>::Balance; -pub struct Client { - sandbox: S, +pub struct Client { + runtime: R, contracts: ContractsRegistry, _phantom: PhantomData, } @@ -115,34 +115,34 @@ pub struct Client { // While it is not necessary true that `Client` is `Send`, it will not be used in a way // that would violate this bound. In particular, all `Client` instances will be operating // synchronously. -unsafe impl Send for Client {} -impl Client +unsafe impl Send for Client {} +impl Client where - S: Default, - S::Runtime: pallet_balances::Config + pallet_revive::Config, - AccountIdFor: From<[u8; 32]>, - BalanceOf: From, + R: Default, + R::Runtime: pallet_balances::Config + pallet_revive::Config, + AccountIdFor: From<[u8; 32]>, + BalanceOf: From, { pub fn new>(contracts: impl IntoIterator) -> Self { - let mut sandbox = S::default(); - Self::fund_accounts(&mut sandbox); + let mut runtime = R::default(); + Self::fund_accounts(&mut runtime); Self { - sandbox, + runtime, contracts: ContractsRegistry::new(contracts), _phantom: Default::default(), } } - /// Get a mutable reference to the underlying sandbox. + /// Get a mutable reference to the underlying runtime. /// - /// This allows direct access to all sandbox methods and traits, making it easy to + /// This allows direct access to all runtime methods and traits, making it easy to /// interact with runtime pallets like `pallet-assets`: - pub fn sandbox(&mut self) -> &mut S { - &mut self.sandbox + pub fn runtime(&mut self) -> &mut R { + &mut self.runtime } - fn fund_accounts(sandbox: &mut S) { + fn fund_accounts(runtime: &mut R) { const TOKENS: u128 = 1_000_000_000_000_000; let accounts = [ @@ -158,30 +158,30 @@ where .map(|kp| kp.public_key().0) .map(From::from); for account in accounts.iter() { - sandbox + runtime .mint_into(account, TOKENS.into()) .unwrap_or_else(|_| panic!("Failed to mint {TOKENS} tokens")); } - let acc = pallet_revive::Pallet::::account_id(); - let ed = pallet_balances::Pallet::::minimum_balance(); - sandbox.mint_into(&acc, ed).unwrap_or_else(|_| { + let acc = pallet_revive::Pallet::::account_id(); + let ed = pallet_balances::Pallet::::minimum_balance(); + runtime.mint_into(&acc, ed).unwrap_or_else(|_| { panic!("Failed to mint existential deposit into `pallet-revive` account") }); } } #[async_trait] -impl + Send, S: RuntimeEnv> ChainBackend - for Client +impl + Send, R: RuntimeEnv> ChainBackend + for Client where - S::Runtime: pallet_balances::Config, - AccountIdFor: From<[u8; 32]>, + R::Runtime: pallet_balances::Config, + AccountIdFor: From<[u8; 32]>, { type AccountId = AccountId; - type Balance = BalanceOf; + type Balance = BalanceOf; type Error = RuntimeErr; - type EventLog = Vec>; + type EventLog = Vec>; async fn create_and_fund_account( &mut self, @@ -190,7 +190,7 @@ where ) -> Keypair { let (pair, seed) = Pair::generate(); - self.sandbox + self.runtime .mint_into(&pair.public().0.into(), amount) .expect("Failed to mint tokens"); @@ -201,8 +201,8 @@ where &mut self, account: Self::AccountId, ) -> Result { - let account = AccountIdFor::::from(*account.as_ref()); - Ok(self.sandbox.free_balance(&account)) + let account = AccountIdFor::::from(*account.as_ref()); + Ok(self.runtime.free_balance(&account)) } async fn runtime_call<'a>( @@ -219,7 +219,7 @@ where // Get metadata of the Runtime environment, so that we can encode the call object. // Panic on error - metadata of the static im-memory runtime should always be // available. - let raw_metadata: Vec = S::get_metadata().into(); + let raw_metadata: Vec = R::get_metadata().into(); let metadata = subxt_metadata::Metadata::decode(&mut raw_metadata.as_slice()) .expect("Failed to decode metadata"); @@ -233,20 +233,20 @@ where // Panic on error - we just encoded a validated call object, so it should be // decodable. let decoded_call = - RuntimeCall::::decode(&mut encoded_call.as_slice()) + RuntimeCall::::decode(&mut encoded_call.as_slice()) .expect("Failed to decode runtime call"); // Execute the call and record events emitted during this operation. - let start = self.sandbox.events().len(); - self.sandbox + let start = self.runtime.events().len(); + self.runtime .runtime_call( decoded_call, - S::convert_account_to_origin(keypair_to_account(origin)), + R::convert_account_to_origin(keypair_to_account(origin)), ) .map_err(|err| { RuntimeErr::new(format!("runtime_call: execution error {:?}", err.error)) })?; - let all = self.sandbox.events(); + let all = self.runtime.events(); let events = all[start..].to_vec(); Ok(events) } @@ -259,12 +259,12 @@ where ) -> Result<(), Self::Error> { let caller = keypair_to_account(origin); let origin = RawOrigin::Signed(caller); - let origin = OriginFor::::from(origin); + let origin = OriginFor::::from(origin); let dest = dest.as_ref(); let dest = Decode::decode(&mut dest.as_slice()).unwrap(); - self.sandbox + self.runtime .transfer_allow_death(&origin, &dest, value) .map_err(|err| { RuntimeErr::new(format!("transfer_allow_death failed: {err:?}")) @@ -275,19 +275,19 @@ where #[async_trait] impl< AccountId: Clone + Send + Sync + From<[u8; 32]> + AsRef<[u8; 32]>, - S: RuntimeEnv, - E: Environment> + R: RuntimeEnv, + E: Environment> + 'static, -> BuilderClient for Client +> BuilderClient for Client where - S::Runtime: pallet_balances::Config + pallet_revive::Config, - AccountIdFor: From<[u8; 32]> + AsRef<[u8; 32]>, - ContractsBalanceOf: Send + Sync, - ContractsBalanceOf: Into + TryFrom + Bounded, - MomentOf: Into, - <::Runtime as frame_system::Config>::Nonce: Into, + R::Runtime: pallet_balances::Config + pallet_revive::Config, + AccountIdFor: From<[u8; 32]> + AsRef<[u8; 32]>, + ContractsBalanceOf: Send + Sync, + ContractsBalanceOf: Into + TryFrom + Bounded, + MomentOf: Into, + ::Nonce: Into, // todo - <::Runtime as frame_system::Config>::Hash: + ::Hash: frame_support::traits::IsType, { fn load_code(&self, contract_name: &str) -> Vec { @@ -311,13 +311,13 @@ where async fn bare_instantiate< Contract: Clone, Args: Send + Sync + EncodeArgsWith + Clone, - R, + Ret, Abi: Send + Sync + Clone, >( &mut self, code: Vec, caller: &Keypair, - constructor: &mut CreateBuilderPartial, + constructor: &mut CreateBuilderPartial, value: E::Balance, gas_limit: Weight, storage_deposit_limit: E::Balance, @@ -337,25 +337,25 @@ where storage_deposit_limit: E::Balance, ) -> Result, Self::Error> { let _ = - as BuilderClient>::map_account(self, caller).await; + as BuilderClient>::map_account(self, caller).await; // get the trace - let _ = self.sandbox.build_block(); + let _ = self.runtime.build_block(); let tracer_type = TracerType::CallTracer(Some(CallTracerConfig::default())); - let mut tracer = self.sandbox.evm_tracer(tracer_type); + let mut tracer = self.runtime.evm_tracer(tracer_type); let mut code_hash: Option = None; // Record events emitted during instantiation - let start = self.sandbox.events().len(); + let start = self.runtime.events().len(); let result = pallet_revive::tracing::trace(tracer.as_tracing(), || { code_hash = Some(H256(ink_e2e::code_hash(&code[..]))); - self.sandbox.deploy_contract( + self.runtime.deploy_contract( code, value, data, salt(), - caller_to_origin::(caller), + caller_to_origin::(caller), // TODO: mismatch in dependencies pallet_revive::Weight::from_parts( gas_limit.ref_time(), @@ -379,13 +379,13 @@ where }; let account_id = - ::AddressMapper::to_fallback_account_id( + ::AddressMapper::to_fallback_account_id( &addr_raw, ) .as_ref() .to_owned(); - let all = self.sandbox.events(); + let all = self.runtime.events(); let events = all[start..].to_vec(); Ok(BareInstantiationResult { @@ -404,13 +404,13 @@ where async fn bare_instantiate_dry_run< Contract: Clone, Args: Send + Sync + EncodeArgsWith + Clone, - R, + Ret, Abi: Send + Sync + Clone, >( &mut self, contract_name: &str, caller: &Keypair, - constructor: &mut CreateBuilderPartial, + constructor: &mut CreateBuilderPartial, value: E::Balance, storage_deposit_limit: Option, ) -> Result, Self::Error> { @@ -440,16 +440,16 @@ where ) -> Result, Self::Error> { // There's a side effect here! let _ = - as BuilderClient>::map_account(self, caller).await; + as BuilderClient>::map_account(self, caller).await; - let dry_run_result = self.sandbox.dry_run(|sandbox| { - sandbox.deploy_contract( + let dry_run_result = self.runtime.dry_run(|runtime| { + runtime.deploy_contract( code, value, data, salt(), - caller_to_origin::(caller), - S::default_gas_limit(), + caller_to_origin::(caller), + R::default_gas_limit(), storage_deposit_limit.unwrap_or(E::Balance::max_value()), ) }); @@ -494,10 +494,10 @@ where ) -> Result, Self::Error> { let code = self.contracts.load_code(contract_name); // Record events emitted during upload - let start = self.sandbox.events().len(); - let result = match self.sandbox.upload_contract( + let start = self.runtime.events().len(); + let result = match self.runtime.upload_contract( code, - caller_to_origin::(caller), + caller_to_origin::(caller), storage_deposit_limit.unwrap_or_else(|| E::Balance::max_value()), ) { Ok(result) => result, @@ -507,7 +507,7 @@ where } }; - let all = self.sandbox.events(); + let all = self.runtime.events(); let events = all[start..].to_vec(); Ok(UploadResult { code_hash: result.code_hash, @@ -524,7 +524,7 @@ where _caller: &Keypair, _code_hash: H256, ) -> Result { - unimplemented!("sandbox does not yet support remove_code") + unimplemented!("runtime does not yet support remove_code") } /// Important: For an uncomplicated UX of the E2E testing environment we @@ -548,11 +548,11 @@ where { // There's a side effect here! let _ = - as BuilderClient>::map_account(self, caller).await; + as BuilderClient>::map_account(self, caller).await; let addr = *message.clone().params().callee(); let exec_input = message.clone().params().exec_input().encode(); - as BuilderClient>::raw_call::<'_, '_, '_>( + as BuilderClient>::raw_call::<'_, '_, '_>( self, addr, exec_input, @@ -574,17 +574,17 @@ where signer: &Keypair, ) -> Result<(Self::EventLog, Option), Self::Error> { // Record events emitted during the contract call - let start = self.sandbox.events().len(); + let start = self.runtime.events().len(); // todo let tracer_type = TracerType::CallTracer(Some(CallTracerConfig::default())); - let mut tracer = self.sandbox.evm_tracer(tracer_type); + let mut tracer = self.runtime.evm_tracer(tracer_type); let _result = pallet_revive::tracing::trace(tracer.as_tracing(), || { - self.sandbox + self.runtime .call_contract( dest, value, input_data, - caller_to_origin::(signer), + caller_to_origin::(signer), // TODO: mismatch in dependencies pallet_revive::Weight::from_parts( gas_limit.ref_time(), @@ -600,7 +600,7 @@ where _ => None, }; - let all = self.sandbox.events(); + let all = self.runtime.events(); let events = all[start..].to_vec(); Ok((events, trace)) } @@ -646,15 +646,15 @@ where ) -> Result, Self::Error> { // There's a side effect here! let _ = - as BuilderClient>::map_account(self, caller).await; + as BuilderClient>::map_account(self, caller).await; - let result = self.sandbox.dry_run(|sandbox| { - sandbox.call_contract( + let result = self.runtime.dry_run(|runtime| { + runtime.call_contract( dest, value, input_data, - caller_to_origin::(caller), - S::default_gas_limit(), + caller_to_origin::(caller), + R::default_gas_limit(), storage_deposit_limit.unwrap_or(E::Balance::max_value()), ) }); @@ -700,11 +700,11 @@ where &mut self, caller: &Keypair, ) -> Result, Self::Error> { - let caller_account: AccountIdFor = keypair_to_account(caller); - let origin = S::convert_account_to_origin(caller_account); + let caller_account: AccountIdFor = keypair_to_account(caller); + let origin = R::convert_account_to_origin(caller_account); - self.sandbox - .execute_with(|| pallet_revive::Pallet::::map_account(origin)) + self.runtime + .execute_with(|| pallet_revive::Pallet::::map_account(origin)) .map_err(|err| { RuntimeErr::new(format!("map_account: execution error {err:?}")) }) @@ -714,30 +714,30 @@ where async fn to_account_id(&mut self, addr: &H160) -> Result { use pallet_revive::AddressMapper; let account_id = - ::AddressMapper::to_account_id(addr); + ::AddressMapper::to_account_id(addr); Ok(E::AccountId::from(*account_id.as_ref())) } } -impl Client +impl Client where - S::Runtime: pallet_revive::Config, - ::RuntimeEvent: - TryInto>, + R::Runtime: pallet_revive::Config, + ::RuntimeEvent: + TryInto>, { pub fn contract_events(&mut self) -> Vec> where - S::Runtime: pallet_revive::Config, - ::RuntimeEvent: - TryInto>, + R::Runtime: pallet_revive::Config, + ::RuntimeEvent: + TryInto>, { - self.sandbox + self.runtime .events() .iter() .filter_map(|event_record| { if let Ok(pallet_event) = &event_record.event.clone().try_into() { match pallet_event { - pallet_revive::Event::::ContractEmitted { + pallet_revive::Event::::ContractEmitted { data, .. } => Some(data.clone()), @@ -753,9 +753,9 @@ where /// Returns the last contract event that was emitted, if any. pub fn last_contract_event(&mut self) -> Option> where - S::Runtime: pallet_revive::Config, - ::RuntimeEvent: - TryInto>, + R::Runtime: pallet_revive::Config, + ::RuntimeEvent: + TryInto>, { self.contract_events().last().cloned() } @@ -764,17 +764,17 @@ where /// Helper function for the `assert_last_contract_event!` macro. /// /// # Parameters: -/// - `client` - The client for interacting with the sandbox. +/// - `client` - The client for interacting with the runtime. /// - `event` - The expected event. #[track_caller] -pub fn assert_last_contract_event_inner( - client: &mut Client, +pub fn assert_last_contract_event_inner( + client: &mut Client, event: E, ) where - S: RuntimeEnv, - S::Runtime: pallet_revive::Config, - ::RuntimeEvent: - TryInto>, + R: RuntimeEnv, + R::Runtime: pallet_revive::Config, + ::RuntimeEvent: + TryInto>, E: Decode + scale::Encode + core::fmt::Debug + std::cmp::PartialEq, { let expected_event = event; @@ -820,19 +820,19 @@ where #[async_trait] impl< AccountId: Clone + Send + Sync + From<[u8; 32]> + AsRef<[u8; 32]>, - S: RuntimeEnv, - E: Environment> + R: RuntimeEnv, + E: Environment> + 'static, -> ContractsBackend for Client +> ContractsBackend for Client where - S::Runtime: pallet_balances::Config + pallet_revive::Config, - AccountIdFor: From<[u8; 32]> + AsRef<[u8; 32]>, + R::Runtime: pallet_balances::Config + pallet_revive::Config, + AccountIdFor: From<[u8; 32]> + AsRef<[u8; 32]>, { type Error = RuntimeErr; - type EventLog = Vec>; + type EventLog = Vec>; } -/// Exposes preset sandbox configurations to be used in tests. +/// Exposes preset runtime configurations to be used in tests. pub mod preset { /* // todo @@ -843,13 +843,13 @@ pub mod preset { BlockBuilder, Extension, RuntimeMetadataPrefixed, - Sandbox, + RuntimeEnv, Snapshot, }; pub use pallet_revive_mock_network::*; use sp_runtime::traits::Dispatchable; - /// A [`ink_runtime::Sandbox`] that can be used to test contracts + /// A [`ink_runtime::RuntimeEnv`] that can be used to test contracts /// with a mock network of relay chain and parachains. /// /// ```no_compile @@ -863,7 +863,7 @@ pub mod preset { dry_run: bool, } - impl Sandbox for MockNetworkRuntime { + impl RuntimeEnv for MockNetworkRuntime { type Runtime = parachain::Runtime; fn execute_with(&mut self, execute: impl FnOnce() -> T) -> T { @@ -956,13 +956,13 @@ pub mod preset { } /// Transforms a `Keypair` into an origin. -pub fn caller_to_origin(caller: &Keypair) -> OriginFor +pub fn caller_to_origin(caller: &Keypair) -> OriginFor where - S: RuntimeEnv, - S::Runtime: pallet_balances::Config + pallet_revive::Config, - AccountIdFor: From<[u8; 32]> + AsRef<[u8; 32]>, + R: RuntimeEnv, + R::Runtime: pallet_balances::Config + pallet_revive::Config, + AccountIdFor: From<[u8; 32]> + AsRef<[u8; 32]>, { let caller = keypair_to_account(caller); let origin = RawOrigin::Signed(caller); - OriginFor::::from(origin) + OriginFor::::from(origin) } diff --git a/crates/runtime/src/macros.rs b/crates/runtime/src/macros.rs index 37f5e8da3d9..df0714a2602 100644 --- a/crates/runtime/src/macros.rs +++ b/crates/runtime/src/macros.rs @@ -500,15 +500,3 @@ pub use construct_runtime::{ } create_runtime!(DefaultRuntime); - -/// Backward compatibility alias for `create_runtime!`. -/// -/// This macro is deprecated and will be removed in a future version. -/// Please use `create_runtime!` instead. -#[macro_export] -#[deprecated(since = "6.0.0", note = "Use `create_runtime!` instead")] -macro_rules! create_sandbox { - ($($tt:tt)*) => { - $crate::create_runtime!($($tt)*) - }; -} diff --git a/integration-tests/public/assets-precompile/lib.rs b/integration-tests/public/assets-precompile/lib.rs index 54b8ab7457d..86d455b3822 100644 --- a/integration-tests/public/assets-precompile/lib.rs +++ b/integration-tests/public/assets-precompile/lib.rs @@ -229,8 +229,8 @@ mod e2e_tests { let asset_id: u32 = 1; let admin = alice(); - client.sandbox().create(&asset_id, &admin, 1u128)?; - client.sandbox().mint_into(&asset_id, &admin, 1000u128)?; + client.runtime().create(&asset_id, &admin, 1u128)?; + client.runtime().mint_into(&asset_id, &admin, 1000u128)?; let contract = client .instantiate( @@ -257,9 +257,9 @@ mod e2e_tests { let alice = alice(); let bob = bob(); - client.sandbox().create(&asset_id, &alice, 1u128)?; - client.sandbox().mint_into(&asset_id, &alice, 1000u128)?; - client.sandbox().mint_into(&asset_id, &bob, 500u128)?; + client.runtime().create(&asset_id, &alice, 1u128)?; + client.runtime().mint_into(&asset_id, &alice, 1000u128)?; + client.runtime().mint_into(&asset_id, &bob, 500u128)?; let contract = client .instantiate( @@ -271,7 +271,7 @@ mod e2e_tests { .await?; // Map bob's account otherwise it fails. - client.sandbox().map_account(&bob)?; + client.runtime().map_account(&bob)?; let contract_call = contract.call_builder::(); let alice_balance = client @@ -294,7 +294,7 @@ mod e2e_tests { let alice = alice(); let bob = bob(); - client.sandbox().create(&asset_id, &alice, 1u128)?; + client.runtime().create(&asset_id, &alice, 1u128)?; let contract = client .instantiate( @@ -306,9 +306,9 @@ mod e2e_tests { .await?; client - .sandbox() + .runtime() .mint_into(&asset_id, &contract.account_id, 100_000u128)?; - client.sandbox().map_account(&bob)?; + client.runtime().map_account(&bob)?; let mut contract_call = contract.call_builder::(); let bob_address = bob.address(); @@ -332,8 +332,8 @@ mod e2e_tests { ); let contract_balance = - client.sandbox().balance_of(&asset_id, &contract.account_id); - let bob_balance = client.sandbox().balance_of(&asset_id, &bob); + client.runtime().balance_of(&asset_id, &contract.account_id); + let bob_balance = client.runtime().balance_of(&asset_id, &bob); assert_eq!(contract_balance, 99_000u128); assert_eq!(bob_balance, 1_000u128); @@ -355,7 +355,7 @@ mod e2e_tests { let alice = alice(); let bob = bob(); - client.sandbox().create(&asset_id, &alice, 1u128)?; + client.runtime().create(&asset_id, &alice, 1u128)?; let contract = client .instantiate("assets_precompile", &alice, &mut AssetHubPrecompileRef::new(asset_id)) @@ -365,12 +365,12 @@ mod e2e_tests { .await?; client - .sandbox() + .runtime() .mint_into(&asset_id, &contract.account_id, 100_000u128)?; - client.sandbox().map_account(&bob)?; + client.runtime().map_account(&bob)?; let bob_allowance_before = client - .sandbox() + .runtime() .allowance(&asset_id, &contract.account_id, &bob); assert_eq!(bob_allowance_before, 0u128); // Bob's allowance is 0 @@ -394,7 +394,7 @@ mod e2e_tests { let bob_allowance = client - .sandbox() + .runtime() .allowance(&asset_id, &contract.account_id, &bob); assert_eq!(bob_allowance, 200u128); @@ -407,7 +407,7 @@ mod e2e_tests { let alice = alice(); let bob = bob(); - client.sandbox().create(&asset_id, &alice, 1u128)?; + client.runtime().create(&asset_id, &alice, 1u128)?; let contract = client .instantiate( @@ -419,15 +419,15 @@ mod e2e_tests { .await?; let contract_call = contract.call_builder::(); - client.sandbox().mint_into(&asset_id, &alice, 100_000u128)?; - client.sandbox().map_account(&bob)?; + client.runtime().mint_into(&asset_id, &alice, 100_000u128)?; + client.runtime().map_account(&bob)?; let allowance_call = &contract_call.allowance(alice.address(), bob.address()); let result = client.call(&alice, allowance_call).dry_run().await?; assert_eq!(result.return_value(), U256::from(0)); // Approve bob to spend alice's tokens - client.sandbox().approve(&asset_id, &alice, &bob, 300u128)?; + client.runtime().approve(&asset_id, &alice, &bob, 300u128)?; let result = client.call(&alice, allowance_call).dry_run().await?; assert_eq!(result.return_value(), U256::from(300)); @@ -441,7 +441,7 @@ mod e2e_tests { let alice = alice(); let bob = bob(); - client.sandbox().create(&asset_id, &alice, 1u128)?; + client.runtime().create(&asset_id, &alice, 1u128)?; let contract = client .instantiate( @@ -452,12 +452,12 @@ mod e2e_tests { .submit() .await?; - client.sandbox().mint_into(&asset_id, &alice, 100_000u128)?; + client.runtime().mint_into(&asset_id, &alice, 100_000u128)?; // Approve alice to spend contract's tokens client - .sandbox() + .runtime() .approve(&asset_id, &alice, &contract.account_id, 50_000u128)?; - client.sandbox().map_account(&bob)?; + client.runtime().map_account(&bob)?; let mut contract_call = contract.call_builder::(); let alice_address = alice.address(); @@ -480,11 +480,11 @@ mod e2e_tests { } ); - let alice_balance = client.sandbox().balance_of(&asset_id, &alice); - let bob_balance = client.sandbox().balance_of(&asset_id, &bob); + let alice_balance = client.runtime().balance_of(&asset_id, &alice); + let bob_balance = client.runtime().balance_of(&asset_id, &bob); let contract_allowance = client - .sandbox() + .runtime() .allowance(&asset_id, &alice, &contract.account_id); assert_eq!(alice_balance, 98_500u128); assert_eq!(bob_balance, 1_500u128); diff --git a/integration-tests/public/debugging-strategies/lib.rs b/integration-tests/public/debugging-strategies/lib.rs index 6fc1ebd8334..9a6a8af81fa 100755 --- a/integration-tests/public/debugging-strategies/lib.rs +++ b/integration-tests/public/debugging-strategies/lib.rs @@ -312,6 +312,6 @@ mod debugging_strategies { Ok(()) } - // todo add the same above, but for the sandbox + // todo add the same above, but for the runtime backend } } diff --git a/integration-tests/public/fuzz-testing/lib.rs b/integration-tests/public/fuzz-testing/lib.rs index 7334c2bd893..ab57f64b416 100644 --- a/integration-tests/public/fuzz-testing/lib.rs +++ b/integration-tests/public/fuzz-testing/lib.rs @@ -43,7 +43,7 @@ pub mod fuzz_testing { use quickcheck_macros::quickcheck; /// We use `#[ink_e2e::test(runtime)]` here. It doesn't start a node for each - /// test, but instead interacts with a sandboxed `pallet-revive`. + /// test, but instead interacts with an in-process `pallet-revive`. /// /// See /// for more details. @@ -67,7 +67,7 @@ pub mod fuzz_testing { /// This means that, by default, for every test run a node process will /// be spawned. You can work around this by setting the env variable /// `CONTRACTS_NODE_URL`. But still, interactions with a real node will - /// always be more heavy-weight than "just" interacting with a sandboxed + /// always be more heavy-weight than "just" interacting with an in-process /// `pallet-revive`. #[ink_e2e::test(runtime, replace_test_attr = "#[quickcheck]")] async fn fuzzing_works_node(val: bool) -> bool { diff --git a/integration-tests/solidity-abi/sol-cross-contract/e2e_tests.rs b/integration-tests/solidity-abi/sol-cross-contract/e2e_tests.rs index 89506eddc94..349757b8d39 100644 --- a/integration-tests/solidity-abi/sol-cross-contract/e2e_tests.rs +++ b/integration-tests/solidity-abi/sol-cross-contract/e2e_tests.rs @@ -2,7 +2,7 @@ use super::sol_cross_contract::*; use ink_e2e::ContractsRegistry; use ink_runtime::{ DefaultRuntime, - Sandbox, + RuntimeEnv, api::prelude::{ BalanceAPI, ContractAPI, @@ -24,16 +24,16 @@ fn call_sol_encoded_message() { let built_contracts = ::ink_e2e::build_root_and_contract_dependencies(vec![]); let contracts = ContractsRegistry::new(built_contracts); - let mut sandbox = ink_runtime::DefaultRuntime::default(); + let mut runtime = ink_runtime::DefaultRuntime::default(); let caller = ink_e2e::alice(); let origin = DefaultRuntime::convert_account_to_origin(DefaultRuntime::default_actor()); - sandbox + runtime .mint_into(&caller.public_key().0.into(), 1_000_000_000_000_000u128) .unwrap_or_else(|_| panic!("Failed to mint tokens")); - sandbox + runtime .map_account(&DefaultRuntime::default_actor()) .expect("unable to map"); @@ -48,18 +48,18 @@ fn call_sol_encoded_message() { let code = contracts.load_code("other-contract-sol"); let other_contract_addr = ::deploy_contract( - &mut sandbox, + &mut runtime, code, 0, exec_input.encode(), // salt None, origin.clone(), - ::default_gas_limit(), + ::default_gas_limit(), STORAGE_DEPOSIT_LIMIT, ) .result - .expect("sandbox deploy contract failed") + .expect("runtime deploy contract failed") .addr; // upload main contract (caller) @@ -73,7 +73,7 @@ fn call_sol_encoded_message() { let code = contracts.load_code("sol-cross-contract"); let contract_addr = ::deploy_contract( - &mut sandbox, + &mut runtime, code, 0, exec_input.encode(), @@ -81,14 +81,14 @@ fn call_sol_encoded_message() { // TODO (@peterwht): figure out why no salt is causing `DuplicateContract` Some([1u8; 32]), origin.clone(), - ::default_gas_limit(), + ::default_gas_limit(), STORAGE_DEPOSIT_LIMIT, ) .result - .expect("sandbox deploy contract failed") + .expect("runtime deploy contract failed") .addr; - let mut contracts = ContractSandbox { sandbox }; + let mut contracts = ContractRuntime { runtime }; // get value let value: bool = contracts.call_with_return_value( @@ -121,17 +121,17 @@ fn call_sol_encoded_message() { assert!(value, "value should have been set to true"); } -struct ContractSandbox { - sandbox: ink_runtime::DefaultRuntime, +struct ContractRuntime { + runtime: ink_runtime::DefaultRuntime, } -impl ContractSandbox { +impl ContractRuntime { fn call_with_return_value( &mut self, contract_addr: Address, message: &str, args: Args, - origin: OriginFor<::Runtime>, + origin: OriginFor<::Runtime>, ) -> Ret where Args: for<'a> SolEncode<'a>, @@ -146,7 +146,7 @@ impl ContractSandbox { contract_addr: Address, message: &str, args: Args, - origin: OriginFor<::Runtime>, + origin: OriginFor<::Runtime>, ) -> Vec where Args: for<'a> SolEncode<'a>, @@ -164,19 +164,19 @@ impl ContractSandbox { &mut self, contract_addr: Address, data: Vec, - origin: OriginFor<::Runtime>, + origin: OriginFor<::Runtime>, ) -> ExecReturnValue { let result = ::call_contract( - &mut self.sandbox, + &mut self.runtime, contract_addr, 0, data, origin, - ::default_gas_limit(), + ::default_gas_limit(), STORAGE_DEPOSIT_LIMIT, ); - let call_raw = result.result.expect("sandbox call contract failed"); + let call_raw = result.result.expect("runtime call contract failed"); ExecReturnValue { flags: ink_env::ReturnFlags::from_bits_truncate(call_raw.flags.bits()), data: call_raw.data, diff --git a/integration-tests/solidity-abi/sol-encoding/e2e_tests.rs b/integration-tests/solidity-abi/sol-encoding/e2e_tests.rs index c00423548a8..0fe1c574447 100644 --- a/integration-tests/solidity-abi/sol-encoding/e2e_tests.rs +++ b/integration-tests/solidity-abi/sol-encoding/e2e_tests.rs @@ -8,7 +8,7 @@ use ink_e2e::ContractsRegistry; use ink_revive_types::ExecReturnValue; use ink_runtime::{ DefaultRuntime, - Sandbox, + RuntimeEnv, api::prelude::{ BalanceAPI, ContractAPI, @@ -23,16 +23,16 @@ fn call_solidity_encoded_message() { let built_contracts = ::ink_e2e::build_root_and_contract_dependencies(vec![]); let contracts = ContractsRegistry::new(built_contracts); - let mut sandbox = DefaultRuntime::default(); + let mut runtime = DefaultRuntime::default(); let caller = ink_e2e::alice(); let origin = DefaultRuntime::convert_account_to_origin(DefaultRuntime::default_actor()); - sandbox + runtime .mint_into(&caller.public_key().0.into(), 1_000_000_000_000_000u128) .unwrap_or_else(|_| panic!("Failed to mint tokens")); - sandbox + runtime .map_account(&DefaultRuntime::default_actor()) .expect("unable to map"); @@ -46,22 +46,22 @@ fn call_solidity_encoded_message() { let code = contracts.load_code("sol_encoding"); let contract_addr = ::deploy_contract( - &mut sandbox, + &mut runtime, code, 0, exec_input.encode(), // salt None, origin.clone(), - ::default_gas_limit(), + ::default_gas_limit(), STORAGE_DEPOSIT_LIMIT, ) .result - .expect("sandbox deploy contract failed") + .expect("runtime deploy contract failed") .addr; - let mut contract = ContractSandbox { - sandbox, + let mut contract = ContractRuntime { + runtime, contract_addr, }; @@ -75,17 +75,17 @@ fn call_solidity_encoded_message() { assert!(value, "value should have been set to true"); } -struct ContractSandbox { - sandbox: DefaultRuntime, +struct ContractRuntime { + runtime: DefaultRuntime, contract_addr: Address, } -impl ContractSandbox { +impl ContractRuntime { fn call_with_return_value( &mut self, message: &str, args: Args, - origin: OriginFor<::Runtime>, + origin: OriginFor<::Runtime>, ) -> Ret where Args: for<'a> SolEncode<'a>, @@ -99,7 +99,7 @@ impl ContractSandbox { &mut self, message: &str, args: Args, - origin: OriginFor<::Runtime>, + origin: OriginFor<::Runtime>, ) -> Vec where Args: for<'a> SolEncode<'a>, @@ -116,19 +116,19 @@ impl ContractSandbox { fn call_raw( &mut self, data: Vec, - origin: OriginFor<::Runtime>, + origin: OriginFor<::Runtime>, ) -> ExecReturnValue { let call_raw = ::call_contract( - &mut self.sandbox, + &mut self.runtime, self.contract_addr, 0, data, origin, - ::default_gas_limit(), + ::default_gas_limit(), STORAGE_DEPOSIT_LIMIT, ) .result - .expect("sandbox call contract failed"); + .expect("runtime call contract failed"); ExecReturnValue { flags: ink_env::ReturnFlags::from_bits_truncate(call_raw.flags.bits()), data: call_raw.data, From 2d3d99e4e2bd28d16f7b2a8f07592ba983bf8098 Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Wed, 26 Nov 2025 16:41:31 -0300 Subject: [PATCH 4/5] refactor: simplify e2e node tests --- integration-tests/all-abi/events/lib.rs | 8 +++--- .../internal/builtin-precompiles/lib.rs | 8 +++--- .../internal/call-builder-return-value/lib.rs | 16 +++-------- .../internal/data-hostfns/lib.rs | 4 +-- integration-tests/internal/gas-hostfns/lib.rs | 6 ++-- .../lang-err/call-builder-delegate/lib.rs | 4 +-- .../internal/lang-err/call-builder/lib.rs | 28 ++++++------------- .../lang-err/constructors-return-value/lib.rs | 6 ++-- .../internal/lang-err/contract-ref/lib.rs | 6 ++-- .../lang-err/integration-flipper/lib.rs | 4 +-- integration-tests/internal/mapping/lib.rs | 12 ++++---- .../internal/misc-evm-getters-hostfns/lib.rs | 14 +++++----- .../internal/misc-hostfns/lib.rs | 4 +-- .../internal/overflow-safety/lib.rs | 8 +++--- .../internal/static-buffer/lib.rs | 4 +-- .../internal/system-precompile/lib.rs | 2 +- integration-tests/public/bytes/lib.rs | 4 +-- .../public/contract-invocation/lib.rs | 2 +- .../public/contract-storage/e2e_tests.rs | 8 +++--- .../public/contract-terminate/lib.rs | 2 +- .../public/contract-transfer/lib.rs | 2 +- integration-tests/public/contract-xcm/lib.rs | 6 ++-- .../e2e_tests.rs | 8 +++--- .../public/cross-contract-calls/e2e_tests.rs | 4 +-- .../public/custom-allocator/lib.rs | 4 +-- .../public/custom-environment/lib.rs | 6 ++-- .../public/debugging-strategies/lib.rs | 8 +++--- .../public/e2e-call-runtime/lib.rs | 2 +- integration-tests/public/erc20/lib.rs | 4 +-- integration-tests/public/events/lib.rs | 10 +++---- .../public/fallible-setter/lib.rs | 2 +- integration-tests/public/flipper/lib.rs | 4 +-- integration-tests/public/lazyvec/lib.rs | 2 +- .../public/multi-contract-caller/lib.rs | 2 +- .../trait-dyn-cross-contract-calls/lib.rs | 2 +- .../upgradeable-contracts/delegator/lib.rs | 6 ++-- .../set-code-hash-migration/e2e_tests.rs | 2 +- .../set-code-hash/lib.rs | 2 +- .../public/wildcard-selector/lib.rs | 4 +-- integration-tests/solidity-abi/events/lib.rs | 6 ++-- .../solidity-calls-flipper/e2e_tests.rs | 2 +- .../trait-dyn-cross-contract-calls/lib.rs | 2 +- 42 files changed, 110 insertions(+), 130 deletions(-) diff --git a/integration-tests/all-abi/events/lib.rs b/integration-tests/all-abi/events/lib.rs index 4c361d6fc95..bcc7b59f2bd 100644 --- a/integration-tests/all-abi/events/lib.rs +++ b/integration-tests/all-abi/events/lib.rs @@ -447,7 +447,7 @@ pub mod events { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn emits_foreign_event( + async fn emits_foreign_event( mut client: Client, ) -> E2EResult<()> { // given @@ -510,7 +510,7 @@ pub mod events { } #[ink_e2e::test()] - async fn emits_inline_anonymous_event( + async fn emits_inline_anonymous_event( mut client: Client, ) -> E2EResult<()> { // given @@ -597,7 +597,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_some( + async fn emits_event_with_option_topic_some( mut client: Client, ) -> E2EResult<()> { // given @@ -672,7 +672,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_none( + async fn emits_event_with_option_topic_none( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/builtin-precompiles/lib.rs b/integration-tests/internal/builtin-precompiles/lib.rs index 976fc250bb6..b18bfbafbad 100755 --- a/integration-tests/internal/builtin-precompiles/lib.rs +++ b/integration-tests/internal/builtin-precompiles/lib.rs @@ -42,7 +42,7 @@ mod builtin_precompiles { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn bn128_add_works( + async fn bn128_add_works( mut client: Client, ) -> E2EResult<()> { // given @@ -76,7 +76,7 @@ mod builtin_precompiles { } #[ink_e2e::test] - async fn bn128_mul_works( + async fn bn128_mul_works( mut client: Client, ) -> E2EResult<()> { // given @@ -110,7 +110,7 @@ mod builtin_precompiles { } #[ink_e2e::test] - async fn bn128_pairing_works( + async fn bn128_pairing_works( mut client: Client, ) -> E2EResult<()> { // given @@ -143,7 +143,7 @@ mod builtin_precompiles { } #[ink_e2e::test] - async fn bn128_pairing_zero_points_works( + async fn bn128_pairing_zero_points_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/call-builder-return-value/lib.rs b/integration-tests/internal/call-builder-return-value/lib.rs index a81bc033aa6..9e760fd97e8 100755 --- a/integration-tests/internal/call-builder-return-value/lib.rs +++ b/integration-tests/internal/call-builder-return-value/lib.rs @@ -121,9 +121,7 @@ mod call_builder { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_delegate_call_return_value_returns_correct_value< - Client: E2EBackend, - >( + async fn e2e_delegate_call_return_value_returns_correct_value( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -165,9 +163,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_delegate_call_return_value_errors_if_return_data_too_long< - Client: E2EBackend, - >( + async fn e2e_delegate_call_return_value_errors_if_return_data_too_long( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -209,9 +205,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_forward_call_return_value_returns_correct_value< - Client: E2EBackend, - >( + async fn e2e_forward_call_return_value_returns_correct_value( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -252,9 +246,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_forward_call_return_value_errors_if_return_data_too_long< - Client: E2EBackend, - >( + async fn e2e_forward_call_return_value_errors_if_return_data_too_long( mut client: Client, ) -> E2EResult<()> { let origin = client diff --git a/integration-tests/internal/data-hostfns/lib.rs b/integration-tests/internal/data-hostfns/lib.rs index a28b7921b00..589481a2d03 100644 --- a/integration-tests/internal/data-hostfns/lib.rs +++ b/integration-tests/internal/data-hostfns/lib.rs @@ -33,7 +33,7 @@ mod data_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_call_data_size_works( + async fn e2e_call_data_size_works( mut client: Client, ) -> E2EResult<()> { // given @@ -63,7 +63,7 @@ mod data_hostfns { } #[ink_e2e::test] - async fn e2e_return_data_size_works( + async fn e2e_return_data_size_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/gas-hostfns/lib.rs b/integration-tests/internal/gas-hostfns/lib.rs index ea9ad1416f5..fc85e1c3feb 100644 --- a/integration-tests/internal/gas-hostfns/lib.rs +++ b/integration-tests/internal/gas-hostfns/lib.rs @@ -39,7 +39,7 @@ mod gas_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_gas_limit_works( + async fn e2e_gas_limit_works( mut client: Client, ) -> E2EResult<()> { // given @@ -65,7 +65,7 @@ mod gas_hostfns { } #[ink_e2e::test] - async fn e2e_gas_price_works( + async fn e2e_gas_price_works( mut client: Client, ) -> E2EResult<()> { // given @@ -91,7 +91,7 @@ mod gas_hostfns { } #[ink_e2e::test] - async fn e2e_gas_left_works( + async fn e2e_gas_left_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/lang-err/call-builder-delegate/lib.rs b/integration-tests/internal/lang-err/call-builder-delegate/lib.rs index 064c4f5ea3f..fc86761c6c8 100755 --- a/integration-tests/internal/lang-err/call-builder-delegate/lib.rs +++ b/integration-tests/internal/lang-err/call-builder-delegate/lib.rs @@ -102,7 +102,7 @@ mod call_builder { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_invalid_message_selector_can_be_handled( + async fn e2e_invalid_message_selector_can_be_handled( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -142,7 +142,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_invalid_message_selector_panics_on_invoke( + async fn e2e_invalid_message_selector_panics_on_invoke( mut client: Client, ) -> E2EResult<()> { let origin = client diff --git a/integration-tests/internal/lang-err/call-builder/lib.rs b/integration-tests/internal/lang-err/call-builder/lib.rs index 2a75f5a9536..093f2c78431 100755 --- a/integration-tests/internal/lang-err/call-builder/lib.rs +++ b/integration-tests/internal/lang-err/call-builder/lib.rs @@ -176,7 +176,7 @@ mod call_builder { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_invalid_message_selector_can_be_handled( + async fn e2e_invalid_message_selector_can_be_handled( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -227,7 +227,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_invalid_message_selector_panics_on_invoke( + async fn e2e_invalid_message_selector_panics_on_invoke( mut client: Client, ) -> E2EResult<()> { let mut constructor = CallBuilderTestRef::new(); @@ -264,7 +264,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_works_with_valid_selector( + async fn e2e_create_builder_works_with_valid_selector( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -305,7 +305,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_fails_with_invalid_selector( + async fn e2e_create_builder_fails_with_invalid_selector( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -346,9 +346,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_with_infallible_revert_constructor_encodes_ok< - Client: E2EBackend, - >( + async fn e2e_create_builder_with_infallible_revert_constructor_encodes_ok( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -385,9 +383,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_can_handle_fallible_constructor_success< - Client: E2EBackend, - >( + async fn e2e_create_builder_can_handle_fallible_constructor_success( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -429,9 +425,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_can_handle_fallible_constructor_error< - Client: E2EBackend, - >( + async fn e2e_create_builder_can_handle_fallible_constructor_error( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -480,9 +474,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_with_fallible_revert_constructor_encodes_ok< - Client: E2EBackend, - >( + async fn e2e_create_builder_with_fallible_revert_constructor_encodes_ok( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -519,9 +511,7 @@ mod call_builder { } #[ink_e2e::test] - async fn e2e_create_builder_with_fallible_revert_constructor_encodes_err< - Client: E2EBackend, - >( + async fn e2e_create_builder_with_fallible_revert_constructor_encodes_err( mut client: Client, ) -> E2EResult<()> { let origin = client diff --git a/integration-tests/internal/lang-err/constructors-return-value/lib.rs b/integration-tests/internal/lang-err/constructors-return-value/lib.rs index a00005d6a9f..aa1fa03795b 100644 --- a/integration-tests/internal/lang-err/constructors-return-value/lib.rs +++ b/integration-tests/internal/lang-err/constructors-return-value/lib.rs @@ -116,7 +116,7 @@ pub mod constructors_return_value { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_infallible_constructor( + async fn e2e_infallible_constructor( mut client: Client, ) -> E2EResult<()> { let mut constructor = ConstructorsReturnValueRef::new(true); @@ -154,7 +154,7 @@ pub mod constructors_return_value { } #[ink_e2e::test] - async fn e2e_fallible_constructor_succeed( + async fn e2e_fallible_constructor_succeed( mut client: Client, ) -> E2EResult<()> { let mut constructor = ConstructorsReturnValueRef::try_new(true); @@ -205,7 +205,7 @@ pub mod constructors_return_value { } #[ink_e2e::test] - async fn e2e_fallible_constructor_fails( + async fn e2e_fallible_constructor_fails( mut client: Client, ) -> E2EResult<()> { let mut constructor = ConstructorsReturnValueRef::try_new(false); diff --git a/integration-tests/internal/lang-err/contract-ref/lib.rs b/integration-tests/internal/lang-err/contract-ref/lib.rs index 3d77a5333cb..8734f09c173 100755 --- a/integration-tests/internal/lang-err/contract-ref/lib.rs +++ b/integration-tests/internal/lang-err/contract-ref/lib.rs @@ -82,7 +82,7 @@ mod contract_ref { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_ref_can_flip_correctly( + async fn e2e_ref_can_flip_correctly( mut client: Client, ) -> E2EResult<()> { let flipper_hash = client @@ -126,7 +126,7 @@ mod contract_ref { } #[ink_e2e::test] - async fn e2e_fallible_ref_can_be_instantiated( + async fn e2e_fallible_ref_can_be_instantiated( mut client: Client, ) -> E2EResult<()> { let flipper_hash: ink::H256 = client @@ -156,7 +156,7 @@ mod contract_ref { } #[ink_e2e::test] - async fn e2e_fallible_ref_fails_to_be_instantiated( + async fn e2e_fallible_ref_fails_to_be_instantiated( mut client: Client, ) -> E2EResult<()> { let flipper_hash = client diff --git a/integration-tests/internal/lang-err/integration-flipper/lib.rs b/integration-tests/internal/lang-err/integration-flipper/lib.rs index 9b200cd912e..aa6e671d078 100644 --- a/integration-tests/internal/lang-err/integration-flipper/lib.rs +++ b/integration-tests/internal/lang-err/integration-flipper/lib.rs @@ -67,7 +67,7 @@ pub mod integration_flipper { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_can_flip_correctly( + async fn e2e_can_flip_correctly( mut client: Client, ) -> E2EResult<()> { let mut constructor = FlipperRef::new_default(); @@ -107,7 +107,7 @@ pub mod integration_flipper { } #[ink_e2e::test] - async fn e2e_message_error_reverts_state( + async fn e2e_message_error_reverts_state( mut client: Client, ) -> E2EResult<()> { let mut constructor = FlipperRef::new_default(); diff --git a/integration-tests/internal/mapping/lib.rs b/integration-tests/internal/mapping/lib.rs index cf59d8dc87d..ac222ad8931 100755 --- a/integration-tests/internal/mapping/lib.rs +++ b/integration-tests/internal/mapping/lib.rs @@ -149,7 +149,7 @@ mod mapping { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn insert_and_get_works( + async fn insert_and_get_works( mut client: Client, ) -> E2EResult<()> { // given @@ -185,7 +185,7 @@ mod mapping { } #[ink_e2e::test] - async fn insert_and_contains_works( + async fn insert_and_contains_works( mut client: Client, ) -> E2EResult<()> { // given @@ -215,7 +215,7 @@ mod mapping { } #[ink_e2e::test] - async fn reinsert_works(mut client: Client) -> E2EResult<()> { + async fn reinsert_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = MappingsRef::new(); let contract = client @@ -258,7 +258,7 @@ mod mapping { } #[ink_e2e::test] - async fn insert_and_remove_works( + async fn insert_and_remove_works( mut client: Client, ) -> E2EResult<()> { // given @@ -300,7 +300,7 @@ mod mapping { } #[ink_e2e::test] - async fn insert_and_take_works( + async fn insert_and_take_works( mut client: Client, ) -> E2EResult<()> { // given @@ -346,7 +346,7 @@ mod mapping { #[ignore] #[ink_e2e::test] - async fn fallible_storage_methods_work( + async fn fallible_storage_methods_work( mut client: Client, ) -> E2EResult<()> { // Makes testing the fallible storage methods more efficient diff --git a/integration-tests/internal/misc-evm-getters-hostfns/lib.rs b/integration-tests/internal/misc-evm-getters-hostfns/lib.rs index 24109cbb7bb..0a5125bfa75 100644 --- a/integration-tests/internal/misc-evm-getters-hostfns/lib.rs +++ b/integration-tests/internal/misc-evm-getters-hostfns/lib.rs @@ -73,7 +73,7 @@ mod misc_evm_getters_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_chain_id_works( + async fn e2e_chain_id_works( mut client: Client, ) -> E2EResult<()> { // given @@ -103,7 +103,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_balance_of_works( + async fn e2e_balance_of_works( mut client: Client, ) -> E2EResult<()> { // given @@ -133,7 +133,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_base_fee_works( + async fn e2e_base_fee_works( mut client: Client, ) -> E2EResult<()> { // given @@ -163,7 +163,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_origin_works( + async fn e2e_origin_works( mut client: Client, ) -> E2EResult<()> { // given @@ -196,7 +196,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_code_size_works( + async fn e2e_code_size_works( mut client: Client, ) -> E2EResult<()> { // given @@ -226,7 +226,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_block_hash_works( + async fn e2e_block_hash_works( mut client: Client, ) -> E2EResult<()> { // given @@ -257,7 +257,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_block_author_works( + async fn e2e_block_author_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/misc-hostfns/lib.rs b/integration-tests/internal/misc-hostfns/lib.rs index eb94943ed9c..c55eeafdccb 100755 --- a/integration-tests/internal/misc-hostfns/lib.rs +++ b/integration-tests/internal/misc-hostfns/lib.rs @@ -60,7 +60,7 @@ mod misc_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_addr_account_id_works( + async fn e2e_addr_account_id_works( mut client: Client, ) -> E2EResult<()> { // given @@ -88,7 +88,7 @@ mod misc_hostfns { } #[ink_e2e::test] - async fn e2e_is_contract_works( + async fn e2e_is_contract_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/overflow-safety/lib.rs b/integration-tests/internal/overflow-safety/lib.rs index 6dae7798da5..0977b1a58c4 100644 --- a/integration-tests/internal/overflow-safety/lib.rs +++ b/integration-tests/internal/overflow-safety/lib.rs @@ -73,7 +73,7 @@ pub mod overflow_safety { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn add_no_overflow_works( + async fn add_no_overflow_works( mut client: Client, ) -> E2EResult<()> { // given @@ -98,7 +98,7 @@ pub mod overflow_safety { } #[ink_e2e::test] - async fn add_with_overflow_reverts( + async fn add_with_overflow_reverts( mut client: Client, ) -> E2EResult<()> { // given @@ -119,7 +119,7 @@ pub mod overflow_safety { } #[ink_e2e::test] - async fn sub_no_overflow_works( + async fn sub_no_overflow_works( mut client: Client, ) -> E2EResult<()> { // given @@ -144,7 +144,7 @@ pub mod overflow_safety { } #[ink_e2e::test] - async fn sub_with_overflow_reverts( + async fn sub_with_overflow_reverts( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/internal/static-buffer/lib.rs b/integration-tests/internal/static-buffer/lib.rs index f299a5f5243..d7df6400cf5 100644 --- a/integration-tests/internal/static-buffer/lib.rs +++ b/integration-tests/internal/static-buffer/lib.rs @@ -67,7 +67,7 @@ pub mod static_buffer { } #[ink_e2e::test] - async fn e2e_run_out_of_buffer_memory( + async fn e2e_run_out_of_buffer_memory( mut client: Client, ) -> E2EResult<()> { // given @@ -97,7 +97,7 @@ pub mod static_buffer { } #[ink_e2e::test] - async fn buffer(mut client: Client) -> E2EResult<()> { + async fn buffer(mut client: Client) -> E2EResult<()> { // given assert_buffer_size(); let mut constructor = StaticBufferRef::new_default(); diff --git a/integration-tests/internal/system-precompile/lib.rs b/integration-tests/internal/system-precompile/lib.rs index 72e0d769bff..112b0432093 100755 --- a/integration-tests/internal/system-precompile/lib.rs +++ b/integration-tests/internal/system-precompile/lib.rs @@ -34,7 +34,7 @@ mod system_precompile { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn minimum_balance_works( + async fn minimum_balance_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/bytes/lib.rs b/integration-tests/public/bytes/lib.rs index aa0a4939222..02e321a4fbc 100644 --- a/integration-tests/public/bytes/lib.rs +++ b/integration-tests/public/bytes/lib.rs @@ -128,7 +128,7 @@ pub mod bytes { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn fixed_bytes_works( + async fn fixed_bytes_works( mut client: Client, ) -> E2EResult<()> { // given @@ -171,7 +171,7 @@ pub mod bytes { } #[ink_e2e::test] - async fn dyn_bytes_works( + async fn dyn_bytes_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/contract-invocation/lib.rs b/integration-tests/public/contract-invocation/lib.rs index 9a7188affb4..d5aaccf96e9 100644 --- a/integration-tests/public/contract-invocation/lib.rs +++ b/integration-tests/public/contract-invocation/lib.rs @@ -427,7 +427,7 @@ mod instantiate_contract { } #[ink_e2e::test] - async fn test_invoke_delegate_e2e( + async fn test_invoke_delegate_e2e( mut client: Client, ) -> E2EResult<()> { let origin = client diff --git a/integration-tests/public/contract-storage/e2e_tests.rs b/integration-tests/public/contract-storage/e2e_tests.rs index 684d740d83c..0e59a0d5485 100644 --- a/integration-tests/public/contract-storage/e2e_tests.rs +++ b/integration-tests/public/contract-storage/e2e_tests.rs @@ -4,7 +4,7 @@ use ink_e2e::ContractsBackend; type E2EResult = std::result::Result>; #[ink_e2e::test] -async fn get_contract_storage_consumes_entire_buffer( +async fn get_contract_storage_consumes_entire_buffer( mut client: Client, ) -> E2EResult<()> { // given @@ -33,7 +33,7 @@ async fn get_contract_storage_consumes_entire_buffer( } #[ink_e2e::test] -async fn get_contract_storage_fails_when_extra_data( +async fn get_contract_storage_fails_when_extra_data( mut client: Client, ) -> E2EResult<()> { // given @@ -63,7 +63,7 @@ async fn get_contract_storage_fails_when_extra_data( } #[ink_e2e::test] -async fn take_contract_storage_consumes_entire_buffer( +async fn take_contract_storage_consumes_entire_buffer( mut client: Client, ) -> E2EResult<()> { // given @@ -92,7 +92,7 @@ async fn take_contract_storage_consumes_entire_buffer( } #[ink_e2e::test] -async fn take_contract_storage_fails_when_extra_data( +async fn take_contract_storage_fails_when_extra_data( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/contract-terminate/lib.rs b/integration-tests/public/contract-terminate/lib.rs index 41632a4892e..4a2f718c76f 100644 --- a/integration-tests/public/contract-terminate/lib.rs +++ b/integration-tests/public/contract-terminate/lib.rs @@ -57,7 +57,7 @@ pub mod just_terminates { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_contract_terminates( + async fn e2e_contract_terminates( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/contract-transfer/lib.rs b/integration-tests/public/contract-transfer/lib.rs index abce84a31bc..bafdbbc25d7 100644 --- a/integration-tests/public/contract-transfer/lib.rs +++ b/integration-tests/public/contract-transfer/lib.rs @@ -190,7 +190,7 @@ pub mod give_me { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_sending_value_to_give_me_must_fail( + async fn e2e_sending_value_to_give_me_must_fail( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/contract-xcm/lib.rs b/integration-tests/public/contract-xcm/lib.rs index bf767dfedcd..a50f10504a0 100644 --- a/integration-tests/public/contract-xcm/lib.rs +++ b/integration-tests/public/contract-xcm/lib.rs @@ -166,7 +166,7 @@ mod contract_xcm { type E2EResult = Result>; #[ink_e2e::test] - async fn xcm_execute_works( + async fn xcm_execute_works( mut client: Client, ) -> E2EResult<()> { // given @@ -217,7 +217,7 @@ mod contract_xcm { } #[ink_e2e::test] - async fn xcm_execute_failure_detection_works( + async fn xcm_execute_failure_detection_works( mut client: Client, ) -> E2EResult<()> { // todo @cmichi: This sleep is necessary until we have our `ink-node` @@ -257,7 +257,7 @@ mod contract_xcm { } #[ink_e2e::test] - async fn xcm_send_works(mut client: Client) -> E2EResult<()> { + async fn xcm_send_works(mut client: Client) -> E2EResult<()> { // todo @cmichi: This sleep is necessary until we have our `ink-node` // support a parachain/relaychain setup. For the moment we use the // Rococo runtime for testing the examples locally. That runtime diff --git a/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs b/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs index ff578d7edbb..511e6ca241d 100644 --- a/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs +++ b/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs @@ -4,7 +4,7 @@ use ink_e2e::ContractsBackend; type E2EResult = std::result::Result>; #[ink_e2e::test] -async fn instantiate_with_insufficient_storage_deposit_limit( +async fn instantiate_with_insufficient_storage_deposit_limit( mut client: Client, ) -> E2EResult<()> { // given @@ -43,7 +43,7 @@ async fn instantiate_with_insufficient_storage_deposit_limit } #[ink_e2e::test] -async fn instantiate_with_sufficient_limits( +async fn instantiate_with_sufficient_limits( mut client: Client, ) -> E2EResult<()> { // given @@ -80,7 +80,7 @@ async fn instantiate_with_sufficient_limits( } #[ink_e2e::test] -async fn instantiate_no_limits(mut client: Client) -> E2EResult<()> { +async fn instantiate_no_limits(mut client: Client) -> E2EResult<()> { // given let other_contract_code = client .upload("other-contract", &ink_e2e::alice()) @@ -105,7 +105,7 @@ async fn instantiate_no_limits(mut client: Client) -> E2ERes } #[ink_e2e::test] -async fn flip_and_get(mut client: Client) -> E2EResult<()> { +async fn flip_and_get(mut client: Client) -> E2EResult<()> { // given let other_contract_code = client .upload("other-contract", &ink_e2e::alice()) diff --git a/integration-tests/public/cross-contract-calls/e2e_tests.rs b/integration-tests/public/cross-contract-calls/e2e_tests.rs index 33f54de7d41..b658bb8fd4b 100644 --- a/integration-tests/public/cross-contract-calls/e2e_tests.rs +++ b/integration-tests/public/cross-contract-calls/e2e_tests.rs @@ -5,7 +5,7 @@ use other_contract::OtherContractRef; type E2EResult = std::result::Result>; #[ink_e2e::test] -async fn instantiate_no_limits(mut client: Client) -> E2EResult<()> { +async fn instantiate_no_limits(mut client: Client) -> E2EResult<()> { // given let mut other_constructor = OtherContractRef::new(true); let other_contract = client @@ -28,7 +28,7 @@ async fn instantiate_no_limits(mut client: Client) -> E2ERes } #[ink_e2e::test] -async fn flip_and_get(mut client: Client) -> E2EResult<()> { +async fn flip_and_get(mut client: Client) -> E2EResult<()> { // given let mut other_constructor = OtherContractRef::new(true); let other_contract = client diff --git a/integration-tests/public/custom-allocator/lib.rs b/integration-tests/public/custom-allocator/lib.rs index 81970fa694f..f77aec9ffe0 100755 --- a/integration-tests/public/custom-allocator/lib.rs +++ b/integration-tests/public/custom-allocator/lib.rs @@ -169,7 +169,7 @@ mod custom_allocator { /// We test that we can upload and instantiate the contract using its default /// constructor. #[ink_e2e::test] - async fn default_works(mut client: Client) -> E2EResult<()> { + async fn default_works(mut client: Client) -> E2EResult<()> { // Given let mut constructor = CustomAllocatorRef::default(); @@ -191,7 +191,7 @@ mod custom_allocator { /// We test that we can read and write a value from the on-chain contract. #[ink_e2e::test] - async fn it_works(mut client: Client) -> E2EResult<()> { + async fn it_works(mut client: Client) -> E2EResult<()> { // Given let mut constructor = CustomAllocatorRef::new(false); let contract = client diff --git a/integration-tests/public/custom-environment/lib.rs b/integration-tests/public/custom-environment/lib.rs index 495ffe5ed68..77504923e03 100644 --- a/integration-tests/public/custom-environment/lib.rs +++ b/integration-tests/public/custom-environment/lib.rs @@ -87,7 +87,7 @@ mod runtime_call { #[cfg(feature = "permissive-node")] #[ink_e2e::test(environment = crate::EnvironmentWithManyTopics)] - async fn calling_custom_environment_works( + async fn calling_custom_environment_works( mut client: Client, ) -> E2EResult<()> { // given @@ -116,9 +116,7 @@ mod runtime_call { #[cfg(not(feature = "permissive-node"))] #[ink_e2e::test(environment = crate::EnvironmentWithManyTopics)] - async fn calling_custom_environment_fails_if_incompatible_with_node< - Client: E2EBackend, - >( + async fn calling_custom_environment_fails_if_incompatible_with_node( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/debugging-strategies/lib.rs b/integration-tests/public/debugging-strategies/lib.rs index 9a6a8af81fa..cfd69404f39 100755 --- a/integration-tests/public/debugging-strategies/lib.rs +++ b/integration-tests/public/debugging-strategies/lib.rs @@ -121,7 +121,7 @@ mod debugging_strategies { /// we can have code in the contract that is utilized purely /// for testing, but not for release builds. #[ink_e2e::test(features = ["debug"])] - async fn e2e_debugging_event_emitted( + async fn e2e_debugging_event_emitted( mut client: Client, ) -> E2EResult<()> { // given @@ -156,7 +156,7 @@ mod debugging_strategies { /// This test illustrates how to decode a `Revive::ContractReverted`. #[ink_e2e::test(features = ["debug"])] - async fn e2e_decode_intentional_revert( + async fn e2e_decode_intentional_revert( mut client: Client, ) -> E2EResult<()> { // given @@ -185,7 +185,7 @@ mod debugging_strategies { /// This test illustrates how to decode a `Revive::ContractReverted`. #[ink_e2e::test] - async fn e2e_decode_revert( + async fn e2e_decode_revert( mut client: Client, ) -> E2EResult<()> { // given @@ -234,7 +234,7 @@ mod debugging_strategies { /// This test illustrates how to use the `pallet-revive` tracing functionality. #[ink_e2e::test] - async fn e2e_tracing(mut client: Client) -> E2EResult<()> { + async fn e2e_tracing(mut client: Client) -> E2EResult<()> { // given let mut constructor = DebuggingStrategiesRef::new(); let contract = client diff --git a/integration-tests/public/e2e-call-runtime/lib.rs b/integration-tests/public/e2e-call-runtime/lib.rs index c8d5a7e3704..0237a7265c1 100644 --- a/integration-tests/public/e2e-call-runtime/lib.rs +++ b/integration-tests/public/e2e-call-runtime/lib.rs @@ -32,7 +32,7 @@ pub mod e2e_call_runtime { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn call_runtime_works( + async fn call_runtime_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/erc20/lib.rs b/integration-tests/public/erc20/lib.rs index 25d738a15b0..fd41432384e 100644 --- a/integration-tests/public/erc20/lib.rs +++ b/integration-tests/public/erc20/lib.rs @@ -536,7 +536,7 @@ mod erc20 { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_transfer(mut client: Client) -> E2EResult<()> { + async fn e2e_transfer(mut client: Client) -> E2EResult<()> { // given let total_supply = U256::from(1_000_000_000); let mut constructor = Erc20Ref::new(total_supply); @@ -583,7 +583,7 @@ mod erc20 { } #[ink_e2e::test] - async fn e2e_allowances(mut client: Client) -> E2EResult<()> { + async fn e2e_allowances(mut client: Client) -> E2EResult<()> { // given let total_supply = U256::from(1_000_000_000); let mut constructor = Erc20Ref::new(total_supply); diff --git a/integration-tests/public/events/lib.rs b/integration-tests/public/events/lib.rs index 95d63361568..d9ab8dea0df 100644 --- a/integration-tests/public/events/lib.rs +++ b/integration-tests/public/events/lib.rs @@ -280,7 +280,7 @@ pub mod events { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn emits_foreign_event( + async fn emits_foreign_event( mut client: Client, ) -> E2EResult<()> { // given @@ -323,7 +323,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_inline_event( + async fn emits_inline_event( mut client: Client, ) -> E2EResult<()> { // given @@ -365,7 +365,7 @@ pub mod events { } #[ink_e2e::test()] - async fn emits_inline_anonymous_event( + async fn emits_inline_anonymous_event( mut client: Client, ) -> E2EResult<()> { use ink::env::hash::{ @@ -431,7 +431,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_none( + async fn emits_event_with_option_topic_none( mut client: Client, ) -> E2EResult<()> { // given @@ -478,7 +478,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_custom_signature_event( + async fn emits_custom_signature_event( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/fallible-setter/lib.rs b/integration-tests/public/fallible-setter/lib.rs index 5740ace7fcc..e32c487a4a4 100644 --- a/integration-tests/public/fallible-setter/lib.rs +++ b/integration-tests/public/fallible-setter/lib.rs @@ -90,7 +90,7 @@ pub mod fallible_setter { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn it_works(mut client: Client) -> E2EResult<()> { + async fn it_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = FallibleSetterRef::new(0); let contract = client diff --git a/integration-tests/public/flipper/lib.rs b/integration-tests/public/flipper/lib.rs index 60eec1b81c7..6018022feca 100644 --- a/integration-tests/public/flipper/lib.rs +++ b/integration-tests/public/flipper/lib.rs @@ -48,7 +48,7 @@ pub mod flipper { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn it_works(mut client: Client) -> E2EResult<()> { + async fn it_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = FlipperRef::new(false); let contract = client @@ -107,7 +107,7 @@ pub mod flipper { /// The test is marked as ignored, as it has the above pre-conditions to succeed. #[ink_e2e::test] #[ignore] - async fn e2e_test_deployed_contract( + async fn e2e_test_deployed_contract( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/lazyvec/lib.rs b/integration-tests/public/lazyvec/lib.rs index 54924d4ee51..191cd3f813b 100755 --- a/integration-tests/public/lazyvec/lib.rs +++ b/integration-tests/public/lazyvec/lib.rs @@ -96,7 +96,7 @@ mod lazyvec { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn create_and_vote( + async fn create_and_vote( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/multi-contract-caller/lib.rs b/integration-tests/public/multi-contract-caller/lib.rs index adcbfa5f0cc..6958e2bc3f9 100644 --- a/integration-tests/public/multi-contract-caller/lib.rs +++ b/integration-tests/public/multi-contract-caller/lib.rs @@ -126,7 +126,7 @@ mod multi_contract_caller { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_multi_contract_caller( + async fn e2e_multi_contract_caller( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs b/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs index f777728a27a..439c81614b0 100644 --- a/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs +++ b/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs @@ -63,7 +63,7 @@ mod e2e_tests { /// The test verifies that we can increment the value of the `Incrementer` contract /// through the `Caller` contract. #[ink_e2e::test] - async fn e2e_cross_contract_calls( + async fn e2e_cross_contract_calls( mut client: Client, ) -> E2EResult<()> { let _ = client diff --git a/integration-tests/public/upgradeable-contracts/delegator/lib.rs b/integration-tests/public/upgradeable-contracts/delegator/lib.rs index 7018a663d89..82e003965fa 100644 --- a/integration-tests/public/upgradeable-contracts/delegator/lib.rs +++ b/integration-tests/public/upgradeable-contracts/delegator/lib.rs @@ -132,7 +132,7 @@ pub mod delegator { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_counter_mutated( + async fn e2e_counter_mutated( mut client: Client, ) -> E2EResult<()> { // given @@ -203,7 +203,7 @@ pub mod delegator { } #[ink_e2e::test] - async fn e2e_mapping_mutated( + async fn e2e_mapping_mutated( mut client: Client, ) -> E2EResult<()> { let origin = client @@ -276,7 +276,7 @@ pub mod delegator { } #[ink_e2e::test] - async fn update_delegate( + async fn update_delegate( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/e2e_tests.rs b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/e2e_tests.rs index 89badcf3caa..cb419978fe4 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash-migration/e2e_tests.rs +++ b/integration-tests/public/upgradeable-contracts/set-code-hash-migration/e2e_tests.rs @@ -4,7 +4,7 @@ use ink_e2e::ContractsBackend; type E2EResult = std::result::Result>; #[ink_e2e::test] -async fn migration_works(mut client: Client) -> E2EResult<()> { +async fn migration_works(mut client: Client) -> E2EResult<()> { // Given let mut constructor = IncrementerRef::new(); let contract = client diff --git a/integration-tests/public/upgradeable-contracts/set-code-hash/lib.rs b/integration-tests/public/upgradeable-contracts/set-code-hash/lib.rs index 959544a9983..0ae182e99be 100644 --- a/integration-tests/public/upgradeable-contracts/set-code-hash/lib.rs +++ b/integration-tests/public/upgradeable-contracts/set-code-hash/lib.rs @@ -77,7 +77,7 @@ pub mod incrementer { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn set_code_works(mut client: Client) -> E2EResult<()> { + async fn set_code_works(mut client: Client) -> E2EResult<()> { // Given let mut constructor = IncrementerRef::new(); let contract = client diff --git a/integration-tests/public/wildcard-selector/lib.rs b/integration-tests/public/wildcard-selector/lib.rs index ddc4e1bf5e5..15ce016d6be 100644 --- a/integration-tests/public/wildcard-selector/lib.rs +++ b/integration-tests/public/wildcard-selector/lib.rs @@ -95,7 +95,7 @@ pub mod wildcard_selector { } #[ink_e2e::test(features = ["emit-event"])] - async fn arbitrary_selectors_handled_by_wildcard( + async fn arbitrary_selectors_handled_by_wildcard( mut client: Client, ) -> E2EResult<()> { // given @@ -167,7 +167,7 @@ pub mod wildcard_selector { } #[ink_e2e::test] - async fn wildcard_complement_works( + async fn wildcard_complement_works( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/solidity-abi/events/lib.rs b/integration-tests/solidity-abi/events/lib.rs index 239809fb292..e7505095a23 100644 --- a/integration-tests/solidity-abi/events/lib.rs +++ b/integration-tests/solidity-abi/events/lib.rs @@ -278,7 +278,7 @@ pub mod events { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn emits_foreign_event( + async fn emits_foreign_event( mut client: Client, ) -> E2EResult<()> { // given @@ -321,7 +321,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_some( + async fn emits_event_with_option_topic_some( mut client: Client, ) -> E2EResult<()> { // given @@ -371,7 +371,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_none( + async fn emits_event_with_option_topic_none( mut client: Client, ) -> E2EResult<()> { // given diff --git a/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs b/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs index 41fd75e351c..e6ffd2fba11 100644 --- a/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs +++ b/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs @@ -32,7 +32,7 @@ type E2EResult = Result>; // scripts. #[ignore] #[ink_e2e::test] -async fn solidity_calls_ink_works( +async fn solidity_calls_ink_works( mut client: Client, ) -> E2EResult<()> { let constructor = FlipperRef::new(false); diff --git a/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs b/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs index f777728a27a..439c81614b0 100644 --- a/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs +++ b/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs @@ -63,7 +63,7 @@ mod e2e_tests { /// The test verifies that we can increment the value of the `Incrementer` contract /// through the `Caller` contract. #[ink_e2e::test] - async fn e2e_cross_contract_calls( + async fn e2e_cross_contract_calls( mut client: Client, ) -> E2EResult<()> { let _ = client From 5f6cf9b15d71ebe0e501da59ff0ad40fd16afd1d Mon Sep 17 00:00:00 2001 From: Daanvdplas Date: Thu, 27 Nov 2025 13:59:09 -0300 Subject: [PATCH 5/5] fmt --- integration-tests/all-abi/events/lib.rs | 16 +++-------- .../internal/builtin-precompiles/lib.rs | 16 +++-------- .../internal/data-hostfns/lib.rs | 8 ++---- integration-tests/internal/gas-hostfns/lib.rs | 12 ++------ .../lang-err/constructors-return-value/lib.rs | 12 ++------ .../internal/lang-err/contract-ref/lib.rs | 4 +-- .../lang-err/integration-flipper/lib.rs | 8 ++---- integration-tests/internal/mapping/lib.rs | 20 ++++--------- .../internal/misc-evm-getters-hostfns/lib.rs | 28 +++++-------------- .../internal/misc-hostfns/lib.rs | 8 ++---- .../internal/overflow-safety/lib.rs | 16 +++-------- .../internal/static-buffer/lib.rs | 4 +-- .../internal/system-precompile/lib.rs | 4 +-- integration-tests/public/bytes/lib.rs | 8 ++---- .../public/contract-invocation/lib.rs | 4 +-- .../public/contract-storage/e2e_tests.rs | 4 +-- .../public/contract-terminate/lib.rs | 4 +-- integration-tests/public/contract-xcm/lib.rs | 4 +-- .../e2e_tests.rs | 4 +-- .../public/custom-environment/lib.rs | 4 +-- .../public/debugging-strategies/lib.rs | 12 ++------ .../public/e2e-call-runtime/lib.rs | 4 +-- integration-tests/public/events/lib.rs | 20 ++++--------- integration-tests/public/flipper/lib.rs | 4 +-- integration-tests/public/lazyvec/lib.rs | 4 +-- .../public/multi-contract-caller/lib.rs | 4 +-- .../trait-dyn-cross-contract-calls/lib.rs | 4 +-- .../upgradeable-contracts/delegator/lib.rs | 12 ++------ .../public/wildcard-selector/lib.rs | 4 +-- integration-tests/solidity-abi/events/lib.rs | 12 ++------ .../solidity-calls-flipper/e2e_tests.rs | 4 +-- .../trait-dyn-cross-contract-calls/lib.rs | 4 +-- 32 files changed, 69 insertions(+), 207 deletions(-) diff --git a/integration-tests/all-abi/events/lib.rs b/integration-tests/all-abi/events/lib.rs index bcc7b59f2bd..f5f8d5f2a26 100644 --- a/integration-tests/all-abi/events/lib.rs +++ b/integration-tests/all-abi/events/lib.rs @@ -447,9 +447,7 @@ pub mod events { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn emits_foreign_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_foreign_event(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -510,9 +508,7 @@ pub mod events { } #[ink_e2e::test()] - async fn emits_inline_anonymous_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_inline_anonymous_event(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -597,9 +593,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_some( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_event_with_option_topic_some(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -672,9 +666,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_none( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_event_with_option_topic_none(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); diff --git a/integration-tests/internal/builtin-precompiles/lib.rs b/integration-tests/internal/builtin-precompiles/lib.rs index b18bfbafbad..296568561ca 100755 --- a/integration-tests/internal/builtin-precompiles/lib.rs +++ b/integration-tests/internal/builtin-precompiles/lib.rs @@ -42,9 +42,7 @@ mod builtin_precompiles { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn bn128_add_works( - mut client: Client, - ) -> E2EResult<()> { + async fn bn128_add_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = BuiltinPrecompilesRef::new(); let contract = client @@ -76,9 +74,7 @@ mod builtin_precompiles { } #[ink_e2e::test] - async fn bn128_mul_works( - mut client: Client, - ) -> E2EResult<()> { + async fn bn128_mul_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = BuiltinPrecompilesRef::new(); let contract = client @@ -110,9 +106,7 @@ mod builtin_precompiles { } #[ink_e2e::test] - async fn bn128_pairing_works( - mut client: Client, - ) -> E2EResult<()> { + async fn bn128_pairing_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = BuiltinPrecompilesRef::new(); let contract = client @@ -143,9 +137,7 @@ mod builtin_precompiles { } #[ink_e2e::test] - async fn bn128_pairing_zero_points_works( - mut client: Client, - ) -> E2EResult<()> { + async fn bn128_pairing_zero_points_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = BuiltinPrecompilesRef::new(); let contract = client diff --git a/integration-tests/internal/data-hostfns/lib.rs b/integration-tests/internal/data-hostfns/lib.rs index 589481a2d03..830e4ea0759 100644 --- a/integration-tests/internal/data-hostfns/lib.rs +++ b/integration-tests/internal/data-hostfns/lib.rs @@ -33,9 +33,7 @@ mod data_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_call_data_size_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_call_data_size_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -63,9 +61,7 @@ mod data_hostfns { } #[ink_e2e::test] - async fn e2e_return_data_size_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_return_data_size_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( diff --git a/integration-tests/internal/gas-hostfns/lib.rs b/integration-tests/internal/gas-hostfns/lib.rs index fc85e1c3feb..01f547e6a51 100644 --- a/integration-tests/internal/gas-hostfns/lib.rs +++ b/integration-tests/internal/gas-hostfns/lib.rs @@ -39,9 +39,7 @@ mod gas_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_gas_limit_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_gas_limit_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate("gas_hostfns", &ink_e2e::alice(), &mut GasHostfnsRef::new()) @@ -65,9 +63,7 @@ mod gas_hostfns { } #[ink_e2e::test] - async fn e2e_gas_price_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_gas_price_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate("gas_hostfns", &ink_e2e::alice(), &mut GasHostfnsRef::new()) @@ -91,9 +87,7 @@ mod gas_hostfns { } #[ink_e2e::test] - async fn e2e_gas_left_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_gas_left_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate("gas_hostfns", &ink_e2e::alice(), &mut GasHostfnsRef::new()) diff --git a/integration-tests/internal/lang-err/constructors-return-value/lib.rs b/integration-tests/internal/lang-err/constructors-return-value/lib.rs index aa1fa03795b..08fc6fcbc49 100644 --- a/integration-tests/internal/lang-err/constructors-return-value/lib.rs +++ b/integration-tests/internal/lang-err/constructors-return-value/lib.rs @@ -116,9 +116,7 @@ pub mod constructors_return_value { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_infallible_constructor( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_infallible_constructor(mut client: Client) -> E2EResult<()> { let mut constructor = ConstructorsReturnValueRef::new(true); let infallible_constructor_result = client .instantiate( @@ -154,9 +152,7 @@ pub mod constructors_return_value { } #[ink_e2e::test] - async fn e2e_fallible_constructor_succeed( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_fallible_constructor_succeed(mut client: Client) -> E2EResult<()> { let mut constructor = ConstructorsReturnValueRef::try_new(true); let result = client .instantiate( @@ -205,9 +201,7 @@ pub mod constructors_return_value { } #[ink_e2e::test] - async fn e2e_fallible_constructor_fails( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_fallible_constructor_fails(mut client: Client) -> E2EResult<()> { let mut constructor = ConstructorsReturnValueRef::try_new(false); let result = client diff --git a/integration-tests/internal/lang-err/contract-ref/lib.rs b/integration-tests/internal/lang-err/contract-ref/lib.rs index 8734f09c173..98d5a84ef97 100755 --- a/integration-tests/internal/lang-err/contract-ref/lib.rs +++ b/integration-tests/internal/lang-err/contract-ref/lib.rs @@ -82,9 +82,7 @@ mod contract_ref { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_ref_can_flip_correctly( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_ref_can_flip_correctly(mut client: Client) -> E2EResult<()> { let flipper_hash = client .upload("integration_flipper", &ink_e2e::alice()) .submit() diff --git a/integration-tests/internal/lang-err/integration-flipper/lib.rs b/integration-tests/internal/lang-err/integration-flipper/lib.rs index aa6e671d078..3c8bba46940 100644 --- a/integration-tests/internal/lang-err/integration-flipper/lib.rs +++ b/integration-tests/internal/lang-err/integration-flipper/lib.rs @@ -67,9 +67,7 @@ pub mod integration_flipper { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_can_flip_correctly( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_can_flip_correctly(mut client: Client) -> E2EResult<()> { let mut constructor = FlipperRef::new_default(); let flipper = client .instantiate("integration_flipper", &ink_e2e::alice(), &mut constructor) @@ -107,9 +105,7 @@ pub mod integration_flipper { } #[ink_e2e::test] - async fn e2e_message_error_reverts_state( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_message_error_reverts_state(mut client: Client) -> E2EResult<()> { let mut constructor = FlipperRef::new_default(); let flipper = client .instantiate("integration_flipper", &ink_e2e::bob(), &mut constructor) diff --git a/integration-tests/internal/mapping/lib.rs b/integration-tests/internal/mapping/lib.rs index ac222ad8931..fabef7c07d4 100755 --- a/integration-tests/internal/mapping/lib.rs +++ b/integration-tests/internal/mapping/lib.rs @@ -149,9 +149,7 @@ mod mapping { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn insert_and_get_works( - mut client: Client, - ) -> E2EResult<()> { + async fn insert_and_get_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = MappingsRef::new(); let contract = client @@ -185,9 +183,7 @@ mod mapping { } #[ink_e2e::test] - async fn insert_and_contains_works( - mut client: Client, - ) -> E2EResult<()> { + async fn insert_and_contains_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = MappingsRef::new(); let contract = client @@ -258,9 +254,7 @@ mod mapping { } #[ink_e2e::test] - async fn insert_and_remove_works( - mut client: Client, - ) -> E2EResult<()> { + async fn insert_and_remove_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = MappingsRef::new(); let contract = client @@ -300,9 +294,7 @@ mod mapping { } #[ink_e2e::test] - async fn insert_and_take_works( - mut client: Client, - ) -> E2EResult<()> { + async fn insert_and_take_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = MappingsRef::new(); let contract = client @@ -346,9 +338,7 @@ mod mapping { #[ignore] #[ink_e2e::test] - async fn fallible_storage_methods_work( - mut client: Client, - ) -> E2EResult<()> { + async fn fallible_storage_methods_work(mut client: Client) -> E2EResult<()> { // Makes testing the fallible storage methods more efficient const ERR: &str = "For this test the env variable `INK_STATIC_BUFFER_SIZE` needs to be set to `256`"; let buffer_size = std::env::var("INK_STATIC_BUFFER_SIZE") diff --git a/integration-tests/internal/misc-evm-getters-hostfns/lib.rs b/integration-tests/internal/misc-evm-getters-hostfns/lib.rs index 0a5125bfa75..1e6b82ab333 100644 --- a/integration-tests/internal/misc-evm-getters-hostfns/lib.rs +++ b/integration-tests/internal/misc-evm-getters-hostfns/lib.rs @@ -73,9 +73,7 @@ mod misc_evm_getters_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_chain_id_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_chain_id_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -103,9 +101,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_balance_of_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_balance_of_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -133,9 +129,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_base_fee_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_base_fee_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -163,9 +157,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_origin_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_origin_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -196,9 +188,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_code_size_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_code_size_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -226,9 +216,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_block_hash_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_block_hash_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -257,9 +245,7 @@ mod misc_evm_getters_hostfns { } #[ink_e2e::test] - async fn e2e_block_author_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_block_author_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( diff --git a/integration-tests/internal/misc-hostfns/lib.rs b/integration-tests/internal/misc-hostfns/lib.rs index c55eeafdccb..247a10b5f21 100755 --- a/integration-tests/internal/misc-hostfns/lib.rs +++ b/integration-tests/internal/misc-hostfns/lib.rs @@ -60,9 +60,7 @@ mod misc_hostfns { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_addr_account_id_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_addr_account_id_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate( @@ -88,9 +86,7 @@ mod misc_hostfns { } #[ink_e2e::test] - async fn e2e_is_contract_works( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_is_contract_works(mut client: Client) -> E2EResult<()> { // given let contract = client .instantiate("misc_hostfns", &ink_e2e::bob(), &mut MiscHostfnsRef::new()) diff --git a/integration-tests/internal/overflow-safety/lib.rs b/integration-tests/internal/overflow-safety/lib.rs index 0977b1a58c4..1feb4fe7c2b 100644 --- a/integration-tests/internal/overflow-safety/lib.rs +++ b/integration-tests/internal/overflow-safety/lib.rs @@ -73,9 +73,7 @@ pub mod overflow_safety { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn add_no_overflow_works( - mut client: Client, - ) -> E2EResult<()> { + async fn add_no_overflow_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = OverflowSafetyRef::new(); let contract = client @@ -98,9 +96,7 @@ pub mod overflow_safety { } #[ink_e2e::test] - async fn add_with_overflow_reverts( - mut client: Client, - ) -> E2EResult<()> { + async fn add_with_overflow_reverts(mut client: Client) -> E2EResult<()> { // given let mut constructor = OverflowSafetyRef::new(); let contract = client @@ -119,9 +115,7 @@ pub mod overflow_safety { } #[ink_e2e::test] - async fn sub_no_overflow_works( - mut client: Client, - ) -> E2EResult<()> { + async fn sub_no_overflow_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = OverflowSafetyRef::new(); let contract = client @@ -144,9 +138,7 @@ pub mod overflow_safety { } #[ink_e2e::test] - async fn sub_with_overflow_reverts( - mut client: Client, - ) -> E2EResult<()> { + async fn sub_with_overflow_reverts(mut client: Client) -> E2EResult<()> { // given let mut constructor = OverflowSafetyRef::new(); let contract = client diff --git a/integration-tests/internal/static-buffer/lib.rs b/integration-tests/internal/static-buffer/lib.rs index d7df6400cf5..e8cdc51ef6d 100644 --- a/integration-tests/internal/static-buffer/lib.rs +++ b/integration-tests/internal/static-buffer/lib.rs @@ -67,9 +67,7 @@ pub mod static_buffer { } #[ink_e2e::test] - async fn e2e_run_out_of_buffer_memory( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_run_out_of_buffer_memory(mut client: Client) -> E2EResult<()> { // given assert_buffer_size(); let mut constructor = StaticBufferRef::new(true); diff --git a/integration-tests/internal/system-precompile/lib.rs b/integration-tests/internal/system-precompile/lib.rs index 112b0432093..1fed4171401 100755 --- a/integration-tests/internal/system-precompile/lib.rs +++ b/integration-tests/internal/system-precompile/lib.rs @@ -34,9 +34,7 @@ mod system_precompile { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn minimum_balance_works( - mut client: Client, - ) -> E2EResult<()> { + async fn minimum_balance_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = SystemPrecompileRef::new(); let contract = client diff --git a/integration-tests/public/bytes/lib.rs b/integration-tests/public/bytes/lib.rs index 02e321a4fbc..ac434fe4824 100644 --- a/integration-tests/public/bytes/lib.rs +++ b/integration-tests/public/bytes/lib.rs @@ -128,9 +128,7 @@ pub mod bytes { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn fixed_bytes_works( - mut client: Client, - ) -> E2EResult<()> { + async fn fixed_bytes_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = BytesRef::new(); let contract = client @@ -171,9 +169,7 @@ pub mod bytes { } #[ink_e2e::test] - async fn dyn_bytes_works( - mut client: Client, - ) -> E2EResult<()> { + async fn dyn_bytes_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = BytesRef::new(); let contract = client diff --git a/integration-tests/public/contract-invocation/lib.rs b/integration-tests/public/contract-invocation/lib.rs index d5aaccf96e9..636dc2c39df 100644 --- a/integration-tests/public/contract-invocation/lib.rs +++ b/integration-tests/public/contract-invocation/lib.rs @@ -427,9 +427,7 @@ mod instantiate_contract { } #[ink_e2e::test] - async fn test_invoke_delegate_e2e( - mut client: Client, - ) -> E2EResult<()> { + async fn test_invoke_delegate_e2e(mut client: Client) -> E2EResult<()> { let origin = client .create_and_fund_account(&ink_e2e::alice(), 10_000_000_000_000) .await; diff --git a/integration-tests/public/contract-storage/e2e_tests.rs b/integration-tests/public/contract-storage/e2e_tests.rs index 0e59a0d5485..58040a43cb1 100644 --- a/integration-tests/public/contract-storage/e2e_tests.rs +++ b/integration-tests/public/contract-storage/e2e_tests.rs @@ -33,9 +33,7 @@ async fn get_contract_storage_consumes_entire_buffer( } #[ink_e2e::test] -async fn get_contract_storage_fails_when_extra_data( - mut client: Client, -) -> E2EResult<()> { +async fn get_contract_storage_fails_when_extra_data(mut client: Client) -> E2EResult<()> { // given let mut constructor = ContractStorageRef::new(); let contract = client diff --git a/integration-tests/public/contract-terminate/lib.rs b/integration-tests/public/contract-terminate/lib.rs index 4a2f718c76f..965813bd615 100644 --- a/integration-tests/public/contract-terminate/lib.rs +++ b/integration-tests/public/contract-terminate/lib.rs @@ -57,9 +57,7 @@ pub mod just_terminates { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_contract_terminates( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_contract_terminates(mut client: Client) -> E2EResult<()> { // given let mut constructor = JustTerminateRef::new(); let contract = client diff --git a/integration-tests/public/contract-xcm/lib.rs b/integration-tests/public/contract-xcm/lib.rs index a50f10504a0..0f3d8e5e4b9 100644 --- a/integration-tests/public/contract-xcm/lib.rs +++ b/integration-tests/public/contract-xcm/lib.rs @@ -166,9 +166,7 @@ mod contract_xcm { type E2EResult = Result>; #[ink_e2e::test] - async fn xcm_execute_works( - mut client: Client, - ) -> E2EResult<()> { + async fn xcm_execute_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = ContractXcmRef::new(); let contract = client diff --git a/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs b/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs index 511e6ca241d..245687a9338 100644 --- a/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs +++ b/integration-tests/public/cross-contract-calls-advanced/e2e_tests.rs @@ -43,9 +43,7 @@ async fn instantiate_with_insufficient_storage_deposit_limit( } #[ink_e2e::test] -async fn instantiate_with_sufficient_limits( - mut client: Client, -) -> E2EResult<()> { +async fn instantiate_with_sufficient_limits(mut client: Client) -> E2EResult<()> { // given let other_contract_code = client .upload("other-contract", &ink_e2e::alice()) diff --git a/integration-tests/public/custom-environment/lib.rs b/integration-tests/public/custom-environment/lib.rs index 77504923e03..52ad4034e0c 100644 --- a/integration-tests/public/custom-environment/lib.rs +++ b/integration-tests/public/custom-environment/lib.rs @@ -87,9 +87,7 @@ mod runtime_call { #[cfg(feature = "permissive-node")] #[ink_e2e::test(environment = crate::EnvironmentWithManyTopics)] - async fn calling_custom_environment_works( - mut client: Client, - ) -> E2EResult<()> { + async fn calling_custom_environment_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = TopicsRef::new(); let contract = client diff --git a/integration-tests/public/debugging-strategies/lib.rs b/integration-tests/public/debugging-strategies/lib.rs index cfd69404f39..5805d655c1c 100755 --- a/integration-tests/public/debugging-strategies/lib.rs +++ b/integration-tests/public/debugging-strategies/lib.rs @@ -121,9 +121,7 @@ mod debugging_strategies { /// we can have code in the contract that is utilized purely /// for testing, but not for release builds. #[ink_e2e::test(features = ["debug"])] - async fn e2e_debugging_event_emitted( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_debugging_event_emitted(mut client: Client) -> E2EResult<()> { // given let mut constructor = DebuggingStrategiesRef::new(); let contract = client @@ -156,9 +154,7 @@ mod debugging_strategies { /// This test illustrates how to decode a `Revive::ContractReverted`. #[ink_e2e::test(features = ["debug"])] - async fn e2e_decode_intentional_revert( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_decode_intentional_revert(mut client: Client) -> E2EResult<()> { // given let mut constructor = DebuggingStrategiesRef::new(); let contract = client @@ -185,9 +181,7 @@ mod debugging_strategies { /// This test illustrates how to decode a `Revive::ContractReverted`. #[ink_e2e::test] - async fn e2e_decode_revert( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_decode_revert(mut client: Client) -> E2EResult<()> { // given let mut constructor = DebuggingStrategiesRef::new(); let contract = client diff --git a/integration-tests/public/e2e-call-runtime/lib.rs b/integration-tests/public/e2e-call-runtime/lib.rs index 0237a7265c1..fa69b8b0103 100644 --- a/integration-tests/public/e2e-call-runtime/lib.rs +++ b/integration-tests/public/e2e-call-runtime/lib.rs @@ -32,9 +32,7 @@ pub mod e2e_call_runtime { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn call_runtime_works( - mut client: Client, - ) -> E2EResult<()> { + async fn call_runtime_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = ContractRef::new(); let contract = client diff --git a/integration-tests/public/events/lib.rs b/integration-tests/public/events/lib.rs index d9ab8dea0df..48420cf3e57 100644 --- a/integration-tests/public/events/lib.rs +++ b/integration-tests/public/events/lib.rs @@ -280,9 +280,7 @@ pub mod events { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn emits_foreign_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_foreign_event(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -323,9 +321,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_inline_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_inline_event(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -365,9 +361,7 @@ pub mod events { } #[ink_e2e::test()] - async fn emits_inline_anonymous_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_inline_anonymous_event(mut client: Client) -> E2EResult<()> { use ink::env::hash::{ Blake2x256, CryptoHash, @@ -431,9 +425,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_none( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_event_with_option_topic_none(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -478,9 +470,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_custom_signature_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_custom_signature_event(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); diff --git a/integration-tests/public/flipper/lib.rs b/integration-tests/public/flipper/lib.rs index 6018022feca..9ab3412ed19 100644 --- a/integration-tests/public/flipper/lib.rs +++ b/integration-tests/public/flipper/lib.rs @@ -107,9 +107,7 @@ pub mod flipper { /// The test is marked as ignored, as it has the above pre-conditions to succeed. #[ink_e2e::test] #[ignore] - async fn e2e_test_deployed_contract( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_test_deployed_contract(mut client: Client) -> E2EResult<()> { // given use ink::Address; let addr = std::env::var("CONTRACT_ADDR_HEX") diff --git a/integration-tests/public/lazyvec/lib.rs b/integration-tests/public/lazyvec/lib.rs index 191cd3f813b..8635334bd86 100755 --- a/integration-tests/public/lazyvec/lib.rs +++ b/integration-tests/public/lazyvec/lib.rs @@ -96,9 +96,7 @@ mod lazyvec { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn create_and_vote( - mut client: Client, - ) -> E2EResult<()> { + async fn create_and_vote(mut client: Client) -> E2EResult<()> { // given let mut constructor = LazyVectorRef::default(); let contract = client diff --git a/integration-tests/public/multi-contract-caller/lib.rs b/integration-tests/public/multi-contract-caller/lib.rs index 6958e2bc3f9..e86369943c6 100644 --- a/integration-tests/public/multi-contract-caller/lib.rs +++ b/integration-tests/public/multi-contract-caller/lib.rs @@ -126,9 +126,7 @@ mod multi_contract_caller { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_multi_contract_caller( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_multi_contract_caller(mut client: Client) -> E2EResult<()> { // given let accumulator_hash = client .upload("accumulator", &ink_e2e::alice()) diff --git a/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs b/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs index 439c81614b0..441828494b0 100644 --- a/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs +++ b/integration-tests/public/trait-dyn-cross-contract-calls/lib.rs @@ -63,9 +63,7 @@ mod e2e_tests { /// The test verifies that we can increment the value of the `Incrementer` contract /// through the `Caller` contract. #[ink_e2e::test] - async fn e2e_cross_contract_calls( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_cross_contract_calls(mut client: Client) -> E2EResult<()> { let _ = client .upload("trait-incrementer", &ink_e2e::alice()) .submit() diff --git a/integration-tests/public/upgradeable-contracts/delegator/lib.rs b/integration-tests/public/upgradeable-contracts/delegator/lib.rs index 82e003965fa..b5dd7d01184 100644 --- a/integration-tests/public/upgradeable-contracts/delegator/lib.rs +++ b/integration-tests/public/upgradeable-contracts/delegator/lib.rs @@ -132,9 +132,7 @@ pub mod delegator { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn e2e_counter_mutated( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_counter_mutated(mut client: Client) -> E2EResult<()> { // given let origin = client .create_and_fund_account(&ink_e2e::alice(), 10_000_000_000_000) @@ -203,9 +201,7 @@ pub mod delegator { } #[ink_e2e::test] - async fn e2e_mapping_mutated( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_mapping_mutated(mut client: Client) -> E2EResult<()> { let origin = client .create_and_fund_account(&ink_e2e::alice(), 10_000_000_000_000) .await; @@ -276,9 +272,7 @@ pub mod delegator { } #[ink_e2e::test] - async fn update_delegate( - mut client: Client, - ) -> E2EResult<()> { + async fn update_delegate(mut client: Client) -> E2EResult<()> { // given let origin = client .create_and_fund_account(&ink_e2e::alice(), 10_000_000_000_000) diff --git a/integration-tests/public/wildcard-selector/lib.rs b/integration-tests/public/wildcard-selector/lib.rs index 15ce016d6be..5bcdce5c493 100644 --- a/integration-tests/public/wildcard-selector/lib.rs +++ b/integration-tests/public/wildcard-selector/lib.rs @@ -167,9 +167,7 @@ pub mod wildcard_selector { } #[ink_e2e::test] - async fn wildcard_complement_works( - mut client: Client, - ) -> E2EResult<()> { + async fn wildcard_complement_works(mut client: Client) -> E2EResult<()> { // given let mut constructor = WildcardSelectorRef::new(); let contract_acc_id = client diff --git a/integration-tests/solidity-abi/events/lib.rs b/integration-tests/solidity-abi/events/lib.rs index e7505095a23..dd821d780bf 100644 --- a/integration-tests/solidity-abi/events/lib.rs +++ b/integration-tests/solidity-abi/events/lib.rs @@ -278,9 +278,7 @@ pub mod events { type E2EResult = std::result::Result>; #[ink_e2e::test] - async fn emits_foreign_event( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_foreign_event(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -321,9 +319,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_some( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_event_with_option_topic_some(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); @@ -371,9 +367,7 @@ pub mod events { } #[ink_e2e::test] - async fn emits_event_with_option_topic_none( - mut client: Client, - ) -> E2EResult<()> { + async fn emits_event_with_option_topic_none(mut client: Client) -> E2EResult<()> { // given let init_value = false; let mut constructor = EventsRef::new(init_value); diff --git a/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs b/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs index e6ffd2fba11..ba6d9072928 100644 --- a/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs +++ b/integration-tests/solidity-abi/solidity-calls-flipper/e2e_tests.rs @@ -32,9 +32,7 @@ type E2EResult = Result>; // scripts. #[ignore] #[ink_e2e::test] -async fn solidity_calls_ink_works( - mut client: Client, -) -> E2EResult<()> { +async fn solidity_calls_ink_works(mut client: Client) -> E2EResult<()> { let constructor = FlipperRef::new(false); let params = constructor .endowment(0u32.into()) diff --git a/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs b/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs index 439c81614b0..441828494b0 100644 --- a/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs +++ b/integration-tests/solidity-abi/trait-dyn-cross-contract-calls/lib.rs @@ -63,9 +63,7 @@ mod e2e_tests { /// The test verifies that we can increment the value of the `Incrementer` contract /// through the `Caller` contract. #[ink_e2e::test] - async fn e2e_cross_contract_calls( - mut client: Client, - ) -> E2EResult<()> { + async fn e2e_cross_contract_calls(mut client: Client) -> E2EResult<()> { let _ = client .upload("trait-incrementer", &ink_e2e::alice()) .submit()