Replace parameter_types with ConstU32 &c. (#10402)

* remove parameter types and use const type

* remove parameter types and use const type

* Delete {

* Delete count,

* refractor for beefy, benchmarking, child bounties, and collective pallets

* refractor for pallet contracts

* refractor for elections

* refractor for more pallets

* fix CI issues

* fix CI issues

* fix CI issues

* fix CI issues

* remove warning to fix CI issue

* remove warning to fix CI issue
refractor for pallet preimage

* remove warning to fix CI issue
refractor for pallet proxy

* remove warning to fix CI issue
refractor for pallet recovery
refractor for pallet randomness-collective-flip

* remove warning to fix CI issue
refractor for pallet scored-pool
refractor for pallet scheduler
refractor for pallet session

* remove warning to fix CI issue
refractor for pallet society, support, system, timestamp, tips

* remove warning to fix CI issue
refractor for pallet transaction_payment, transaction_storage, treasury, uniques, utility

* remove warning to fix CI issue

* cargo +nightly fmt

* CI fix

* more param refractor on beefy-mmr

* refractor for beefy

* Update frame/babe/src/mock.rs

* Update frame/babe/src/mock.rs

* Update frame/bounties/src/tests.rs

* Update frame/tips/src/tests.rs

* Delete mock.rs

* Update frame/examples/basic/src/tests.rs

* Apply suggestions from code review

* Update frame/im-online/src/mock.rs

* Update frame/im-online/src/mock.rs

* Update frame/offences/benchmarking/src/mock.rs

* Update frame/session/benchmarking/src/mock.rs

* Update frame/support/test/tests/pallet_compatibility.rs

* Update frame/support/test/tests/pallet_compatibility_instance.rs

* Update frame/treasury/src/tests.rs

* Update test-utils/runtime/src/lib.rs

* some cleanup

* fmt

* remove unused

Co-authored-by: Damilare <dakinlose@teamapt.com>
Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
dharjeezy
2021-12-16 04:06:11 +01:00
committed by GitHub
parent cf1eb73046
commit 1b0be8ae06
76 changed files with 629 additions and 966 deletions
+16 -29
View File
@@ -22,7 +22,9 @@ use crate as pallet_democracy;
use codec::Encode;
use frame_support::{
assert_noop, assert_ok, ord_parameter_types, parameter_types,
traits::{Contains, EqualPrivilegeOnly, GenesisBuild, OnInitialize, SortedMembers},
traits::{
ConstU32, ConstU64, Contains, EqualPrivilegeOnly, GenesisBuild, OnInitialize, SortedMembers,
},
weights::Weight,
};
use frame_system::{EnsureRoot, EnsureSignedBy};
@@ -50,8 +52,6 @@ const NAY: Vote = Vote { aye: false, conviction: Conviction::None };
const BIG_AYE: Vote = Vote { aye: true, conviction: Conviction::Locked1x };
const BIG_NAY: Vote = Vote { aye: false, conviction: Conviction::Locked1x };
const MAX_PROPOSALS: u32 = 100;
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
type Block = frame_system::mocking::MockBlock<Test>;
@@ -77,7 +77,6 @@ impl Contains<Call> for BaseFilter {
}
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1_000_000);
}
@@ -96,7 +95,7 @@ impl frame_system::Config for Test {
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = Event;
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<u64>;
@@ -123,31 +122,19 @@ impl pallet_scheduler::Config for Test {
type PreimageProvider = ();
type NoPreimagePostponement = ();
}
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
pub const MaxLocks: u32 = 10;
}
impl pallet_balances::Config for Test {
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type MaxLocks = MaxLocks;
type MaxLocks = ConstU32<10>;
type Balance = u64;
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
}
parameter_types! {
pub const LaunchPeriod: u64 = 2;
pub const VotingPeriod: u64 = 2;
pub const FastTrackVotingPeriod: u64 = 2;
pub const MinimumDeposit: u64 = 1;
pub const EnactmentPeriod: u64 = 2;
pub const VoteLockingPeriod: u64 = 3;
pub const CooloffPeriod: u64 = 2;
pub const MaxVotes: u32 = 100;
pub const MaxProposals: u32 = MAX_PROPOSALS;
pub static PreimageByteDeposit: u64 = 0;
pub static InstantAllowed: bool = false;
}
@@ -172,12 +159,12 @@ impl Config for Test {
type Proposal = Call;
type Event = Event;
type Currency = pallet_balances::Pallet<Self>;
type EnactmentPeriod = EnactmentPeriod;
type LaunchPeriod = LaunchPeriod;
type VotingPeriod = VotingPeriod;
type VoteLockingPeriod = VoteLockingPeriod;
type FastTrackVotingPeriod = FastTrackVotingPeriod;
type MinimumDeposit = MinimumDeposit;
type EnactmentPeriod = ConstU64<2>;
type LaunchPeriod = ConstU64<2>;
type VotingPeriod = ConstU64<2>;
type VoteLockingPeriod = ConstU64<3>;
type FastTrackVotingPeriod = ConstU64<2>;
type MinimumDeposit = ConstU64<1>;
type ExternalOrigin = EnsureSignedBy<Two, u64>;
type ExternalMajorityOrigin = EnsureSignedBy<Three, u64>;
type ExternalDefaultOrigin = EnsureSignedBy<One, u64>;
@@ -186,17 +173,17 @@ impl Config for Test {
type BlacklistOrigin = EnsureRoot<u64>;
type CancelProposalOrigin = EnsureRoot<u64>;
type VetoOrigin = EnsureSignedBy<OneToFive, u64>;
type CooloffPeriod = CooloffPeriod;
type CooloffPeriod = ConstU64<2>;
type PreimageByteDeposit = PreimageByteDeposit;
type Slash = ();
type InstantOrigin = EnsureSignedBy<Six, u64>;
type InstantAllowed = InstantAllowed;
type Scheduler = Scheduler;
type MaxVotes = MaxVotes;
type MaxVotes = ConstU32<100>;
type OperationalPreimageOrigin = EnsureSignedBy<Six, u64>;
type PalletsOrigin = OriginCaller;
type WeightInfo = ();
type MaxProposals = MaxProposals;
type MaxProposals = ConstU32<100>;
}
pub fn new_test_ext() -> sp_io::TestExternalities {