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,
dispatch::DispatchClass,
parameter_types,
traits::{Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
traits::{ConstU32, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem},
weights::{
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 {}
parameter_types! {
pub const MaxAuthorities: u32 = 10;
}
impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type MaxAuthorities = MaxAuthorities;
type MaxAuthorities = ConstU32<10>;
type DisabledValidators = ();
}
impl pallet_beefy::Config for Runtime {
type BeefyId = BeefyId;
type MaxAuthorities = MaxAuthorities;
type MaxAuthorities = ConstU32<10>;
type OnNewValidatorSet = MmrLeaf;
}
@@ -243,7 +239,7 @@ impl pallet_grandpa::Config for Runtime {
type HandleEquivocation = ();
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxAuthorities = ConstU32<10>;
}
/// MMR helper types.
@@ -311,10 +307,6 @@ impl pallet_timestamp::Config for Runtime {
parameter_types! {
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 {
@@ -327,15 +319,16 @@ impl pallet_balances::Config for Runtime {
type AccountStore = System;
// TODO: update me (https://github.com/paritytech/parity-bridges-common/issues/78)
type WeightInfo = ();
type MaxLocks = MaxLocks;
type MaxReserves = MaxReserves;
// 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.
type MaxLocks = ConstU32<50>;
type MaxReserves = ConstU32<50>;
type ReserveIdentifier = [u8; 8];
}
parameter_types! {
pub const TransactionBaseFee: Balance = 0;
pub const TransactionByteFee: Balance = 1;
pub const OperationalFeeMultiplier: u8 = 5;
// 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
pub const TargetBlockFullness: Perquintill = Perquintill::from_percent(25);
@@ -346,7 +339,7 @@ parameter_types! {
impl pallet_transaction_payment::Config for Runtime {
type OnChargeTransaction = pallet_transaction_payment::CurrencyAdapter<Balances, ()>;
type OperationalFeeMultiplier = OperationalFeeMultiplier;
type OperationalFeeMultiplier = ConstU8<5>;
type WeightToFee = bp_millau::WeightToFee;
type LengthToFee = ConstantMultiplier<Balance, TransactionByteFee>;
type FeeMultiplierUpdate = pallet_transaction_payment::TargetedFeeAdjustment<
@@ -383,14 +376,6 @@ impl pallet_session::Config for Runtime {
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 {
type RuntimeEvent = RuntimeEvent;
type Reward = Balance;
@@ -439,7 +424,11 @@ parameter_types! {
pub type RialtoGrandpaInstance = ();
impl pallet_bridge_grandpa::Config for Runtime {
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 MaxBridgedAuthorities = MaxAuthoritiesAtRialto;
type MaxBridgedHeaderSize = MaxRialtoHeaderSize;
@@ -450,7 +439,7 @@ impl pallet_bridge_grandpa::Config for Runtime {
pub type WestendGrandpaInstance = pallet_bridge_grandpa::Instance1;
impl pallet_bridge_grandpa::Config<WestendGrandpaInstance> for Runtime {
type BridgedChain = bp_westend::Westend;
type MaxRequests = MaxRequests;
type MaxRequests = ConstU32<50>;
type HeadersToKeep = HeadersToKeep;
type MaxBridgedAuthorities = MaxAuthoritiesAtWestend;
type MaxBridgedHeaderSize = MaxWestendHeaderSize;
+2 -6
View File
@@ -31,7 +31,7 @@ use bridge_runtime_common::{
};
use frame_support::{
parameter_types,
traits::{Everything, Nothing},
traits::{ConstU32, Everything, Nothing},
};
use xcm::latest::prelude::*;
use xcm_builder::{
@@ -112,10 +112,6 @@ pub type XcmRouter = (
XcmBridgeAdapter<ToRialtoParachainBridge>,
);
parameter_types! {
pub const MaxAssetsIntoHolding: u32 = 64;
}
/// The barriers one of which must be passed for an XCM message to be executed.
pub type Barrier = (
// Weight that is paid for may be consumed.
@@ -149,7 +145,7 @@ impl xcm_executor::Config for XcmConfig {
type AssetClaims = XcmPallet;
type SubscriptionService = XcmPallet;
type PalletInstancesInfo = AllPalletsWithSystem;
type MaxAssetsIntoHolding = MaxAssetsIntoHolding;
type MaxAssetsIntoHolding = ConstU32<64>;
type FeeManager = ();
type MessageExporter = ();
type UniversalAliases = Nothing;