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
@@ -22,6 +22,7 @@
use crate::{self as pallet_balances, decl_tests, Config, Pallet};
use frame_support::{
parameter_types,
traits::{ConstU32, ConstU64, ConstU8},
weights::{DispatchInfo, IdentityFee, Weight},
};
use pallet_transaction_payment::CurrencyAdapter;
@@ -44,7 +45,6 @@ frame_support::construct_runtime!(
);
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
pub static ExistentialDeposit: u64 = 0;
@@ -64,7 +64,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 = super::AccountData<u64>;
@@ -75,22 +75,15 @@ impl frame_system::Config for Test {
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
parameter_types! {
pub const TransactionByteFee: u64 = 1;
pub const OperationalFeeMultiplier: u8 = 5;
}
impl pallet_transaction_payment::Config for Test {
type OnChargeTransaction = CurrencyAdapter<Pallet<Test>, ()>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type TransactionByteFee = ConstU64<1>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<u64>;
type FeeMultiplierUpdate = ();
}
parameter_types! {
pub const MaxReserves: u32 = 2;
}
impl Config for Test {
type Balance = u64;
type DustRemoval = ();
@@ -98,7 +91,7 @@ impl Config for Test {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = frame_system::Pallet<Test>;
type MaxLocks = ();
type MaxReserves = MaxReserves;
type MaxReserves = ConstU32<2>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
}
+8 -15
View File
@@ -22,7 +22,7 @@
use crate::{self as pallet_balances, decl_tests, Config, Pallet};
use frame_support::{
parameter_types,
traits::StorageMapShim,
traits::{ConstU32, ConstU64, ConstU8, StorageMapShim},
weights::{DispatchInfo, IdentityFee, Weight},
};
use pallet_transaction_payment::CurrencyAdapter;
@@ -46,7 +46,6 @@ frame_support::construct_runtime!(
);
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
pub static ExistentialDeposit: u64 = 0;
@@ -66,7 +65,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 = ();
@@ -77,21 +76,15 @@ impl frame_system::Config for Test {
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
parameter_types! {
pub const TransactionByteFee: u64 = 1;
pub const OperationalFeeMultiplier: u8 = 5;
}
impl pallet_transaction_payment::Config for Test {
type OnChargeTransaction = CurrencyAdapter<Pallet<Test>, ()>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type TransactionByteFee = ConstU64<1>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<u64>;
type FeeMultiplierUpdate = ();
}
parameter_types! {
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 2;
}
impl Config for Test {
type Balance = u64;
type DustRemoval = ();
@@ -99,8 +92,8 @@ impl Config for Test {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore =
StorageMapShim<super::Account<Test>, system::Provider<Test>, u64, super::AccountData<u64>>;
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<2>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
}
@@ -20,7 +20,11 @@
#![cfg(test)]
use crate::{self as pallet_balances, Config, Pallet};
use frame_support::{parameter_types, traits::StorageMapShim, weights::IdentityFee};
use frame_support::{
parameter_types,
traits::{ConstU32, ConstU64, ConstU8, StorageMapShim},
weights::IdentityFee,
};
use pallet_transaction_payment::CurrencyAdapter;
use sp_core::H256;
use sp_io;
@@ -48,7 +52,6 @@ frame_support::construct_runtime!(
);
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
pub static ExistentialDeposit: u64 = 0;
@@ -68,7 +71,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 = ();
@@ -79,14 +82,11 @@ impl frame_system::Config for Test {
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
parameter_types! {
pub const TransactionByteFee: u64 = 1;
pub const OperationalFeeMultiplier: u8 = 5;
}
impl pallet_transaction_payment::Config for Test {
type OnChargeTransaction = CurrencyAdapter<Pallet<Test>, ()>;
type TransactionByteFee = TransactionByteFee;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type TransactionByteFee = ConstU64<1>;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = IdentityFee<u64>;
type FeeMultiplierUpdate = ();
}
@@ -97,10 +97,7 @@ impl OnUnbalanced<NegativeImbalance<Test>> for OnDustRemoval {
assert_ok!(Balances::resolve_into_existing(&1, amount));
}
}
parameter_types! {
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 2;
}
impl Config for Test {
type Balance = u64;
type DustRemoval = OnDustRemoval;
@@ -108,8 +105,8 @@ impl Config for Test {
type ExistentialDeposit = ExistentialDeposit;
type AccountStore =
StorageMapShim<super::Account<Test>, system::Provider<Test>, u64, super::AccountData<u64>>;
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<2>;
type ReserveIdentifier = [u8; 8];
type WeightInfo = ();
}