diff --git a/crates/e2e/Cargo.toml b/crates/e2e/Cargo.toml index 0fb88001d6f..3705bf9cd28 100644 --- a/crates/e2e/Cargo.toml +++ b/crates/e2e/Cargo.toml @@ -21,6 +21,7 @@ ink_env = { version = "4.0.0-beta.1", path = "../env" } ink_primitives = { version = "4.0.0-beta.1", path = "../primitives" } contract-metadata = { version = "2.0.0-rc" } +funty = "2.0.0" impl-serde = { version = "0.3.1", default-features = false } jsonrpsee = { version = "0.16.0", features = ["ws-client"] } serde = { version = "1.0.137", default-features = false, features = ["derive"] } @@ -29,14 +30,14 @@ tokio = { version = "1.18.2", features = ["rt-multi-thread"] } log = { version = "0.4" } env_logger = { version = "0.10" } scale = { package = "parity-scale-codec", version = "3", default-features = false, features = ["derive", "full"] } -subxt = "0.25.0" +subxt = "0.26.0" # Substrate -pallet-contracts-primitives = "7.0.0" -sp-core = "7.0.0" -sp-keyring = "7.0.0" -sp-runtime = "7.0.0" -sp-weights = "4.0.0" +pallet-contracts-primitives = "12.0.0" +sp-core = "11.0.0" +sp-keyring = "12.0.0" +sp-runtime = "12.0.0" +sp-weights = "8.0.0" [dev-dependencies] # Required for the doctest of `MessageBuilder::call` diff --git a/crates/e2e/src/client.rs b/crates/e2e/src/client.rs index 6e725a870f1..9324c1eab5b 100644 --- a/crates/e2e/src/client.rs +++ b/crates/e2e/src/client.rs @@ -32,30 +32,22 @@ use ink_env::Environment; use ink_primitives::MessageResult; use sp_core::Pair; -use sp_runtime::traits::{ - IdentifyAccount, - Verify, -}; use std::{ collections::BTreeMap, fmt::Debug, path::Path, }; + use subxt::{ blocks::ExtrinsicEvents, + config::ExtrinsicParams, events::EventDetails, - ext::{ - bitvec::macros::internal::funty::Fundamental, - scale_value::{ - Composite, - Value, - ValueDef, - }, - }, - tx::{ - ExtrinsicParams, - PairSigner, + ext::scale_value::{ + Composite, + Value, + ValueDef, }, + tx::PairSigner, }; /// Result of a contract instantiation. @@ -103,6 +95,7 @@ where impl core::fmt::Debug for InstantiationResult where C: subxt::Config, + C::AccountId: Debug, E: Environment, ::AccountId: Debug, ::Balance: Debug, @@ -287,14 +280,10 @@ where impl Client where C: subxt::Config, - C::AccountId: Into + serde::de::DeserializeOwned, - C::Address: From, + C::AccountId: serde::de::DeserializeOwned, + C::AccountId: scale::Codec + Debug, C::Signature: From, - ::Signer: From, >::OtherParams: Default, - ::Signer: - From + IdentifyAccount, - sr25519::Signature: Into, E: Environment, E::AccountId: Debug, @@ -348,11 +337,12 @@ where ) -> Signer where E::Balance: Clone, - C::AccountId: Clone + core::fmt::Display, + C::AccountId: Clone + core::fmt::Display + core::fmt::Debug, + C::AccountId: From, { let (pair, _, _) = ::generate_with_phrase(None); - let account_id = - ::Signer::from(pair.public()).into_account(); + let pair_signer = PairSigner::::new(pair); + let account_id = pair_signer.account_id().to_owned(); for _ in 0..6 { let transfer_result = self @@ -380,7 +370,7 @@ where } } - PairSigner::new(pair) + pair_signer } /// This function extracts the metadata of the contract at the file path @@ -540,6 +530,8 @@ where /// Generate a unique salt based on the system time. fn salt() -> Vec { + use funty::Fundamental as _; + std::time::SystemTime::now() .duration_since(std::time::UNIX_EPOCH) .unwrap_or_else(|err| panic!("unable to get unix time: {err}")) @@ -660,7 +652,12 @@ where let dry_run = self .api - .call_dry_run(signer.account_id().clone(), &message, value, None) + .call_dry_run( + subxt::tx::Signer::account_id(signer).clone(), + &message, + value, + None, + ) .await; log_info(&format!("call dry run: {:?}", &dry_run.result)); log_info(&format!( @@ -732,7 +729,12 @@ where .api .client .storage() - .fetch_or_default(&account_addr, None) + .at(None) + .await + .unwrap_or_else(|err| { + panic!("unable to fetch balance: {:?}", err); + }) + .fetch_or_default(&account_addr) .await .unwrap_or_else(|err| { panic!("unable to fetch balance: {err:?}"); diff --git a/crates/e2e/src/default_accounts.rs b/crates/e2e/src/default_accounts.rs index 1e0b542411a..fe8349d8871 100644 --- a/crates/e2e/src/default_accounts.rs +++ b/crates/e2e/src/default_accounts.rs @@ -16,9 +16,7 @@ use super::{ AccountKeyring, - IdentifyAccount, PairSigner, - Verify, }; use sp_core::sr25519; @@ -33,9 +31,8 @@ macro_rules! default_account { pub fn $fn_name() -> PairSigner where C: subxt::Config, - ::Signer: From, C::Signature: From, - ::Signer: IdentifyAccount, + C::AccountId: From { PairSigner::new(AccountKeyring::$keyring_fn_name.pair()) } diff --git a/crates/e2e/src/lib.rs b/crates/e2e/src/lib.rs index ca867b5798d..f03f3f5bfd6 100644 --- a/crates/e2e/src/lib.rs +++ b/crates/e2e/src/lib.rs @@ -52,10 +52,6 @@ use pallet_contracts_primitives::{ ContractInstantiateResult, }; use sp_core::sr25519; -use sp_runtime::traits::{ - IdentifyAccount, - Verify, -}; use std::{ cell::RefCell, sync::Once, @@ -71,20 +67,22 @@ impl subxt::Config for SubstrateConfig { type Index = u32; type BlockNumber = u32; type Hash = sp_core::H256; - type Hashing = sp_runtime::traits::BlakeTwo256; - type AccountId = sp_runtime::AccountId32; + type Hasher = subxt::config::substrate::BlakeTwo256; + type AccountId = subxt::config::substrate::AccountId32; type Address = sp_runtime::MultiAddress; - type Header = - sp_runtime::generic::Header; + type Header = subxt::config::substrate::SubstrateHeader< + Self::BlockNumber, + subxt::config::substrate::BlakeTwo256, + >; type Signature = sp_runtime::MultiSignature; - type ExtrinsicParams = subxt::tx::SubstrateExtrinsicParams; + type ExtrinsicParams = subxt::config::substrate::SubstrateExtrinsicParams; } /// Default set of commonly used types by Polkadot nodes. #[cfg(feature = "std")] pub type PolkadotConfig = subxt::config::WithExtrinsicParams< SubstrateConfig, - subxt::tx::PolkadotExtrinsicParams, + subxt::config::polkadot::PolkadotExtrinsicParams, >; /// Signer that is used throughout the E2E testing. diff --git a/crates/e2e/src/xts.rs b/crates/e2e/src/xts.rs index fafe279b8e6..a5d94d30eba 100644 --- a/crates/e2e/src/xts.rs +++ b/crates/e2e/src/xts.rs @@ -18,9 +18,7 @@ use super::{ sr25519, ContractExecResult, ContractInstantiateResult, - IdentifyAccount, Signer, - Verify, }; use ink_env::Environment; @@ -41,7 +39,7 @@ use sp_core::{ use sp_weights::Weight; use subxt::{ blocks::ExtrinsicEvents, - tx::ExtrinsicParams, + config::ExtrinsicParams, OnlineClient, }; @@ -176,14 +174,10 @@ pub struct ContractsApi { impl ContractsApi where C: subxt::Config, - C::AccountId: Into + serde::de::DeserializeOwned, - >::OtherParams: Default, - + C::AccountId: serde::de::DeserializeOwned, + C::AccountId: scale::Codec, C::Signature: From, - ::Signer: From, - ::Signer: - From + IdentifyAccount, - sr25519::Signature: Into, + >::OtherParams: Default, E: Environment, E::Balance: scale::HasCompact + serde::Serialize, @@ -251,7 +245,7 @@ where ) -> ContractInstantiateResult { let code = Code::Upload(code); let call_request = RpcInstantiateRequest:: { - origin: signer.account_id().clone(), + origin: subxt::tx::Signer::account_id(signer).clone(), value, gas_limit: None, storage_deposit_limit, @@ -337,7 +331,7 @@ where storage_deposit_limit: Option, ) -> CodeUploadResult { let call_request = RpcCodeUploadRequest:: { - origin: signer.account_id().clone(), + origin: subxt::tx::Signer::account_id(signer).clone(), code, storage_deposit_limit, determinism: Determinism::Deterministic,