mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-11 11:51:12 +00:00
Replace simple parameter_types (#11254)
* update bin/node-template/runtime/src/lib.rs * update frame/contracts/src/tests.rs * update frame/executive/src/lib.rs * update frame/grandpa/src/mock.rs * update frame/im-online/src/mock.rs * update frame/offences/benchmarking/src/mock.rs * update frame/recovery/src/mock.rs * update frame/referenda/src/mock.rs * update frame/session/benchmarking/src/mock.rs * update frame/staking/src/mock.rs * update frame/state-trie-migration/src/lib.rs * update frame/support/test/compile_pass/src/lib.rs * frame/treasury/src/tests.rs * update frame/whitelist/src/mock.rs * update frame/vesting/src/mock.rs * update test-utils/runtime/src/lib.rs * update bin/node-template/runtime/src/lib.rs * Update frame/grandpa/src/mock.rs Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * resolve failed checks 1518659 & 1518669 * resolve format check * backtrack to resolve compile error * check --all --tests ✅ * cargo +nightly fmt ✅ Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
committed by
GitHub
parent
b0bfbbbc04
commit
aaf693f05a
@@ -26,7 +26,9 @@ use sp_version::RuntimeVersion;
|
||||
// A few exports that help ease life for downstream crates.
|
||||
pub use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{ConstU128, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo},
|
||||
traits::{
|
||||
ConstU128, ConstU32, ConstU64, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo,
|
||||
},
|
||||
weights::{
|
||||
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
|
||||
IdentityFee, Weight,
|
||||
@@ -132,8 +134,8 @@ pub fn native_version() -> NativeVersion {
|
||||
const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);
|
||||
|
||||
parameter_types! {
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
pub const BlockHashCount: BlockNumber = 2400;
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
/// We allow for 2 seconds of compute with a 6 second average block time.
|
||||
pub BlockWeights: frame_system::limits::BlockWeights = frame_system::limits::BlockWeights
|
||||
::with_sensible_defaults(2 * WEIGHT_PER_SECOND, NORMAL_DISPATCH_RATIO);
|
||||
@@ -224,15 +226,11 @@ impl pallet_grandpa::Config for Runtime {
|
||||
type MaxAuthorities = ConstU32<32>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
|
||||
}
|
||||
|
||||
impl pallet_timestamp::Config for Runtime {
|
||||
/// A timestamp: milliseconds since the unix epoch.
|
||||
type Moment = u64;
|
||||
type OnTimestampSet = Aura;
|
||||
type MinimumPeriod = MinimumPeriod;
|
||||
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
|
||||
@@ -234,9 +234,6 @@ impl pallet_utility::Config for Test {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub const MaxValueSize: u32 = 16_384;
|
||||
pub const DeletionWeightLimit: Weight = 500_000_000_000;
|
||||
pub const MaxCodeSize: u32 = 2 * 1024;
|
||||
pub MySchedule: Schedule<Test> = {
|
||||
let mut schedule = <Schedule<Test>>::default();
|
||||
// We want stack height to be always enabled for tests so that this
|
||||
@@ -244,7 +241,6 @@ parameter_types! {
|
||||
schedule.limits.stack_height = Some(512);
|
||||
schedule
|
||||
};
|
||||
pub const TransactionByteFee: u64 = 0;
|
||||
pub static DepositPerByte: BalanceOf<Test> = 1;
|
||||
pub const DepositPerItem: BalanceOf<Test> = 2;
|
||||
}
|
||||
@@ -286,7 +282,7 @@ impl Config for Test {
|
||||
type WeightInfo = ();
|
||||
type ChainExtension = TestExtension;
|
||||
type DeletionQueueDepth = ConstU32<1024>;
|
||||
type DeletionWeightLimit = DeletionWeightLimit;
|
||||
type DeletionWeightLimit = ConstU64<500_000_000_000>;
|
||||
type Schedule = MySchedule;
|
||||
type DepositPerByte = DepositPerByte;
|
||||
type DepositPerItem = DepositPerItem;
|
||||
|
||||
@@ -769,14 +769,11 @@ mod tests {
|
||||
}
|
||||
|
||||
type Balance = u64;
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = 1;
|
||||
}
|
||||
impl pallet_balances::Config for Runtime {
|
||||
type Balance = Balance;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type ExistentialDeposit = ConstU64<1>;
|
||||
type AccountStore = System;
|
||||
type MaxLocks = ();
|
||||
type MaxReserves = ();
|
||||
|
||||
@@ -172,11 +172,7 @@ pallet_staking_reward_curve::build! {
|
||||
parameter_types! {
|
||||
pub const SessionsPerEra: SessionIndex = 3;
|
||||
pub const BondingDuration: EraIndex = 3;
|
||||
pub const SlashDeferDuration: EraIndex = 0;
|
||||
pub const AttestationPeriod: u64 = 100;
|
||||
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
|
||||
pub const ElectionLookahead: u64 = 0;
|
||||
pub const StakingUnsignedPriority: u64 = u64::MAX / 2;
|
||||
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(17);
|
||||
}
|
||||
|
||||
@@ -199,7 +195,7 @@ impl pallet_staking::Config for Test {
|
||||
type Reward = ();
|
||||
type SessionsPerEra = SessionsPerEra;
|
||||
type BondingDuration = BondingDuration;
|
||||
type SlashDeferDuration = SlashDeferDuration;
|
||||
type SlashDeferDuration = ();
|
||||
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
|
||||
type SessionInterface = Self;
|
||||
type UnixTime = pallet_timestamp::Pallet<Test>;
|
||||
|
||||
@@ -218,17 +218,13 @@ impl frame_support::traits::EstimateNextSessionRotation<u64> for TestNextSession
|
||||
}
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const UnsignedPriority: u64 = 1 << 20;
|
||||
}
|
||||
|
||||
impl Config for Runtime {
|
||||
type AuthorityId = UintAuthorityId;
|
||||
type Event = Event;
|
||||
type ValidatorSet = Historical;
|
||||
type NextSessionRotation = TestNextSessionRotation;
|
||||
type ReportUnresponsiveness = OffenceHandler;
|
||||
type UnsignedPriority = UnsignedPriority;
|
||||
type UnsignedPriority = ConstU64<{ 1 << 20 }>;
|
||||
type WeightInfo = ();
|
||||
type MaxKeys = ConstU32<10_000>;
|
||||
type MaxPeerInHeartbeats = ConstU32<10_000>;
|
||||
|
||||
@@ -69,9 +69,7 @@ impl frame_system::Config for Test {
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = 10;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Test {
|
||||
type MaxLocks = ();
|
||||
type MaxReserves = ();
|
||||
@@ -79,7 +77,7 @@ impl pallet_balances::Config for Test {
|
||||
type Balance = Balance;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type ExistentialDeposit = ConstU64<10>;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ use frame_support::{
|
||||
ConstU32, ConstU64, Contains, EqualPrivilegeOnly, OnInitialize, OriginTrait, Polling,
|
||||
PreimageRecipient, SortedMembers,
|
||||
},
|
||||
weights::Weight,
|
||||
};
|
||||
use frame_system::{EnsureRoot, EnsureSignedBy};
|
||||
use sp_core::H256;
|
||||
@@ -62,7 +61,6 @@ impl Contains<Call> for BaseFilter {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u64 = 250;
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(1_000_000);
|
||||
}
|
||||
@@ -81,7 +79,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>;
|
||||
@@ -101,15 +99,12 @@ impl pallet_preimage::Config for Test {
|
||||
type BaseDeposit = ();
|
||||
type ByteDeposit = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub MaximumSchedulerWeight: Weight = 2_000_000_000_000;
|
||||
}
|
||||
impl pallet_scheduler::Config for Test {
|
||||
type Event = Event;
|
||||
type Origin = Origin;
|
||||
type PalletsOrigin = OriginCaller;
|
||||
type Call = Call;
|
||||
type MaximumWeight = MaximumSchedulerWeight;
|
||||
type MaximumWeight = ConstU64<2_000_000_000_000>;
|
||||
type ScheduleOrigin = EnsureRoot<u64>;
|
||||
type MaxScheduledPerBlock = ConstU32<100>;
|
||||
type WeightInfo = ();
|
||||
@@ -117,26 +112,19 @@ impl pallet_scheduler::Config for Test {
|
||||
type PreimageProvider = Preimage;
|
||||
type NoPreimagePostponement = ConstU64<10>;
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
pub const MaxLocks: u32 = 10;
|
||||
}
|
||||
impl pallet_balances::Config for Test {
|
||||
type MaxReserves = ();
|
||||
type ReserveIdentifier = [u8; 8];
|
||||
type MaxLocks = MaxLocks;
|
||||
type MaxLocks = ConstU32<10>;
|
||||
type Balance = u64;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type ExistentialDeposit = ConstU64<1>;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
parameter_types! {
|
||||
pub static AlarmInterval: u64 = 1;
|
||||
pub const SubmissionDeposit: u64 = 2;
|
||||
pub const MaxQueued: u32 = 3;
|
||||
pub const UndecidingTimeout: u64 = 20;
|
||||
}
|
||||
ord_parameter_types! {
|
||||
pub const One: u64 = 1;
|
||||
@@ -228,9 +216,9 @@ impl Config for Test {
|
||||
type Slash = ();
|
||||
type Votes = u32;
|
||||
type Tally = Tally;
|
||||
type SubmissionDeposit = SubmissionDeposit;
|
||||
type MaxQueued = MaxQueued;
|
||||
type UndecidingTimeout = UndecidingTimeout;
|
||||
type SubmissionDeposit = ConstU64<2>;
|
||||
type MaxQueued = ConstU32<3>;
|
||||
type UndecidingTimeout = ConstU64<20>;
|
||||
type AlarmInterval = AlarmInterval;
|
||||
type Tracks = TestTracksInfo;
|
||||
}
|
||||
|
||||
@@ -73,9 +73,7 @@ impl frame_system::Config for Test {
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: Balance = 10;
|
||||
}
|
||||
|
||||
impl pallet_balances::Config for Test {
|
||||
type MaxLocks = ();
|
||||
type MaxReserves = ();
|
||||
@@ -83,7 +81,7 @@ impl pallet_balances::Config for Test {
|
||||
type Balance = Balance;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type ExistentialDeposit = ConstU64<10>;
|
||||
type AccountStore = System;
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
@@ -980,7 +980,10 @@ mod benchmarks {
|
||||
mod mock {
|
||||
use super::*;
|
||||
use crate as pallet_state_trie_migration;
|
||||
use frame_support::{parameter_types, traits::Hooks};
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
traits::{ConstU32, ConstU64, Hooks},
|
||||
};
|
||||
use frame_system::{EnsureRoot, EnsureSigned};
|
||||
use sp_core::{
|
||||
storage::{ChildInfo, StateVersion},
|
||||
@@ -1008,7 +1011,6 @@ mod mock {
|
||||
);
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: u32 = 250;
|
||||
pub const SS58Prefix: u8 = 42;
|
||||
}
|
||||
|
||||
@@ -1026,7 +1028,7 @@ mod mock {
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = sp_runtime::generic::Header<Self::BlockNumber, BlakeTwo256>;
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockHashCount = ConstU32<250>;
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = PalletInfo;
|
||||
@@ -1036,12 +1038,10 @@ mod mock {
|
||||
type SystemWeightInfo = ();
|
||||
type SS58Prefix = SS58Prefix;
|
||||
type OnSetCode = ();
|
||||
type MaxConsumers = frame_support::traits::ConstU32<16>;
|
||||
type MaxConsumers = ConstU32<16>;
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const ExistentialDeposit: u64 = 1;
|
||||
pub const OffchainRepeat: u32 = 1;
|
||||
pub const SignedDepositPerItem: u64 = 1;
|
||||
pub const SignedDepositBase: u64 = 5;
|
||||
}
|
||||
@@ -1050,7 +1050,7 @@ mod mock {
|
||||
type Balance = u64;
|
||||
type Event = Event;
|
||||
type DustRemoval = ();
|
||||
type ExistentialDeposit = ExistentialDeposit;
|
||||
type ExistentialDeposit = ConstU64<1>;
|
||||
type AccountStore = System;
|
||||
type MaxLocks = ();
|
||||
type MaxReserves = ();
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
use frame_support::{
|
||||
construct_runtime, parameter_types,
|
||||
traits::{ConstU16, ConstU32},
|
||||
traits::{ConstU16, ConstU32, ConstU64},
|
||||
};
|
||||
use sp_core::{sr25519, H256};
|
||||
use sp_runtime::{
|
||||
@@ -50,7 +50,6 @@ pub type BlockNumber = u64;
|
||||
pub type Index = u64;
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: BlockNumber = 2400;
|
||||
pub const Version: RuntimeVersion = VERSION;
|
||||
}
|
||||
|
||||
@@ -63,7 +62,7 @@ impl frame_system::Config for Runtime {
|
||||
type Hashing = BlakeTwo256;
|
||||
type Header = Header;
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockHashCount = ConstU64<2400>;
|
||||
type Version = Version;
|
||||
type AccountData = ();
|
||||
type Origin = Origin;
|
||||
|
||||
@@ -101,9 +101,6 @@ parameter_types! {
|
||||
pub const ProposalBond: Permill = Permill::from_percent(5);
|
||||
pub const Burn: Permill = Permill::from_percent(50);
|
||||
pub const TreasuryPalletId: PalletId = PalletId(*b"py/trsry");
|
||||
pub const BountyUpdatePeriod: u32 = 20;
|
||||
pub const BountyCuratorDeposit: Permill = Permill::from_percent(50);
|
||||
pub const BountyValueMinimum: u64 = 1;
|
||||
pub const MaxApprovals: u32 = 100;
|
||||
}
|
||||
impl Config for Test {
|
||||
@@ -121,7 +118,7 @@ impl Config for Test {
|
||||
type BurnDestination = (); // Just gets burned.
|
||||
type WeightInfo = ();
|
||||
type SpendFunds = ();
|
||||
type MaxApprovals = MaxApprovals;
|
||||
type MaxApprovals = ConstU32<100>;
|
||||
}
|
||||
|
||||
pub fn new_test_ext() -> sp_io::TestExternalities {
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
use crate as pallet_whitelist;
|
||||
|
||||
use frame_support::{
|
||||
parameter_types,
|
||||
construct_runtime, parameter_types,
|
||||
traits::{ConstU32, ConstU64, Nothing},
|
||||
};
|
||||
use frame_system::EnsureRoot;
|
||||
@@ -36,7 +36,7 @@ use sp_runtime::{
|
||||
type UncheckedExtrinsic = frame_system::mocking::MockUncheckedExtrinsic<Test>;
|
||||
type Block = frame_system::mocking::MockBlock<Test>;
|
||||
|
||||
frame_support::construct_runtime!(
|
||||
construct_runtime!(
|
||||
pub enum Test where
|
||||
Block = Block,
|
||||
NodeBlock = Block,
|
||||
@@ -49,7 +49,7 @@ frame_support::construct_runtime!(
|
||||
}
|
||||
);
|
||||
|
||||
frame_support::parameter_types! {
|
||||
parameter_types! {
|
||||
pub BlockWeights: frame_system::limits::BlockWeights =
|
||||
frame_system::limits::BlockWeights::simple_max(1024);
|
||||
}
|
||||
@@ -92,16 +92,11 @@ impl pallet_balances::Config for Test {
|
||||
type WeightInfo = ();
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
// Taken from Polkadot as reference.
|
||||
pub const PreimageMaxSize: u32 = 4096 * 1024;
|
||||
}
|
||||
|
||||
impl pallet_preimage::Config for Test {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
type ManagerOrigin = EnsureRoot<Self::AccountId>;
|
||||
type MaxSize = PreimageMaxSize;
|
||||
type MaxSize = ConstU32<{ 4096 * 1024 }>; // PreimageMaxSize Taken from Polkadot as reference.
|
||||
type BaseDeposit = ConstU64<1>;
|
||||
type ByteDeposit = ConstU64<1>;
|
||||
type WeightInfo = ();
|
||||
|
||||
@@ -553,7 +553,6 @@ impl frame_support::traits::PalletInfo for Runtime {
|
||||
}
|
||||
|
||||
parameter_types! {
|
||||
pub const BlockHashCount: BlockNumber = 2400;
|
||||
pub const DbWeight: RuntimeDbWeight = RuntimeDbWeight {
|
||||
read: 100,
|
||||
write: 1000,
|
||||
@@ -578,7 +577,7 @@ impl frame_system::Config for Runtime {
|
||||
type Lookup = IdentityLookup<Self::AccountId>;
|
||||
type Header = Header;
|
||||
type Event = Event;
|
||||
type BlockHashCount = BlockHashCount;
|
||||
type BlockHashCount = ConstU64<2400>;
|
||||
type DbWeight = ();
|
||||
type Version = ();
|
||||
type PalletInfo = Self;
|
||||
|
||||
Reference in New Issue
Block a user