mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-09 20:11:09 +00:00
Make the number of nominations configurable (#8368)
* Base features and traits. * pallet and unsigned phase * Undo bad formattings. * some formatting cleanup. * Small self-cleanup. * Make it all build * self-review * Some doc tests. * Some changes from other PR * Fix session test * Update Cargo.lock * Update frame/election-provider-multi-phase/src/lib.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Some review comments * Rename + make encode/decode * Do an assert as well, just in case. * Fix build * Update frame/election-provider-multi-phase/src/unsigned.rs Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * Las comment * fix staking fuzzer. * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * Add one last layer of feasibility check as well. * Last fixes to benchmarks * Some more docs. * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * cargo run --release --features=runtime-benchmarks --manifest-path=bin/node/cli/Cargo.toml -- benchmark --chain=dev --steps=50 --repeat=20 --pallet=pallet_election_provider_multi_phase --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --output=./frame/election-provider-multi-phase/src/weights.rs --template=./.maintain/frame-weight-template.hbs * Some nits * It all works * Some self cleanup * Update frame/staking/src/lib.rs Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com> * remove most todos. * Round of self-review. * Fix migration * clean macro * Revert wrong merge * Make the number of nominations configurable * Self reivew * renmae. Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> Co-authored-by: Parity Benchmarking Bot <admin@parity.io> Co-authored-by: Peter Goodspeed-Niklaus <coriolinus@users.noreply.github.com>
This commit is contained in:
@@ -36,6 +36,7 @@ sp-keyring = { version = "3.0.0", optional = true, path = "../../../primitives/k
|
||||
sp-session = { version = "3.0.0", default-features = false, path = "../../../primitives/session" }
|
||||
sp-transaction-pool = { version = "3.0.0", default-features = false, path = "../../../primitives/transaction-pool" }
|
||||
sp-version = { version = "3.0.0", default-features = false, path = "../../../primitives/version" }
|
||||
sp-npos-elections = { version = "3.0.0", default-features = false, path = "../../../primitives/npos-elections" }
|
||||
|
||||
# frame dependencies
|
||||
frame-executive = { version = "3.0.0", default-features = false, path = "../../../frame/executive" }
|
||||
@@ -159,6 +160,7 @@ std = [
|
||||
"pallet-vesting/std",
|
||||
"log/std",
|
||||
"frame-try-runtime/std",
|
||||
"sp-npos-elections/std",
|
||||
]
|
||||
runtime-benchmarks = [
|
||||
"frame-benchmarking",
|
||||
|
||||
@@ -471,6 +471,8 @@ parameter_types! {
|
||||
}
|
||||
|
||||
impl pallet_staking::Config for Runtime {
|
||||
const MAX_NOMINATIONS: u32 =
|
||||
<NposCompactSolution16 as sp_npos_elections::CompactSolution>::LIMIT as u32;
|
||||
type Currency = Balances;
|
||||
type UnixTime = Timestamp;
|
||||
type CurrencyToVote = U128CurrencyToVote;
|
||||
@@ -515,6 +517,12 @@ parameter_types! {
|
||||
.saturating_sub(BlockExecutionWeight::get());
|
||||
}
|
||||
|
||||
sp_npos_elections::generate_solution_type!(
|
||||
#[compact]
|
||||
pub struct NposCompactSolution16::<u32, u16, sp_runtime::PerU16>(16)
|
||||
// -------------------- ^^ <NominatorIndex, ValidatorIndex, Accuracy>
|
||||
);
|
||||
|
||||
impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type Event = Event;
|
||||
type Currency = Balances;
|
||||
@@ -526,7 +534,7 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type MinerTxPriority = MultiPhaseUnsignedPriority;
|
||||
type DataProvider = Staking;
|
||||
type OnChainAccuracy = Perbill;
|
||||
type CompactSolution = pallet_staking::CompactAssignments;
|
||||
type CompactSolution = NposCompactSolution16;
|
||||
type Fallback = Fallback;
|
||||
type WeightInfo = pallet_election_provider_multi_phase::weights::SubstrateWeight<Runtime>;
|
||||
type BenchmarkingConfig = ();
|
||||
|
||||
Reference in New Issue
Block a user