From e200b96cbe8f37dd8665dc49ab50fdec2bb0ee16 Mon Sep 17 00:00:00 2001 From: Juan Date: Fri, 14 Jul 2023 10:46:49 +0200 Subject: [PATCH] Replace Index for Nonce (#2740) * replace Index for Nonce * update lockfile for {"substrate", "polkadot"} --------- Co-authored-by: parity-processbot <> --- Cargo.lock | 1 + bridges/bin/runtime-common/src/integrity.rs | 4 ++-- bridges/bin/runtime-common/src/mock.rs | 8 ++++---- bridges/modules/grandpa/src/mock.rs | 4 ++-- bridges/modules/messages/src/mock.rs | 2 +- bridges/modules/parachains/src/mock.rs | 14 +++++++------- bridges/modules/relayers/src/mock.rs | 2 +- .../primitives/chain-bridge-hub-cumulus/src/lib.rs | 12 ++++++------ .../primitives/chain-bridge-hub-kusama/src/lib.rs | 2 +- .../chain-bridge-hub-polkadot/src/lib.rs | 2 +- .../primitives/chain-bridge-hub-rococo/src/lib.rs | 2 +- .../primitives/chain-bridge-hub-wococo/src/lib.rs | 2 +- bridges/primitives/chain-kusama/src/lib.rs | 2 +- bridges/primitives/chain-polkadot/src/lib.rs | 2 +- bridges/primitives/chain-rococo/src/lib.rs | 2 +- bridges/primitives/chain-wococo/src/lib.rs | 2 +- bridges/primitives/polkadot-core/src/lib.rs | 5 +---- bridges/primitives/runtime/src/chain.rs | 6 +++--- bridges/primitives/runtime/src/lib.rs | 2 +- pallets/collator-selection/src/mock.rs | 2 +- pallets/dmp-queue/src/lib.rs | 2 +- pallets/parachain-system/src/tests.rs | 2 +- pallets/xcmp-queue/src/mock.rs | 2 +- parachain-template/node/src/rpc.rs | 2 +- parachain-template/pallets/template/src/mock.rs | 2 +- parachain-template/runtime/src/lib.rs | 8 ++++---- parachains/common/src/impls.rs | 2 +- parachains/common/src/lib.rs | 2 +- .../runtimes/assets/asset-hub-kusama/src/lib.rs | 8 ++++---- .../runtimes/assets/asset-hub-polkadot/src/lib.rs | 8 ++++---- .../runtimes/assets/asset-hub-westend/src/lib.rs | 8 ++++---- .../bridge-hubs/bridge-hub-kusama/src/lib.rs | 8 ++++---- .../bridge-hubs/bridge-hub-polkadot/src/lib.rs | 8 ++++---- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 8 ++++---- .../collectives/collectives-polkadot/src/lib.rs | 8 ++++---- .../runtimes/contracts/contracts-rococo/src/lib.rs | 8 ++++---- .../runtimes/glutton/glutton-kusama/src/lib.rs | 8 ++++---- parachains/runtimes/starters/seedling/src/lib.rs | 4 ++-- parachains/runtimes/starters/shell/src/lib.rs | 4 ++-- parachains/runtimes/testing/penpal/src/lib.rs | 8 ++++---- .../runtimes/testing/rococo-parachain/src/lib.rs | 8 ++++---- polkadot-parachain/src/rpc.rs | 2 +- polkadot-parachain/src/service.rs | 2 +- test/runtime/src/lib.rs | 8 ++++---- 44 files changed, 103 insertions(+), 105 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f06c1e30d2..08745430e20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7223,6 +7223,7 @@ source = "git+https://github.com/paritytech/substrate?branch=polkadot-v1.0.0#b8d dependencies = [ "frame-support", "frame-system", + "pallet-asset-conversion", "pallet-transaction-payment", "parity-scale-codec", "scale-info", diff --git a/bridges/bin/runtime-common/src/integrity.rs b/bridges/bin/runtime-common/src/integrity.rs index a9e657049fc..1292a4fbaa3 100644 --- a/bridges/bin/runtime-common/src/integrity.rs +++ b/bridges/bin/runtime-common/src/integrity.rs @@ -30,7 +30,7 @@ use pallet_bridge_messages::WeightInfoExt as _; use sp_runtime::traits::SignedExtension; /// Macro that ensures that the runtime configuration and chain primitives crate are sharing -/// the same types (index, block number, hash, hasher, account id and header). +/// the same types (nonce, block number, hash, hasher, account id and header). #[macro_export] macro_rules! assert_chain_types( ( runtime: $r:path, this_chain: $this:path ) => { @@ -41,7 +41,7 @@ macro_rules! assert_chain_types( use frame_system::{Config as SystemConfig, pallet_prelude::*}; use static_assertions::assert_type_eq_all; - assert_type_eq_all!(<$r as SystemConfig>::Index, bp_runtime::IndexOf<$this>); + assert_type_eq_all!(<$r as SystemConfig>::Nonce, bp_runtime::NonceOf<$this>); assert_type_eq_all!(BlockNumberFor<$r>, bp_runtime::BlockNumberOf<$this>); assert_type_eq_all!(<$r as SystemConfig>::Hash, bp_runtime::HashOf<$this>); assert_type_eq_all!(<$r as SystemConfig>::Hashing, bp_runtime::HasherOf<$this>); diff --git a/bridges/bin/runtime-common/src/mock.rs b/bridges/bin/runtime-common/src/mock.rs index 322245aa0e8..f7e5fc7daa3 100644 --- a/bridges/bin/runtime-common/src/mock.rs +++ b/bridges/bin/runtime-common/src/mock.rs @@ -143,7 +143,7 @@ parameter_types! { impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = ThisChainHash; type Hashing = ThisChainHasher; @@ -317,7 +317,7 @@ impl Chain for ThisUnderlyingChain { type Hasher = ThisChainHasher; type AccountId = ThisChainAccountId; type Balance = ThisChainBalance; - type Index = u32; + type Nonce = u32; type Signature = sp_runtime::MultiSignature; fn max_extrinsic_size() -> u32 { @@ -356,7 +356,7 @@ impl Chain for BridgedUnderlyingChain { type Hasher = BridgedChainHasher; type AccountId = BridgedChainAccountId; type Balance = BridgedChainBalance; - type Index = u32; + type Nonce = u32; type Signature = sp_runtime::MultiSignature; fn max_extrinsic_size() -> u32 { @@ -381,7 +381,7 @@ impl Chain for BridgedUnderlyingParachain { type Hasher = BridgedChainHasher; type AccountId = BridgedChainAccountId; type Balance = BridgedChainBalance; - type Index = u32; + type Nonce = u32; type Signature = sp_runtime::MultiSignature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/modules/grandpa/src/mock.rs b/bridges/modules/grandpa/src/mock.rs index 2161b3e30aa..819875b870a 100644 --- a/bridges/modules/grandpa/src/mock.rs +++ b/bridges/modules/grandpa/src/mock.rs @@ -57,7 +57,7 @@ parameter_types! { impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; @@ -106,7 +106,7 @@ impl Chain for TestBridgedChain { type AccountId = AccountId; type Balance = u64; - type Index = u64; + type Nonce = u64; type Signature = Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/modules/messages/src/mock.rs b/bridges/modules/messages/src/mock.rs index b6dce22b636..62bc76c5e01 100644 --- a/bridges/modules/messages/src/mock.rs +++ b/bridges/modules/messages/src/mock.rs @@ -93,7 +93,7 @@ pub type DbWeight = RocksDbWeight; impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; diff --git a/bridges/modules/parachains/src/mock.rs b/bridges/modules/parachains/src/mock.rs index 38e897d5ae0..c72298a5e1d 100644 --- a/bridges/modules/parachains/src/mock.rs +++ b/bridges/modules/parachains/src/mock.rs @@ -53,7 +53,7 @@ impl Chain for Parachain1 { type Hasher = RegularParachainHasher; type AccountId = u64; type Balance = u64; - type Index = u64; + type Nonce = u64; type Signature = MultiSignature; fn max_extrinsic_size() -> u32 { @@ -76,7 +76,7 @@ impl Chain for Parachain2 { type Hasher = RegularParachainHasher; type AccountId = u64; type Balance = u64; - type Index = u64; + type Nonce = u64; type Signature = MultiSignature; fn max_extrinsic_size() -> u32 { @@ -99,7 +99,7 @@ impl Chain for Parachain3 { type Hasher = RegularParachainHasher; type AccountId = u64; type Balance = u64; - type Index = u64; + type Nonce = u64; type Signature = MultiSignature; fn max_extrinsic_size() -> u32 { @@ -125,7 +125,7 @@ impl Chain for BigParachain { type Hasher = RegularParachainHasher; type AccountId = u64; type Balance = u64; - type Index = u64; + type Nonce = u64; type Signature = MultiSignature; fn max_extrinsic_size() -> u32 { @@ -159,7 +159,7 @@ parameter_types! { impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = RegularParachainHasher; @@ -262,7 +262,7 @@ impl Chain for TestBridgedChain { type AccountId = AccountId; type Balance = u32; - type Index = u32; + type Nonce = u32; type Signature = sp_runtime::testing::TestSignature; fn max_extrinsic_size() -> u32 { @@ -292,7 +292,7 @@ impl Chain for OtherBridgedChain { type AccountId = AccountId; type Balance = u32; - type Index = u32; + type Nonce = u32; type Signature = sp_runtime::testing::TestSignature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/modules/relayers/src/mock.rs b/bridges/modules/relayers/src/mock.rs index b0987c5e380..e9ba058bc4c 100644 --- a/bridges/modules/relayers/src/mock.rs +++ b/bridges/modules/relayers/src/mock.rs @@ -63,7 +63,7 @@ parameter_types! { impl frame_system::Config for TestRuntime { type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; diff --git a/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs b/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs index d95bb90b795..f0826952209 100644 --- a/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs @@ -18,7 +18,7 @@ pub use bp_polkadot_core::{ AccountId, AccountInfoStorageMapKeyProvider, AccountPublic, Balance, Block, BlockNumber, Hash, - Hasher, Hashing, Header, Index, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic, + Hasher, Hashing, Header, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic, EXTRA_STORAGE_PROOF_SIZE, TX_EXTRA_BYTES, }; @@ -140,7 +140,7 @@ pub type SignedExtra = ( CheckTxVersion, CheckGenesis, CheckEra, - CheckNonce, + CheckNonce, CheckWeight, ChargeTransactionPayment, BridgeRejectObsoleteHeadersAndMessages, @@ -159,12 +159,12 @@ pub trait BridgeHubSignedExtension { transaction_version: u32, era: bp_runtime::TransactionEra, genesis_hash: Hash, - nonce: Index, + nonce: Nonce, tip: Balance, ) -> Self; /// Return transaction nonce. - fn nonce(&self) -> Index; + fn nonce(&self) -> Nonce; /// Return transaction tip. fn tip(&self) -> Balance; @@ -177,7 +177,7 @@ impl BridgeHubSignedExtension for SignedExtension { transaction_version: u32, era: bp_runtime::TransactionEra, genesis_hash: Hash, - nonce: Index, + nonce: Nonce, tip: Balance, ) -> Self { GenericSignedExtension::new( @@ -209,7 +209,7 @@ impl BridgeHubSignedExtension for SignedExtension { } /// Return transaction nonce. - fn nonce(&self) -> Index { + fn nonce(&self) -> Nonce { self.payload.5 .0 } diff --git a/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs b/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs index e253045946e..ac899256343 100644 --- a/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-kusama/src/lib.rs @@ -41,7 +41,7 @@ impl Chain for BridgeHubKusama { type Block = Block; type AccountId = AccountId; type Balance = Balance; - type Index = Index; + type Nonce = Nonce; type Signature = Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs b/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs index 9c0233ed787..76af4b943c4 100644 --- a/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs @@ -37,7 +37,7 @@ impl Chain for BridgeHubPolkadot { type Block = Block; type AccountId = AccountId; type Balance = Balance; - type Index = Index; + type Nonce = Nonce; type Signature = Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs index 80c8bbbdb48..a11bc6b8e1f 100644 --- a/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-rococo/src/lib.rs @@ -41,7 +41,7 @@ impl Chain for BridgeHubRococo { type Block = Block; type AccountId = AccountId; type Balance = Balance; - type Index = Index; + type Nonce = Nonce; type Signature = Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs index b71916276e8..71010695337 100644 --- a/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs +++ b/bridges/primitives/chain-bridge-hub-wococo/src/lib.rs @@ -37,7 +37,7 @@ impl Chain for BridgeHubWococo { type Block = Block; type AccountId = AccountId; type Balance = Balance; - type Index = Index; + type Nonce = Nonce; type Signature = Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-kusama/src/lib.rs b/bridges/primitives/chain-kusama/src/lib.rs index 9d82f3bb69d..e4b5d330354 100644 --- a/bridges/primitives/chain-kusama/src/lib.rs +++ b/bridges/primitives/chain-kusama/src/lib.rs @@ -34,7 +34,7 @@ impl Chain for Kusama { type AccountId = ::AccountId; type Balance = ::Balance; - type Index = ::Index; + type Nonce = ::Nonce; type Signature = ::Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-polkadot/src/lib.rs b/bridges/primitives/chain-polkadot/src/lib.rs index 1e165958293..b57486916d2 100644 --- a/bridges/primitives/chain-polkadot/src/lib.rs +++ b/bridges/primitives/chain-polkadot/src/lib.rs @@ -34,7 +34,7 @@ impl Chain for Polkadot { type AccountId = ::AccountId; type Balance = ::Balance; - type Index = ::Index; + type Nonce = ::Nonce; type Signature = ::Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-rococo/src/lib.rs b/bridges/primitives/chain-rococo/src/lib.rs index c07712f3866..b8a6b47b423 100644 --- a/bridges/primitives/chain-rococo/src/lib.rs +++ b/bridges/primitives/chain-rococo/src/lib.rs @@ -33,7 +33,7 @@ impl Chain for Rococo { type Hasher = ::Hasher; type AccountId = ::AccountId; type Balance = ::Balance; - type Index = ::Index; + type Nonce = ::Nonce; type Signature = ::Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/chain-wococo/src/lib.rs b/bridges/primitives/chain-wococo/src/lib.rs index 0383bc2775f..00653267e70 100644 --- a/bridges/primitives/chain-wococo/src/lib.rs +++ b/bridges/primitives/chain-wococo/src/lib.rs @@ -36,7 +36,7 @@ impl Chain for Wococo { type Hasher = ::Hasher; type AccountId = ::AccountId; type Balance = ::Balance; - type Index = ::Index; + type Nonce = ::Nonce; type Signature = ::Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/polkadot-core/src/lib.rs b/bridges/primitives/polkadot-core/src/lib.rs index b607c0a0b54..2f812a79538 100644 --- a/bridges/primitives/polkadot-core/src/lib.rs +++ b/bridges/primitives/polkadot-core/src/lib.rs @@ -181,9 +181,6 @@ pub type BlockNumber = u32; /// Hash type used in Polkadot-like chains. pub type Hash = ::Out; -/// Account Index (a.k.a. nonce). -pub type Index = u32; - /// Hashing type. pub type Hashing = BlakeTwo256; @@ -234,7 +231,7 @@ impl Chain for PolkadotLike { type Block = Block; type AccountId = AccountId; type Balance = Balance; - type Index = Index; + type Nonce = Nonce; type Signature = Signature; fn max_extrinsic_size() -> u32 { diff --git a/bridges/primitives/runtime/src/chain.rs b/bridges/primitives/runtime/src/chain.rs index b14dce50180..fa0d82311e3 100644 --- a/bridges/primitives/runtime/src/chain.rs +++ b/bridges/primitives/runtime/src/chain.rs @@ -147,7 +147,7 @@ pub trait Chain: Send + Sync + 'static { + TryFrom + MaxEncodedLen; /// Index of a transaction used by the chain. - type Index: Parameter + type Nonce: Parameter + Member + MaybeSerialize + Debug @@ -181,7 +181,7 @@ where type Block = ::Block; type AccountId = ::AccountId; type Balance = ::Balance; - type Index = ::Index; + type Nonce = ::Nonce; type Signature = ::Signature; fn max_extrinsic_size() -> u32 { @@ -237,7 +237,7 @@ pub type AccountIdOf = ::AccountId; pub type BalanceOf = ::Balance; /// Transaction index type used by the chain. -pub type IndexOf = ::Index; +pub type NonceOf = ::Nonce; /// Signature type used by the chain. pub type SignatureOf = ::Signature; diff --git a/bridges/primitives/runtime/src/lib.rs b/bridges/primitives/runtime/src/lib.rs index 1ce1b7a0eed..7ba20e11e22 100644 --- a/bridges/primitives/runtime/src/lib.rs +++ b/bridges/primitives/runtime/src/lib.rs @@ -31,7 +31,7 @@ use sp_std::{convert::TryFrom, fmt::Debug, ops::RangeInclusive, vec, vec::Vec}; pub use chain::{ AccountIdOf, AccountPublicOf, BalanceOf, BlockNumberOf, Chain, EncodedOrDecodedCall, HashOf, - HasherOf, HeaderOf, IndexOf, Parachain, ParachainIdOf, SignatureOf, TransactionEraOf, + HasherOf, HeaderOf, NonceOf, Parachain, ParachainIdOf, SignatureOf, TransactionEraOf, UnderlyingChainOf, UnderlyingChainProvider, }; pub use frame_support::storage::storage_prefix as storage_value_final_key; diff --git a/pallets/collator-selection/src/mock.rs b/pallets/collator-selection/src/mock.rs index ccc1401c1b0..7e8b1595d2c 100644 --- a/pallets/collator-selection/src/mock.rs +++ b/pallets/collator-selection/src/mock.rs @@ -57,7 +57,7 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; diff --git a/pallets/dmp-queue/src/lib.rs b/pallets/dmp-queue/src/lib.rs index 8bd2123936e..627124da994 100644 --- a/pallets/dmp-queue/src/lib.rs +++ b/pallets/dmp-queue/src/lib.rs @@ -455,7 +455,7 @@ mod tests { impl frame_system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; diff --git a/pallets/parachain-system/src/tests.rs b/pallets/parachain-system/src/tests.rs index ebf1a1b6f9d..5d259eabb72 100755 --- a/pallets/parachain-system/src/tests.rs +++ b/pallets/parachain-system/src/tests.rs @@ -71,7 +71,7 @@ parameter_types! { impl frame_system::Config for Test { type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; diff --git a/pallets/xcmp-queue/src/mock.rs b/pallets/xcmp-queue/src/mock.rs index e3e4edb083d..2c27568115f 100644 --- a/pallets/xcmp-queue/src/mock.rs +++ b/pallets/xcmp-queue/src/mock.rs @@ -61,7 +61,7 @@ impl frame_system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = AccountId; diff --git a/parachain-template/node/src/rpc.rs b/parachain-template/node/src/rpc.rs index 2bc5ccccf72..b5ca484fa48 100644 --- a/parachain-template/node/src/rpc.rs +++ b/parachain-template/node/src/rpc.rs @@ -7,7 +7,7 @@ use std::sync::Arc; -use parachain_template_runtime::{opaque::Block, AccountId, Balance, Index as Nonce}; +use parachain_template_runtime::{opaque::Block, AccountId, Balance, Nonce}; use sc_client_api::AuxStore; pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; diff --git a/parachain-template/pallets/template/src/mock.rs b/parachain-template/pallets/template/src/mock.rs index cdfbf3d7fd2..8fae1019f42 100644 --- a/parachain-template/pallets/template/src/mock.rs +++ b/parachain-template/pallets/template/src/mock.rs @@ -29,7 +29,7 @@ impl system::Config for Test { type DbWeight = (); type RuntimeOrigin = RuntimeOrigin; type RuntimeCall = RuntimeCall; - type Index = u64; + type Nonce = u64; type Hash = H256; type Hashing = BlakeTwo256; type AccountId = u64; diff --git a/parachain-template/runtime/src/lib.rs b/parachain-template/runtime/src/lib.rs index 87726f67ba7..761a3944afb 100644 --- a/parachain-template/runtime/src/lib.rs +++ b/parachain-template/runtime/src/lib.rs @@ -71,7 +71,7 @@ pub type AccountId = <::Signer as IdentifyAccount>::Account pub type Balance = u128; /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; @@ -269,7 +269,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -599,8 +599,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/common/src/impls.rs b/parachains/common/src/impls.rs index db48a1d9658..4a1f4f90d05 100644 --- a/parachains/common/src/impls.rs +++ b/parachains/common/src/impls.rs @@ -158,7 +158,7 @@ mod tests { impl frame_system::Config for Test { type BaseCallFilter = frame_support::traits::Everything; type RuntimeOrigin = RuntimeOrigin; - type Index = u64; + type Nonce = u64; type RuntimeCall = RuntimeCall; type Hash = H256; type Hashing = BlakeTwo256; diff --git a/parachains/common/src/lib.rs b/parachains/common/src/lib.rs index 46a8af0fb2e..0a9686bf8a3 100644 --- a/parachains/common/src/lib.rs +++ b/parachains/common/src/lib.rs @@ -43,7 +43,7 @@ mod types { pub type Balance = u128; /// Index of a transaction in the chain. - pub type Index = u32; + pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; diff --git a/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs b/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs index a22708605fb..87c9f71db9d 100644 --- a/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs +++ b/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs @@ -67,7 +67,7 @@ use pallet_nfts::PalletFeatures; pub use parachains_common as common; use parachains_common::{ impls::{AssetsToBlockAuthor, DealWithFees}, - AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Index, + AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; @@ -165,7 +165,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; - type Index = Index; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type Block = Block; @@ -935,8 +935,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs b/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs index e07767cea70..4ecf0f6466b 100644 --- a/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/assets/asset-hub-polkadot/src/lib.rs @@ -103,7 +103,7 @@ pub use parachains_common as common; use parachains_common::{ impls::{AssetsToBlockAuthor, DealWithFees}, AccountId, AssetHubPolkadotAuraId as AuraId, AssetIdForTrustBackedAssets, Balance, BlockNumber, - Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, + Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_config::{ @@ -183,7 +183,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; - type Index = Index; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type Block = Block; @@ -917,8 +917,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/assets/asset-hub-westend/src/lib.rs b/parachains/runtimes/assets/asset-hub-westend/src/lib.rs index f7cde77eeb0..15164b53823 100644 --- a/parachains/runtimes/assets/asset-hub-westend/src/lib.rs +++ b/parachains/runtimes/assets/asset-hub-westend/src/lib.rs @@ -53,7 +53,7 @@ use pallet_nfts::PalletFeatures; pub use parachains_common as common; use parachains_common::{ impls::DealWithFees, AccountId, AssetIdForTrustBackedAssets, AuraId, Balance, BlockNumber, - Hash, Header, Index, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, + Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use sp_api::impl_runtime_apis; @@ -147,7 +147,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; - type Index = Index; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type Block = Block; @@ -966,8 +966,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs index 49fb4737180..d2836bec59c 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs @@ -69,7 +69,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; @@ -180,7 +180,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -542,8 +542,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs index 4cd9e3da52e..403df659bba 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs @@ -70,7 +70,7 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use parachains_common::{ - impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; // XCM Imports @@ -180,7 +180,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -542,8 +542,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index ea69edf8250..460d6be6b97 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -87,7 +87,7 @@ use bridge_runtime_common::{ messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch}, }; use parachains_common::{ - impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, AccountId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; use xcm_executor::XcmExecutor; @@ -194,7 +194,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -723,8 +723,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs index 989dcc970b3..16494268158 100644 --- a/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs +++ b/parachains/runtimes/collectives/collectives-polkadot/src/lib.rs @@ -80,7 +80,7 @@ use frame_system::{ }; pub use parachains_common as common; use parachains_common::{ - impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, AccountId, AuraId, Balance, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, DAYS, HOURS, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; @@ -159,7 +159,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; - type Index = Index; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type Block = Block; @@ -761,8 +761,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs index 57a617e9246..a21d0360d0d 100644 --- a/parachains/runtimes/contracts/contracts-rococo/src/lib.rs +++ b/parachains/runtimes/contracts/contracts-rococo/src/lib.rs @@ -57,7 +57,7 @@ use frame_support::{ use frame_system::limits::{BlockLength, BlockWeights}; pub use parachains_common as common; use parachains_common::{ - impls::DealWithFees, AccountId, BlockNumber, Hash, Header, Index, Signature, + impls::DealWithFees, AccountId, BlockNumber, Hash, Header, Nonce, Signature, AVERAGE_ON_INITIALIZE_RATIO, MAXIMUM_BLOCK_WEIGHT, MINUTES, NORMAL_DISPATCH_RATIO, SLOT_DURATION, }; @@ -174,7 +174,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; - type Index = Index; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type Block = Block; @@ -484,8 +484,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/glutton/glutton-kusama/src/lib.rs b/parachains/runtimes/glutton/glutton-kusama/src/lib.rs index e759ec89ee6..d7db1d28801 100644 --- a/parachains/runtimes/glutton/glutton-kusama/src/lib.rs +++ b/parachains/runtimes/glutton/glutton-kusama/src/lib.rs @@ -142,7 +142,7 @@ impl frame_system::Config for Runtime { type AccountId = AccountId; type RuntimeCall = RuntimeCall; type Lookup = AccountIdLookup; - type Index = Index; + type Nonce = Nonce; type Hash = Hash; type Hashing = BlakeTwo256; type Block = Block; @@ -216,7 +216,7 @@ construct_runtime! { } /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; /// An index to a block. @@ -348,8 +348,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/starters/seedling/src/lib.rs b/parachains/runtimes/starters/seedling/src/lib.rs index 05932df2109..cc62e609a63 100644 --- a/parachains/runtimes/starters/seedling/src/lib.rs +++ b/parachains/runtimes/starters/seedling/src/lib.rs @@ -125,7 +125,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -194,7 +194,7 @@ construct_runtime! { } /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; /// An index to a block. diff --git a/parachains/runtimes/starters/shell/src/lib.rs b/parachains/runtimes/starters/shell/src/lib.rs index b29fac6415c..aa14c83fef0 100644 --- a/parachains/runtimes/starters/shell/src/lib.rs +++ b/parachains/runtimes/starters/shell/src/lib.rs @@ -133,7 +133,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -232,7 +232,7 @@ impl sp_runtime::traits::SignedExtension for DisallowSigned { } /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; /// An index to a block. diff --git a/parachains/runtimes/testing/penpal/src/lib.rs b/parachains/runtimes/testing/penpal/src/lib.rs index 95a6b986342..cdd559777ed 100644 --- a/parachains/runtimes/testing/penpal/src/lib.rs +++ b/parachains/runtimes/testing/penpal/src/lib.rs @@ -83,7 +83,7 @@ use xcm_executor::XcmExecutor; pub type Balance = u128; /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; @@ -317,7 +317,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -689,8 +689,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/parachains/runtimes/testing/rococo-parachain/src/lib.rs b/parachains/runtimes/testing/rococo-parachain/src/lib.rs index 2265f22f1a5..0c5ac5129a8 100644 --- a/parachains/runtimes/testing/rococo-parachain/src/lib.rs +++ b/parachains/runtimes/testing/rococo-parachain/src/lib.rs @@ -178,7 +178,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = AccountIdLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -587,7 +587,7 @@ construct_runtime! { /// Balance of an account. pub type Balance = u128; /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; /// An index to a block. @@ -724,8 +724,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } } diff --git a/polkadot-parachain/src/rpc.rs b/polkadot-parachain/src/rpc.rs index c2eeaf38608..7c885ee1537 100644 --- a/polkadot-parachain/src/rpc.rs +++ b/polkadot-parachain/src/rpc.rs @@ -20,7 +20,7 @@ use std::sync::Arc; -use parachains_common::{AccountId, Balance, Block, Index as Nonce}; +use parachains_common::{AccountId, Balance, Block, Nonce}; use sc_client_api::AuxStore; pub use sc_rpc::{DenyUnsafe, SubscriptionTaskExecutor}; use sc_transaction_pool_api::TransactionPool; diff --git a/polkadot-parachain/src/service.rs b/polkadot-parachain/src/service.rs index 552c6b4a832..826fa886121 100644 --- a/polkadot-parachain/src/service.rs +++ b/polkadot-parachain/src/service.rs @@ -34,7 +34,7 @@ use sp_core::Pair; use jsonrpsee::RpcModule; use crate::rpc; -pub use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Header, Index as Nonce}; +pub use parachains_common::{AccountId, Balance, Block, BlockNumber, Hash, Header, Nonce}; use cumulus_client_consensus_relay_chain::Verifier as RelayChainVerifier; use futures::lock::Mutex; diff --git a/test/runtime/src/lib.rs b/test/runtime/src/lib.rs index 8cfd62df1f8..7e2fd9695fd 100644 --- a/test/runtime/src/lib.rs +++ b/test/runtime/src/lib.rs @@ -185,7 +185,7 @@ impl frame_system::Config for Runtime { /// The lookup mechanism to get account ID from whatever is passed in dispatchers. type Lookup = IdentityLookup; /// The index type for storing how many extrinsics an account has signed. - type Index = Index; + type Nonce = Nonce; /// The type for hashing blocks and tries. type Hash = Hash; /// The hashing algorithm used. @@ -306,7 +306,7 @@ construct_runtime! { } /// Index of a transaction in the chain. -pub type Index = u32; +pub type Nonce = u32; /// A hash of some data used by the chain. pub type Hash = sp_core::H256; /// Balance of an account. @@ -403,8 +403,8 @@ impl_runtime_apis! { } } - impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { - fn account_nonce(account: AccountId) -> Index { + impl frame_system_rpc_runtime_api::AccountNonceApi for Runtime { + fn account_nonce(account: AccountId) -> Nonce { System::account_nonce(account) } }