Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
e95c523
update bin/node-template/runtime/src/lib.rs
bizzyvinci Apr 20, 2022
fb3d60a
update frame/contracts/src/tests.rs
bizzyvinci Apr 20, 2022
3534a60
update frame/executive/src/lib.rs
bizzyvinci Apr 20, 2022
2becd1e
update frame/grandpa/src/mock.rs
bizzyvinci Apr 20, 2022
c76b8ed
update frame/im-online/src/mock.rs
bizzyvinci Apr 20, 2022
f974d1c
update frame/offences/benchmarking/src/mock.rs
bizzyvinci Apr 20, 2022
8b0fa6e
update frame/recovery/src/mock.rs
bizzyvinci Apr 20, 2022
2f58878
update frame/referenda/src/mock.rs
bizzyvinci Apr 20, 2022
db6d8ea
update frame/session/benchmarking/src/mock.rs
bizzyvinci Apr 20, 2022
e0b39fc
update frame/staking/src/mock.rs
bizzyvinci Apr 20, 2022
cdc7c3b
update frame/state-trie-migration/src/lib.rs
bizzyvinci Apr 20, 2022
9be9885
update frame/support/test/compile_pass/src/lib.rs
bizzyvinci Apr 20, 2022
08703f9
frame/treasury/src/tests.rs
bizzyvinci Apr 20, 2022
a609114
update frame/whitelist/src/mock.rs
bizzyvinci Apr 20, 2022
fd100fd
update frame/vesting/src/mock.rs
bizzyvinci Apr 20, 2022
7c146de
update test-utils/runtime/src/lib.rs
bizzyvinci Apr 20, 2022
247bcac
update bin/node-template/runtime/src/lib.rs
bizzyvinci Apr 21, 2022
2f7eb78
Update frame/grandpa/src/mock.rs
shawntabrizi Apr 23, 2022
c54dcfd
resolve failed checks 1518659 & 1518669
bizzyvinci Apr 23, 2022
c93976d
resolve format check
bizzyvinci Apr 23, 2022
11eea86
backtrack to resolve compile error
bizzyvinci Apr 23, 2022
4b3d89d
check --all --tests ✅
bizzyvinci Apr 25, 2022
9d221d7
cargo +nightly fmt ✅
bizzyvinci Apr 25, 2022
b448eb3
Merge branch 'master' into parameter_types
KiChjang Apr 28, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions bin/node-template/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ 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, ConstU64, ConstU32, ConstU8, KeyOwnerProofSystem, Randomness, StorageInfo},
weights::{
constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND},
IdentityFee, Weight,
Expand Down Expand Up @@ -133,13 +133,11 @@ const NORMAL_DISPATCH_RATIO: Perbill = Perbill::from_percent(75);

parameter_types! {
pub const Version: RuntimeVersion = VERSION;
pub const BlockHashCount: BlockNumber = 2400;
/// 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);
pub BlockLength: frame_system::limits::BlockLength = frame_system::limits::BlockLength
::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
pub const SS58Prefix: u8 = 42;
}

// Configure FRAME pallets to include in runtime.
Expand Down Expand Up @@ -172,7 +170,7 @@ impl frame_system::Config for Runtime {
/// The ubiquitous origin type.
type Origin = Origin;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
type BlockHashCount = ConstU32<2400>;
/// The weight of database operations that the runtime can invoke.
type DbWeight = RocksDbWeight;
/// Version of the runtime.
Expand All @@ -190,7 +188,7 @@ impl frame_system::Config for Runtime {
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
type SS58Prefix = ConstU8<42>;
/// The set code logic, just the default since we're not a parachain.
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
Expand Down Expand Up @@ -224,15 +222,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 = ();
}

Expand Down
6 changes: 1 addition & 5 deletions frame/contracts/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,17 +234,13 @@ 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
// instrumentation path is always tested implicitly.
schedule.limits.stack_height = Some(512);
schedule
};
pub const TransactionByteFee: u64 = 0;
pub static DepositPerByte: BalanceOf<Test> = 1;
pub const DepositPerItem: BalanceOf<Test> = 2;
}
Expand Down Expand Up @@ -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;
Expand Down
5 changes: 1 addition & 4 deletions frame/executive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ();
Expand Down
6 changes: 1 addition & 5 deletions frame/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -198,7 +194,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>;
Expand Down
6 changes: 1 addition & 5 deletions frame/im-online/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand Down
6 changes: 2 additions & 4 deletions frame/offences/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,15 @@ 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 = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<10>;
type AccountStore = System;
type WeightInfo = ();
}
Expand Down
18 changes: 4 additions & 14 deletions frame/recovery/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,36 +77,26 @@ impl frame_system::Config for Test {
type MaxConsumers = ConstU32<16>;
}

