Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,6 +471,7 @@ parameter_types! {
pub const SlashDeferDuration: pallet_staking::EraIndex = 24 * 7; // 1/4 the bonding duration.
pub const RewardCurve: &'static PiecewiseLinear<'static> = &REWARD_CURVE;
pub const MaxNominatorRewardedPerValidator: u32 = 256;
pub SlashTaskWeight: Weight = RuntimeBlockWeights::get().max_block / 2;
}

impl pallet_staking::Config for Runtime {
Expand All @@ -496,6 +497,7 @@ impl pallet_staking::Config for Runtime {
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type ElectionProvider = ElectionProviderMultiPhase;
type TaskExecutor = frame_support::executor::SinglePassExecutor<pallet_staking::SlashTask<Self>, SlashTaskWeight>;
type WeightInfo = pallet_staking::weights::SubstrateWeight<Runtime>;
}

Expand Down
1 change: 1 addition & 0 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ impl pallet_staking::Config for Test {
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
type TaskExecutor = frame_support::executor::SinglePassExecutor<pallet_staking::SlashTask<Self>>;
type WeightInfo = ();
}

Expand Down
1 change: 1 addition & 0 deletions frame/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ impl pallet_staking::Config for Test {
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type NextNewSession = Session;
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
type TaskExecutor = frame_support::executor::SinglePassExecutor<pallet_staking::SlashTask<Self>>;
type WeightInfo = ();
}

Expand Down
1 change: 1 addition & 0 deletions frame/offences/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ impl pallet_staking::Config for Test {
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
type TaskExecutor = frame_support::executor::SinglePassExecutor<pallet_staking::SlashTask<Self>>;
type WeightInfo = ();
}

Expand Down
1 change: 1 addition & 0 deletions frame/session/benchmarking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ impl pallet_staking::Config for Test {
type NextNewSession = Session;
type MaxNominatorRewardedPerValidator = MaxNominatorRewardedPerValidator;
type ElectionProvider = onchain::OnChainSequentialPhragmen<Self>;
type TaskExecutor = frame_support::executor::SinglePassExecutor<pallet_staking::SlashTask<Self>>;
type WeightInfo = ();
}

Expand Down
3 changes: 2 additions & 1 deletion frame/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ static_assertions = "1.1.0"
serde = { version = "1.0.101", optional = true }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = ["derive"] }
sp-std = { version = "3.0.0", default-features = false, path = "../../primitives/std" }
sp-core = { version = "3.0.0", path = "../../primitives/core", default-features = false }
sp-io ={ version = "3.0.0", default-features = false, path = "../../primitives/io" }
sp-runtime = { version = "3.0.0", default-features = false, path = "../../primitives/runtime" }
sp-staking = { version = "3.0.0", default-features = false, path = "../../primitives/staking" }
Expand All @@ -36,7 +37,6 @@ rand_chacha = { version = "0.2", default-features = false, optional = true }
[dev-dependencies]
sp-storage = { version = "3.0.0", path = "../../primitives/storage" }
sp-tracing = { version = "3.0.0", path = "../../primitives/tracing" }
sp-core = { version = "3.0.0", path = "../../primitives/core" }
pallet-balances = { version = "3.0.0", path = "../balances" }
pallet-timestamp = { version = "3.0.0", path = "../timestamp" }
pallet-staking-reward-curve = { version = "3.0.0", path = "../staking/reward-curve" }
Expand All @@ -54,6 +54,7 @@ std = [
"codec/std",
"sp-std/std",
"sp-io/std",
"sp-core/std",
"frame-support/std",
"sp-runtime/std",
"sp-staking/std",
Expand Down
1 change: 1 addition & 0 deletions frame/staking/fuzzer/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,5 +196,6 @@ impl pallet_staking::Config for Test {
type UnsignedPriority = ();
type OffchainSolutionWeightLimit = ();
type WeightInfo = ();
type TaskExecutor = frame_support::executor::SinglePassExecutor<pallet_staking::SlashTask<Self>>;
type ElectionProvider = MockElectionProvider;
}
4 changes: 2 additions & 2 deletions frame/staking/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ benchmarks! {

// all nominators now should be nominating our validator...
for n in nominator_stashes.iter() {
assert!(Nominators::<T>::get(n).unwrap().targets.contains(&stash));
assert!(Nominators::<T>::get(n).unwrap().targets.iter().any(|(t, _)| t == &stash));
}

// we need the unlookuped version of the nominator stash for the kick.
Expand All @@ -260,7 +260,7 @@ benchmarks! {
verify {
// all nominators now should *not* be nominating our validator...
for n in nominator_stashes.iter() {
assert!(!Nominators::<T>::get(n).unwrap().targets.contains(&stash));
assert!(!Nominators::<T>::get(n).unwrap().targets.iter().any(|(t, _)| t == &stash));
}
}

Expand Down
Loading