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 7 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
2 changes: 1 addition & 1 deletion runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ pub type NegativeImbalance<T> = <pallet_balances::Module<T> as Currency<<T as fr

/// We assume that an on-initialize consumes 10% of the weight on average, hence a single extrinsic
/// will not be allowed to consume more than `AvailableBlockRatio - 10%`.
const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10);
pub const AVERAGE_ON_INITIALIZE_WEIGHT: Perbill = Perbill::from_percent(10);

// Common constants used in all runtimes.
parameter_types! {
Expand Down
1 change: 1 addition & 0 deletions runtime/common/src/paras_registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,6 +411,7 @@ mod tests {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = ();
type MinSolutionScoreBump = ();
type OffchainSolutionWeightLimit = MaximumBlockWeight;
type WeightInfo = ();
}

Expand Down
8 changes: 6 additions & 2 deletions runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use runtime_common::{
impls::{CurrencyToVoteHandler, ToAuthor},
NegativeImbalance, BlockHashCount, MaximumBlockWeight, AvailableBlockRatio,
MaximumBlockLength, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight,
MaximumExtrinsicWeight, ParachainSessionKeyPlaceholder,
MaximumExtrinsicWeight, ParachainSessionKeyPlaceholder, AVERAGE_ON_INITIALIZE_WEIGHT,
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, ModuleId,
Expand Down Expand Up @@ -362,6 +362,9 @@ impl pallet_staking::Trait for Runtime {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type MinSolutionScoreBump = MinSolutionScoreBump;
// The unsigned solution weight targeted by the OCW. We set it to the maximum possible value of
// a single extrinsic.
type OffchainSolutionWeightLimit = MaximumExtrinsicWeight;
type WeightInfo = weights::pallet_staking::WeightInfo;
}

Expand Down Expand Up @@ -574,7 +577,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
8 changes: 6 additions & 2 deletions runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use runtime_common::{
impls::{CurrencyToVoteHandler, ToAuthor},
NegativeImbalance, BlockHashCount, MaximumBlockWeight, AvailableBlockRatio,
MaximumBlockLength, BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight,
MaximumExtrinsicWeight, purchase, ParachainSessionKeyPlaceholder,
MaximumExtrinsicWeight, purchase, ParachainSessionKeyPlaceholder, AVERAGE_ON_INITIALIZE_WEIGHT,
};

use sp_std::prelude::*;
Expand Down Expand Up @@ -369,6 +369,9 @@ impl pallet_staking::Trait for Runtime {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type MinSolutionScoreBump = MinSolutionScoreBump;
// The unsigned solution weight targeted by the OCW. We set it to the maximum possible value of
// a single extrinsic.
type OffchainSolutionWeightLimit = MaximumExtrinsicWeight;
type WeightInfo = weights::pallet_staking::WeightInfo;
}

Expand Down Expand Up @@ -620,7 +623,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
1 change: 1 addition & 0 deletions runtime/rococo-v1/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,7 @@ impl pallet_staking::Trait for Runtime {
type Call = Call;
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type OffchainSolutionWeightLimit = MaximumBlockWeight;
type MinSolutionScoreBump = MinSolutionScoreBump;
type WeightInfo = ();
}
Expand Down
1 change: 1 addition & 0 deletions runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ impl pallet_staking::Trait for Runtime {
type Call = Call;
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type OffchainSolutionWeightLimit = MaximumBlockWeight;
type MinSolutionScoreBump = MinSolutionScoreBump;
type WeightInfo = ();

Expand Down
3 changes: 2 additions & 1 deletion runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ use runtime_common::{
impls::{CurrencyToVoteHandler, ToAuthor},
BlockHashCount, MaximumBlockWeight, AvailableBlockRatio, MaximumBlockLength,
BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, MaximumExtrinsicWeight,
ParachainSessionKeyPlaceholder,
ParachainSessionKeyPlaceholder, AVERAGE_ON_INITIALIZE_WEIGHT,
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
Expand Down Expand Up @@ -334,6 +334,7 @@ impl pallet_staking::Trait for Runtime {
type UnsignedPriority = StakingUnsignedPriority;
type MaxIterations = MaxIterations;
type MinSolutionScoreBump = MinSolutionScoreBump;
type OffchainSolutionWeightLimit = MaximumExtrinsicWeight;
type WeightInfo = weights::pallet_staking::WeightInfo;
}

Expand Down