mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 11:41:02 +00:00
move paras inherent filtering to runtime (#4028)
* move things around, add filter methods * validator keys, modify availability bitfields according to disputes * simplify, keep the filter -> sanitize generic for both usecases * minor * assure tests still work, reduce changeset * integration * start entropy passing * fixins * compile, 1 failing test * filter with coverage * fixins * Update runtime/parachains/src/paras_inherent.rs Co-authored-by: Robert Habermeier <rphmeier@gmail.com> * slip of the pen * improve test cases * misc * fix * fixins * test avoid extra into() calls in assert_noop! * chores * ff * test fixup superfluous into call * chore: pfmt * improve apply_block_weight_limit to try to maximize the number of sufficiently backed blocks and add extra bitfields in a round-robin fashion * new code treats the lack of backed candidates as ok * Use vrf based entropy * fixup vrf random * add warn * slip of the pen * fixup * assure ordering * rethink apply_weights * mock * use a closure as predicate check * extract and use DisputedBitfield * chore: simplify * remove stray dbg * chore: fmt * address feedback * fix test, halfway there * stage1 * dbg stuff * make group selection align * fix session index * fix wrongly returned candidates * cleanup * chore fmt * fix ensure check * make good case test work * more tests for bitfields * create sanitize_backed_candidates * fixup tests * update guide * add check referenced in the guide * improve weights code * fmt * fixins * Update roadmap/implementers-guide/src/runtime/inclusion.md Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> * compiling + address review * add comments * fix weight calc * address review comments and test failure * fix * fix: condition * Fix random_sel function * Fix overlength block check * Zeke + Ladi commit for disputes filtering + integration test builder + runtime benchmarks + integration tests * Add benchmarks for code upgrades * Code upgrade bench; Feature gate TestWeightInfo * Try and make CI happier * Feature gate enter test to not(benchmarks) * Make sure no unused imports/fn * refactor, re-use, the beginning * Fix issue with frame benchmarking dep compilation * More precise feature gating for some derives * integrate piece-wise * foo * fixins * chore fmt * fixins * rename const generic * Update runtime/parachains/src/paras_inherent.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Fix compilation * limit to test * remove unused spam slots * spellcheck * remove a tick, fix a typo * Add Code upgrade weights * comment improvements + >= Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * remove another tick * Update runtime/parachains/src/paras_inherent/benchmarking.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * saturating fixins + some spaces * fix * benchmarking - preliminary results * Add training wheels * Refactor some early exit logic for enter * Gracefully handle filtering bitfields & candidates (#4280) This updates the logic for sanitize_bitfields and sanitize_backed_candidates to never error when there is an issue, but instead to simply skip the problematic items. * Refactor inherent data weight limiting logic (#4287) * Apply suggestions from code review * Update runtime/parachains/src/builder.rs Co-authored-by: Zeke Mostov <z.mostov@gmail.com> * Update runtime/parachains/src/builder.rs * Update runtime/parachains/src/paras_inherent.rs * final pass * Run cargo +nightly-2021-10-29 fmt * Update implementors guide with `sanitize_*` & `enter` (#4294) * Make spell check happier * Make wasm runtimes compile with benchmarks enabled (#4303) * comment stuff out, use old toml * Seems to be working? * Remove feature gating from builder * Remove commented out stuff * Remove generic from digest * Update weight files for runtime Co-authored-by: Robert Habermeier <rphmeier@gmail.com> Co-authored-by: Zeke Mostov <32168567+emostov@users.noreply.github.com> Co-authored-by: Lldenaurois <Ljdenaurois@gmail.com> Co-authored-by: Zeke Mostov <z.mostov@gmail.com> Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
committed by
GitHub
parent
4a2e412000
commit
1aa6a4aba4
@@ -846,7 +846,9 @@ impl parachains_hrmp::Config for Runtime {
|
||||
type Currency = Balances;
|
||||
}
|
||||
|
||||
impl parachains_paras_inherent::Config for Runtime {}
|
||||
impl parachains_paras_inherent::Config for Runtime {
|
||||
type WeightInfo = weights::runtime_parachains_paras_inherent::WeightInfo<Runtime>;
|
||||
}
|
||||
|
||||
impl parachains_scheduler::Config for Runtime {}
|
||||
|
||||
@@ -1482,6 +1484,7 @@ sp_api::impl_runtime_apis! {
|
||||
list_benchmark!(list, extra, runtime_common::slots, Slots);
|
||||
list_benchmark!(list, extra, runtime_parachains::configuration, Configuration);
|
||||
list_benchmark!(list, extra, runtime_parachains::initializer, Initializer);
|
||||
list_benchmark!(list, extra, runtime_parachains::paras_inherent, ParaInherent);
|
||||
list_benchmark!(list, extra, runtime_parachains::paras, Paras);
|
||||
|
||||
// Substrate
|
||||
@@ -1595,6 +1598,7 @@ sp_api::impl_runtime_apis! {
|
||||
add_benchmark!(params, batches, runtime_parachains::configuration, Configuration);
|
||||
add_benchmark!(params, batches, runtime_parachains::initializer, Initializer);
|
||||
add_benchmark!(params, batches, runtime_parachains::paras, Paras);
|
||||
add_benchmark!(params, batches, runtime_parachains::paras_inherent, ParaInherent);
|
||||
|
||||
// Substrate
|
||||
add_benchmark!(params, batches, pallet_bags_list, BagsList);
|
||||
|
||||
@@ -37,4 +37,5 @@ pub mod runtime_common_slots;
|
||||
pub mod runtime_parachains_configuration;
|
||||
pub mod runtime_parachains_initializer;
|
||||
pub mod runtime_parachains_paras;
|
||||
pub mod runtime_parachains_paras_inherent;
|
||||
pub mod xcm;
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
// Copyright 2017-2021 Parity Technologies (UK) Ltd.
|
||||
// This file is part of Polkadot.
|
||||
|
||||
// Polkadot is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
|
||||
// Polkadot is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
|
||||
//! Autogenerated weights for `runtime_parachains::paras_inherent`
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2021-11-14, STEPS: `50`, REPEAT: 3, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
|
||||
|
||||
// Executed Command:
|
||||
// target/release/polkadot
|
||||
// benchmark
|
||||
// --chain=kusama-dev
|
||||
// --steps=50
|
||||
// --repeat=3
|
||||
// --pallet=runtime_parachains::paras_inherent
|
||||
// --extrinsic=*
|
||||
// --execution=wasm
|
||||
// --wasm-execution=compiled
|
||||
// --heap-pages=4096
|
||||
// --header=./file_header.txt
|
||||
// --output=./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs
|
||||
|
||||
|
||||
#![cfg_attr(rustfmt, rustfmt_skip)]
|
||||
#![allow(unused_parens)]
|
||||
#![allow(unused_imports)]
|
||||
|
||||
use frame_support::{traits::Get, weights::Weight};
|
||||
use sp_std::marker::PhantomData;
|
||||
|
||||
/// Weight functions for `runtime_parachains::paras_inherent`.
|
||||
pub struct WeightInfo<T>(PhantomData<T>);
|
||||
impl<T: frame_system::Config> runtime_parachains::paras_inherent::WeightInfo for WeightInfo<T> {
|
||||
// Storage: ParaInherent Included (r:1 w:1)
|
||||
// Storage: System ParentHash (r:1 w:0)
|
||||
// Storage: ParaScheduler AvailabilityCores (r:1 w:1)
|
||||
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
// Storage: ParaInclusion PendingAvailability (r:2 w:1)
|
||||
// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
// Storage: Paras Parachains (r:1 w:0)
|
||||
// Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Session Validators (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
|
||||
// Storage: Staking ActiveEra (r:1 w:0)
|
||||
// Storage: Staking ErasRewardPoints (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
|
||||
// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
// Storage: ParaScheduler SessionStartBlock (r:1 w:0)
|
||||
// Storage: ParaScheduler ParathreadQueue (r:1 w:1)
|
||||
// Storage: ParaScheduler Scheduled (r:1 w:1)
|
||||
// Storage: ParaScheduler ValidatorGroups (r:1 w:0)
|
||||
// Storage: Ump NeedsDispatch (r:1 w:1)
|
||||
// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
|
||||
// Storage: ParaInherent OnChainVotes (r:0 w:1)
|
||||
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
|
||||
// Storage: Paras Heads (r:0 w:1)
|
||||
fn enter_variable_disputes(v: u32, ) -> Weight {
|
||||
(316_331_000 as Weight)
|
||||
// Standard Error: 112_000
|
||||
.saturating_add((325_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(23 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(14 as Weight))
|
||||
}
|
||||
// Storage: ParaInherent Included (r:1 w:1)
|
||||
// Storage: System ParentHash (r:1 w:0)
|
||||
// Storage: ParaScheduler AvailabilityCores (r:1 w:1)
|
||||
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
// Storage: Paras Parachains (r:1 w:0)
|
||||
// Storage: ParaInclusion PendingAvailability (r:2 w:1)
|
||||
// Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Session Validators (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
|
||||
// Storage: Staking ActiveEra (r:1 w:0)
|
||||
// Storage: Staking ErasRewardPoints (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
|
||||
// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
// Storage: ParaScheduler SessionStartBlock (r:1 w:0)
|
||||
// Storage: ParaScheduler ParathreadQueue (r:1 w:1)
|
||||
// Storage: ParaScheduler Scheduled (r:1 w:1)
|
||||
// Storage: ParaScheduler ValidatorGroups (r:1 w:0)
|
||||
// Storage: Ump NeedsDispatch (r:1 w:1)
|
||||
// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
|
||||
// Storage: ParaInclusion AvailabilityBitfields (r:0 w:1)
|
||||
// Storage: ParaInherent OnChainVotes (r:0 w:1)
|
||||
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
|
||||
// Storage: Paras Heads (r:0 w:1)
|
||||
fn enter_bitfields() -> Weight {
|
||||
(352_749_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(23 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(15 as Weight))
|
||||
}
|
||||
// Storage: ParaInherent Included (r:1 w:1)
|
||||
// Storage: System ParentHash (r:1 w:0)
|
||||
// Storage: ParaScheduler AvailabilityCores (r:1 w:1)
|
||||
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
// Storage: Paras Parachains (r:1 w:0)
|
||||
// Storage: ParaInclusion PendingAvailability (r:2 w:1)
|
||||
// Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Session Validators (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
|
||||
// Storage: Staking ActiveEra (r:1 w:0)
|
||||
// Storage: Staking ErasRewardPoints (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
|
||||
// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
// Storage: ParaScheduler SessionStartBlock (r:1 w:0)
|
||||
// Storage: ParaScheduler ParathreadQueue (r:1 w:1)
|
||||
// Storage: ParaScheduler Scheduled (r:1 w:1)
|
||||
// Storage: ParaScheduler ValidatorGroups (r:1 w:0)
|
||||
// Storage: Paras PastCodeMeta (r:1 w:0)
|
||||
// Storage: Paras CurrentCodeHash (r:1 w:0)
|
||||
// Storage: Ump RelayDispatchQueueSize (r:1 w:0)
|
||||
// Storage: Ump NeedsDispatch (r:1 w:1)
|
||||
// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
|
||||
// Storage: ParaInherent OnChainVotes (r:0 w:1)
|
||||
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
|
||||
// Storage: Paras Heads (r:0 w:1)
|
||||
fn enter_backed_candidates_variable(v: u32, ) -> Weight {
|
||||
(88_047_000 as Weight)
|
||||
// Standard Error: 3_275_000
|
||||
.saturating_add((68_499_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add(T::DbWeight::get().reads(26 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(14 as Weight))
|
||||
}
|
||||
// Storage: ParaInherent Included (r:1 w:1)
|
||||
// Storage: System ParentHash (r:1 w:0)
|
||||
// Storage: ParaScheduler AvailabilityCores (r:1 w:1)
|
||||
// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
|
||||
// Storage: Paras Parachains (r:1 w:0)
|
||||
// Storage: ParaInclusion PendingAvailability (r:2 w:1)
|
||||
// Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
|
||||
// Storage: Configuration ActiveConfig (r:1 w:0)
|
||||
// Storage: Session Validators (r:1 w:0)
|
||||
// Storage: ParasShared ActiveValidatorIndices (r:1 w:0)
|
||||
// Storage: Staking ActiveEra (r:1 w:0)
|
||||
// Storage: Staking ErasRewardPoints (r:1 w:1)
|
||||
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
|
||||
// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
|
||||
// Storage: Paras FutureCodeUpgrades (r:1 w:0)
|
||||
// Storage: ParaScheduler SessionStartBlock (r:1 w:0)
|
||||
// Storage: ParaScheduler ParathreadQueue (r:1 w:1)
|
||||
// Storage: ParaScheduler Scheduled (r:1 w:1)
|
||||
// Storage: ParaScheduler ValidatorGroups (r:1 w:0)
|
||||
// Storage: Paras PastCodeMeta (r:1 w:0)
|
||||
// Storage: Paras CurrentCodeHash (r:1 w:0)
|
||||
// Storage: Ump RelayDispatchQueueSize (r:1 w:0)
|
||||
// Storage: Ump NeedsDispatch (r:1 w:1)
|
||||
// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
|
||||
// Storage: ParaInherent OnChainVotes (r:0 w:1)
|
||||
// Storage: Hrmp HrmpWatermarks (r:0 w:1)
|
||||
// Storage: Paras Heads (r:0 w:1)
|
||||
fn enter_backed_candidate_code_upgrade() -> Weight {
|
||||
(53_728_168_000 as Weight)
|
||||
.saturating_add(T::DbWeight::get().reads(26 as Weight))
|
||||
.saturating_add(T::DbWeight::get().writes(14 as Weight))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user