Replace const parameters types (#1691)

* Replace const parameters

* fmt

* missed out Maxlocks
This commit is contained in:
Binston Sukhael Cardoza
2022-12-02 13:15:34 +05:30
committed by Bastian Köcher
parent 9cea69349f
commit 3a8cb23103
11 changed files with 59 additions and 95 deletions
+2 -3
View File
@@ -24,7 +24,7 @@ use crate::{
use bp_beefy::{BeefyValidatorSignatureOf, ChainWithBeefy, Commitment, MmrDataOrHash};
use bp_runtime::{BasicOperatingMode, Chain};
use codec::Encode;
use frame_support::{construct_runtime, parameter_types, weights::Weight};
use frame_support::{construct_runtime, parameter_types, traits::ConstU64, weights::Weight};
use sp_core::{sr25519::Signature, Pair};
use sp_runtime::{
testing::{Header, H256},
@@ -72,7 +72,6 @@ construct_runtime! {
}
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -89,7 +88,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = ();
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
+2 -3
View File
@@ -18,7 +18,7 @@
#![allow(clippy::from_over_into)]
use bp_runtime::Chain;
use frame_support::{construct_runtime, parameter_types, weights::Weight};
use frame_support::{construct_runtime, parameter_types, traits::ConstU64, weights::Weight};
use sp_core::sr25519::Signature;
use sp_runtime::{
testing::{Header, H256},
@@ -50,7 +50,6 @@ construct_runtime! {
}
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -67,7 +66,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = ();
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();
+3 -6
View File
@@ -32,6 +32,7 @@ use bp_runtime::{messages::MessageDispatchResult, Size};
use codec::{Decode, Encode};
use frame_support::{
parameter_types,
traits::ConstU64,
weights::{RuntimeDbWeight, Weight},
};
use scale_info::TypeInfo;
@@ -104,7 +105,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup<Self::AccountId>;
type Header = SubstrateHeader;
type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>;
@@ -120,16 +121,12 @@ impl frame_system::Config for TestRuntime {
type MaxConsumers = frame_support::traits::ConstU32<16>;
}
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Config for TestRuntime {
type MaxLocks = ();
type Balance = Balance;
type DustRemoval = ();
type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = frame_system::Pallet<TestRuntime>;
type WeightInfo = ();
type MaxReserves = ();
+8 -5
View File
@@ -16,7 +16,11 @@
use bp_polkadot_core::parachains::ParaId;
use bp_runtime::Chain;
use frame_support::{construct_runtime, parameter_types, traits::IsInVec, weights::Weight};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, IsInVec},
weights::Weight,
};
use sp_runtime::{
testing::{Header, H256},
traits::{BlakeTwo256, Header as HeaderT, IdentityLookup},
@@ -86,15 +90,14 @@ impl frame_system::Config for TestRuntime {
}
parameter_types! {
pub const MaxRequests: u32 = 2;
pub const HeadersToKeep: u32 = 5;
pub const SessionLength: u64 = 5;
pub const NumValidators: u32 = 5;
pub const HeadersToKeep: u32 = 5;
}
impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance1> for TestRuntime {
type BridgedChain = TestBridgedChain;
type MaxRequests = MaxRequests;
type MaxRequests = ConstU32<2>;
type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = frame_support::traits::ConstU32<5>;
type MaxBridgedHeaderSize = frame_support::traits::ConstU32<512>;
@@ -103,7 +106,7 @@ impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance1> for TestRun
impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance2> for TestRuntime {
type BridgedChain = TestBridgedChain;
type MaxRequests = MaxRequests;
type MaxRequests = ConstU32<2>;
type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = frame_support::traits::ConstU32<5>;
type MaxBridgedHeaderSize = frame_support::traits::ConstU32<512>;
@@ -152,7 +152,6 @@ mod tests {
}
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -169,7 +168,7 @@ mod tests {
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type RuntimeEvent = ();
type BlockHashCount = BlockHashCount;
type BlockHashCount = frame_support::traits::ConstU64<250>;
type Version = ();
type PalletInfo = PalletInfo;
type AccountData = ();