This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Replace parameter_types with ConstU32 &c. #10402
Merged
paritytech-processbot
merged 46 commits into
paritytech:master
from
dharjeezy:dharjeezy/change-parameter-types
Dec 16, 2021
Merged
Changes from 3 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
949cf3a
remove parameter types and use const type
e0a6de6
remove parameter types and use const type
eb685a2
fix merge conflict
c65bd09
Delete {
gui1117 691c8a0
Delete count,
gui1117 367dfe1
Merge branch 'master' of https://github.com/paritytech/substrate into…
a7ec5ed
Merge branch 'dharjeezy/change-parameter-types' of https://github.com…
97c6827
refractor for beefy, benchmarking, child bounties, and collective pal…
d4cb6cd
refractor for pallet contracts
79803af
refractor for elections
fe5fc30
refractor for more pallets
049330b
fix CI issues
0891184
fix CI issues
28ef4ab
fix CI issues
f884936
fix CI issues
2f06a51
Merge branch 'master' of https://github.com/paritytech/substrate into…
afeb9d1
remove warning to fix CI issue
fed71ad
remove warning to fix CI issue
ff2b679
remove warning to fix CI issue
578c606
remove warning to fix CI issue
c26c0c7
remove warning to fix CI issue
73fd9eb
remove warning to fix CI issue
1a4ddd8
remove warning to fix CI issue
7f031c1
remove warning to fix CI issue
9db0013
cargo +nightly fmt
ee86965
CI fix
7db185e
more param refractor on beefy-mmr
96a70a1
refractor for beefy
68edde0
Update frame/babe/src/mock.rs
gui1117 760ada2
Update frame/babe/src/mock.rs
gui1117 3215584
Update frame/bounties/src/tests.rs
gui1117 8fcedb7
Update frame/tips/src/tests.rs
gui1117 8452705
Delete mock.rs
gui1117 1934f96
Update frame/examples/basic/src/tests.rs
gui1117 1dacf5f
Apply suggestions from code review
gui1117 7b761ec
Update frame/im-online/src/mock.rs
gui1117 84e1f50
Update frame/im-online/src/mock.rs
gui1117 01d7b53
Update frame/offences/benchmarking/src/mock.rs
gui1117 d58eb39
Update frame/session/benchmarking/src/mock.rs
gui1117 a128b97
Update frame/support/test/tests/pallet_compatibility.rs
gui1117 cc389e7
Update frame/support/test/tests/pallet_compatibility_instance.rs
gui1117 f32ffdb
Update frame/treasury/src/tests.rs
gui1117 9feb374
Update test-utils/runtime/src/lib.rs
gui1117 7e65680
some cleanup
gui1117 1aca17d
fmt
gui1117 c67bc24
remove unused
gui1117 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,7 @@ use codec::{Decode, Encode, MaxEncodedLen}; | |
| use frame_support::{ | ||
| construct_runtime, parameter_types, | ||
| traits::{ | ||
| ConstU32, Currency, EnsureOneOf, EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter, | ||
| ConstU16, ConstU32, Currency, EnsureOneOf, EqualPrivilegeOnly, Everything, Imbalance, InstanceFilter, | ||
| KeyOwnerProofSystem, LockIdentifier, Nothing, OnUnbalanced, U128CurrencyToVote, | ||
| }, | ||
| weights::{ | ||
|
|
@@ -190,7 +190,6 @@ parameter_types! { | |
| }) | ||
| .avg_block_initialization(AVERAGE_ON_INITIALIZE_RATIO) | ||
| .build_or_panic(); | ||
| pub const SS58Prefix: u16 = 42; | ||
| } | ||
|
|
||
| const_assert!(NORMAL_DISPATCH_RATIO.deconstruct() >= AVERAGE_ON_INITIALIZE_RATIO.deconstruct()); | ||
|
|
@@ -217,7 +216,7 @@ impl frame_system::Config for Runtime { | |
| type OnNewAccount = (); | ||
| type OnKilledAccount = (); | ||
| type SystemWeightInfo = frame_system::weights::SubstrateWeight<Runtime>; | ||
| type SS58Prefix = SS58Prefix; | ||
| type SS58Prefix = ConstU16<42>; | ||
| type OnSetCode = (); | ||
| } | ||
|
|
||
|
|
@@ -235,7 +234,6 @@ parameter_types! { | |
| pub const DepositBase: Balance = deposit(1, 88); | ||
| // Additional storage item size of 32 bytes. | ||
| pub const DepositFactor: Balance = deposit(0, 32); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. isn't is possible to use |
||
| pub const MaxSignatories: u16 = 100; | ||
| } | ||
|
|
||
| impl pallet_multisig::Config for Runtime { | ||
|
|
@@ -244,7 +242,7 @@ impl pallet_multisig::Config for Runtime { | |
| type Currency = Balances; | ||
| type DepositBase = DepositBase; | ||
| type DepositFactor = DepositFactor; | ||
| type MaxSignatories = MaxSignatories; | ||
| type MaxSignatories = ConstU16<100>; | ||
| type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>; | ||
| } | ||
|
|
||
|
|
@@ -253,10 +251,8 @@ parameter_types! { | |
| pub const ProxyDepositBase: Balance = deposit(1, 8); | ||
| // Additional storage item size of 33 bytes. | ||
| pub const ProxyDepositFactor: Balance = deposit(0, 33); | ||
| pub const MaxProxies: u16 = 32; | ||
| pub const AnnouncementDepositBase: Balance = deposit(1, 8); | ||
| pub const AnnouncementDepositFactor: Balance = deposit(0, 66); | ||
| pub const MaxPending: u16 = 32; | ||
| } | ||
|
|
||
| /// The type used to represent the kinds of proxying allowed. | ||
|
|
@@ -323,9 +319,9 @@ impl pallet_proxy::Config for Runtime { | |
| type ProxyType = ProxyType; | ||
| type ProxyDepositBase = ProxyDepositBase; | ||
| type ProxyDepositFactor = ProxyDepositFactor; | ||
| type MaxProxies = MaxProxies; | ||
| type MaxProxies = ConstU32<32>; | ||
| type WeightInfo = pallet_proxy::weights::SubstrateWeight<Runtime>; | ||
| type MaxPending = MaxPending; | ||
| type MaxPending = ConstU32<32>; | ||
| type CallHasher = BlakeTwo256; | ||
| type AnnouncementDepositBase = AnnouncementDepositBase; | ||
| type AnnouncementDepositFactor = AnnouncementDepositFactor; | ||
|
|
@@ -334,7 +330,6 @@ impl pallet_proxy::Config for Runtime { | |
| parameter_types! { | ||
| pub MaximumSchedulerWeight: Weight = Perbill::from_percent(80) * | ||
| RuntimeBlockWeights::get().max_block; | ||
| pub const MaxScheduledPerBlock: u32 = 50; | ||
| } | ||
|
|
||
| impl pallet_scheduler::Config for Runtime { | ||
|
|
@@ -344,7 +339,7 @@ impl pallet_scheduler::Config for Runtime { | |
| type Call = Call; | ||
| type MaximumWeight = MaximumSchedulerWeight; | ||
| type ScheduleOrigin = EnsureRoot<AccountId>; | ||
| type MaxScheduledPerBlock = MaxScheduledPerBlock; | ||
| type MaxScheduledPerBlock = ConstU32<50>; | ||
| type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>; | ||
| type OriginPrivilegeCmp = EqualPrivilegeOnly; | ||
| } | ||
|
|
@@ -558,7 +553,6 @@ parameter_types! { | |
| pub const UnsignedPhase: u32 = EPOCH_DURATION_IN_BLOCKS / 4; | ||
|
|
||
| // signed config | ||
| pub const SignedMaxSubmissions: u32 = 10; | ||
| pub const SignedRewardBase: Balance = 1 * DOLLARS; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same we can probably use |
||
| pub const SignedDepositBase: Balance = 1 * DOLLARS; | ||
| pub const SignedDepositByte: Balance = 1 * CENTS; | ||
|
|
@@ -576,11 +570,6 @@ parameter_types! { | |
| *RuntimeBlockLength::get() | ||
| .max | ||
| .get(DispatchClass::Normal); | ||
|
|
||
| // BagsList allows a practically unbounded count of nominators to participate in NPoS elections. | ||
| // To ensure we respect memory limits when using the BagsList this must be set to a number of | ||
| // voters we know can fit into a single vec allocation. | ||
| pub const VoterSnapshotPerBlock: u32 = 10_000; | ||
| } | ||
|
|
||
| sp_npos_elections::generate_solution_type!( | ||
|
|
@@ -645,7 +634,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime { | |
| type MinerMaxWeight = MinerMaxWeight; | ||
| type MinerMaxLength = MinerMaxLength; | ||
| type MinerTxPriority = MultiPhaseUnsignedPriority; | ||
| type SignedMaxSubmissions = SignedMaxSubmissions; | ||
| type SignedMaxSubmissions = ConstU32<10>; | ||
| type SignedRewardBase = SignedRewardBase; | ||
| type SignedDepositBase = SignedDepositBase; | ||
| type SignedDepositByte = SignedDepositByte; | ||
|
|
@@ -664,7 +653,10 @@ impl pallet_election_provider_multi_phase::Config for Runtime { | |
| type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight<Self>; | ||
| type ForceOrigin = EnsureRootOrHalfCouncil; | ||
| type BenchmarkingConfig = ElectionProviderBenchmarkConfig; | ||
| type VoterSnapshotPerBlock = VoterSnapshotPerBlock; | ||
| // BagsList allows a practically unbounded count of nominators to participate in NPoS elections. | ||
| // To ensure we respect memory limits when using the BagsList this must be set to a number of | ||
| // voters we know can fit into a single vec allocation. | ||
| type VoterSnapshotPerBlock = ConstU32<10_000>; | ||
| } | ||
|
|
||
| parameter_types! { | ||
|
|
@@ -682,7 +674,6 @@ parameter_types! { | |
| pub const LaunchPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; | ||
| pub const VotingPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; | ||
| pub const FastTrackVotingPeriod: BlockNumber = 3 * 24 * 60 * MINUTES; | ||
| pub const InstantAllowed: bool = true; | ||
| pub const MinimumDeposit: Balance = 100 * DOLLARS; | ||
| pub const EnactmentPeriod: BlockNumber = 30 * 24 * 60 * MINUTES; | ||
| pub const CooloffPeriod: BlockNumber = 28 * 24 * 60 * MINUTES; | ||
|
|
@@ -717,7 +708,7 @@ impl pallet_democracy::Config for Runtime { | |
| pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, TechnicalCollective>; | ||
| type InstantOrigin = | ||
| pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>; | ||
| type InstantAllowed = InstantAllowed; | ||
| type InstantAllowed = frame_support::traits::ConstBool<true>; | ||
| type FastTrackVotingPeriod = FastTrackVotingPeriod; | ||
| // To cancel a proposal which has been passed, 2/3 of the council must agree to it. | ||
| type CancellationOrigin = | ||
|
|
@@ -738,7 +729,7 @@ impl pallet_democracy::Config for Runtime { | |
| type Slash = Treasury; | ||
| type Scheduler = Scheduler; | ||
| type PalletsOrigin = OriginCaller; | ||
| type MaxVotes = MaxVotes; | ||
| type MaxVotes = frame_support::traits::ConstU32<100>; | ||
|
gui1117 marked this conversation as resolved.
|
||
| type WeightInfo = pallet_democracy::weights::SubstrateWeight<Runtime>; | ||
| type MaxProposals = MaxProposals; | ||
| } | ||
|
|
||
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could also remove this with a ConstU128 actually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still to do