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
+18 -28
View File
@@ -24,8 +24,11 @@ use crate as pallet_bounties;
use std::cell::RefCell;
use frame_support::{
assert_noop, assert_ok, pallet_prelude::GenesisBuild, parameter_types, traits::OnInitialize,
weights::Weight, PalletId,
assert_noop, assert_ok,
pallet_prelude::GenesisBuild,
parameter_types,
traits::{ConstU32, ConstU64, OnInitialize},
PalletId,
};
use sp_core::H256;
@@ -54,9 +57,6 @@ frame_support::construct_runtime!(
);
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = 1024;
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
}
@@ -75,7 +75,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>;
@@ -86,9 +86,7 @@ impl frame_system::Config for Test {
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = ();
@@ -96,7 +94,7 @@ impl pallet_balances::Config for Test {
type Balance = u64;
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
}
@@ -105,13 +103,10 @@ thread_local! {
}
parameter_types! {
pub const ProposalBond: Permill = Permill::from_percent(5);
pub const ProposalBondMinimum: u64 = 1;
pub const SpendPeriod: u64 = 2;
pub const Burn: Permill = Permill::from_percent(50);
pub const DataDepositPerByte: u64 = 1;
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
pub const MaxApprovals: u32 = 100;
}
// impl pallet_treasury::Config for Test {
impl pallet_treasury::Config for Test {
type PalletId = TreasuryPalletId;
@@ -121,31 +116,26 @@ impl pallet_treasury::Config for Test {
type Event = Event;
type OnSlash = ();
type ProposalBond = ProposalBond;
type ProposalBondMinimum = ProposalBondMinimum;
type SpendPeriod = SpendPeriod;
type ProposalBondMinimum = ConstU64<1>;
type SpendPeriod = ConstU64<2>;
type Burn = Burn;
type BurnDestination = (); // Just gets burned.
type WeightInfo = ();
type SpendFunds = Bounties;
type MaxApprovals = MaxApprovals;
type MaxApprovals = ConstU32<100>;
}
parameter_types! {
pub const BountyDepositBase: u64 = 80;
pub const BountyDepositPayoutDelay: u64 = 3;
pub const BountyUpdatePeriod: u32 = 20;
pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
pub const BountyValueMinimum: u64 = 1;
pub const MaximumReasonLength: u32 = 16384;
}
impl Config for Test {
type Event = Event;
type BountyDepositBase = BountyDepositBase;
type BountyDepositPayoutDelay = BountyDepositPayoutDelay;
type BountyUpdatePeriod = BountyUpdatePeriod;
type BountyDepositBase = ConstU64<80>;
type BountyDepositPayoutDelay = ConstU64<3>;
type BountyUpdatePeriod = ConstU64<20>;
type BountyCuratorDeposit = BountyCuratorDeposit;
type BountyValueMinimum = BountyValueMinimum;
type DataDepositPerByte = DataDepositPerByte;
type MaximumReasonLength = MaximumReasonLength;
type BountyValueMinimum = ConstU64<1>;
type DataDepositPerByte = ConstU64<1>;
type MaximumReasonLength = ConstU32<16384>;
type WeightInfo = ();
type ChildBountyManager = ();
}