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

Commit

Permalink
Companion of paritytech/substrate#10382, !
Browse files Browse the repository at this point in the history
  • Loading branch information
AurevoirXavier committed Sep 8, 2022
1 parent 2d12161 commit dec1844
Show file tree
Hide file tree
Showing 23 changed files with 49 additions and 20 deletions.
5 changes: 3 additions & 2 deletions frame/balances/src/tests_local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use scale_info::TypeInfo;
use frame_support::{
assert_err, assert_noop, assert_ok, assert_storage_noop, parameter_types,
traits::{
BalanceStatus, Currency, Everything, ExistenceRequirement, GenesisBuild, Imbalance,
LockIdentifier, LockableCurrency, NamedReservableCurrency, ReservableCurrency,
BalanceStatus, ConstU32, Currency, Everything, ExistenceRequirement, GenesisBuild,
Imbalance, LockIdentifier, LockableCurrency, NamedReservableCurrency, ReservableCurrency,
StorageMapShim, WithdrawReasons,
},
weights::{DispatchInfo, IdentityFee, Weight},
Expand Down Expand Up @@ -68,6 +68,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = Balance;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
5 changes: 3 additions & 2 deletions frame/balances/src/tests_reentrancy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ use scale_info::TypeInfo;
use frame_support::{
assert_ok,
traits::{
BalanceStatus, Currency, Everything, GenesisBuild, OnUnbalanced, ReservableCurrency,
StorageMapShim,
BalanceStatus, ConstU32, Currency, Everything, GenesisBuild, OnUnbalanced,
ReservableCurrency, StorageMapShim,
},
weights::IdentityFee,
};
Expand Down Expand Up @@ -65,6 +65,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
1 change: 1 addition & 0 deletions frame/bridge/ecdsa-authority/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = Index;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/bridge/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
// --- crates.io ---
use codec::MaxEncodedLen;
// --- paritytech ---
use frame_support::traits::{Everything, OnInitialize};
use frame_support::traits::{ConstU32, Everything, OnInitialize};
use frame_system::{mocking::*, EnsureRoot};
use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup, RuntimeDebug};
Expand Down Expand Up @@ -53,6 +53,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/bridge/relay-authority/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
// --- paritytech ---
use frame_support::traits::{Everything, GenesisBuild, OnFinalize, OnInitialize};
use frame_support::traits::{ConstU32, Everything, GenesisBuild, OnFinalize, OnInitialize};
use frame_system::{mocking::*, EnsureRoot};
use sp_core::H256;
use sp_io::{hashing, TestExternalities};
Expand Down Expand Up @@ -67,6 +67,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = Index;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/bridge/relayer-game/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ pub mod mock_relay {
use codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
// --- paritytech ---
use frame_support::traits::{Everything, GenesisBuild, OnFinalize};
use frame_support::traits::{ConstU32, Everything, GenesisBuild, OnFinalize};
use frame_system::mocking::*;
use sp_runtime::RuntimeDebug;
// --- darwinia-network ---
Expand Down Expand Up @@ -264,6 +264,7 @@ impl frame_system::Config for Test {
type Header = sp_runtime::testing::Header;
type Index = u64;
type Lookup = sp_runtime::traits::IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/dvm/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use sha3::{Digest, Keccak256};
// --- paritytech ---
use fp_evm::{Context, FeeCalculator, Precompile, PrecompileResult, PrecompileSet};
use frame_support::{
traits::{Everything, FindAuthor, GenesisBuild, OriginTrait, WithdrawReasons},
traits::{ConstU32, Everything, FindAuthor, GenesisBuild, OriginTrait, WithdrawReasons},
weights::GetDispatchInfo,
ConsensusEngineId, PalletId,
};
Expand Down Expand Up @@ -80,6 +80,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/dvm/evm/precompiles/kton/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use fp_evm::{
};
use frame_support::{
pallet_prelude::Weight,
traits::{Everything, FindAuthor, GenesisBuild},
traits::{ConstU32, Everything, FindAuthor, GenesisBuild},
weights::GetDispatchInfo,
ConsensusEngineId, PalletId,
};
Expand Down Expand Up @@ -84,6 +84,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/dvm/evm/precompiles/state-storage/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ use fp_evm::{
use frame_support::{
assert_ok,
pallet_prelude::Weight,
traits::{Everything, FindAuthor, GenesisBuild},
traits::{ConstU32, Everything, FindAuthor, GenesisBuild},
weights::GetDispatchInfo,
Blake2_128Concat, ConsensusEngineId, PalletId, StorageHasher, Twox128,
};
Expand Down Expand Up @@ -89,6 +89,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/dvm/evm/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use scale_info::TypeInfo;
// --- paritytech ---
use frame_support::{
assert_ok,
traits::{Everything, GenesisBuild},
traits::{ConstU32, Everything, GenesisBuild},
ConsensusEngineId,
};
use frame_system::mocking::*;
Expand Down Expand Up @@ -65,6 +65,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/header-mmr/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use codec::Encode;
// --- github.com ---
use mmr::MMRStore;
// --- paritytech ---
use frame_support::traits::{Everything, OnFinalize, OnInitialize};
use frame_support::traits::{ConstU32, Everything, OnFinalize, OnInitialize};
use frame_system::mocking::*;
use sp_core::{
offchain::{testing::TestOffchainExt, OffchainDbExt, OffchainWorkerExt},
Expand Down Expand Up @@ -60,6 +60,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
5 changes: 3 additions & 2 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ use frame_support::{
assert_ok, parameter_types,
storage::IterableStorageMap,
traits::{
Currency, Everything, FindAuthor, GenesisBuild, Get, Imbalance, OnFinalize, OnInitialize,
OnUnbalanced, OneSessionHandler, UnixTime,
ConstU32, Currency, Everything, FindAuthor, GenesisBuild, Get, Imbalance, OnFinalize,
OnInitialize, OnUnbalanced, OneSessionHandler, UnixTime,
},
weights::constants::RocksDbWeight,
PalletId, StorageValue,
Expand Down Expand Up @@ -135,6 +135,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = AccountIndex;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
6 changes: 5 additions & 1 deletion frame/transaction-pause/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
#![cfg(test)]

use super::*;
use frame_support::{construct_runtime, ord_parameter_types, parameter_types, traits::Everything};
use frame_support::{
construct_runtime, ord_parameter_types, parameter_types,
traits::{ConstU32, Everything},
};
use frame_system::EnsureSignedBy;
use scale_info::TypeInfo;
use sp_core::H256;
Expand Down Expand Up @@ -57,6 +60,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/wormhole/backing/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use scale_info::TypeInfo;
// --- paritytech ---
use frame_election_provider_support::onchain;
use frame_support::{
traits::{Everything, GenesisBuild, SortedMembers},
traits::{ConstU32, Everything, GenesisBuild, SortedMembers},
PalletId,
};
use frame_system::{mocking::*, EnsureRoot};
Expand Down Expand Up @@ -76,6 +76,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
6 changes: 5 additions & 1 deletion frame/wormhole/backing/s2s/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ use scale_info::TypeInfo;
use bp_messages::source_chain::SendMessageArtifacts;
use bp_runtime::{derive_account_id, SourceAccount};
use frame_support::{
assert_err, assert_ok, dispatch::PostDispatchInfo, traits::Everything, PalletId,
assert_err, assert_ok,
dispatch::PostDispatchInfo,
traits::{ConstU32, Everything},
PalletId,
};
use frame_system::{mocking::*, RawOrigin};
use sp_runtime::{
Expand Down Expand Up @@ -90,6 +93,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 2 additions & 1 deletion frame/wormhole/issuing/s2s/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use scale_info::TypeInfo;
// --- paritytech ---
use fp_evm::{Context, FeeCalculator, Precompile, PrecompileResult, PrecompileSet};
use frame_support::{
traits::{Everything, GenesisBuild},
traits::{ConstU32, Everything, GenesisBuild},
weights::GetDispatchInfo,
PalletId,
};
Expand Down Expand Up @@ -79,6 +79,7 @@ impl frame_system::Config for Test {
type Header = Header;
type Index = u64;
type Lookup = IdentityLookup<Self::AccountId>;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
2 changes: 1 addition & 1 deletion node/runtime/common/src/gov_origin.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// --- paritytech ---
use frame_system::EnsureRoot;
use frame_support::traits::EnsureOneOf;
use frame_system::EnsureRoot;
use pallet_collective::{EnsureProportionAtLeast, EnsureProportionMoreThan};
use sp_core::u32_trait::{_1, _2, _3, _5};
// --- darwinia-network ---
Expand Down
2 changes: 1 addition & 1 deletion node/runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ pub type Block = generic::Block<Header, UncheckedExtrinsic>;
pub type SignedBlock = generic::SignedBlock<Block>;
/// The SignedExtension to the basic transaction logic.
pub type SignedExtra = (
CheckNonZeroSender::<Runtime>,
CheckNonZeroSender<Runtime>,
CheckSpecVersion<Runtime>,
CheckTxVersion<Runtime>,
CheckGenesis<Runtime>,
Expand Down
1 change: 1 addition & 0 deletions node/runtime/pangolin/src/pallets/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl Config for Runtime {
type Header = Header;
type Index = Nonce;
type Lookup = DarwiniaAccountLookup;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
1 change: 1 addition & 0 deletions node/runtime/pangoro/src/pallets/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ impl Config for Runtime {
type Header = Header;
type Index = Nonce;
type Lookup = DarwiniaAccountLookup;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down
3 changes: 3 additions & 0 deletions node/runtime/template/src/pallets/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
pub mod shared_imports;
pub use shared_imports::*;

pub mod system;
pub use system::*;

Expand Down
1 change: 1 addition & 0 deletions node/runtime/template/src/pallets/shared_imports.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub use frame_support::traits::ConstU32;
1 change: 1 addition & 0 deletions node/runtime/template/src/pallets/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ impl Config for Runtime {
type Header = Header;
type Index = Nonce;
type Lookup = DarwiniaAccountLookup;
type MaxConsumers = ConstU32<16>;
type OnKilledAccount = ();
type OnNewAccount = ();
type OnSetCode = ();
Expand Down

0 comments on commit dec1844

Please sign in to comment.