parameter_types! {
pub const ExistentialDeposit: u64 = 1;
}

impl pallet_balances::Config for Test {
type MaxLocks = ();
type MaxReserves = ();
type ReserveIdentifier = [u8; 8];
type Balance = u128;
type DustRemoval = ();
type Event = Event;
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
}

parameter_types! {
pub const ConfigDepositBase: u64 = 10;
pub const FriendDepositFactor: u64 = 1;
pub const RecoveryDeposit: u64 = 10;
}

impl Config for Test {
type Event = Event;
type Call = Call;
type Currency = Balances;
type ConfigDepositBase = ConfigDepositBase;
type FriendDepositFactor = FriendDepositFactor;
type ConfigDepositBase = ConstU64<10>;
type FriendDepositFactor = ConstU64<1>;
type MaxFriends = ConstU32<3>;
type RecoveryDeposit = RecoveryDeposit;
type RecoveryDeposit = ConstU64<10>;
}

pub type BalancesCall = pallet_balances::Call<Test>;
Expand Down
25 changes: 7 additions & 18 deletions frame/referenda/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,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);
}
Expand All @@ -81,7 +80,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>;
Expand All @@ -101,42 +100,32 @@ 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 = ();
type OriginPrivilegeCmp = EqualPrivilegeOnly;
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;
Expand Down Expand Up @@ -228,9 +217,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;
}
Expand Down
6 changes: 2 additions & 4 deletions frame/session/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,15 @@ 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 = ();
type ReserveIdentifier = [u8; 8];
type Balance = Balance;
type Event = Event;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type ExistentialDeposit = ConstU64<10>;
type AccountStore = System;
type WeightInfo = ();
}
Expand Down
3 changes: 1 addition & 2 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ pallet_staking_reward_curve::build! {
);
}
parameter_types! {
pub const BondingDuration: EraIndex = 3;
pub const RewardCurve: &'static PiecewiseLinear<'static> = &I_NPOS;
pub const OffendingValidatorsThreshold: Perbill = Perbill::from_percent(75);
}
Expand Down Expand Up @@ -267,7 +266,7 @@ impl crate::pallet::pallet::Config for Test {
type SessionsPerEra = SessionsPerEra;
type SlashDeferDuration = SlashDeferDuration;
type SlashCancelOrigin = frame_system::EnsureRoot<Self::AccountId>;
type BondingDuration = BondingDuration;
type BondingDuration = ConstU32<3>;
type SessionInterface = Self;
type EraPayout = ConvertCurve<RewardCurve>;
type NextNewSession = Session;
Expand Down
20 changes: 8 additions & 12 deletions frame/state-trie-migration/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{ConstU8, ConstU32, ConstU64, Hooks}
};
use frame_system::{EnsureRoot, EnsureSigned};
use sp_core::{
storage::{ChildInfo, StateVersion},
Expand All @@ -1007,11 +1010,6 @@ mod mock {
}
);

parameter_types! {
pub const BlockHashCount: u32 = 250;
pub const SS58Prefix: u8 = 42;
}

impl frame_system::Config for Test {
type BaseCallFilter = frame_support::traits::Everything;
type BlockWeights = ();
Expand All @@ -1026,22 +1024,20 @@ 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;
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = SS58Prefix;
type SS58Prefix = ConstU8<42>;
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;
}
Expand All @@ -1050,7 +1046,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 = ();
Expand Down
5 changes: 2 additions & 3 deletions frame/support/test/compile_pass/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -50,7 +50,6 @@ pub type BlockNumber = u64;
pub type Index = u64;

parameter_types! {
pub const BlockHashCount: BlockNumber = 2400;
pub const Version: RuntimeVersion = VERSION;
}

Expand All @@ -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;
Expand Down
Loading