Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Replace Index for Nonce #2740

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bridges/bin/runtime-common/src/integrity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) => {
Expand All @@ -41,7 +41,7 @@ macro_rules! assert_chain_types(
use frame_system::Config as SystemConfig;
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!(<$r as SystemConfig>::BlockNumber, 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>);
Expand Down
8 changes: 4 additions & 4 deletions bridges/bin/runtime-common/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ parameter_types! {

impl frame_system::Config for TestRuntime {
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type BlockNumber = ThisChainBlockNumber;
type Hash = ThisChainHash;
Expand Down Expand Up @@ -324,7 +324,7 @@ impl Chain for ThisUnderlyingChain {
type Header = ThisChainHeader;
type AccountId = ThisChainAccountId;
type Balance = ThisChainBalance;
type Index = u32;
type Nonce = u32;
type Signature = sp_runtime::MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand Down Expand Up @@ -364,7 +364,7 @@ impl Chain for BridgedUnderlyingChain {
type Header = BridgedChainHeader;
type AccountId = BridgedChainAccountId;
type Balance = BridgedChainBalance;
type Index = u32;
type Nonce = u32;
type Signature = sp_runtime::MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand All @@ -390,7 +390,7 @@ impl Chain for BridgedUnderlyingParachain {
type Header = BridgedChainHeader;
type AccountId = BridgedChainAccountId;
type Balance = BridgedChainBalance;
type Index = u32;
type Nonce = u32;
type Signature = sp_runtime::MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand Down
4 changes: 2 additions & 2 deletions bridges/modules/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ parameter_types! {

impl frame_system::Config for TestRuntime {
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type BlockNumber = u64;
type Hash = H256;
Expand Down Expand Up @@ -112,7 +112,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 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/messages/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ pub type DbWeight = RocksDbWeight;

impl frame_system::Config for TestRuntime {
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type BlockNumber = u64;
type Hash = H256;
Expand Down
14 changes: 7 additions & 7 deletions bridges/modules/parachains/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl Chain for Parachain1 {
type Header = RegularParachainHeader;
type AccountId = u64;
type Balance = u64;
type Index = u64;
type Nonce = u64;
type Signature = MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand All @@ -79,7 +79,7 @@ impl Chain for Parachain2 {
type Header = RegularParachainHeader;
type AccountId = u64;
type Balance = u64;
type Index = u64;
type Nonce = u64;
type Signature = MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand All @@ -103,7 +103,7 @@ impl Chain for Parachain3 {
type Header = RegularParachainHeader;
type AccountId = u64;
type Balance = u64;
type Index = u64;
type Nonce = u64;
type Signature = MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand All @@ -128,7 +128,7 @@ impl Chain for BigParachain {
type Header = BigParachainHeader;
type AccountId = u64;
type Balance = u64;
type Index = u64;
type Nonce = u64;
type Signature = MultiSignature;

fn max_extrinsic_size() -> u32 {
Expand Down Expand Up @@ -165,7 +165,7 @@ parameter_types! {

impl frame_system::Config for TestRuntime {
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type BlockNumber = TestNumber;
type Hash = H256;
Expand Down Expand Up @@ -270,7 +270,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 {
Expand Down Expand Up @@ -301,7 +301,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 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/modules/relayers/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ parameter_types! {

impl frame_system::Config for TestRuntime {
type RuntimeOrigin = RuntimeOrigin;
type Index = u64;
type Nonce = u64;
type RuntimeCall = RuntimeCall;
type BlockNumber = BlockNumber;
type Hash = H256;
Expand Down
12 changes: 6 additions & 6 deletions bridges/primitives/chain-bridge-hub-cumulus/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

pub use bp_polkadot_core::{
AccountId, AccountInfoStorageMapKeyProvider, AccountPublic, Balance, BlockNumber, Hash, Hasher,
Hashing, Header, Index, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic,
Hashing, Header, Nonce, Perbill, Signature, SignedBlock, UncheckedExtrinsic,
EXTRA_STORAGE_PROOF_SIZE, TX_EXTRA_BYTES,
};

Expand Down Expand Up @@ -136,7 +136,7 @@ pub type SignedExtra = (
CheckTxVersion,
CheckGenesis<Hash>,
CheckEra<Hash>,
CheckNonce<Index>,
CheckNonce<Nonce>,
CheckWeight,
ChargeTransactionPayment<Balance>,
BridgeRejectObsoleteHeadersAndMessages,
Expand All @@ -155,12 +155,12 @@ pub trait BridgeHubSignedExtension {
transaction_version: u32,
era: bp_runtime::TransactionEra<BlockNumber, Hash>,
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;
Expand All @@ -173,7 +173,7 @@ impl BridgeHubSignedExtension for SignedExtension {
transaction_version: u32,
era: bp_runtime::TransactionEra<BlockNumber, Hash>,
genesis_hash: Hash,
nonce: Index,
nonce: Nonce,
tip: Balance,
) -> Self {
GenericSignedExtension::new(
Expand Down Expand Up @@ -205,7 +205,7 @@ impl BridgeHubSignedExtension for SignedExtension {
}

/// Return transaction nonce.
fn nonce(&self) -> Index {
fn nonce(&self) -> Nonce {
self.payload.5 .0
}

Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Chain for BridgeHubKusama {

type AccountId = AccountId;
type Balance = Balance;
type Index = Index;
type Nonce = Nonce;
type Signature = Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Chain for BridgeHubPolkadot {

type AccountId = AccountId;
type Balance = Balance;
type Index = Index;
type Nonce = Nonce;
type Signature = Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ impl Chain for BridgeHubRococo {

type AccountId = AccountId;
type Balance = Balance;
type Index = Index;
type Nonce = Nonce;
type Signature = Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-bridge-hub-wococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl Chain for BridgeHubWococo {

type AccountId = AccountId;
type Balance = Balance;
type Index = Index;
type Nonce = Nonce;
type Signature = Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Chain for Kusama {

type AccountId = <PolkadotLike as Chain>::AccountId;
type Balance = <PolkadotLike as Chain>::Balance;
type Index = <PolkadotLike as Chain>::Index;
type Nonce = <PolkadotLike as Chain>::Nonce;
type Signature = <PolkadotLike as Chain>::Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Chain for Polkadot {

type AccountId = <PolkadotLike as Chain>::AccountId;
type Balance = <PolkadotLike as Chain>::Balance;
type Index = <PolkadotLike as Chain>::Index;
type Nonce = <PolkadotLike as Chain>::Nonce;
type Signature = <PolkadotLike as Chain>::Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Chain for Rococo {

type AccountId = <PolkadotLike as Chain>::AccountId;
type Balance = <PolkadotLike as Chain>::Balance;
type Index = <PolkadotLike as Chain>::Index;
type Nonce = <PolkadotLike as Chain>::Nonce;
type Signature = <PolkadotLike as Chain>::Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/chain-wococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl Chain for Wococo {

type AccountId = <PolkadotLike as Chain>::AccountId;
type Balance = <PolkadotLike as Chain>::Balance;
type Index = <PolkadotLike as Chain>::Index;
type Nonce = <PolkadotLike as Chain>::Nonce;
type Signature = <PolkadotLike as Chain>::Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
5 changes: 1 addition & 4 deletions bridges/primitives/polkadot-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ pub type BlockNumber = u32;
/// Hash type used in Polkadot-like chains.
pub type Hash = <BlakeTwo256 as HasherT>::Out;

/// Account Index (a.k.a. nonce).
pub type Index = u32;

/// Hashing type.
pub type Hashing = BlakeTwo256;

Expand Down Expand Up @@ -236,7 +233,7 @@ impl Chain for PolkadotLike {

type AccountId = AccountId;
type Balance = Balance;
type Index = Index;
type Nonce = Nonce;
type Signature = Signature;

fn max_extrinsic_size() -> u32 {
Expand Down
6 changes: 3 additions & 3 deletions bridges/primitives/runtime/src/chain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub trait Chain: Send + Sync + 'static {
+ TryFrom<sp_core::U256>
+ MaxEncodedLen;
/// Index of a transaction used by the chain.
type Index: Parameter
type Nonce: Parameter
+ Member
+ MaybeSerialize
+ Debug
Expand Down Expand Up @@ -206,7 +206,7 @@ where
type Header = <T::Chain as Chain>::Header;
type AccountId = <T::Chain as Chain>::AccountId;
type Balance = <T::Chain as Chain>::Balance;
type Index = <T::Chain as Chain>::Index;
type Nonce = <T::Chain as Chain>::Nonce;
type Signature = <T::Chain as Chain>::Signature;

fn max_extrinsic_size() -> u32 {
Expand Down Expand Up @@ -262,7 +262,7 @@ pub type AccountIdOf<C> = <C as Chain>::AccountId;
pub type BalanceOf<C> = <C as Chain>::Balance;

/// Transaction index type used by the chain.
pub type IndexOf<C> = <C as Chain>::Index;
pub type NonceOf<C> = <C as Chain>::Nonce;

/// Signature type used by the chain.
pub type SignatureOf<C> = <C as Chain>::Signature;
Expand Down
2 changes: 1 addition & 1 deletion bridges/primitives/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ impl system::Config for Test {
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type Nonce = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
Expand Down
2 changes: 1 addition & 1 deletion pallets/dmp-queue/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ mod tests {
impl frame_system::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type Nonce = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
Expand Down
2 changes: 1 addition & 1 deletion pallets/parachain-system/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ parameter_types! {
impl frame_system::Config for Test {
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type Nonce = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
Expand Down
2 changes: 1 addition & 1 deletion pallets/xcmp-queue/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl frame_system::Config for Test {
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type Nonce = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
Expand Down
2 changes: 1 addition & 1 deletion parachain-template/node/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
2 changes: 1 addition & 1 deletion parachain-template/pallets/template/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ impl system::Config for Test {
type DbWeight = ();
type RuntimeOrigin = RuntimeOrigin;
type RuntimeCall = RuntimeCall;
type Index = u64;
type Nonce = u64;
type BlockNumber = u64;
type Hash = H256;
type Hashing = BlakeTwo256;
Expand Down
Loading