mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 08:11:03 +00:00
Companion for Trim compact solution for length during preparation (#2649)
* Companion for Trim compact solution for length during preparation https://github.com/paritytech/substrate/pull/8317 * eliminate potential for overflow in OffchainSolutionLengthLimit * Apply suggestions from code review Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com> * update substrate: cargo update -p sp-io Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Guillaume Thiolliere <gui.thiolliere@gmail.com>
This commit is contained in:
committed by
GitHub
parent
f1f9192a38
commit
f822381c4c
Generated
+149
-149
File diff suppressed because it is too large
Load Diff
@@ -118,6 +118,14 @@ parameter_types! {
|
||||
.max_extrinsic
|
||||
.expect("Normal extrinsics have weight limit configured by default; qed")
|
||||
.saturating_sub(BlockExecutionWeight::get());
|
||||
|
||||
/// A limit for off-chain phragmen unsigned solution length.
|
||||
///
|
||||
/// We allow up to 90% of the block's size to be consumed by the solution.
|
||||
pub OffchainSolutionLengthLimit: u32 = Perbill::from_rational(90_u32, 100) *
|
||||
*BlockLength::get()
|
||||
.max
|
||||
.get(DispatchClass::Normal);
|
||||
}
|
||||
|
||||
/// Parameterized slow adjusting fee updated based on
|
||||
|
||||
@@ -34,7 +34,8 @@ use primitives::v1::{
|
||||
use runtime_common::{
|
||||
claims, SlowAdjustingFeeUpdate, CurrencyToVote,
|
||||
impls::DealWithFees,
|
||||
BlockHashCount, RocksDbWeight, BlockWeights, BlockLength, OffchainSolutionWeightLimit,
|
||||
BlockHashCount, RocksDbWeight, BlockWeights, BlockLength,
|
||||
OffchainSolutionWeightLimit, OffchainSolutionLengthLimit,
|
||||
ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder,
|
||||
};
|
||||
use sp_runtime::{
|
||||
@@ -338,7 +339,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type UnsignedPhase = UnsignedPhase;
|
||||
type SolutionImprovementThreshold = SolutionImprovementThreshold;
|
||||
type MinerMaxIterations = MinerMaxIterations;
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit;
|
||||
type MinerMaxLength = OffchainSolutionLengthLimit;
|
||||
type MinerTxPriority = NposSolutionPriority;
|
||||
type DataProvider = Staking;
|
||||
type OnChainAccuracy = Perbill;
|
||||
|
||||
@@ -24,7 +24,8 @@ use pallet_transaction_payment::CurrencyAdapter;
|
||||
use runtime_common::{
|
||||
claims, SlowAdjustingFeeUpdate, CurrencyToVote,
|
||||
impls::DealWithFees,
|
||||
BlockHashCount, RocksDbWeight, BlockWeights, BlockLength, OffchainSolutionWeightLimit,
|
||||
BlockHashCount, RocksDbWeight, BlockWeights, BlockLength,
|
||||
OffchainSolutionWeightLimit, OffchainSolutionLengthLimit,
|
||||
ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder,
|
||||
};
|
||||
|
||||
@@ -348,7 +349,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type UnsignedPhase = UnsignedPhase;
|
||||
type SolutionImprovementThreshold = SolutionImprovementThreshold;
|
||||
type MinerMaxIterations = MinerMaxIterations;
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit;
|
||||
type MinerMaxLength = OffchainSolutionLengthLimit;
|
||||
type MinerTxPriority = NposSolutionPriority;
|
||||
type DataProvider = Staking;
|
||||
type OnChainAccuracy = Perbill;
|
||||
|
||||
@@ -34,7 +34,8 @@ use runtime_common::{
|
||||
mmr as mmr_common,
|
||||
SlowAdjustingFeeUpdate, CurrencyToVote,
|
||||
impls::ToAuthor,
|
||||
BlockHashCount, BlockWeights, BlockLength, RocksDbWeight, OffchainSolutionWeightLimit,
|
||||
BlockHashCount, BlockWeights, BlockLength, RocksDbWeight,
|
||||
OffchainSolutionWeightLimit, OffchainSolutionLengthLimit,
|
||||
ParachainSessionKeyPlaceholder, AssignmentSessionKeyPlaceholder,
|
||||
};
|
||||
use sp_runtime::{
|
||||
@@ -365,7 +366,8 @@ impl pallet_election_provider_multi_phase::Config for Runtime {
|
||||
type UnsignedPhase = UnsignedPhase;
|
||||
type SolutionImprovementThreshold = SolutionImprovementThreshold;
|
||||
type MinerMaxIterations = MinerMaxIterations;
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit; // For now use the one from staking.
|
||||
type MinerMaxWeight = OffchainSolutionWeightLimit;
|
||||
type MinerMaxLength = OffchainSolutionLengthLimit;
|
||||
type MinerTxPriority = NposSolutionPriority;
|
||||
type DataProvider = Staking;
|
||||
type OnChainAccuracy = Perbill;
|
||||
|
||||
Reference in New Issue
Block a user