diff --git a/runtime/integration-tests/src/evm/precompile.rs b/runtime/integration-tests/src/evm/precompile.rs index 835130af9f..26335f8c58 100644 --- a/runtime/integration-tests/src/evm/precompile.rs +++ b/runtime/integration-tests/src/evm/precompile.rs @@ -32,8 +32,8 @@ use parity_scale_codec::Encode; use runtime_common::{account_conversion::AccountConverter, evm::precompile::LP_AXELAR_GATEWAY}; use sp_core::{Get, H160, H256, U256}; use sp_runtime::traits::{BlakeTwo256, Hash}; +use staging_xcm::{v3::MultiLocation, VersionedMultiLocation}; use tokio::runtime::Handle; -use xcm::{v3::MultiLocation, VersionedMultiLocation}; use crate::{ chain::centrifuge::{ diff --git a/runtime/integration-tests/src/utils/accounts.rs b/runtime/integration-tests/src/utils/accounts.rs index d4cc842c72..3a0f563486 100644 --- a/runtime/integration-tests/src/utils/accounts.rs +++ b/runtime/integration-tests/src/utils/accounts.rs @@ -14,9 +14,9 @@ use std::collections::HashMap; -use cfg_primitives::Index; +use cfg_primitives::Nonce; use fudge::primitives::Chain; -use node_primitives::{AccountId as RelayAccountId, Index as RelayIndex}; +use polkadot_core_primitives::{AccountId as RelayAccountId, Nonce as RelayNonce}; pub use sp_core::sr25519; use sp_core::{ sr25519::{Pair, Public, Signature}, @@ -31,7 +31,7 @@ use crate::{ /// Struct that takes care of handling nonces for accounts pub struct NonceManager { - nonces: HashMap>, + nonces: HashMap>, } impl NonceManager { @@ -47,7 +47,7 @@ impl NonceManager { /// map. /// /// MUST be executed in an externalites provided env. - pub fn nonce(&mut self, chain: Chain, who: Keyring) -> Index { + pub fn nonce(&mut self, chain: Chain, who: Keyring) -> Nonce { self.nonces .entry(chain) .or_insert(HashMap::new()) @@ -56,13 +56,13 @@ impl NonceManager { .clone() } - fn nonce_from_chain(chain: Chain, who: Keyring) -> Index { + fn nonce_from_chain(chain: Chain, who: Keyring) -> Nonce { match chain { - Chain::Relay => nonce::( + Chain::Relay => nonce::( who.clone().to_account_id().into(), ), Chain::Para(id) => match id { - _ if id == PARA_ID => nonce::( + _ if id == PARA_ID => nonce::( who.clone().to_account_id().into() ), _ => unreachable!("Currently no nonces for chains differing from Relay and centrifuge are supported. Para ID {}", id) @@ -77,7 +77,7 @@ impl NonceManager { /// map. /// /// MUST be executed in an externalites provided env. - pub fn fetch_add(&mut self, chain: Chain, who: Keyring) -> Index { + pub fn fetch_add(&mut self, chain: Chain, who: Keyring) -> Nonce { let curr = self .nonces .entry(chain) @@ -105,10 +105,10 @@ impl NonceManager { /// Retrieves a nonce from the centrifuge state /// /// **NOTE: Usually one should use the TestEnv::nonce() api** -fn nonce_centrifuge(env: &TestEnv, who: Keyring) -> cfg_primitives::Index { +fn nonce_centrifuge(env: &TestEnv, who: Keyring) -> Nonce { env.centrifuge .with_state(|| { - nonce::( + nonce::( who.clone().to_account_id().into(), ) }) @@ -118,19 +118,19 @@ fn nonce_centrifuge(env: &TestEnv, who: Keyring) -> cfg_primitives::Index { /// Retrieves a nonce from the relay state /// /// **NOTE: Usually one should use the TestEnv::nonce() api** -fn nonce_relay(env: &TestEnv, who: Keyring) -> RelayIndex { +fn nonce_relay(env: &TestEnv, who: Keyring) -> RelayNonce { env.relay .with_state(|| { - nonce::(who.clone().to_account_id().into()) + nonce::(who.clone().to_account_id().into()) }) .expect("ESSENTIAL: Nonce must be retrievable.") } -fn nonce(who: AccountId) -> Index +fn nonce(who: AccountId) -> Nonce where Runtime: frame_system::Config, AccountId: Into<::AccountId>, - Index: From<::Index>, + Nonce: From<::Nonce>, { frame_system::Pallet::::account_nonce(who.into()).into() } diff --git a/runtime/integration-tests/src/utils/env.rs b/runtime/integration-tests/src/utils/env.rs index 1159ecc156..48f2a24f50 100644 --- a/runtime/integration-tests/src/utils/env.rs +++ b/runtime/integration-tests/src/utils/env.rs @@ -13,7 +13,7 @@ //! Utilities to create a relay-chain-parachain setup use std::collections::HashMap; -use cfg_primitives::{AuraId, BlockNumber, Index}; +use cfg_primitives::{AuraId, BlockNumber, Nonce}; use frame_support::traits::GenesisBuild; use frame_system::EventRecord; use fudge::{ @@ -31,7 +31,7 @@ use lazy_static::lazy_static; pub use macros::*; use parity_scale_codec::{Decode, Encode}; use polkadot_core_primitives::{Block as RelayBlock, Header as RelayHeader}; -use polkadot_parachain::primitives::Id as ParaId; +use polkadot_parachain_primitives::primitives::Id as ParaId; use polkadot_runtime_parachains::{configuration, configuration::HostConfiguration, dmp}; use sc_executor::{WasmExecutionMethod, WasmExecutor}; use sc_service::{TFullBackend, TFullClient, TaskManager}; @@ -548,7 +548,7 @@ impl TestEnv { /// Returns the next nonce to be used /// **WARN: Increases the nonce counter on `NonceManager** - fn fetch_add_nonce(&mut self, chain: Chain, who: Keyring) -> Index { + fn fetch_add_nonce(&mut self, chain: Chain, who: Keyring) -> Nonce { let manager = self.nonce_manager.clone(); self.with_state(chain, || { manager @@ -561,7 +561,7 @@ impl TestEnv { /// Returns the next nonce to be used. Does NOT increase counter in /// `NonceManager` - fn nonce(&mut self, chain: Chain, who: Keyring) -> Index { + fn nonce(&mut self, chain: Chain, who: Keyring) -> Nonce { let manager = self.nonce_manager.clone(); self.with_state(chain, || { manager diff --git a/runtime/integration-tests/src/utils/extrinsics.rs b/runtime/integration-tests/src/utils/extrinsics.rs index 1c84165317..5cf9c6a311 100644 --- a/runtime/integration-tests/src/utils/extrinsics.rs +++ b/runtime/integration-tests/src/utils/extrinsics.rs @@ -14,11 +14,12 @@ #![allow(unused)] use cfg_primitives::{ - AccountId as CentrifugeAccountId, Address as CentrifugeAddress, Index as CentrifugeIndex, + AccountId as CentrifugeAccountId, Address as CentrifugeAddress, Nonce as CentrifugeNonce, }; -use node_primitives::Index as RelayIndex; use parity_scale_codec::Encode; -use polkadot_core_primitives::{AccountId as RelayAccountId, BlockId as RelayBlockId}; +use polkadot_core_primitives::{ + AccountId as RelayAccountId, BlockId as RelayBlockId, Nonce as RelayNonce, +}; use sc_client_api::client::BlockBackend; use sp_core::H256; use sp_runtime::{ @@ -49,7 +50,7 @@ use crate::{ pub fn xt_centrifuge( env: &TestEnv, who: Keyring, - nonce: cfg_primitives::Index, + nonce: cfg_primitives::Nonce, call: centrifuge::RuntimeCall, ) -> Result> { let client = env.centrifuge.client(); @@ -77,7 +78,7 @@ pub fn xt_centrifuge( pub fn xt_relay( env: &TestEnv, who: Keyring, - nonce: RelayIndex, + nonce: RelayNonce, call: relay::RuntimeCall, ) -> Result> { let client = env.relay.client(); @@ -98,7 +99,7 @@ pub fn xt_relay( .map_err(|e| e.into()) } -fn signed_extra_centrifuge(nonce: cfg_primitives::Index) -> CentrifugeSignedExtra { +fn signed_extra_centrifuge(nonce: cfg_primitives::Nonce) -> CentrifugeSignedExtra { ( frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), @@ -114,7 +115,7 @@ fn signed_extra_centrifuge(nonce: cfg_primitives::Index) -> CentrifugeSignedExtr fn sign_centrifuge( who: Keyring, - nonce: cfg_primitives::Index, + nonce: cfg_primitives::Nonce, call: CentrifugeCall, spec_version: u32, tx_version: u32, @@ -143,7 +144,7 @@ fn sign_centrifuge( ) } -fn signed_extra_relay(nonce: RelayIndex) -> RelaySignedExtra { +fn signed_extra_relay(nonce: RelayNonce) -> RelaySignedExtra { ( frame_system::CheckNonZeroSender::::new(), frame_system::CheckSpecVersion::::new(), @@ -158,7 +159,7 @@ fn signed_extra_relay(nonce: RelayIndex) -> RelaySignedExtra { fn sign_relay( who: Keyring, - nonce: RelayIndex, + nonce: RelayNonce, call: RelayCall, spec_version: u32, tx_version: u32, @@ -190,10 +191,10 @@ fn sign_relay( /// /// **NOTE: Should not be used if the TesteEnv::sign_and_submit() interface is /// also used with the same `who` as the sender** -pub fn nonce_centrifuge(env: &TestEnv, who: Keyring) -> cfg_primitives::Index { +pub fn nonce_centrifuge(env: &TestEnv, who: Keyring) -> cfg_primitives::Nonce { env.centrifuge .with_state(|| { - nonce::( + nonce::( who.clone().to_account_id().into(), ) }) @@ -204,19 +205,19 @@ pub fn nonce_centrifuge(env: &TestEnv, who: Keyring) -> cfg_primitives::Index { /// /// **NOTE: Should not be used if the TesteEnv::sign_and_submit() interface is /// also used with the same `who` as the sender** -pub fn nonce_relay(env: &TestEnv, who: Keyring) -> RelayIndex { +pub fn nonce_relay(env: &TestEnv, who: Keyring) -> RelayNonce { env.relay .with_state(|| { - nonce::(who.clone().to_account_id().into()) + nonce::(who.clone().to_account_id().into()) }) .expect("ESSENTIAL: Nonce must be retrievable.") } -fn nonce(who: AccountId) -> Index +fn nonce(who: AccountId) -> Nonce where Runtime: frame_system::Config, AccountId: Into<::AccountId>, - Index: From<::Index>, + Nonce: From<::Nonce>, { frame_system::Pallet::::account_nonce(who.into()).into() }