From 60bd4c6d73924773cfaca9b5851b7585bdf3d248 Mon Sep 17 00:00:00 2001 From: Nikhil Gupta <17176722+gupnik@users.noreply.github.com> Date: Tue, 20 Jun 2023 10:24:03 +0530 Subject: [PATCH] Uses u32 in mock block --- client/chain-spec/README.md | 2 +- client/chain-spec/src/extension.rs | 2 +- client/chain-spec/src/lib.rs | 2 +- client/statement-store/src/lib.rs | 2 +- frame/alliance/src/mock.rs | 2 +- frame/authority-discovery/src/lib.rs | 2 +- frame/election-provider-multi-phase/src/mock.rs | 6 +++--- .../test-staking-e2e/src/mock.rs | 2 +- frame/election-provider-support/src/onchain.rs | 2 +- frame/fast-unstake/src/mock.rs | 2 +- frame/nomination-pools/benchmarking/src/mock.rs | 2 +- frame/nomination-pools/src/mock.rs | 2 +- frame/nomination-pools/test-staking/src/mock.rs | 2 +- frame/root-offences/src/mock.rs | 2 +- frame/staking/src/mock.rs | 2 +- frame/support/test/compile_pass/src/lib.rs | 2 +- frame/utility/src/tests.rs | 2 +- primitives/test-primitives/src/lib.rs | 2 +- test-utils/runtime/src/lib.rs | 2 +- utils/frame/rpc/client/src/lib.rs | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/client/chain-spec/README.md b/client/chain-spec/README.md index 5525affbed81c..382ead3b45fc9 100644 --- a/client/chain-spec/README.md +++ b/client/chain-spec/README.md @@ -50,7 +50,7 @@ pub struct Extension { pub pool: PoolParams, } -pub type BlockNumber = u64; +pub type BlockNumber = u32; /// A chain spec supporting forkable `ClientParams`. pub type MyChainSpec1 = GenericChainSpec>; diff --git a/client/chain-spec/src/extension.rs b/client/chain-spec/src/extension.rs index 25ab011a05b32..5993aa28629ce 100644 --- a/client/chain-spec/src/extension.rs +++ b/client/chain-spec/src/extension.rs @@ -164,7 +164,7 @@ pub trait IsForks { } impl IsForks for Option<()> { - type BlockNumber = u64; + type BlockNumber = u32; type Extension = Self; } diff --git a/client/chain-spec/src/lib.rs b/client/chain-spec/src/lib.rs index 6239eb7326b78..f043780a90655 100644 --- a/client/chain-spec/src/lib.rs +++ b/client/chain-spec/src/lib.rs @@ -68,7 +68,7 @@ //! pub pool: PoolParams, //! } //! -//! pub type BlockNumber = u64; +//! pub type BlockNumber = u32; //! //! /// A chain spec supporting forkable `ClientParams`. //! pub type MyChainSpec1 = GenericChainSpec>; diff --git a/client/statement-store/src/lib.rs b/client/statement-store/src/lib.rs index 4acb89a05f7d1..8c09d11188d6f 100644 --- a/client/statement-store/src/lib.rs +++ b/client/statement-store/src/lib.rs @@ -891,7 +891,7 @@ mod tests { type Extrinsic = sp_runtime::OpaqueExtrinsic; type Hash = sp_core::H256; type Hashing = sp_runtime::traits::BlakeTwo256; - type BlockNumber = u64; + type BlockNumber = u32; type Header = sp_runtime::generic::Header; type Block = sp_runtime::generic::Block; diff --git a/frame/alliance/src/mock.rs b/frame/alliance/src/mock.rs index 58a31fdef5562..33be8798c4a01 100644 --- a/frame/alliance/src/mock.rs +++ b/frame/alliance/src/mock.rs @@ -37,7 +37,7 @@ pub use crate as pallet_alliance; use super::*; -type BlockNumber = u64; +type BlockNumber = u32; type AccountId = u64; parameter_types! { diff --git a/frame/authority-discovery/src/lib.rs b/frame/authority-discovery/src/lib.rs index c6b7656311fdd..6079d0e712f85 100644 --- a/frame/authority-discovery/src/lib.rs +++ b/frame/authority-discovery/src/lib.rs @@ -216,7 +216,7 @@ mod tests { type FullIdentificationOf = (); } - pub type BlockNumber = u64; + pub type BlockNumber = u32; parameter_types! { pub const Period: BlockNumber = 1; diff --git a/frame/election-provider-multi-phase/src/mock.rs b/frame/election-provider-multi-phase/src/mock.rs index 440950a606761..240f84914f9ea 100644 --- a/frame/election-provider-multi-phase/src/mock.rs +++ b/frame/election-provider-multi-phase/src/mock.rs @@ -64,7 +64,7 @@ frame_support::construct_runtime!( pub(crate) type Balance = u64; pub(crate) type AccountId = u64; -pub(crate) type BlockNumber = u64; +pub(crate) type BlockNumber = u32; pub(crate) type VoterIndex = u32; pub(crate) type TargetIndex = u16; @@ -319,7 +319,7 @@ impl onchain::Config for OnChainSeqPhragmen { pub struct MockFallback; impl ElectionProviderBase for MockFallback { type AccountId = AccountId; - type BlockNumber = u64; + type BlockNumber = u32; type Error = &'static str; type DataProvider = StakingMock; type MaxWinners = MaxWinners; @@ -433,7 +433,7 @@ pub struct ExtBuilder {} pub struct StakingMock; impl ElectionDataProvider for StakingMock { type AccountId = AccountId; - type BlockNumber = u64; + type BlockNumber = u32; type MaxVotesPerVoter = MaxNominations; fn electable_targets(maybe_max_len: Option) -> data_provider::Result> { diff --git a/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs b/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs index b9a8db5da806b..122ee11c8c339 100644 --- a/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs +++ b/frame/election-provider-multi-phase/test-staking-e2e/src/mock.rs @@ -69,7 +69,7 @@ frame_support::construct_runtime!( pub(crate) type AccountId = u128; pub(crate) type AccountIndex = u32; -pub(crate) type BlockNumber = u64; +pub(crate) type BlockNumber = u32; pub(crate) type Balance = u64; pub(crate) type VoterIndex = u32; pub(crate) type TargetIndex = u16; diff --git a/frame/election-provider-support/src/onchain.rs b/frame/election-provider-support/src/onchain.rs index 60378d4dac589..81a48b89bd1b9 100644 --- a/frame/election-provider-support/src/onchain.rs +++ b/frame/election-provider-support/src/onchain.rs @@ -190,7 +190,7 @@ mod tests { use sp_npos_elections::Support; use sp_runtime::Perbill; type AccountId = u64; - type BlockNumber = u64; + type BlockNumber = u32; pub type Header = sp_runtime::generic::Header; pub type UncheckedExtrinsic = sp_runtime::generic::UncheckedExtrinsic; diff --git a/frame/fast-unstake/src/mock.rs b/frame/fast-unstake/src/mock.rs index 6808df73cf321..7fce3205a264a 100644 --- a/frame/fast-unstake/src/mock.rs +++ b/frame/fast-unstake/src/mock.rs @@ -30,7 +30,7 @@ use sp_std::prelude::*; pub type AccountId = u128; pub type AccountIndex = u32; -pub type BlockNumber = u64; +pub type BlockNumber = u32; pub type Balance = u128; pub type T = Runtime; diff --git a/frame/nomination-pools/benchmarking/src/mock.rs b/frame/nomination-pools/benchmarking/src/mock.rs index 7f7703c795b25..709943837b102 100644 --- a/frame/nomination-pools/benchmarking/src/mock.rs +++ b/frame/nomination-pools/benchmarking/src/mock.rs @@ -25,7 +25,7 @@ use sp_runtime::{ type AccountId = u128; type AccountIndex = u32; -type BlockNumber = u64; +type BlockNumber = u32; type Balance = u128; impl frame_system::Config for Runtime { diff --git a/frame/nomination-pools/src/mock.rs b/frame/nomination-pools/src/mock.rs index 84812c0b3dd83..3f3c921076886 100644 --- a/frame/nomination-pools/src/mock.rs +++ b/frame/nomination-pools/src/mock.rs @@ -5,7 +5,7 @@ use frame_system::RawOrigin; use sp_runtime::FixedU128; use sp_staking::Stake; -pub type BlockNumber = u64; +pub type BlockNumber = u32; pub type AccountId = u128; pub type Balance = u128; pub type RewardCounter = FixedU128; diff --git a/frame/nomination-pools/test-staking/src/mock.rs b/frame/nomination-pools/test-staking/src/mock.rs index b2eb804266d59..6a881c0f0765d 100644 --- a/frame/nomination-pools/test-staking/src/mock.rs +++ b/frame/nomination-pools/test-staking/src/mock.rs @@ -30,7 +30,7 @@ use sp_runtime::{ type AccountId = u128; type AccountIndex = u32; -type BlockNumber = u64; +type BlockNumber = u32; type Balance = u128; pub(crate) type T = Runtime; diff --git a/frame/root-offences/src/mock.rs b/frame/root-offences/src/mock.rs index e5e5da061bd1f..62bd2514861a0 100644 --- a/frame/root-offences/src/mock.rs +++ b/frame/root-offences/src/mock.rs @@ -36,7 +36,7 @@ use sp_std::collections::btree_map::BTreeMap; type Block = frame_system::mocking::MockBlock; type AccountId = u64; type Balance = u64; -type BlockNumber = u64; +type BlockNumber = u32; pub const INIT_TIMESTAMP: u64 = 30_000; pub const BLOCK_TIME: u64 = 1000; diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index 5cfc8a6995916..affdc5f8917a7 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -43,7 +43,7 @@ pub const BLOCK_TIME: u64 = 1000; /// The AccountId alias in this test module. pub(crate) type AccountId = u64; pub(crate) type AccountIndex = u64; -pub(crate) type BlockNumber = u64; +pub(crate) type BlockNumber = u32; pub(crate) type Balance = u128; /// Another session handler struct to test on_disabled. diff --git a/frame/support/test/compile_pass/src/lib.rs b/frame/support/test/compile_pass/src/lib.rs index 75911d7569f80..2579af65f201c 100644 --- a/frame/support/test/compile_pass/src/lib.rs +++ b/frame/support/test/compile_pass/src/lib.rs @@ -44,7 +44,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { pub type Signature = sr25519::Signature; pub type AccountId = ::Signer; -pub type BlockNumber = u64; +pub type BlockNumber = u32; pub type Index = u64; parameter_types! { diff --git a/frame/utility/src/tests.rs b/frame/utility/src/tests.rs index ef6ec49349378..685104330be35 100644 --- a/frame/utility/src/tests.rs +++ b/frame/utility/src/tests.rs @@ -37,7 +37,7 @@ use sp_runtime::{ TokenError, }; -type BlockNumber = u64; +type BlockNumber = u32; // example module to test behaviors. #[frame_support::pallet(dev_mode)] diff --git a/primitives/test-primitives/src/lib.rs b/primitives/test-primitives/src/lib.rs index 913cb762d92a5..6bada984dff56 100644 --- a/primitives/test-primitives/src/lib.rs +++ b/primitives/test-primitives/src/lib.rs @@ -69,7 +69,7 @@ pub type AccountId = ::Signer; /// A simple hash type for all our hashing. pub type Hash = H256; /// The block number type used in this runtime. -pub type BlockNumber = u64; +pub type BlockNumber = u32; /// Index of a transaction. pub type Index = u64; /// The item of a block digest. diff --git a/test-utils/runtime/src/lib.rs b/test-utils/runtime/src/lib.rs index 23230021c3457..415c78509d35e 100644 --- a/test-utils/runtime/src/lib.rs +++ b/test-utils/runtime/src/lib.rs @@ -154,7 +154,7 @@ pub type Hash = H256; /// The hashing algorithm used. pub type Hashing = BlakeTwo256; /// The block number type used in this runtime. -pub type BlockNumber = u64; +pub type BlockNumber = u32; /// Index of a transaction. pub type Index = u64; /// The item of a block digest. diff --git a/utils/frame/rpc/client/src/lib.rs b/utils/frame/rpc/client/src/lib.rs index ebc903559e19c..a0878fcc27c61 100644 --- a/utils/frame/rpc/client/src/lib.rs +++ b/utils/frame/rpc/client/src/lib.rs @@ -203,7 +203,7 @@ mod tests { use tokio::sync::Mutex; type Block = TBlock>; - type BlockNumber = u64; + type BlockNumber = u32; type Hash = H256; struct MockHeaderProvider(pub Arc>>);