HRMP benchmarks (#3876)

* wip template for hrmp benchmarks

* add all of the benchmarks, first draft

* File was not saved :/

* cargo +nightly fmt

* Use configs

* add configs

* Fix rococo

* Final touches

* revert fmt changes, one last time

* Fix wrappings

* Fix a bunch of tests

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_hrmp.rs

* add to westend

* actually use everything

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_hrmp.rs

* Update runtime/parachains/src/hrmp.rs

Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>

* use real weight in wnd

* reorg

* minor cleanup

* weigh some of the internal stuff as well

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=kusama-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/kusama/src/weights/runtime_parachains_hrmp.rs

* cargo run --quiet --release --features=runtime-benchmarks -- benchmark --chain=westend-dev --steps=50 --repeat=20 --pallet=runtime_parachains::hrmp --extrinsic=* --execution=wasm --wasm-execution=compiled --heap-pages=4096 --header=./file_header.txt --output=./runtime/westend/src/weights/runtime_parachains_hrmp.rs

* add files

* Master.into()

* add validation

* fmt

* fmt

* final fixes

* all runtimes build

* undo formatting

* Update runtime/parachains/src/hrmp.rs

Co-authored-by: Zeke Mostov <z.mostov@gmail.com>

* non-controversial changes

* do it the parachain-way: use const instead of type configs for simplicity.

* borrow assert_storage_consistency_exhaustive

* move assert_storage_consistency_exhaustive to Pallet, so it can be reused for benchmarks as well.

* fix typo

Co-authored-by: Parity Bot <admin@parity.io>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
Co-authored-by: Sergey Shulepov <s.pepyakin@gmail.com>
Co-authored-by: Zeke Mostov <z.mostov@gmail.com>
This commit is contained in:
Kian Paimani
2022-01-21 14:42:39 +01:00
committed by GitHub
parent efe290490a
commit 3cb2d62665
20 changed files with 1323 additions and 222 deletions
@@ -47,6 +47,7 @@ pub mod runtime_common_paras_registrar;
pub mod runtime_common_slots;
pub mod runtime_parachains_configuration;
pub mod runtime_parachains_disputes;
pub mod runtime_parachains_hrmp;
pub mod runtime_parachains_initializer;
pub mod runtime_parachains_paras;
pub mod runtime_parachains_paras_inherent;
@@ -0,0 +1,157 @@
// Copyright 2017-2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
//! Autogenerated weights for `runtime_parachains::hrmp`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2021-11-05, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("kusama-dev"), DB CACHE: 128
// Executed Command:
// target/release/polkadot
// benchmark
// --chain=kusama-dev
// --steps=50
// --repeat=20
// --pallet=runtime_parachains::hrmp
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --header=./file_header.txt
// --output=./runtime/kusama/src/weights/runtime_parachains_hrmp.rs
#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
use frame_support::{traits::Get, weights::Weight};
use sp_std::marker::PhantomData;
/// Weight functions for `runtime_parachains::hrmp`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> runtime_parachains::hrmp::WeightInfo for WeightInfo<T> {
// Storage: Paras ParaLifecycles (r:2 w:0)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1)
// Storage: Hrmp HrmpChannels (r:1 w:0)
// Storage: Hrmp HrmpEgressChannelsIndex (r:1 w:0)
// Storage: Hrmp HrmpOpenChannelRequestCount (r:1 w:1)
// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1)
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
fn hrmp_init_open_channel() -> Weight {
(54_952_000 as Weight)
.saturating_add(T::DbWeight::get().reads(10 as Weight))
.saturating_add(T::DbWeight::get().writes(5 as Weight))
}
// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: Paras ParaLifecycles (r:1 w:0)
// Storage: Hrmp HrmpIngressChannelsIndex (r:1 w:0)
// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:1 w:1)
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
fn hrmp_accept_open_channel() -> Weight {
(47_965_000 as Weight)
.saturating_add(T::DbWeight::get().reads(7 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
// Storage: Hrmp HrmpChannels (r:1 w:0)
// Storage: Hrmp HrmpCloseChannelRequests (r:1 w:1)
// Storage: Hrmp HrmpCloseChannelRequestsList (r:1 w:1)
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: Dmp DownwardMessageQueueHeads (r:1 w:1)
// Storage: Dmp DownwardMessageQueues (r:1 w:1)
fn hrmp_close_channel() -> Weight {
(44_369_000 as Weight)
.saturating_add(T::DbWeight::get().reads(6 as Weight))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
}
// Storage: Hrmp HrmpIngressChannelsIndex (r:128 w:127)
// Storage: Hrmp HrmpEgressChannelsIndex (r:1 w:1)
// Storage: Hrmp HrmpChannels (r:127 w:127)
// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:0 w:1)
// Storage: Hrmp HrmpChannelContents (r:0 w:127)
// Storage: Hrmp HrmpOpenChannelRequestCount (r:0 w:1)
fn force_clean_hrmp(i: u32, e: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 17_000
.saturating_add((15_959_000 as Weight).saturating_mul(i as Weight))
// Standard Error: 17_000
.saturating_add((16_048_000 as Weight).saturating_mul(e as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(i as Weight)))
.saturating_add(T::DbWeight::get().reads((2 as Weight).saturating_mul(e as Weight)))
.saturating_add(T::DbWeight::get().writes(4 as Weight))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(i as Weight)))
.saturating_add(T::DbWeight::get().writes((3 as Weight).saturating_mul(e as Weight)))
}
// Storage: Configuration ActiveConfig (r:1 w:0)
// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:0)
// Storage: Hrmp HrmpOpenChannelRequests (r:2 w:2)
// Storage: Paras ParaLifecycles (r:4 w:0)
// Storage: Hrmp HrmpIngressChannelsIndex (r:2 w:2)
// Storage: Hrmp HrmpEgressChannelsIndex (r:2 w:2)
// Storage: Hrmp HrmpOpenChannelRequestCount (r:2 w:2)
// Storage: Hrmp HrmpAcceptedChannelRequestCount (r:2 w:2)
// Storage: Hrmp HrmpChannels (r:0 w:2)
fn force_process_hrmp_open(c: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 26_000
.saturating_add((35_598_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(2 as Weight))
.saturating_add(T::DbWeight::get().reads((7 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes((6 as Weight).saturating_mul(c as Weight)))
}
// Storage: Hrmp HrmpCloseChannelRequestsList (r:1 w:0)
// Storage: Hrmp HrmpChannels (r:2 w:2)
// Storage: Hrmp HrmpEgressChannelsIndex (r:2 w:2)
// Storage: Hrmp HrmpIngressChannelsIndex (r:2 w:2)
// Storage: Hrmp HrmpCloseChannelRequests (r:0 w:2)
// Storage: Hrmp HrmpChannelContents (r:0 w:2)
fn force_process_hrmp_close(c: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 15_000
.saturating_add((20_510_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((3 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes((5 as Weight).saturating_mul(c as Weight)))
}
// Storage: Hrmp HrmpOpenChannelRequests (r:1 w:1)
// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1)
// Storage: Hrmp HrmpOpenChannelRequestCount (r:1 w:1)
fn hrmp_cancel_open_request(c: u32, ) -> Weight {
(32_749_000 as Weight)
// Standard Error: 0
.saturating_add((59_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(3 as Weight))
.saturating_add(T::DbWeight::get().writes(3 as Weight))
}
// Storage: Hrmp HrmpOpenChannelRequestsList (r:1 w:1)
// Storage: Hrmp HrmpOpenChannelRequests (r:2 w:2)
fn clean_open_channel_requests(c: u32, ) -> Weight {
(0 as Weight)
// Standard Error: 6_000
.saturating_add((5_781_000 as Weight).saturating_mul(c as Weight))
.saturating_add(T::DbWeight::get().reads(1 as Weight))
.saturating_add(T::DbWeight::get().reads((1 as Weight).saturating_mul(c as Weight)))
.saturating_add(T::DbWeight::get().writes(1 as Weight))
.saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(c as Weight)))
}
}