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
+15 -26
View File
@@ -62,7 +62,7 @@ pub use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
parameter_types, parameter_types,
traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem}, traits::{ConstU32, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
weights::{ weights::{
constants::WEIGHT_PER_SECOND, ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight, constants::WEIGHT_PER_SECOND, ConstantMultiplier, IdentityFee, RuntimeDbWeight, Weight,
}, },
@@ -215,19 +215,15 @@ impl frame_system::Config for Runtime {
impl pallet_randomness_collective_flip::Config for Runtime {} impl pallet_randomness_collective_flip::Config for Runtime {}
parameter_types! {
pub const MaxAuthorities: u32 = 10;
}
impl pallet_aura::Config for Runtime { impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId; type AuthorityId = AuraId;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
type DisabledValidators = (); type DisabledValidators = ();
} }
impl pallet_beefy::Config for Runtime { impl pallet_beefy::Config for Runtime {
type BeefyId = BeefyId; type BeefyId = BeefyId;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
type OnNewValidatorSet = MmrLeaf; type OnNewValidatorSet = MmrLeaf;
} }
@@ -243,7 +239,7 @@ impl pallet_grandpa::Config for Runtime {
type HandleEquivocation = (); type HandleEquivocation = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = (); type WeightInfo = ();
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
} }
/// MMR helper types. /// MMR helper types.
@@ -311,10 +307,6 @@ impl pallet_timestamp::Config for Runtime {
parameter_types! { parameter_types! {
pub const ExistentialDeposit: bp_millau::Balance = 500; pub const ExistentialDeposit: bp_millau::Balance = 500;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50;
} }
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
@@ -327,15 +319,16 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System; type AccountStore = System;
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = (); type WeightInfo = ();
type MaxLocks = MaxLocks; // For weight estimation, we assume that the most locks on an individual account will be 50.
type MaxReserves = MaxReserves; // This number may need to be adjusted in the future if this assumption no longer holds true.
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
} }
parameter_types! { parameter_types! {
pub const TransactionBaseFee: Balance = 0; pub const TransactionBaseFee: Balance = 0;
pub const TransactionByteFee: Balance = 1; pub const TransactionByteFee: Balance = 1;
pub const OperationalFeeMultiplier: u8 = 5;
// values for following parameters are copied from polkadot repo, but it is fine // values for following parameters are copied from polkadot repo, but it is fine
// not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains // not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
@@ -346,7 +339,7 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = bp_millau::WeightToFee; type WeightToFee = bp_millau::WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>; type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment< type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
@@ -383,14 +376,6 @@ impl pallet_session::Config for Runtime {
type WeightInfo = (); type WeightInfo = ();
} }
parameter_types! {
// This is a pretty unscientific cap.
//
// Note that once this is hit the pallet will essentially throttle incoming requests down to one
// call per block.
pub const MaxRequests: u32 = 50;
}
impl pallet_bridge_relayers::Config for Runtime { impl pallet_bridge_relayers::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type Reward = Balance; type Reward = Balance;
@@ -439,7 +424,11 @@ parameter_types! {
pub type RialtoGrandpaInstance = (); pub type RialtoGrandpaInstance = ();
impl pallet_bridge_grandpa::Config for Runtime { impl pallet_bridge_grandpa::Config for Runtime {
type BridgedChain = bp_rialto::Rialto; type BridgedChain = bp_rialto::Rialto;
type MaxRequests = MaxRequests; // This is a pretty unscientific cap.
//
// Note that once this is hit the pallet will essentially throttle incoming requests down to one
// call per block.
type MaxRequests = ConstU32<50>;
type HeadersToKeep = HeadersToKeep; type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = MaxAuthoritiesAtRialto; type MaxBridgedAuthorities = MaxAuthoritiesAtRialto;
type MaxBridgedHeaderSize = MaxRialtoHeaderSize; type MaxBridgedHeaderSize = MaxRialtoHeaderSize;
@@ -450,7 +439,7 @@ impl pallet_bridge_grandpa::Config for Runtime {
pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1; pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1;
impl pallet_bridge_grandpa::Config<WestendGrandpaInstance> for Runtime { impl pallet_bridge_grandpa::Config<WestendGrandpaInstance> for Runtime {
type BridgedChain = bp_westend::Westend; type BridgedChain = bp_westend::Westend;
type MaxRequests = MaxRequests; type MaxRequests = ConstU32<50>;
type HeadersToKeep = HeadersToKeep; type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = MaxAuthoritiesAtWestend; type MaxBridgedAuthorities = MaxAuthoritiesAtWestend;
type MaxBridgedHeaderSize = MaxWestendHeaderSize; type MaxBridgedHeaderSize = MaxWestendHeaderSize;
+2 -6
View File
@@ -31,7 +31,7 @@ use bridge_runtime_common::{
}; };
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
traits::{Everything, Nothing}, traits::{ConstU32, Everything, Nothing},
}; };
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
@@ -112,10 +112,6 @@ pub type XcmRouter = (
XcmBridgeAdapter<ToRialtoParachainBridge>, XcmBridgeAdapter<ToRialtoParachainBridge>,
); );
parameter_types! {
pub const MaxAssetsIntoHolding: u32 = 64;
}
/// The barriers one of which must be passed for an XCM message to be executed. /// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = ( pub type Barrier = (
// Weight that is paid for may be consumed. // Weight that is paid for may be consumed.
@@ -149,7 +145,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetClaims = XcmPallet; type AssetClaims = XcmPallet;
type SubscriptionService = XcmPallet; type SubscriptionService = XcmPallet;
type PalletInstancesInfo = AllPalletsWithSystem; type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type MaxAssetsIntoHolding = ConstU32<64>;
type FeeManager = (); type FeeManager = ();
type MessageExporter = (); type MessageExporter = ();
type UniversalAliases = Nothing; type UniversalAliases = Nothing;
@@ -50,7 +50,7 @@ pub use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
match_types, parameter_types, match_types, parameter_types,
traits::{Everything, IsInVec, Nothing, Randomness}, traits::{ConstU32, Everything, IsInVec, Nothing, Randomness},
weights::{ weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
IdentityFee, Weight, IdentityFee, Weight,
@@ -249,8 +249,6 @@ parameter_types! {
pub const CreationFee: u128 = MILLIUNIT; pub const CreationFee: u128 = MILLIUNIT;
pub const TransactionByteFee: u128 = MICROUNIT; pub const TransactionByteFee: u128 = MICROUNIT;
pub const OperationalFeeMultiplier: u8 = 5; pub const OperationalFeeMultiplier: u8 = 5;
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50;
} }
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
@@ -262,8 +260,8 @@ impl pallet_balances::Config for Runtime {
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System; type AccountStore = System;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>; type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type MaxLocks = MaxLocks; type MaxLocks = ConstU32<50>;
type MaxReserves = MaxReserves; type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
} }
@@ -518,12 +516,6 @@ impl pallet_bridge_relayers::Config for Runtime {
} }
parameter_types! { parameter_types! {
/// This is a pretty unscientific cap.
///
/// Note that once this is hit the pallet will essentially throttle incoming requests down to one
/// call per block.
pub const MaxRequests: u32 = 50;
/// Number of headers to keep. /// Number of headers to keep.
/// ///
/// Assuming the worst case of every header being finalized, we will keep headers at least for a /// Assuming the worst case of every header being finalized, we will keep headers at least for a
@@ -539,7 +531,11 @@ parameter_types! {
pub type MillauGrandpaInstance = (); pub type MillauGrandpaInstance = ();
impl pallet_bridge_grandpa::Config for Runtime { impl pallet_bridge_grandpa::Config for Runtime {
type BridgedChain = bp_millau::Millau; type BridgedChain = bp_millau::Millau;
type MaxRequests = MaxRequests; /// This is a pretty unscientific cap.
///
/// Note that once this is hit the pallet will essentially throttle incoming requests down to
/// one call per block.
type MaxRequests = ConstU32<50>;
type HeadersToKeep = HeadersToKeep; type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = MaxAuthoritiesAtMillau; type MaxBridgedAuthorities = MaxAuthoritiesAtMillau;
type MaxBridgedHeaderSize = MaxMillauHeaderSize; type MaxBridgedHeaderSize = MaxMillauHeaderSize;
+15 -21
View File
@@ -61,7 +61,7 @@ pub use frame_support::{
construct_runtime, construct_runtime,
dispatch::DispatchClass, dispatch::DispatchClass,
parameter_types, parameter_types,
traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem}, traits::{ConstU32, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
weights::{constants::WEIGHT_PER_SECOND, IdentityFee, RuntimeDbWeight, Weight}, weights::{constants::WEIGHT_PER_SECOND, IdentityFee, RuntimeDbWeight, Weight},
StorageValue, StorageValue,
}; };
@@ -222,13 +222,12 @@ pub const BABE_GENESIS_EPOCH_CONFIG: sp_consensus_babe::BabeEpochConfiguration =
parameter_types! { parameter_types! {
pub const EpochDuration: u64 = bp_rialto::EPOCH_DURATION_IN_SLOTS as u64; pub const EpochDuration: u64 = bp_rialto::EPOCH_DURATION_IN_SLOTS as u64;
pub const ExpectedBlockTime: bp_rialto::Moment = bp_rialto::time_units::MILLISECS_PER_BLOCK; pub const ExpectedBlockTime: bp_rialto::Moment = bp_rialto::time_units::MILLISECS_PER_BLOCK;
pub const MaxAuthorities: u32 = 10;
} }
impl pallet_babe::Config for Runtime { impl pallet_babe::Config for Runtime {
type EpochDuration = EpochDuration; type EpochDuration = EpochDuration;
type ExpectedBlockTime = ExpectedBlockTime; type ExpectedBlockTime = ExpectedBlockTime;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
// session module is the trigger // session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger; type EpochChangeTrigger = pallet_babe::ExternalTrigger;
@@ -251,13 +250,13 @@ impl pallet_babe::Config for Runtime {
impl pallet_beefy::Config for Runtime { impl pallet_beefy::Config for Runtime {
type BeefyId = BeefyId; type BeefyId = BeefyId;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
type OnNewValidatorSet = MmrLeaf; type OnNewValidatorSet = MmrLeaf;
} }
impl pallet_grandpa::Config for Runtime { impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
type KeyOwnerProofSystem = (); type KeyOwnerProofSystem = ();
type KeyOwnerProof = type KeyOwnerProof =
<Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof; <Self::KeyOwnerProofSystem as KeyOwnerProofSystem<(KeyTypeId, GrandpaId)>>::Proof;
@@ -327,10 +326,6 @@ impl pallet_timestamp::Config for Runtime {
parameter_types! { parameter_types! {
pub const ExistentialDeposit: bp_rialto::Balance = 500; pub const ExistentialDeposit: bp_rialto::Balance = 500;
// For weight estimation, we assume that the most locks on an individual account will be 50.
// This number may need to be adjusted in the future if this assumption no longer holds true.
pub const MaxLocks: u32 = 50;
pub const MaxReserves: u32 = 50;
} }
impl pallet_balances::Config for Runtime { impl pallet_balances::Config for Runtime {
@@ -343,15 +338,16 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System; type AccountStore = System;
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78) // TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = (); type WeightInfo = ();
type MaxLocks = MaxLocks; // For weight estimation, we assume that the most locks on an individual account will be 50.
type MaxReserves = MaxReserves; // This number may need to be adjusted in the future if this assumption no longer holds true.
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8]; type ReserveIdentifier = [u8; 8];
} }
parameter_types! { parameter_types! {
pub const TransactionBaseFee: Balance = 0; pub const TransactionBaseFee: Balance = 0;
pub const TransactionByteFee: Balance = 1; pub const TransactionByteFee: Balance = 1;
pub const OperationalFeeMultiplier: u8 = 5;
// values for following parameters are copied from polkadot repo, but it is fine // values for following parameters are copied from polkadot repo, but it is fine
// not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains // not to sync them - we're not going to make Rialto a full copy of one of Polkadot-like chains
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25); pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
@@ -362,7 +358,7 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime { impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>; type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier; type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = bp_rialto::WeightToFee; type WeightToFee = bp_rialto::WeightToFee;
type LengthToFee = bp_rialto::WeightToFee; type LengthToFee = bp_rialto::WeightToFee;
type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment< type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
@@ -394,7 +390,7 @@ impl pallet_session::Config for Runtime {
} }
impl pallet_authority_discovery::Config for Runtime { impl pallet_authority_discovery::Config for Runtime {
type MaxAuthorities = MaxAuthorities; type MaxAuthorities = ConstU32<10>;
} }
impl pallet_bridge_relayers::Config for Runtime { impl pallet_bridge_relayers::Config for Runtime {
@@ -405,12 +401,6 @@ impl pallet_bridge_relayers::Config for Runtime {
} }
parameter_types! { parameter_types! {
/// This is a pretty unscientific cap.
///
/// Note that once this is hit the pallet will essentially throttle incoming requests down to one
/// call per block.
pub const MaxRequests: u32 = 50;
/// Number of headers to keep. /// Number of headers to keep.
/// ///
/// Assuming the worst case of every header being finalized, we will keep headers at least for a /// Assuming the worst case of every header being finalized, we will keep headers at least for a
@@ -426,7 +416,11 @@ parameter_types! {
pub type MillauGrandpaInstance = (); pub type MillauGrandpaInstance = ();
impl pallet_bridge_grandpa::Config for Runtime { impl pallet_bridge_grandpa::Config for Runtime {
type BridgedChain = bp_millau::Millau; type BridgedChain = bp_millau::Millau;
type MaxRequests = MaxRequests; /// This is a pretty unscientific cap.
///
/// Note that once this is hit the pallet will essentially throttle incoming requests down to
/// one call per block.
type MaxRequests = ConstU32<50>;
type HeadersToKeep = HeadersToKeep; type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = MaxAuthoritiesAtMillau; type MaxBridgedAuthorities = MaxAuthoritiesAtMillau;
type MaxBridgedHeaderSize = MaxMillauHeaderSize; type MaxBridgedHeaderSize = MaxMillauHeaderSize;
+1 -5
View File
@@ -123,14 +123,10 @@ impl parachains_session_info::Config for Runtime {
impl parachains_shared::Config for Runtime {} impl parachains_shared::Config for Runtime {}
parameter_types! {
pub const FirstMessageFactorPercent: u64 = 100;
}
impl parachains_ump::Config for Runtime { impl parachains_ump::Config for Runtime {
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type UmpSink = (); type UmpSink = ();
type FirstMessageFactorPercent = FirstMessageFactorPercent; type FirstMessageFactorPercent = frame_support::traits::ConstU64<100>;
type ExecuteOverweightOrigin = EnsureRoot<AccountId>; type ExecuteOverweightOrigin = EnsureRoot<AccountId>;
type WeightInfo = parachains_ump::TestWeightInfo; type WeightInfo = parachains_ump::TestWeightInfo;
} }
+2 -6
View File
@@ -27,7 +27,7 @@ use bridge_runtime_common::{
}; };
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
traits::{Everything, Nothing}, traits::{ConstU32, Everything, Nothing},
}; };
use xcm::latest::prelude::*; use xcm::latest::prelude::*;
use xcm_builder::{ use xcm_builder::{
@@ -104,10 +104,6 @@ pub type XcmRouter = (
XcmBridgeAdapter<ToMillauBridge>, XcmBridgeAdapter<ToMillauBridge>,
); );
parameter_types! {
pub const MaxAssetsIntoHolding: u32 = 64;
}
/// The barriers one of which must be passed for an XCM message to be executed. /// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = ( pub type Barrier = (
// Weight that is paid for may be consumed. // Weight that is paid for may be consumed.
@@ -141,7 +137,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetClaims = XcmPallet; type AssetClaims = XcmPallet;
type SubscriptionService = XcmPallet; type SubscriptionService = XcmPallet;
type PalletInstancesInfo = AllPalletsWithSystem; type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding; type MaxAssetsIntoHolding = ConstU32<64>;
type FeeManager = (); type FeeManager = ();
type MessageExporter = (); type MessageExporter = ();
type UniversalAliases = Nothing; type UniversalAliases = Nothing;
+2 -3
View File
@@ -24,7 +24,7 @@ use crate::{
use bp_beefy::{BeefyValidatorSignatureOf, ChainWithBeefy, Commitment, MmrDataOrHash}; use bp_beefy::{BeefyValidatorSignatureOf, ChainWithBeefy, Commitment, MmrDataOrHash};
use bp_runtime::{BasicOperatingMode, Chain}; use bp_runtime::{BasicOperatingMode, Chain};
use codec::Encode; 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_core::{sr25519::Signature, Pair};
use sp_runtime::{ use sp_runtime::{
testing::{Header, H256}, testing::{Header, H256},
@@ -72,7 +72,6 @@ construct_runtime! {
} }
parameter_types! { parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024; pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one(); pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -89,7 +88,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type RuntimeEvent = (); type RuntimeEvent = ();
type BlockHashCount = BlockHashCount; type BlockHashCount = ConstU64<250>;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
type AccountData = (); type AccountData = ();
+2 -3
View File
@@ -18,7 +18,7 @@
#![allow(clippy::from_over_into)] #![allow(clippy::from_over_into)]
use bp_runtime::Chain; 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_core::sr25519::Signature;
use sp_runtime::{ use sp_runtime::{
testing::{Header, H256}, testing::{Header, H256},
@@ -50,7 +50,6 @@ construct_runtime! {
} }
parameter_types! { parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024; pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one(); pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -67,7 +66,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type RuntimeEvent = (); type RuntimeEvent = ();
type BlockHashCount = BlockHashCount; type BlockHashCount = ConstU64<250>;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
type AccountData = (); type AccountData = ();
+3 -6
View File
@@ -32,6 +32,7 @@ use bp_runtime::{messages::MessageDispatchResult, Size};
use codec::{Decode, Encode}; use codec::{Decode, Encode};
use frame_support::{ use frame_support::{
parameter_types, parameter_types,
traits::ConstU64,
weights::{RuntimeDbWeight, Weight}, weights::{RuntimeDbWeight, Weight},
}; };
use scale_info::TypeInfo; use scale_info::TypeInfo;
@@ -104,7 +105,7 @@ impl frame_system::Config for TestRuntime {
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = SubstrateHeader; type Header = SubstrateHeader;
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type BlockHashCount = BlockHashCount; type BlockHashCount = ConstU64<250>;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
type AccountData = pallet_balances::AccountData<Balance>; type AccountData = pallet_balances::AccountData<Balance>;
@@ -120,16 +121,12 @@ impl frame_system::Config for TestRuntime {
type MaxConsumers = frame_support::traits::ConstU32<16>; type MaxConsumers = frame_support::traits::ConstU32<16>;
} }
parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}
impl pallet_balances::Config for TestRuntime { impl pallet_balances::Config for TestRuntime {
type MaxLocks = (); type MaxLocks = ();
type Balance = Balance; type Balance = Balance;
type DustRemoval = (); type DustRemoval = ();
type RuntimeEvent = RuntimeEvent; type RuntimeEvent = RuntimeEvent;
type ExistentialDeposit = ExistentialDeposit; type ExistentialDeposit = ConstU64<1>;
type AccountStore = frame_system::Pallet<TestRuntime>; type AccountStore = frame_system::Pallet<TestRuntime>;
type WeightInfo = (); type WeightInfo = ();
type MaxReserves = (); type MaxReserves = ();
+8 -5
View File
@@ -16,7 +16,11 @@
use bp_polkadot_core::parachains::ParaId; use bp_polkadot_core::parachains::ParaId;
use bp_runtime::Chain; 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::{ use sp_runtime::{
testing::{Header, H256}, testing::{Header, H256},
traits::{BlakeTwo256, Header as HeaderT, IdentityLookup}, traits::{BlakeTwo256, Header as HeaderT, IdentityLookup},
@@ -86,15 +90,14 @@ impl frame_system::Config for TestRuntime {
} }
parameter_types! { parameter_types! {
pub const MaxRequests: u32 = 2;
pub const HeadersToKeep: u32 = 5;
pub const SessionLength: u64 = 5; pub const SessionLength: u64 = 5;
pub const NumValidators: u32 = 5; pub const NumValidators: u32 = 5;
pub const HeadersToKeep: u32 = 5;
} }
impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance1> for TestRuntime { impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance1> for TestRuntime {
type BridgedChain = TestBridgedChain; type BridgedChain = TestBridgedChain;
type MaxRequests = MaxRequests; type MaxRequests = ConstU32<2>;
type HeadersToKeep = HeadersToKeep; type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = frame_support::traits::ConstU32<5>; type MaxBridgedAuthorities = frame_support::traits::ConstU32<5>;
type MaxBridgedHeaderSize = frame_support::traits::ConstU32<512>; 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 { impl pallet_bridge_grandpa::Config<pallet_bridge_grandpa::Instance2> for TestRuntime {
type BridgedChain = TestBridgedChain; type BridgedChain = TestBridgedChain;
type MaxRequests = MaxRequests; type MaxRequests = ConstU32<2>;
type HeadersToKeep = HeadersToKeep; type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = frame_support::traits::ConstU32<5>; type MaxBridgedAuthorities = frame_support::traits::ConstU32<5>;
type MaxBridgedHeaderSize = frame_support::traits::ConstU32<512>; type MaxBridgedHeaderSize = frame_support::traits::ConstU32<512>;
@@ -152,7 +152,6 @@ mod tests {
} }
parameter_types! { parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024); pub const MaximumBlockWeight: Weight = Weight::from_ref_time(1024);
pub const MaximumBlockLength: u32 = 2 * 1024; pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::one(); pub const AvailableBlockRatio: Perbill = Perbill::one();
@@ -169,7 +168,7 @@ mod tests {
type Lookup = IdentityLookup<Self::AccountId>; type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header; type Header = Header;
type RuntimeEvent = (); type RuntimeEvent = ();
type BlockHashCount = BlockHashCount; type BlockHashCount = frame_support::traits::ConstU64<250>;
type Version = (); type Version = ();
type PalletInfo = PalletInfo; type PalletInfo = PalletInfo;
type AccountData = (); type AccountData = ();