diff --git a/runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs b/runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs
index cf7822b057a2..19bd2e4ad147 100644
--- a/runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs
+++ b/runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs
@@ -13,34 +13,37 @@
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see .
+
//! Autogenerated weights for `runtime_parachains::paras_inherent`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
-//! DATE: 2023-03-16, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! DATE: 2023-04-27, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
-//! HOSTNAME: `bm5`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
+//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 1024
// Executed Command:
-// ./target/production/polkadot
+// target/production/polkadot
// benchmark
// pallet
-// --chain=kusama-dev
// --steps=50
// --repeat=20
-// --pallet=runtime_parachains::paras_inherent
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
+// --heap-pages=4096
+// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/polkadot/.git/.artifacts/bench.json
+// --pallet=runtime_parachains::paras_inherent
+// --chain=kusama-dev
// --header=./file_header.txt
-// --output=./runtime/kusama/src/weights/runtime_parachains_paras_inherent.rs
+// --output=./runtime/kusama/src/weights/
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::Weight};
-use sp_std::marker::PhantomData;
+use core::marker::PhantomData;
/// Weight functions for `runtime_parachains::paras_inherent`.
pub struct WeightInfo(PhantomData);
@@ -83,6 +86,8 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// Proof Skipped: ParaInclusion PendingAvailabilityCommitments (max_values: None, max_size: None, mode: Measured)
/// Storage: Dmp DownwardMessageQueues (r:1 w:1)
/// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Dmp DeliveryFeeFactor (r:1 w:1)
+ /// Proof Skipped: Dmp DeliveryFeeFactor (max_values: None, max_size: None, mode: Measured)
/// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
/// Proof Skipped: Hrmp HrmpChannelDigests (max_values: None, max_size: None, mode: Measured)
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
@@ -110,15 +115,15 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// The range of component `v` is `[10, 200]`.
fn enter_variable_disputes(v: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `50748`
- // Estimated: `1483464 + v * (23 ±0)`
- // Minimum execution time: 769_729_000 picoseconds.
- Weight::from_parts(297_815_591, 0)
- .saturating_add(Weight::from_parts(0, 1483464))
- // Standard Error: 29_486
- .saturating_add(Weight::from_parts(48_796_195, 0).saturating_mul(v.into()))
- .saturating_add(T::DbWeight::get().reads(28))
- .saturating_add(T::DbWeight::get().writes(16))
+ // Measured: `50714`
+ // Estimated: `56654 + v * (23 ±0)`
+ // Minimum execution time: 807_787_000 picoseconds.
+ Weight::from_parts(337_998_397, 0)
+ .saturating_add(Weight::from_parts(0, 56654))
+ // Standard Error: 26_069
+ .saturating_add(Weight::from_parts(48_452_644, 0).saturating_mul(v.into()))
+ .saturating_add(T::DbWeight::get().reads(29))
+ .saturating_add(T::DbWeight::get().writes(17))
.saturating_add(Weight::from_parts(0, 23).saturating_mul(v.into()))
}
/// Storage: ParaInherent Included (r:1 w:1)
@@ -151,6 +156,8 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// Proof Skipped: Staking ErasRewardPoints (max_values: None, max_size: None, mode: Measured)
/// Storage: Dmp DownwardMessageQueues (r:1 w:1)
/// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Dmp DeliveryFeeFactor (r:1 w:1)
+ /// Proof Skipped: Dmp DeliveryFeeFactor (max_values: None, max_size: None, mode: Measured)
/// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
/// Proof Skipped: Hrmp HrmpChannelDigests (max_values: None, max_size: None, mode: Measured)
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
@@ -183,88 +190,13 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// Proof Skipped: Paras UpgradeGoAheadSignal (max_values: None, max_size: None, mode: Measured)
fn enter_bitfields() -> Weight {
// Proof Size summary in bytes:
- // Measured: `42582`
- // Estimated: `1205232`
- // Minimum execution time: 328_321_000 picoseconds.
- Weight::from_parts(342_358_000, 0)
- .saturating_add(Weight::from_parts(0, 1205232))
- .saturating_add(T::DbWeight::get().reads(26))
- .saturating_add(T::DbWeight::get().writes(17))
- }
- /// Storage: ParaInherent Included (r:1 w:1)
- /// Proof Skipped: ParaInherent Included (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: System ParentHash (r:1 w:0)
- /// Proof: System ParentHash (max_values: Some(1), max_size: Some(32), added: 527, mode: MaxEncodedLen)
- /// Storage: ParasShared CurrentSessionIndex (r:1 w:0)
- /// Proof Skipped: ParasShared CurrentSessionIndex (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: Babe AuthorVrfRandomness (r:1 w:0)
- /// Proof: Babe AuthorVrfRandomness (max_values: Some(1), max_size: Some(33), added: 528, mode: MaxEncodedLen)
- /// Storage: ParaScheduler AvailabilityCores (r:1 w:1)
- /// Proof Skipped: ParaScheduler AvailabilityCores (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParasDisputes Frozen (r:1 w:0)
- /// Proof Skipped: ParasDisputes Frozen (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParasShared ActiveValidatorKeys (r:1 w:0)
- /// Proof Skipped: ParasShared ActiveValidatorKeys (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: Paras Parachains (r:1 w:0)
- /// Proof Skipped: Paras Parachains (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParaInclusion PendingAvailability (r:2 w:1)
- /// Proof Skipped: ParaInclusion PendingAvailability (max_values: None, max_size: None, mode: Measured)
- /// Storage: ParaInclusion PendingAvailabilityCommitments (r:1 w:1)
- /// Proof Skipped: ParaInclusion PendingAvailabilityCommitments (max_values: None, max_size: None, mode: Measured)
- /// Storage: ParaSessionInfo AccountKeys (r:1 w:0)
- /// Proof Skipped: ParaSessionInfo AccountKeys (max_values: None, max_size: None, mode: Measured)
- /// Storage: Session Validators (r:1 w:0)
- /// Proof Skipped: Session Validators (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: Staking ActiveEra (r:1 w:0)
- /// Proof: Staking ActiveEra (max_values: Some(1), max_size: Some(13), added: 508, mode: MaxEncodedLen)
- /// Storage: Staking ErasRewardPoints (r:1 w:1)
- /// Proof Skipped: Staking ErasRewardPoints (max_values: None, max_size: None, mode: Measured)
- /// Storage: Dmp DownwardMessageQueues (r:1 w:1)
- /// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured)
- /// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
- /// Proof Skipped: Hrmp HrmpChannelDigests (max_values: None, max_size: None, mode: Measured)
- /// Storage: Paras FutureCodeUpgrades (r:1 w:0)
- /// Proof Skipped: Paras FutureCodeUpgrades (max_values: None, max_size: None, mode: Measured)
- /// Storage: ParaInherent OnChainVotes (r:1 w:1)
- /// Proof Skipped: ParaInherent OnChainVotes (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParasDisputes Disputes (r:2 w:0)
- /// Proof Skipped: ParasDisputes Disputes (max_values: None, max_size: None, mode: Measured)
- /// Storage: ParaScheduler SessionStartBlock (r:1 w:0)
- /// Proof Skipped: ParaScheduler SessionStartBlock (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParaScheduler ParathreadQueue (r:1 w:1)
- /// Proof Skipped: ParaScheduler ParathreadQueue (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParaScheduler Scheduled (r:1 w:1)
- /// Proof Skipped: ParaScheduler Scheduled (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParaScheduler ValidatorGroups (r:1 w:0)
- /// Proof Skipped: ParaScheduler ValidatorGroups (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: Paras CurrentCodeHash (r:1 w:0)
- /// Proof Skipped: Paras CurrentCodeHash (max_values: None, max_size: None, mode: Measured)
- /// Storage: Ump RelayDispatchQueueSize (r:1 w:0)
- /// Proof Skipped: Ump RelayDispatchQueueSize (max_values: None, max_size: None, mode: Measured)
- /// Storage: Ump NeedsDispatch (r:1 w:1)
- /// Proof Skipped: Ump NeedsDispatch (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
- /// Proof Skipped: Ump NextDispatchRoundStartWith (max_values: Some(1), max_size: None, mode: Measured)
- /// Storage: ParasDisputes Included (r:0 w:1)
- /// Proof Skipped: ParasDisputes Included (max_values: None, max_size: None, mode: Measured)
- /// Storage: Hrmp HrmpWatermarks (r:0 w:1)
- /// Proof Skipped: Hrmp HrmpWatermarks (max_values: None, max_size: None, mode: Measured)
- /// Storage: Paras Heads (r:0 w:1)
- /// Proof Skipped: Paras Heads (max_values: None, max_size: None, mode: Measured)
- /// Storage: Paras UpgradeGoAheadSignal (r:0 w:1)
- /// Proof Skipped: Paras UpgradeGoAheadSignal (max_values: None, max_size: None, mode: Measured)
- /// The range of component `v` is `[101, 200]`.
- fn enter_backed_candidates_variable(v: u32, ) -> Weight {
- // Proof Size summary in bytes:
- // Measured: `42613`
- // Estimated: `1258087`
- // Minimum execution time: 5_578_743_000 picoseconds.
- Weight::from_parts(810_980_132, 0)
- .saturating_add(Weight::from_parts(0, 1258087))
- // Standard Error: 53_608
- .saturating_add(Weight::from_parts(48_048_855, 0).saturating_mul(v.into()))
- .saturating_add(T::DbWeight::get().reads(29))
- .saturating_add(T::DbWeight::get().writes(16))
+ // Measured: `42548`
+ // Estimated: `48488`
+ // Minimum execution time: 356_755_000 picoseconds.
+ Weight::from_parts(364_728_000, 0)
+ .saturating_add(Weight::from_parts(0, 48488))
+ .saturating_add(T::DbWeight::get().reads(27))
+ .saturating_add(T::DbWeight::get().writes(18))
}
/// Storage: ParaInherent Included (r:1 w:1)
/// Proof Skipped: ParaInherent Included (max_values: Some(1), max_size: None, mode: Measured)
@@ -296,6 +228,8 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// Proof Skipped: Staking ErasRewardPoints (max_values: None, max_size: None, mode: Measured)
/// Storage: Dmp DownwardMessageQueues (r:1 w:1)
/// Proof Skipped: Dmp DownwardMessageQueues (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Dmp DeliveryFeeFactor (r:1 w:1)
+ /// Proof Skipped: Dmp DeliveryFeeFactor (max_values: None, max_size: None, mode: Measured)
/// Storage: Hrmp HrmpChannelDigests (r:1 w:1)
/// Proof Skipped: Hrmp HrmpChannelDigests (max_values: None, max_size: None, mode: Measured)
/// Storage: Paras FutureCodeUpgrades (r:1 w:0)
@@ -320,6 +254,8 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// Proof Skipped: Paras UpgradeRestrictionSignal (max_values: None, max_size: None, mode: Measured)
/// Storage: Ump RelayDispatchQueueSize (r:1 w:0)
/// Proof Skipped: Ump RelayDispatchQueueSize (max_values: None, max_size: None, mode: Measured)
+ /// Storage: Hrmp HrmpChannels (r:1 w:0)
+ /// Proof Skipped: Hrmp HrmpChannels (max_values: None, max_size: None, mode: Measured)
/// Storage: Ump NeedsDispatch (r:1 w:1)
/// Proof Skipped: Ump NeedsDispatch (max_values: Some(1), max_size: None, mode: Measured)
/// Storage: Ump NextDispatchRoundStartWith (r:1 w:1)
@@ -332,14 +268,24 @@ impl runtime_parachains::paras_inherent::WeightInfo for
/// Proof Skipped: Paras Heads (max_values: None, max_size: None, mode: Measured)
/// Storage: Paras UpgradeGoAheadSignal (r:0 w:1)
/// Proof Skipped: Paras UpgradeGoAheadSignal (max_values: None, max_size: None, mode: Measured)
- fn enter_backed_candidate_code_upgrade() -> Weight {
+ /// The range of component `v` is `[2, 5]`.
+ /// The range of component `u` is `[0, 10]`.
+ /// The range of component `h` is `[0, 10]`.
+ /// The range of component `c` is `[0, 10]`.
+ fn enter_backed_candidate(v: u32, u: u32, h: u32, c: u32, ) -> Weight {
// Proof Size summary in bytes:
- // Measured: `42640`
- // Estimated: `1351053`
- // Minimum execution time: 32_728_672_000 picoseconds.
- Weight::from_parts(32_934_819_000, 0)
- .saturating_add(Weight::from_parts(0, 1351053))
+ // Measured: `42671`
+ // Estimated: `48561 + c * (1 ±0) + h * (3 ±0) + u * (1 ±0) + v * (2 ±0)`
+ // Minimum execution time: 877_200_000 picoseconds.
+ Weight::from_parts(792_124_769, 0)
+ .saturating_add(Weight::from_parts(0, 48561))
+ // Standard Error: 510_045
+ .saturating_add(Weight::from_parts(58_442_198, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(31))
- .saturating_add(T::DbWeight::get().writes(16))
+ .saturating_add(T::DbWeight::get().writes(17))
+ .saturating_add(Weight::from_parts(0, 1).saturating_mul(c.into()))
+ .saturating_add(Weight::from_parts(0, 3).saturating_mul(h.into()))
+ .saturating_add(Weight::from_parts(0, 1).saturating_mul(u.into()))
+ .saturating_add(Weight::from_parts(0, 2).saturating_mul(v.into()))
}
}
diff --git a/runtime/parachains/src/builder.rs b/runtime/parachains/src/builder.rs
index 452c4c255ecf..615f07d26d3d 100644
--- a/runtime/parachains/src/builder.rs
+++ b/runtime/parachains/src/builder.rs
@@ -15,10 +15,11 @@
// along with Polkadot. If not, see .
use crate::{
- configuration, inclusion, initializer, paras,
+ configuration,
+ hrmp::{HrmpChannel, HrmpChannels},
+ inclusion, initializer, paras,
paras::ParaKind,
- paras_inherent::{self},
- scheduler, session_info, shared,
+ paras_inherent, scheduler, session_info, shared,
};
use bitvec::{order::Lsb0 as BitOrderLsb0, vec::BitVec};
use frame_support::pallet_prelude::*;
@@ -26,10 +27,10 @@ use primitives::{
collator_signature_payload, AvailabilityBitfield, BackedCandidate, CandidateCommitments,
CandidateDescriptor, CandidateHash, CollatorId, CollatorSignature, CommittedCandidateReceipt,
CompactStatement, CoreIndex, CoreOccupied, DisputeStatement, DisputeStatementSet, GroupIndex,
- HeadData, Id as ParaId, IndexedVec, InherentData as ParachainsInherentData,
- InvalidDisputeStatementKind, PersistedValidationData, SessionIndex, SigningContext,
- UncheckedSigned, ValidDisputeStatementKind, ValidationCode, ValidatorId, ValidatorIndex,
- ValidityAttestation,
+ HeadData, HrmpChannelId, Id as ParaId, IndexedVec, InherentData as ParachainsInherentData,
+ InvalidDisputeStatementKind, OutboundHrmpMessage, PersistedValidationData, SessionIndex,
+ SigningContext, UncheckedSigned, ValidDisputeStatementKind, ValidationCode, ValidatorId,
+ ValidatorIndex, ValidityAttestation,
};
use sp_core::{sr25519, H256};
use sp_runtime::{
@@ -37,7 +38,7 @@ use sp_runtime::{
traits::{Header as HeaderT, One, TrailingZeroInput, Zero},
RuntimeAppPublic,
};
-use sp_std::{collections::btree_map::BTreeMap, prelude::Vec, vec};
+use sp_std::{cmp, collections::btree_map::BTreeMap, prelude::Vec, vec};
fn mock_validation_code() -> ValidationCode {
ValidationCode(vec![1, 2, 3])
@@ -74,8 +75,6 @@ pub(crate) struct BenchBuilder {
session: SessionIndex,
/// Session we want the scenario to take place in. We will roll to this session.
target_session: u32,
- /// Optionally set the max validators per core; otherwise uses the configuration value.
- max_validators_per_core: Option,
/// Optionally set the max validators; otherwise uses the configuration value.
max_validators: Option,
/// Optionally set the number of dispute statements for each candidate.
@@ -86,11 +85,8 @@ pub(crate) struct BenchBuilder {
/// will correspond to core index 3. There must be one entry for each core with a dispute
/// statement set.
dispute_sessions: Vec,
- /// Map from core seed to number of validity votes.
- backed_and_concluding_cores: BTreeMap,
- /// Make every candidate include a code upgrade by setting this to `Some` where the interior
- /// value is the byte length of the new code.
- code_upgrade: Option,
+ /// Map from core seed to data for a backed candidate.
+ backed_and_concluding_cores: BTreeMap,
_phantom: sp_std::marker::PhantomData,
}
@@ -102,6 +98,18 @@ pub(crate) struct Bench {
pub(crate) _block_number: T::BlockNumber,
}
+#[derive(Copy, Clone)]
+pub struct BackedCandidateScenario {
+ /// Number of validity votes
+ pub validity_votes: u32,
+ /// Upward messages in bytes
+ pub ump: u32,
+ /// Horizontal messages in bytes
+ pub hrmp: u32,
+ /// Any code upgrade in bytes
+ pub code: u32,
+}
+
impl BenchBuilder {
/// Create a new `BenchBuilder` with some opinionated values that should work with the rest
/// of the functions in this implementation.
@@ -111,16 +119,35 @@ impl BenchBuilder {
block_number: Zero::zero(),
session: SessionIndex::from(0u32),
target_session: 2u32,
- max_validators_per_core: None,
max_validators: None,
dispute_statements: BTreeMap::new(),
dispute_sessions: Default::default(),
backed_and_concluding_cores: Default::default(),
- code_upgrade: None,
_phantom: sp_std::marker::PhantomData::,
}
}
+ /// Make sure config contains suitable values for benchmarking.
+ ///
+ /// Fallback values are chosen based on current Kusama values at the time of writing.
+ pub(crate) fn adjust_config_benchmarking() {
+ let mut config = configuration::Pallet::::config();
+
+ config.max_upward_message_num_per_candidate =
+ Self::fallback_max_upward_message_num_per_candidate();
+ config.max_upward_message_size = Self::fallback_max_upward_message_size();
+ config.max_upward_queue_count = Self::fallback_max_upward_queue_count();
+ config.max_upward_queue_size = Self::fallback_max_upward_queue_size();
+
+ config.hrmp_max_message_num_per_candidate =
+ Self::fallback_hrmp_max_message_num_per_candidate();
+ config.hrmp_channel_max_message_size = Self::fallback_hrmp_channel_max_message_size();
+
+ config.max_code_size = Self::fallback_max_code_size();
+
+ configuration::Pallet::::force_set_active_config(config);
+ }
+
/// Set the session index for each dispute statement set (in other words, set the session the
/// the dispute statement set's relay chain block is from). Indexes of `dispute_sessions`
/// correspond to a core, which is offset by the number of entries for
@@ -136,19 +163,12 @@ impl BenchBuilder {
/// Set a map from core/para id seed to number of validity votes.
pub(crate) fn set_backed_and_concluding_cores(
mut self,
- backed_and_concluding_cores: BTreeMap,
+ backed_and_concluding_cores: BTreeMap,
) -> Self {
self.backed_and_concluding_cores = backed_and_concluding_cores;
self
}
- /// Set to include a code upgrade for all backed candidates. The value will be the byte length
- /// of the code.
- pub(crate) fn set_code_upgrade(mut self, code_upgrade: impl Into