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 1 commit
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
Next Next commit
Companion for substrate/pull/7215
  • Loading branch information
kianenigma committed Sep 29, 2020
commit a1193ffb14f018ed1238cc075c8be2a1cbc4762d
11 changes: 10 additions & 1 deletion runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,13 @@ parameter_types! {
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
// The unsigned solution is operational, so as long as the average on_initialize weights are
// less than `MaximumBlockWeight * (1 - T::AvailableRatio)`, it can consume at most most this
// amount.
pub OffchainSolutionWeightLimit: Weight =
MaximumBlockWeight::get()
.saturating_sub(BlockExecutionWeight::get())
.saturating_sub(ExtrinsicBaseWeight::get());
}

type SlashCancelOrigin = EnsureOneOf<
Expand Down Expand Up @@ -362,6 +369,7 @@ impl pallet_staking::Trait for Runtime {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type MinSolutionScoreBump = MinSolutionScoreBump;
type OffchainSolutionWeightLimit = OffchainSolutionWeightLimit;
type WeightInfo = weights::pallet_staking::WeightInfo;
}

Expand Down Expand Up @@ -574,7 +582,8 @@ parameter_types! {
}

parameter_types! {
pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
pub StakingUnsignedPriority: TransactionPriority =
Perbill::from_percent(90) * TransactionPriority::max_value();
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
}

Expand Down
11 changes: 10 additions & 1 deletion runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,13 @@ parameter_types! {
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 16;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
// The unsigned solution is operational, so as long as the average on_initialize weights are
// less than `MaximumBlockWeight * (1 - T::AvailableRatio)`, it can consume at most most this
// amount.
pub OffchainSolutionWeightLimit: Weight =
MaximumBlockWeight::get()
.saturating_sub(BlockExecutionWeight::get())
.saturating_sub(ExtrinsicBaseWeight::get());
}

type SlashCancelOrigin = EnsureOneOf<
Expand Down Expand Up @@ -369,6 +376,7 @@ impl pallet_staking::Trait for Runtime {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type MinSolutionScoreBump = MinSolutionScoreBump;
type OffchainSolutionWeightLimit = OffchainSolutionWeightLimit;
type WeightInfo = weights::pallet_staking::WeightInfo;
}

Expand Down Expand Up @@ -620,7 +628,8 @@ parameter_types! {
}

parameter_types! {
pub const StakingUnsignedPriority: TransactionPriority = TransactionPriority::max_value() / 2;
pub StakingUnsignedPriority: TransactionPriority =
Perbill::from_percent(90) * TransactionPriority::max_value();
pub const ImOnlineUnsignedPriority: TransactionPriority = TransactionPriority::max_value();
}

Expand Down
5 changes: 5 additions & 0 deletions runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,10 @@ parameter_types! {
pub const ElectionLookahead: BlockNumber = EPOCH_DURATION_IN_BLOCKS / 4;
pub const MaxIterations: u32 = 10;
pub MinSolutionScoreBump: Perbill = Perbill::from_rational_approximation(5u32, 10_000);
pub OffchainSolutionWeightLimit: Weight =
MaximumBlockWeight::get()
.saturating_sub(BlockExecutionWeight::get())
.saturating_sub(ExtrinsicBaseWeight::get());
}

impl pallet_staking::Trait for Runtime {
Expand All @@ -334,6 +338,7 @@ impl pallet_staking::Trait for Runtime {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type MinSolutionScoreBump = MinSolutionScoreBump;
type OffchainSolutionWeightLimit = OffchainSolutionWeightLimit;
type WeightInfo = weights::pallet_staking::WeightInfo;
}

Expand Down