From a7b44a9effba21d6ffea2fdcb3a7f46cf4cfc2bd Mon Sep 17 00:00:00 2001 From: JesseAbram <33698952+JesseAbram@users.noreply.github.com> Date: Tue, 8 Jun 2021 13:24:19 +0200 Subject: [PATCH] Add session weight (#477) * session weight * decouple session benchmarking and collator selection * removed mock * licensing * benchmarking script * set benchmarking into runtime * Update scripts/benchmarks.sh * real weights Co-authored-by: Shawn Tabrizi --- Cargo.lock | 26 ++++++++-- Cargo.toml | 1 + pallets/session-benchmarking/Cargo.toml | 44 ++++++++++++++++ pallets/session-benchmarking/README.md | 3 ++ pallets/session-benchmarking/src/lib.rs | 51 +++++++++++++++++++ .../statemine-runtime/Cargo.toml | 2 + .../statemine-runtime/src/lib.rs | 6 ++- .../statemine-runtime/src/weights/mod.rs | 1 + .../src/weights/pallet_session.rs | 41 +++++++++++++++ .../statemint-runtime/Cargo.toml | 2 + .../statemint-runtime/src/lib.rs | 6 ++- .../statemint-runtime/src/weights/mod.rs | 1 + .../src/weights/pallet_session.rs | 41 +++++++++++++++ .../westmint-runtime/Cargo.toml | 2 + .../westmint-runtime/src/lib.rs | 6 ++- .../westmint-runtime/src/weights/mod.rs | 1 + .../src/weights/pallet_session.rs | 41 +++++++++++++++ scripts/benchmarks.sh | 44 ++++++++++++++++ 18 files changed, 312 insertions(+), 7 deletions(-) create mode 100644 pallets/session-benchmarking/Cargo.toml create mode 100644 pallets/session-benchmarking/README.md create mode 100644 pallets/session-benchmarking/src/lib.rs create mode 100644 polkadot-parachains/statemine-runtime/src/weights/pallet_session.rs create mode 100644 polkadot-parachains/statemint-runtime/src/weights/pallet_session.rs create mode 100644 polkadot-parachains/westmint-runtime/src/weights/pallet_session.rs create mode 100755 scripts/benchmarks.sh diff --git a/Cargo.lock b/Cargo.lock index fe3d167e50..0bfd3d93cd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3874,7 +3874,7 @@ dependencies = [ "pallet-recovery", "pallet-scheduler", "pallet-session", - "pallet-session-benchmarking", + "pallet-session-benchmarking 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", "pallet-society", "pallet-staking", "pallet-staking-reward-fn", @@ -5675,6 +5675,23 @@ dependencies = [ "sp-trie", ] +[[package]] +name = "pallet-session-benchmarking" +version = "3.0.0" +dependencies = [ + "frame-benchmarking", + "frame-support", + "frame-system", + "pallet-session", + "parity-scale-codec", + "serde", + "sp-core", + "sp-io", + "sp-runtime", + "sp-staking", + "sp-std", +] + [[package]] name = "pallet-session-benchmarking" version = "3.0.0" @@ -7134,7 +7151,7 @@ dependencies = [ "pallet-randomness-collective-flip", "pallet-scheduler", "pallet-session", - "pallet-session-benchmarking", + "pallet-session-benchmarking 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", "pallet-staking", "pallet-staking-reward-curve", "pallet-timestamp", @@ -10637,6 +10654,7 @@ dependencies = [ "pallet-proxy", "pallet-randomness-collective-flip", "pallet-session", + "pallet-session-benchmarking 3.0.0", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", @@ -10724,6 +10742,7 @@ dependencies = [ "pallet-proxy", "pallet-randomness-collective-flip", "pallet-session", + "pallet-session-benchmarking 3.0.0", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", @@ -12449,7 +12468,7 @@ dependencies = [ "pallet-recovery", "pallet-scheduler", "pallet-session", - "pallet-session-benchmarking", + "pallet-session-benchmarking 3.0.0 (git+https://github.com/paritytech/substrate?branch=master)", "pallet-society", "pallet-staking", "pallet-staking-reward-curve", @@ -12524,6 +12543,7 @@ dependencies = [ "pallet-proxy", "pallet-randomness-collective-flip", "pallet-session", + "pallet-session-benchmarking 3.0.0", "pallet-sudo", "pallet-timestamp", "pallet-transaction-payment", diff --git a/Cargo.toml b/Cargo.toml index e42baff20f..a1bbff9c53 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ members = [ "pallets/collator-selection", "pallets/dmp-queue", "pallets/parachain-system", + "pallets/session-benchmarking", "pallets/xcm", "pallets/xcmp-queue", "primitives/core", diff --git a/pallets/session-benchmarking/Cargo.toml b/pallets/session-benchmarking/Cargo.toml new file mode 100644 index 0000000000..5d4f0b2ebc --- /dev/null +++ b/pallets/session-benchmarking/Cargo.toml @@ -0,0 +1,44 @@ +[package] +name = "pallet-session-benchmarking" +version = "3.0.0" +authors = ["Parity Technologies "] +edition = "2018" +license = "Apache-2.0" +homepage = "https://substrate.dev" +repository = "https://github.com/paritytech/cumulus/" +description = "FRAME sessions pallet benchmarking for statemint" +readme = "README.md" + +[package.metadata.docs.rs] +targets = ["x86_64-unknown-linux-gnu"] + +[dependencies] +sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +sp-runtime = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +sp-staking = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +frame-support = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +frame-system = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +pallet-session = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } +sp-io = { default-features = false, git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } + +[dev-dependencies] +serde = { version = "1.0.119" } +codec = { package = "parity-scale-codec", version = "2.0.0", features = ["derive"] } +sp-core = { git = 'https://github.com/paritytech/substrate', branch = "master", version = '3.0.0' } + +[features] +default = ["std"] +runtime-benchmarks = [ + 'frame-benchmarking', + 'frame-support/runtime-benchmarks', + 'frame-system/runtime-benchmarks', +] +std = [ + "sp-std/std", + "sp-runtime/std", + "frame-system/std", + "frame-benchmarking/std", + "frame-support/std", + "pallet-session/std", +] diff --git a/pallets/session-benchmarking/README.md b/pallets/session-benchmarking/README.md new file mode 100644 index 0000000000..e097f03f34 --- /dev/null +++ b/pallets/session-benchmarking/README.md @@ -0,0 +1,3 @@ +Benchmarks for the Session Pallet. + +License: Apache-2.0 diff --git a/pallets/session-benchmarking/src/lib.rs b/pallets/session-benchmarking/src/lib.rs new file mode 100644 index 0000000000..86117d102a --- /dev/null +++ b/pallets/session-benchmarking/src/lib.rs @@ -0,0 +1,51 @@ +// Copyright (C) 2021 Parity Technologies (UK) Ltd. +// SPDX-License-Identifier: Apache-2.0 + +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +//! Benchmarking setup for pallet-session +#![cfg_attr(not(feature = "std"), no_std)] +#![cfg(feature = "runtime-benchmarks")] +use sp_std::prelude::*; +use sp_std::vec; + +use frame_benchmarking::{benchmarks, impl_benchmark_test_suite, whitelisted_caller}; +use frame_system::{RawOrigin}; +use pallet_session::*; +pub struct Pallet(pallet_session::Pallet); +pub trait Config: pallet_session::Config {} + + +benchmarks! { + set_keys { + let caller: T::AccountId = whitelisted_caller(); + frame_system::Pallet::::inc_providers(&caller); + let keys = T::Keys::default(); + let proof: Vec = vec![0,1,2,3]; + }: _(RawOrigin::Signed(caller), keys, proof) + + purge_keys { + let caller: T::AccountId = whitelisted_caller(); + frame_system::Pallet::::inc_providers(&caller); + let keys = T::Keys::default(); + let proof: Vec = vec![0,1,2,3]; + let _t = pallet_session::Pallet::::set_keys(RawOrigin::Signed(caller.clone()).into(), keys, proof); + }: _(RawOrigin::Signed(caller)) + +} +impl_benchmark_test_suite!( + Pallet, + crate::mock::new_test_ext(), + crate::mock::Test, + extra = false, +); diff --git a/polkadot-parachains/statemine-runtime/Cargo.toml b/polkadot-parachains/statemine-runtime/Cargo.toml index 093254033f..0c907123c1 100644 --- a/polkadot-parachains/statemine-runtime/Cargo.toml +++ b/polkadot-parachains/statemine-runtime/Cargo.toml @@ -41,6 +41,7 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", default-fea pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session-benchmarking = {path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0"} pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -92,6 +93,7 @@ runtime-benchmarks = [ 'pallet-balances/runtime-benchmarks', 'pallet-multisig/runtime-benchmarks', 'pallet-proxy/runtime-benchmarks', + 'pallet-session-benchmarking/runtime-benchmarks', 'pallet-uniques/runtime-benchmarks', 'pallet-utility/runtime-benchmarks', 'pallet-timestamp/runtime-benchmarks', diff --git a/polkadot-parachains/statemine-runtime/src/lib.rs b/polkadot-parachains/statemine-runtime/src/lib.rs index 52adfc3dcc..9677d0057f 100644 --- a/polkadot-parachains/statemine-runtime/src/lib.rs +++ b/polkadot-parachains/statemine-runtime/src/lib.rs @@ -630,7 +630,7 @@ impl pallet_session::Config for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = opaque::SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type WeightInfo = (); + type WeightInfo = weights::pallet_session::WeightInfo; } impl pallet_aura::Config for Runtime { @@ -858,8 +858,11 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; + use pallet_session_benchmarking::Pallet as SessionBench; use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + impl pallet_session_benchmarking::Config for Runtime {} let whitelist: Vec = vec![ // Block Number @@ -882,6 +885,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_multisig, Multisig); add_benchmark!(params, batches, pallet_proxy, Proxy); + add_benchmark!(params, batches, pallet_session, SessionBench::); add_benchmark!(params, batches, pallet_uniques, Uniques); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_timestamp, Timestamp); diff --git a/polkadot-parachains/statemine-runtime/src/weights/mod.rs b/polkadot-parachains/statemine-runtime/src/weights/mod.rs index 6b5ddfa192..0e4e48b1a1 100644 --- a/polkadot-parachains/statemine-runtime/src/weights/mod.rs +++ b/polkadot-parachains/statemine-runtime/src/weights/mod.rs @@ -3,6 +3,7 @@ pub mod pallet_balances; pub mod pallet_multisig; pub mod pallet_collator_selection; pub mod pallet_proxy; +pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_uniques; pub mod pallet_utility; diff --git a/polkadot-parachains/statemine-runtime/src/weights/pallet_session.rs b/polkadot-parachains/statemine-runtime/src/weights/pallet_session.rs new file mode 100644 index 0000000000..9cb59607b3 --- /dev/null +++ b/polkadot-parachains/statemine-runtime/src/weights/pallet_session.rs @@ -0,0 +1,41 @@ + +//! Autogenerated weights for pallet_session +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-08, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemine-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot-collator +// benchmark +// --chain=statemine-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=pallet_session +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --raw +// --output=./polkadot-parachains/statemine-runtime/src/weights + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_session. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + fn set_keys() -> Weight { + (25_201_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn purge_keys() -> Weight { + (17_510_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/polkadot-parachains/statemint-runtime/Cargo.toml b/polkadot-parachains/statemint-runtime/Cargo.toml index 4f906aaacc..6595579b8f 100644 --- a/polkadot-parachains/statemint-runtime/Cargo.toml +++ b/polkadot-parachains/statemint-runtime/Cargo.toml @@ -41,6 +41,7 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", default-fea pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session-benchmarking = { path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0" } pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -91,6 +92,7 @@ runtime-benchmarks = [ 'pallet-balances/runtime-benchmarks', 'pallet-multisig/runtime-benchmarks', 'pallet-proxy/runtime-benchmarks', + 'pallet-session-benchmarking/runtime-benchmarks', 'pallet-utility/runtime-benchmarks', 'pallet-timestamp/runtime-benchmarks', 'pallet-xcm/runtime-benchmarks', diff --git a/polkadot-parachains/statemint-runtime/src/lib.rs b/polkadot-parachains/statemint-runtime/src/lib.rs index f51bc0bd38..7913f189bd 100644 --- a/polkadot-parachains/statemint-runtime/src/lib.rs +++ b/polkadot-parachains/statemint-runtime/src/lib.rs @@ -573,7 +573,7 @@ impl pallet_session::Config for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = opaque::SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type WeightInfo = (); + type WeightInfo = weights::pallet_session::WeightInfo; } impl pallet_aura::Config for Runtime { @@ -791,9 +791,10 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; + use pallet_session_benchmarking::Pallet as SessionBench; use frame_system_benchmarking::Pallet as SystemBench; impl frame_system_benchmarking::Config for Runtime {} - + impl pallet_session_benchmarking::Config for Runtime {} let whitelist: Vec = vec![ // Block Number hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), @@ -815,6 +816,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_multisig, Multisig); add_benchmark!(params, batches, pallet_proxy, Proxy); + add_benchmark!(params, batches, pallet_session, SessionBench::); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection); diff --git a/polkadot-parachains/statemint-runtime/src/weights/mod.rs b/polkadot-parachains/statemint-runtime/src/weights/mod.rs index 619f9a943a..85e91c2791 100644 --- a/polkadot-parachains/statemint-runtime/src/weights/mod.rs +++ b/polkadot-parachains/statemint-runtime/src/weights/mod.rs @@ -3,5 +3,6 @@ pub mod pallet_balances; pub mod pallet_multisig; pub mod pallet_collator_selection; pub mod pallet_proxy; +pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_utility; diff --git a/polkadot-parachains/statemint-runtime/src/weights/pallet_session.rs b/polkadot-parachains/statemint-runtime/src/weights/pallet_session.rs new file mode 100644 index 0000000000..389e7c2b9e --- /dev/null +++ b/polkadot-parachains/statemint-runtime/src/weights/pallet_session.rs @@ -0,0 +1,41 @@ + +//! Autogenerated weights for pallet_session +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-08, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot-collator +// benchmark +// --chain=statemint-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=pallet_session +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --raw +// --output=./polkadot-parachains/statemint-runtime/src/weights + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_session. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + fn set_keys() -> Weight { + (25_040_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn purge_keys() -> Weight { + (17_551_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/polkadot-parachains/westmint-runtime/Cargo.toml b/polkadot-parachains/westmint-runtime/Cargo.toml index 84c36165e1..a3215e063b 100644 --- a/polkadot-parachains/westmint-runtime/Cargo.toml +++ b/polkadot-parachains/westmint-runtime/Cargo.toml @@ -41,6 +41,7 @@ pallet-multisig = { git = "https://github.com/paritytech/substrate", default-fea pallet-proxy = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-randomness-collective-flip = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-session = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } +pallet-session-benchmarking = {path = "../../pallets/session-benchmarking", default-features = false, version = "3.0.0"} pallet-sudo = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-timestamp = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } pallet-transaction-payment = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" } @@ -91,6 +92,7 @@ runtime-benchmarks = [ 'pallet-balances/runtime-benchmarks', 'pallet-multisig/runtime-benchmarks', 'pallet-proxy/runtime-benchmarks', + 'pallet-session-benchmarking/runtime-benchmarks', 'pallet-utility/runtime-benchmarks', 'pallet-timestamp/runtime-benchmarks', 'pallet-xcm/runtime-benchmarks', diff --git a/polkadot-parachains/westmint-runtime/src/lib.rs b/polkadot-parachains/westmint-runtime/src/lib.rs index 52bfe3ee0f..e4d5db3b9f 100644 --- a/polkadot-parachains/westmint-runtime/src/lib.rs +++ b/polkadot-parachains/westmint-runtime/src/lib.rs @@ -570,7 +570,7 @@ impl pallet_session::Config for Runtime { type SessionHandler = ::KeyTypeIdProviders; type Keys = opaque::SessionKeys; type DisabledValidatorsThreshold = DisabledValidatorsThreshold; - type WeightInfo = (); + type WeightInfo = weights::pallet_session::WeightInfo; } impl pallet_aura::Config for Runtime { @@ -789,8 +789,11 @@ impl_runtime_apis! { ) -> Result, sp_runtime::RuntimeString> { use frame_benchmarking::{Benchmarking, BenchmarkBatch, add_benchmark, TrackedStorageKey}; + use pallet_session_benchmarking::Pallet as SessionBench; use frame_system_benchmarking::Pallet as SystemBench; + impl frame_system_benchmarking::Config for Runtime {} + impl pallet_session_benchmarking::Config for Runtime {} let whitelist: Vec = vec![ // Block Number @@ -813,6 +816,7 @@ impl_runtime_apis! { add_benchmark!(params, batches, pallet_balances, Balances); add_benchmark!(params, batches, pallet_multisig, Multisig); add_benchmark!(params, batches, pallet_proxy, Proxy); + add_benchmark!(params, batches, pallet_session, SessionBench::); add_benchmark!(params, batches, pallet_utility, Utility); add_benchmark!(params, batches, pallet_timestamp, Timestamp); add_benchmark!(params, batches, pallet_collator_selection, CollatorSelection); diff --git a/polkadot-parachains/westmint-runtime/src/weights/mod.rs b/polkadot-parachains/westmint-runtime/src/weights/mod.rs index 619f9a943a..85e91c2791 100644 --- a/polkadot-parachains/westmint-runtime/src/weights/mod.rs +++ b/polkadot-parachains/westmint-runtime/src/weights/mod.rs @@ -3,5 +3,6 @@ pub mod pallet_balances; pub mod pallet_multisig; pub mod pallet_collator_selection; pub mod pallet_proxy; +pub mod pallet_session; pub mod pallet_timestamp; pub mod pallet_utility; diff --git a/polkadot-parachains/westmint-runtime/src/weights/pallet_session.rs b/polkadot-parachains/westmint-runtime/src/weights/pallet_session.rs new file mode 100644 index 0000000000..389e7c2b9e --- /dev/null +++ b/polkadot-parachains/westmint-runtime/src/weights/pallet_session.rs @@ -0,0 +1,41 @@ + +//! Autogenerated weights for pallet_session +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0 +//! DATE: 2021-06-08, STEPS: `[50, ]`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("statemint-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot-collator +// benchmark +// --chain=statemint-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=pallet_session +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --raw +// --output=./polkadot-parachains/statemint-runtime/src/weights + + +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for pallet_session. +pub struct WeightInfo(PhantomData); +impl pallet_session::WeightInfo for WeightInfo { + fn set_keys() -> Weight { + (25_040_000 as Weight) + .saturating_add(T::DbWeight::get().reads(2 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + fn purge_keys() -> Weight { + (17_551_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } +} diff --git a/scripts/benchmarks.sh b/scripts/benchmarks.sh new file mode 100755 index 0000000000..eee548dd61 --- /dev/null +++ b/scripts/benchmarks.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +steps=50 +repeat=20 +statemineOutput=./polkadot-parachains/statemine-runtime/src/weights +statemintOutput=./polkadot-parachains/statemint-runtime/src/weights +statemineChain=statemine-dev +statemintChain=statemint-dev +pallets=( + pallet_assets + pallet_balances + pallet_collator_selection + pallet_multisig + pallet_proxy + pallet_session + pallet_timestamp + pallet_utility +) + +for p in ${pallets[@]} +do + ./target/release/polkadot-collator benchmark \ + --chain=$statemineChain \ + --execution=wasm \ + --wasm-execution=compiled \ + --pallet=$p \ + --extrinsic='*' \ + --steps=$steps \ + --repeat=$repeat \ + --raw \ + --output=$statemineOutput + + ./target/release/polkadot-collator benchmark \ + --chain=$statemintChain \ + --execution=wasm \ + --wasm-execution=compiled \ + --pallet=$p \ + --extrinsic='*' \ + --steps=$steps \ + --repeat=$repeat \ + --raw \ + --output=$statemintOutput + +done