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>) -> Self { - self.code_upgrade = code_upgrade.into(); - self - } - /// Mock header. pub(crate) fn header(block_number: T::BlockNumber) -> T::Header { T::Header::new( @@ -178,6 +198,61 @@ impl BenchBuilder { self.max_validators.unwrap_or(Self::fallback_max_validators()) } + pub(crate) fn fallback_max_upward_queue_count() -> u32 { + // Make sure we can at least queue as many messages as are allowed in a single candidate. + cmp::max( + Self::fallback_max_upward_message_num_per_candidate(), + configuration::Pallet::::config().max_upward_queue_count, + ) + } + + pub(crate) fn fallback_max_upward_message_num_per_candidate() -> u32 { + // Make sure we get some benchmark data, no matter what (values are current Kusama values + // at the time of writing): + let min_value = 10; + cmp::max( + configuration::Pallet::::config().max_upward_message_num_per_candidate, + min_value, + ) + } + + pub(crate) fn fallback_max_upward_queue_size() -> u32 { + // Make sure we can at least queue as many messages as are allowed in a single candidate. + cmp::max( + Self::fallback_max_upward_message_size() * + Self::fallback_max_upward_message_num_per_candidate(), + configuration::Pallet::::config().max_upward_queue_size, + ) + } + + pub(crate) fn fallback_max_upward_message_size() -> u32 { + // Make sure we get some benchmark data, no matter what (values are current Kusama values + // at the time of writing): + let min_value = 51_200; + cmp::max(configuration::Pallet::::config().max_upward_message_size, min_value) + } + + pub(crate) fn fallback_hrmp_max_message_num_per_candidate() -> u32 { + // Make sure we get some benchmark data, no matter what (values are current Kusama values + // at the time of writing): + let min_value = 10; + cmp::max(configuration::Pallet::::config().hrmp_max_message_num_per_candidate, min_value) + } + + pub(crate) fn fallback_hrmp_channel_max_message_size() -> u32 { + // Make sure we get some benchmark data, no matter what (values are current Kusama values + // at the time of writing): + let min_value = 102_400; + cmp::max(configuration::Pallet::::config().hrmp_channel_max_message_size, min_value) + } + + pub(crate) fn fallback_max_code_size() -> u32 { + // Make sure we get some benchmark data, no matter what (values are current Kusama values + // at the time of writing): + let min_value = 3_145_728; + cmp::max(configuration::Pallet::::config().max_code_size, min_value) + } + /// Set the maximum number of active validators. #[cfg(not(feature = "runtime-benchmarks"))] pub(crate) fn set_max_validators(mut self, n: u32) -> Self { @@ -202,27 +277,18 @@ impl BenchBuilder { self } - /// Get the maximum number of validators per core. - fn max_validators_per_core(&self) -> u32 { - self.max_validators_per_core.unwrap_or(Self::fallback_max_validators_per_core()) - } - - /// Set maximum number of validators per core. - #[cfg(not(feature = "runtime-benchmarks"))] - pub(crate) fn set_max_validators_per_core(mut self, n: u32) -> Self { - self.max_validators_per_core = Some(n); - self - } - /// Get the maximum number of cores we expect from this configuration. pub(crate) fn max_cores(&self) -> u32 { - self.max_validators() / self.max_validators_per_core() + self.max_validators() / Self::fallback_max_validators_per_core() } /// Get the minimum number of validity votes in order for a backed candidate to be included. #[cfg(feature = "runtime-benchmarks")] - pub(crate) fn fallback_min_validity_votes() -> u32 { - (Self::fallback_max_validators() / 2) + 1 + pub(crate) fn fallback_min_backing_votes() -> u32 { + use crate::inclusion::minimum_backing_votes; + minimum_backing_votes(Self::fallback_max_validators_per_core() as _) + .try_into() + .unwrap() } /// Create para id, core index, and grab the associated group index from the scheduler pallet. @@ -305,7 +371,7 @@ impl BenchBuilder { /// Create an `AvailabilityBitfield` where `concluding` is a map where each key is a core index /// that is concluding and `cores` is the total number of cores in the system. - fn availability_bitvec(concluding: &BTreeMap, cores: u32) -> AvailabilityBitfield { + fn availability_bitvec(concluding: &BTreeMap, cores: u32) -> AvailabilityBitfield { let mut bitfields = bitvec::bitvec![u8, bitvec::order::Lsb0; 0; 0]; for i in 0..cores { if concluding.get(&(i as u32)).is_some() { @@ -429,9 +495,9 @@ impl BenchBuilder { /// `concluding_cores` is fully available. Additionally set up storage such that each /// `concluding_cores`is pending becoming fully available so the generated bitfields will be /// to the cores successfully being freed from the candidates being marked as available. - fn create_availability_bitfields( + fn create_availability_bitfields( &self, - concluding_cores: &BTreeMap, + concluding_cores: &BTreeMap, total_cores: u32, ) -> Vec> { let validators = @@ -476,8 +542,7 @@ impl BenchBuilder { /// validity votes. fn create_backed_candidates( &self, - cores_with_backed_candidates: &BTreeMap, - includes_code_upgrade: Option, + cores_with_backed_candidates: &BTreeMap, ) -> Vec> { let validators = self.validators.as_ref().expect("must have some validators prior to calling"); @@ -485,8 +550,8 @@ impl BenchBuilder { cores_with_backed_candidates .iter() - .map(|(seed, num_votes)| { - assert!(*num_votes <= validators.len() as u32); + .map(|(seed, scenario)| { + assert!(scenario.validity_votes <= validators.len() as u32); let (para_id, _core_idx, group_idx) = self.create_indexes(seed.clone()); // This generates a pair and adds it to the keystore, returning just the public. @@ -534,22 +599,14 @@ impl BenchBuilder { para_head: head_data.hash(), validation_code_hash, }, - commitments: CandidateCommitments:: { - upward_messages: Default::default(), - horizontal_messages: Default::default(), - new_validation_code: includes_code_upgrade - .map(|v| ValidationCode(vec![42u8; v as usize])), - head_data, - processed_downward_messages: 0, - hrmp_watermark: self.relay_parent_number(), - }, + commitments: self.create_candidate_commitments(para_id, head_data, scenario), }; let candidate_hash = candidate.hash(); let validity_votes: Vec<_> = group_validators .iter() - .take(*num_votes as usize) + .take(scenario.validity_votes as usize) .map(|val_idx| { let public = validators.get(*val_idx).unwrap(); let sig = UncheckedSigned::::benchmark_sign( @@ -635,6 +692,77 @@ impl BenchBuilder { .collect() } + fn create_candidate_commitments( + &self, + para_id: ParaId, + head_data: HeadData, + scenario: &BackedCandidateScenario, + ) -> CandidateCommitments { + let config = crate::configuration::Pallet::::config(); + let upward_messages = { + let unbounded = create_messages( + scenario.ump, + config.max_upward_message_size, + config.max_upward_message_num_per_candidate, + ) + .map(|m| m.collect()) + .collect(); + BoundedVec::truncate_from(unbounded) + }; + + let horizontal_messages = { + let unbounded: Vec<_> = create_messages( + scenario.hrmp, + config.hrmp_channel_max_message_size, + config.hrmp_max_message_num_per_candidate, + ) + .collect(); + + for n in 0..unbounded.len() { + let channel_id = + HrmpChannelId { sender: para_id, recipient: para_id + n as u32 + 1 }; + HrmpChannels::::insert( + &channel_id, + HrmpChannel { + sender_deposit: 42, + recipient_deposit: 42, + max_capacity: 10_000_000, + max_total_size: 1_000_000_000, + max_message_size: 10_000_000, + msg_count: 0, + total_size: 0, + mqc_head: None, + }, + ); + } + + let unbounded = unbounded + .into_iter() + .enumerate() + .map(|(n, m)| OutboundHrmpMessage { + recipient: para_id + n as u32 + 1, + data: m.collect(), + }) + .collect(); + BoundedVec::truncate_from(unbounded) + }; + + let new_validation_code = if scenario.code > 0 { + Some(ValidationCode(vec![42u8; scenario.code as usize])) + } else { + None + }; + + CandidateCommitments:: { + upward_messages, + horizontal_messages, + new_validation_code, + head_data, + processed_downward_messages: 0, + hrmp_watermark: self.relay_parent_number(), + } + } + /// Build a scenario for testing or benchmarks. /// /// Note that this API only allows building scenarios where the `backed_and_concluding_cores` @@ -642,6 +770,8 @@ impl BenchBuilder { /// `backed_and_concluding_cores.len() + dispute_sessions.len()` must be less than the max /// number of cores. pub(crate) fn build(self) -> Bench { + // Necessary for benchmarks to succeed: + Self::adjust_config_benchmarking(); // Make sure relevant storage is cleared. This is just to get the asserts to work when // running tests because it seems the storage is not cleared in between. #[allow(deprecated)] @@ -665,8 +795,8 @@ impl BenchBuilder { let bitfields = builder.create_availability_bitfields(&builder.backed_and_concluding_cores, used_cores); - let backed_candidates = builder - .create_backed_candidates(&builder.backed_and_concluding_cores, builder.code_upgrade); + let backed_candidates = + builder.create_backed_candidates(&builder.backed_and_concluding_cores); let disputes = builder.create_disputes( builder.backed_and_concluding_cores.len() as u32, @@ -700,3 +830,29 @@ impl BenchBuilder { } } } + +/// Create messages with a total number of `num_bytes`. +fn create_messages( + num_bytes: u32, + max_message_size: u32, + max_messages: u32, +) -> impl Iterator> { + let max_message_size = if max_message_size == 0 { num_bytes } else { max_message_size }; + let num_full_messages = if num_bytes == 0 { 0 } else { num_bytes / max_message_size }; + let last_message_size = if num_bytes == 0 { 0 } else { num_bytes % max_message_size }; + let last_message = + if last_message_size == 0 { vec![] } else { vec![(0..last_message_size).map(as_byte)] }; + + assert!( + max_messages == 0 || num_full_messages + last_message.len() as u32 <= max_messages, + "Too many messages generated. max_messages: {}, num_full_messages: {}, num_bytes: {}, max_message_size: {}, last_message_size: {}", max_messages, num_full_messages, num_bytes, max_message_size, last_message_size, + ); + + fn as_byte(u: u32) -> u8 { + u as u8 + } + + (0..num_full_messages) + .map(move |_| (0..max_message_size).map(as_byte)) + .chain(last_message) +} diff --git a/runtime/parachains/src/paras_inherent/benchmarking.rs b/runtime/parachains/src/paras_inherent/benchmarking.rs index 3043127c3174..85b8feeb29ae 100644 --- a/runtime/parachains/src/paras_inherent/benchmarking.rs +++ b/runtime/parachains/src/paras_inherent/benchmarking.rs @@ -20,7 +20,7 @@ use frame_benchmarking::{benchmarks, impl_benchmark_test_suite}; use frame_system::RawOrigin; use sp_std::collections::btree_map::BTreeMap; -use crate::builder::BenchBuilder; +use crate::builder::{BackedCandidateScenario, BenchBuilder}; benchmarks! { // Variant over `v`, the number of dispute statements in a dispute statement set. This gives the @@ -57,8 +57,14 @@ benchmarks! { // The weight of one bitfield. enter_bitfields { + let scenario = BackedCandidateScenario { + validity_votes: BenchBuilder::::fallback_max_validators_per_core(), + ump: 0, + hrmp: 0, + code: 0 + }; let cores_with_backed: BTreeMap<_, _> - = vec![(0, BenchBuilder::::fallback_max_validators())] + = vec![(0, scenario)] .into_iter() .collect(); @@ -86,9 +92,13 @@ benchmarks! { assert_eq!(vote.session, scenario._session); } - // Variant over `v`, the amount of validity votes for a backed candidate. This gives the weight + // Variant over: + // - `v`, the count of validity votes for a backed candidate. + // - `u`, total size of upward messages in bytes + // - `h`, total size of horizontal messages in bytes + // - `c`, size of new validation code if any in bytes // of a single backed candidate. - enter_backed_candidates_variable { + enter_backed_candidate { // NOTE: the starting value must be over half of the max validators per group so the backed // candidate is not rejected. Also, we cannot have more validity votes than validators in // the group. @@ -96,14 +106,39 @@ benchmarks! { // Do not use this range for Rococo because it only has 1 validator per backing group, // which causes issues when trying to create slopes with the benchmarking analysis. Instead // use v = 1 for running Rococo benchmarks - let v in (BenchBuilder::::fallback_min_validity_votes()) - ..(BenchBuilder::::fallback_max_validators()); + let v in (BenchBuilder::::fallback_min_backing_votes()) + ..(BenchBuilder::::fallback_max_validators_per_core()); + + // Can't use real limits as this would lead to severely over estimated base case: + // https://github.com/paritytech/substrate/issues/13808 + + // let u in 0 .. (BenchBuilder::::fallback_max_upward_message_num_per_candidate() * BenchBuilder::::fallback_max_upward_message_size()); + // let h in 0 .. (BenchBuilder::::fallback_hrmp_max_message_num_per_candidate() * BenchBuilder::::fallback_hrmp_channel_max_message_size()); + // let c in 0 .. (BenchBuilder::::fallback_max_code_size()); + + // These low values may lead to constant factors being ignored (although it just worked for + // me locally), but that is currently the + // better option than having a base weight that would only allow one to two backed + // candidates per block. We will limit by size in addition to CPU weight, which should + // suffice to also not exceed the weight limit in practice. + let u in 0 .. 10; + let h in 0 .. 10; + let c in 0 .. 10; + + BenchBuilder::::adjust_config_benchmarking(); + + let candidate_scenario = BackedCandidateScenario { + validity_votes: v, + ump: u, + hrmp: h, + code: c, + }; // Comment in for running rococo benchmarks // let v = 1; let cores_with_backed: BTreeMap<_, _> - = vec![(0, v)] // The backed candidate will have `v` validity votes. + = vec![(0, candidate_scenario)] // The backed candidate will have `v` validity votes. .into_iter() .collect(); @@ -122,7 +157,6 @@ benchmarks! { benchmark.disputes.clear(); }: enter(RawOrigin::None, benchmark) verify { - let max_validators_per_core = BenchBuilder::::fallback_max_validators_per_core(); // Assert that the block was not discarded assert!(Included::::get().is_some()); // Assert that there are on-chain votes that got scraped @@ -141,71 +175,11 @@ benchmarks! { assert_eq!(backing_validators.1.len(), v as usize); } - assert_eq!( - inclusion::PendingAvailabilityCommitments::::iter().count(), - cores_with_backed.len() - ); - assert_eq!( - inclusion::PendingAvailability::::iter().count(), - cores_with_backed.len() - ); - } - - enter_backed_candidate_code_upgrade { - // For now we always assume worst case code size. In the future we could vary over this. - let v = crate::configuration::Pallet::::config().max_code_size; - - let cores_with_backed: BTreeMap<_, _> - = vec![(0, BenchBuilder::::fallback_min_validity_votes())] - .into_iter() - .collect(); - - let scenario = BenchBuilder::::new() - .set_backed_and_concluding_cores(cores_with_backed.clone()) - .set_code_upgrade(v) - .build(); - - let mut benchmark = scenario.data.clone(); - - // There is 1 backed - assert_eq!(benchmark.backed_candidates.len(), 1); - assert_eq!( - benchmark.backed_candidates.get(0).unwrap().validity_votes.len() as u32, - BenchBuilder::::fallback_min_validity_votes() - ); - - benchmark.bitfields.clear(); - benchmark.disputes.clear(); - crate::paras::benchmarking::generate_disordered_upgrades::(); - }: enter(RawOrigin::None, benchmark) - verify { - let max_validators_per_core = BenchBuilder::::fallback_max_validators_per_core(); - // Assert that the block was not discarded - assert!(Included::::get().is_some()); - // Assert that there are on-chain votes that got scraped - let onchain_votes = OnChainVotes::::get(); - assert!(onchain_votes.is_some()); - let vote = onchain_votes.unwrap(); - // Ensure that the votes are for the correct session - assert_eq!(vote.session, scenario._session); - // Ensure that there are an expected number of candidates - let header = BenchBuilder::::header(scenario._block_number.clone()); - // Traverse candidates and assert descriptors are as expected - for (para_id, backing_validators) - in vote.backing_validators_per_candidate.iter().enumerate() { - let descriptor = backing_validators.0.descriptor(); - assert_eq!(ParaId::from(para_id), descriptor.para_id); - assert_eq!(header.hash(), descriptor.relay_parent); - assert_eq!( - backing_validators.1.len() as u32, - BenchBuilder::::fallback_min_validity_votes() - ); - } - - assert_eq!( - inclusion::PendingAvailabilityCommitments::::iter().count(), - cores_with_backed.len() - ); + // Disabled this check, because it is making the allocater to run out of memory: + // assert_eq!( + // inclusion::PendingAvailabilityCommitments::::iter().count(), + // cores_with_backed.len() + // ); assert_eq!( inclusion::PendingAvailability::::iter().count(), cores_with_backed.len() diff --git a/runtime/parachains/src/paras_inherent/tests.rs b/runtime/parachains/src/paras_inherent/tests.rs index f499b0a5ae3e..8721674641f0 100644 --- a/runtime/parachains/src/paras_inherent/tests.rs +++ b/runtime/parachains/src/paras_inherent/tests.rs @@ -23,7 +23,7 @@ use super::*; mod enter { use super::*; use crate::{ - builder::{Bench, BenchBuilder}, + builder::{BackedCandidateScenario, Bench, BenchBuilder}, mock::{new_test_ext, MockGenesisConfig, Test}, }; use assert_matches::assert_matches; @@ -33,35 +33,23 @@ mod enter { struct TestConfig { dispute_statements: BTreeMap, dispute_sessions: Vec, - backed_and_concluding: BTreeMap, - num_validators_per_core: u32, - code_upgrade: Option, + backed_and_concluding: BTreeMap, } fn make_inherent_data( - TestConfig { - dispute_statements, - dispute_sessions, - backed_and_concluding, - num_validators_per_core, - code_upgrade, - }: TestConfig, + TestConfig { dispute_statements, dispute_sessions, backed_and_concluding }: TestConfig, ) -> Bench { let builder = BenchBuilder::::new() .set_max_validators( (dispute_sessions.len() + backed_and_concluding.len()) as u32 * - num_validators_per_core, + BenchBuilder::::fallback_max_validators_per_core(), ) - .set_max_validators_per_core(num_validators_per_core) + // .set_max_validators_per_core(num_validators_per_core) .set_dispute_statements(dispute_statements) .set_backed_and_concluding_cores(backed_and_concluding) .set_dispute_sessions(&dispute_sessions[..]); - if let Some(code_size) = code_upgrade { - builder.set_code_upgrade(code_size).build() - } else { - builder.build() - } + builder.build() } #[test] @@ -73,15 +61,14 @@ mod enter { let dispute_statements = BTreeMap::new(); let mut backed_and_concluding = BTreeMap::new(); - backed_and_concluding.insert(0, 1); - backed_and_concluding.insert(1, 1); + let scenario = BackedCandidateScenario { validity_votes: 1, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(0, scenario); + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![], // No disputes backed_and_concluding, - num_validators_per_core: 1, - code_upgrade: None, }); // We expect the scenario to have cores 0 & 1 with pending availability. The backed @@ -252,8 +239,6 @@ mod enter { dispute_statements, dispute_sessions: vec![1, 2, 3 /* Session 3 too new, will get filtered out */], backed_and_concluding, - num_validators_per_core: 5, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -326,8 +311,6 @@ mod enter { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 6, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -396,8 +379,6 @@ mod enter { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 6, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -438,15 +419,14 @@ mod enter { let mut backed_and_concluding = BTreeMap::new(); // 2 backed candidates shall be scheduled - backed_and_concluding.insert(0, 2); - backed_and_concluding.insert(1, 2); + let scenario = BackedCandidateScenario { validity_votes: 2, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(0, scenario); + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 4, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -518,16 +498,15 @@ mod enter { let dispute_statements = BTreeMap::new(); let mut backed_and_concluding = BTreeMap::new(); + let scenario = BackedCandidateScenario { validity_votes: 2, ump: 0, hrmp: 0, code: 0 }; // 2 backed candidates shall be scheduled - backed_and_concluding.insert(0, 2); - backed_and_concluding.insert(1, 2); + backed_and_concluding.insert(0, scenario); + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 4, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -575,15 +554,14 @@ mod enter { let mut backed_and_concluding = BTreeMap::new(); // Schedule 2 backed candidates - backed_and_concluding.insert(0, 2); - backed_and_concluding.insert(1, 2); + let scenario = BackedCandidateScenario { validity_votes: 2, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(0, scenario); + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 5, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -661,15 +639,14 @@ mod enter { let mut backed_and_concluding = BTreeMap::new(); // 2 backed candidates shall be scheduled - backed_and_concluding.insert(0, 2); - backed_and_concluding.insert(1, 2); + let scenario = BackedCandidateScenario { validity_votes: 2, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(0, scenario); + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 5, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -746,15 +723,15 @@ mod enter { let mut backed_and_concluding = BTreeMap::new(); // 2 backed candidates shall be scheduled - backed_and_concluding.insert(0, 16); - backed_and_concluding.insert(1, 25); + let scenario = BackedCandidateScenario { validity_votes: 16, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(0, scenario); + let scenario = BackedCandidateScenario { validity_votes: 25, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 5, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); @@ -826,16 +803,16 @@ mod enter { dispute_statements.insert(4, 17); let mut backed_and_concluding = BTreeMap::new(); + let scenario = BackedCandidateScenario { validity_votes: 16, ump: 0, hrmp: 0, code: 0 }; // 2 backed candidates shall be scheduled - backed_and_concluding.insert(0, 16); - backed_and_concluding.insert(1, 25); + backed_and_concluding.insert(0, scenario); + let scenario = BackedCandidateScenario { validity_votes: 25, ump: 0, hrmp: 0, code: 0 }; + backed_and_concluding.insert(1, scenario); let scenario = make_inherent_data(TestConfig { dispute_statements, dispute_sessions: vec![2, 2, 1], // 3 cores with disputes backed_and_concluding, - num_validators_per_core: 5, - code_upgrade: None, }); let expected_para_inherent_data = scenario.data.clone(); diff --git a/runtime/parachains/src/paras_inherent/weights.rs b/runtime/parachains/src/paras_inherent/weights.rs index f6e1262f5eb9..61e09ac35bd6 100644 --- a/runtime/parachains/src/paras_inherent/weights.rs +++ b/runtime/parachains/src/paras_inherent/weights.rs @@ -11,6 +11,8 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. +use primitives::ValidationCode; + // You should have received a copy of the GNU General Public License // along with Polkadot. If not, see . use super::{ @@ -23,11 +25,13 @@ pub trait WeightInfo { fn enter_variable_disputes(v: u32) -> Weight; /// The weight of one bitfield. fn enter_bitfields() -> Weight; - /// Variant over `v`, the count of validity votes for a backed candidate. This gives the weight + /// Variant over: + /// - `v`, the count of validity votes for a backed candidate. + /// - u, total size of upward messages in bytes + /// - h, total size of horizontal messages in bytes + /// - c, size of new validation code if any in bytes /// of a single backed candidate. - fn enter_backed_candidates_variable(v: u32) -> Weight; - /// The weight of a single backed candidate with a code upgrade. - fn enter_backed_candidate_code_upgrade() -> Weight; + fn enter_backed_candidate(v: u32, u: u32, h: u32, c: u32) -> Weight; } pub struct TestWeightInfo; @@ -43,13 +47,10 @@ impl WeightInfo for TestWeightInfo { // MAX Block Weight should fit 4 backed candidates Weight::from_parts(40_000u64, 0) } - fn enter_backed_candidates_variable(v: u32) -> Weight { + fn enter_backed_candidate(v: u32, _ump: u32, _hrmp: u32, _code: u32) -> Weight { // MAX Block Weight should fit 4 backed candidates Weight::from_parts(40_000 * v as u64 + 40_000, 0) } - fn enter_backed_candidate_code_upgrade() -> Weight { - Weight::zero() - } } // To simplify benchmarks running as tests, we set all the weights to 0. `enter` will exit early // when if the data causes it to be over weight, but we don't want that to block a benchmark from @@ -62,10 +63,7 @@ impl WeightInfo for TestWeightInfo { fn enter_bitfields() -> Weight { Weight::zero() } - fn enter_backed_candidates_variable(_v: u32) -> Weight { - Weight::zero() - } - fn enter_backed_candidate_code_upgrade() -> Weight { + fn enter_backed_candidate(_v: u32, _ump: u32, _hrmp: u32, _code: u32) -> Weight { Weight::zero() } } @@ -110,13 +108,27 @@ pub fn signed_bitfields_weight(bitfields_len: usize) -> Weight { pub fn backed_candidate_weight( candidate: &BackedCandidate, ) -> Weight { - if candidate.candidate.commitments.new_validation_code.is_some() { - <::WeightInfo as WeightInfo>::enter_backed_candidate_code_upgrade() - } else { - <::WeightInfo as WeightInfo>::enter_backed_candidates_variable( - candidate.validity_votes.len() as u32, - ) - } + let v = candidate.validity_votes.len() as u32; + let ump = candidate + .candidate + .commitments + .upward_messages + .iter() + // We assume message sizes to never even come close to the limits of u32: + .map(|m| m.len() as u32) + .sum(); + let hrmp = candidate + .candidate + .commitments + .horizontal_messages + .iter() + .map(|m| m.data.len() as u32) + .sum(); + let code = match &candidate.candidate.commitments.new_validation_code { + Some(ValidationCode(upgrade)) => upgrade.len() as u32, + None => 0, + }; + <::WeightInfo as WeightInfo>::enter_backed_candidate(v, ump, hrmp, code) } pub fn backed_candidates_weight( diff --git a/runtime/polkadot/src/weights/runtime_parachains_paras_inherent.rs b/runtime/polkadot/src/weights/runtime_parachains_paras_inherent.rs index ed914bfd6da2..b3bf722d7f72 100644 --- a/runtime/polkadot/src/weights/runtime_parachains_paras_inherent.rs +++ b/runtime/polkadot/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: `bm4`, 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("polkadot-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=polkadot-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=polkadot-dev // --header=./file_header.txt -// --output=./runtime/polkadot/src/weights/runtime_parachains_paras_inherent.rs +// --output=./runtime/polkadot/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); @@ -85,6 +88,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) @@ -112,15 +117,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: `50870` - // Estimated: `1539235 + v * (23 ±0)` - // Minimum execution time: 776_077_000 picoseconds. - Weight::from_parts(298_478_078, 0) - .saturating_add(Weight::from_parts(0, 1539235)) - // Standard Error: 25_937 - .saturating_add(Weight::from_parts(48_728_687, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(29)) - .saturating_add(T::DbWeight::get().writes(16)) + // Measured: `50979` + // Estimated: `56919 + v * (23 ±0)` + // Minimum execution time: 815_525_000 picoseconds. + Weight::from_parts(342_846_666, 0) + .saturating_add(Weight::from_parts(0, 56919)) + // Standard Error: 24_948 + .saturating_add(Weight::from_parts(48_295_615, 0).saturating_mul(v.into())) + .saturating_add(T::DbWeight::get().reads(30)) + .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) @@ -155,6 +160,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) @@ -187,90 +194,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: `42703` - // Estimated: `1252687` - // Minimum execution time: 333_634_000 picoseconds. - Weight::from_parts(347_247_000, 0) - .saturating_add(Weight::from_parts(0, 1252687)) - .saturating_add(T::DbWeight::get().reads(27)) - .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: Configuration ActiveConfig (r:1 w:0) - /// Proof Skipped: Configuration ActiveConfig (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: `42735` - // Estimated: `1305723` - // Minimum execution time: 5_585_712_000 picoseconds. - Weight::from_parts(817_055_988, 0) - .saturating_add(Weight::from_parts(0, 1305723)) - // Standard Error: 47_975 - .saturating_add(Weight::from_parts(48_146_281, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(30)) - .saturating_add(T::DbWeight::get().writes(16)) + // Measured: `42813` + // Estimated: `48753` + // Minimum execution time: 358_902_000 picoseconds. + Weight::from_parts(366_074_000, 0) + .saturating_add(Weight::from_parts(0, 48753)) + .saturating_add(T::DbWeight::get().reads(28)) + .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) @@ -304,6 +234,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) @@ -328,6 +260,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) @@ -340,14 +274,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: `42762` - // Estimated: `1398960` - // Minimum execution time: 32_705_265_000 picoseconds. - Weight::from_parts(32_937_507_000, 0) - .saturating_add(Weight::from_parts(0, 1398960)) + // Measured: `42936` + // Estimated: `48826 + c * (1 ±0) + h * (3 ±0) + u * (1 ±0) + v * (2 ±0)` + // Minimum execution time: 878_549_000 picoseconds. + Weight::from_parts(794_861_042, 0) + .saturating_add(Weight::from_parts(0, 48826)) + // Standard Error: 519_711 + .saturating_add(Weight::from_parts(58_530_623, 0).saturating_mul(v.into())) .saturating_add(T::DbWeight::get().reads(32)) - .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/rococo/src/weights/runtime_parachains_paras_inherent.rs b/runtime/rococo/src/weights/runtime_parachains_paras_inherent.rs index a102d1903b2f..dcf1f44c20ef 100644 --- a/runtime/rococo/src/weights/runtime_parachains_paras_inherent.rs +++ b/runtime/rococo/src/weights/runtime_parachains_paras_inherent.rs @@ -133,7 +133,7 @@ impl runtime_parachains::paras_inherent::WeightInfo for // Storage: ParasDisputes Included (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 { + fn enter_backed_candidate(_v: u32, _u: u32, _h: u32, _c: u32) -> Weight { Weight::from_parts(442_472_000 as u64, 0) .saturating_add(T::DbWeight::get().reads(25 as u64)) .saturating_add(T::DbWeight::get().writes(14 as u64)) @@ -165,9 +165,4 @@ impl runtime_parachains::paras_inherent::WeightInfo for // Storage: ParasDisputes Included (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 { - Weight::from_parts(36_903_411_000 as u64, 0) - .saturating_add(T::DbWeight::get().reads(25 as u64)) - .saturating_add(T::DbWeight::get().writes(14 as u64)) - } } diff --git a/runtime/westend/src/weights/runtime_parachains_paras_inherent.rs b/runtime/westend/src/weights/runtime_parachains_paras_inherent.rs index 1113d4bc06a1..be6d015b1536 100644 --- a/runtime/westend/src/weights/runtime_parachains_paras_inherent.rs +++ b/runtime/westend/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-15, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! DATE: 2023-04-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]` //! WORST CASE MAP SIZE: `1000000` -//! HOSTNAME: `bm6`, 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("westend-dev"), DB CACHE: 1024 // Executed Command: -// ./target/production/polkadot +// target/production/polkadot // benchmark // pallet -// --chain=westend-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=westend-dev // --header=./file_header.txt -// --output=./runtime/westend/src/weights/runtime_parachains_paras_inherent.rs +// --output=./runtime/westend/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) @@ -111,14 +116,14 @@ impl runtime_parachains::paras_inherent::WeightInfo for fn enter_variable_disputes(v: u32, ) -> Weight { // Proof Size summary in bytes: // Measured: `50561` - // Estimated: `1478228 + v * (23 ±0)` - // Minimum execution time: 768_115_000 picoseconds. - Weight::from_parts(294_738_363, 0) - .saturating_add(Weight::from_parts(0, 1478228)) - // Standard Error: 18_829 - .saturating_add(Weight::from_parts(48_431_584, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(28)) - .saturating_add(T::DbWeight::get().writes(16)) + // Estimated: `56501 + v * (23 ±0)` + // Minimum execution time: 805_405_000 picoseconds. + Weight::from_parts(342_195_461, 0) + .saturating_add(Weight::from_parts(0, 56501)) + // Standard Error: 27_524 + .saturating_add(Weight::from_parts(48_351_060, 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) @@ -184,87 +191,12 @@ impl runtime_parachains::paras_inherent::WeightInfo for fn enter_bitfields() -> Weight { // Proof Size summary in bytes: // Measured: `42395` - // Estimated: `1200183` - // Minimum execution time: 322_846_000 picoseconds. - Weight::from_parts(333_533_000, 0) - .saturating_add(Weight::from_parts(0, 1200183)) - .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: `42426` - // Estimated: `1252851` - // Minimum execution time: 5_562_919_000 picoseconds. - Weight::from_parts(788_126_549, 0) - .saturating_add(Weight::from_parts(0, 1252851)) - // Standard Error: 40_209 - .saturating_add(Weight::from_parts(47_710_957, 0).saturating_mul(v.into())) - .saturating_add(T::DbWeight::get().reads(29)) - .saturating_add(T::DbWeight::get().writes(16)) + // Estimated: `48335` + // Minimum execution time: 348_336_000 picoseconds. + Weight::from_parts(358_001_000, 0) + .saturating_add(Weight::from_parts(0, 48335)) + .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,28 @@ 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: `42453` - // Estimated: `1345443` - // Minimum execution time: 32_601_053_000 picoseconds. - Weight::from_parts(32_810_866_000, 0) - .saturating_add(Weight::from_parts(0, 1345443)) + // Measured: `42518` + // Estimated: `48408 + c * (1 ±0) + h * (3 ±0) + u * (1 ±0) + v * (2 ±0)` + // Minimum execution time: 869_838_000 picoseconds. + Weight::from_parts(780_250_196, 0) + .saturating_add(Weight::from_parts(0, 48408)) + // Standard Error: 520_761 + .saturating_add(Weight::from_parts(57_984_625, 0).saturating_mul(v.into())) + // Standard Error: 177_867 + .saturating_add(Weight::from_parts(201_843, 0).saturating_mul(h.into())) + // Standard Error: 177_867 + .saturating_add(Weight::from_parts(176_126, 0).saturating_mul(c.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())) } }