From 64ef9efe583e764f448d2053d20c243b6a48f7c0 Mon Sep 17 00:00:00 2001 From: Ignacio Palacios Date: Mon, 15 Nov 2021 19:55:31 +0100 Subject: [PATCH] Add system weights to Statemint (#762) * waiting for weights from bm * frame_system weights added * cargo toml fix + fmt --- polkadot-parachains/Cargo.toml | 2 +- polkadot-parachains/statemine/src/lib.rs | 2 +- .../statemine/src/weights/frame_system.rs | 93 +++++++++++++++++++ .../statemine/src/weights/mod.rs | 1 + polkadot-parachains/statemint/src/lib.rs | 2 +- .../statemint/src/weights/frame_system.rs | 93 +++++++++++++++++++ .../statemint/src/weights/mod.rs | 1 + polkadot-parachains/westmint/src/lib.rs | 2 +- .../westmint/src/weights/frame_system.rs | 93 +++++++++++++++++++ .../westmint/src/weights/mod.rs | 1 + scripts/benchmarks.sh | 1 + 11 files changed, 287 insertions(+), 4 deletions(-) create mode 100644 polkadot-parachains/statemine/src/weights/frame_system.rs create mode 100644 polkadot-parachains/statemint/src/weights/frame_system.rs create mode 100644 polkadot-parachains/westmint/src/weights/frame_system.rs diff --git a/polkadot-parachains/Cargo.toml b/polkadot-parachains/Cargo.toml index 0508e956b4..7d810f68dd 100644 --- a/polkadot-parachains/Cargo.toml +++ b/polkadot-parachains/Cargo.toml @@ -19,7 +19,7 @@ hex-literal = "0.2.1" async-trait = "0.1.42" # Parachain runtimes -rococo-parachain-runtime = { package = "rococo-parachain-runtime", path = "rococo" } +rococo-parachain-runtime = { path = "rococo" } shell-runtime = { path = "shell" } statemint-runtime = { path = "statemint" } statemine-runtime = { path = "statemine" } diff --git a/polkadot-parachains/statemine/src/lib.rs b/polkadot-parachains/statemine/src/lib.rs index faa07decea..8246070cf0 100644 --- a/polkadot-parachains/statemine/src/lib.rs +++ b/polkadot-parachains/statemine/src/lib.rs @@ -149,7 +149,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type AccountData = pallet_balances::AccountData; - type SystemWeightInfo = (); + type SystemWeightInfo = weights::frame_system::WeightInfo; type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; } diff --git a/polkadot-parachains/statemine/src/weights/frame_system.rs b/polkadot-parachains/statemine/src/weights/frame_system.rs new file mode 100644 index 0000000000..ccfe1dd6ba --- /dev/null +++ b/polkadot-parachains/statemine/src/weights/frame_system.rs @@ -0,0 +1,93 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-11-12, 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=frame_system +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --raw +// --header=./file_header.txt +// --output=./polkadot-parachains/statemine/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; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + fn remark(b: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + } + fn remark_with_event(b: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + (4_791_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a6368616e6765735f74726965] (r:0 w:1) + fn set_changes_trie_config() -> Weight { + (6_710_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn set_storage(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((737_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_storage(i: u32, ) -> Weight { + (1_312_000 as Weight) + // Standard Error: 0 + .saturating_add((496_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_prefix(p: u32, ) -> Weight { + (3_976_000 as Weight) + // Standard Error: 1_000 + .saturating_add((737_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } +} diff --git a/polkadot-parachains/statemine/src/weights/mod.rs b/polkadot-parachains/statemine/src/weights/mod.rs index 90afa8388a..487bd01819 100644 --- a/polkadot-parachains/statemine/src/weights/mod.rs +++ b/polkadot-parachains/statemine/src/weights/mod.rs @@ -1,3 +1,4 @@ +pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; pub mod pallet_collator_selection; diff --git a/polkadot-parachains/statemint/src/lib.rs b/polkadot-parachains/statemint/src/lib.rs index 19f267d36f..6d3574da4d 100644 --- a/polkadot-parachains/statemint/src/lib.rs +++ b/polkadot-parachains/statemint/src/lib.rs @@ -161,7 +161,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type AccountData = pallet_balances::AccountData; - type SystemWeightInfo = (); + type SystemWeightInfo = weights::frame_system::WeightInfo; type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; } diff --git a/polkadot-parachains/statemint/src/weights/frame_system.rs b/polkadot-parachains/statemint/src/weights/frame_system.rs new file mode 100644 index 0000000000..4b722b4eaf --- /dev/null +++ b/polkadot-parachains/statemint/src/weights/frame_system.rs @@ -0,0 +1,93 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-11-12, 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=frame_system +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --raw +// --header=./file_header.txt +// --output=./polkadot-parachains/statemint/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; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + fn remark(b: u32, ) -> Weight { + (814_000 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + } + fn remark_with_event(b: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + (4_802_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a6368616e6765735f74726965] (r:0 w:1) + fn set_changes_trie_config() -> Weight { + (6_948_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn set_storage(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((740_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_storage(i: u32, ) -> Weight { + (1_709_000 as Weight) + // Standard Error: 0 + .saturating_add((497_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_prefix(p: u32, ) -> Weight { + (4_520_000 as Weight) + // Standard Error: 0 + .saturating_add((732_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } +} diff --git a/polkadot-parachains/statemint/src/weights/mod.rs b/polkadot-parachains/statemint/src/weights/mod.rs index 90afa8388a..487bd01819 100644 --- a/polkadot-parachains/statemint/src/weights/mod.rs +++ b/polkadot-parachains/statemint/src/weights/mod.rs @@ -1,3 +1,4 @@ +pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; pub mod pallet_collator_selection; diff --git a/polkadot-parachains/westmint/src/lib.rs b/polkadot-parachains/westmint/src/lib.rs index f99b084920..b934d2cea8 100644 --- a/polkadot-parachains/westmint/src/lib.rs +++ b/polkadot-parachains/westmint/src/lib.rs @@ -150,7 +150,7 @@ impl frame_system::Config for Runtime { type OnNewAccount = (); type OnKilledAccount = (); type AccountData = pallet_balances::AccountData; - type SystemWeightInfo = (); + type SystemWeightInfo = weights::frame_system::WeightInfo; type SS58Prefix = SS58Prefix; type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode; } diff --git a/polkadot-parachains/westmint/src/weights/frame_system.rs b/polkadot-parachains/westmint/src/weights/frame_system.rs new file mode 100644 index 0000000000..72617d79ee --- /dev/null +++ b/polkadot-parachains/westmint/src/weights/frame_system.rs @@ -0,0 +1,93 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus 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. + +// Cumulus 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 Cumulus. If not, see . + +//! Autogenerated weights for `frame_system` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2021-11-12, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("westmint-dev"), DB CACHE: 128 + +// Executed Command: +// ./target/release/polkadot-collator +// benchmark +// --chain=westmint-dev +// --execution=wasm +// --wasm-execution=compiled +// --pallet=frame_system +// --extrinsic=* +// --steps=50 +// --repeat=20 +// --raw +// --header=./file_header.txt +// --output=./polkadot-parachains/westmint/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; + +/// Weight functions for `frame_system`. +pub struct WeightInfo(PhantomData); +impl frame_system::WeightInfo for WeightInfo { + fn remark(b: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((1_000 as Weight).saturating_mul(b as Weight)) + } + fn remark_with_event(b: u32, ) -> Weight { + (606_000 as Weight) + // Standard Error: 0 + .saturating_add((2_000 as Weight).saturating_mul(b as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a686561707061676573] (r:0 w:1) + fn set_heap_pages() -> Weight { + (4_704_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: System Digest (r:1 w:1) + // Storage: unknown [0x3a6368616e6765735f74726965] (r:0 w:1) + fn set_changes_trie_config() -> Weight { + (6_551_000 as Weight) + .saturating_add(T::DbWeight::get().reads(1 as Weight)) + .saturating_add(T::DbWeight::get().writes(2 as Weight)) + } + // Storage: Skipped Metadata (r:0 w:0) + fn set_storage(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((770_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_storage(i: u32, ) -> Weight { + (0 as Weight) + // Standard Error: 0 + .saturating_add((510_000 as Weight).saturating_mul(i as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(i as Weight))) + } + // Storage: Skipped Metadata (r:0 w:0) + fn kill_prefix(p: u32, ) -> Weight { + (3_350_000 as Weight) + // Standard Error: 1_000 + .saturating_add((739_000 as Weight).saturating_mul(p as Weight)) + .saturating_add(T::DbWeight::get().writes((1 as Weight).saturating_mul(p as Weight))) + } +} diff --git a/polkadot-parachains/westmint/src/weights/mod.rs b/polkadot-parachains/westmint/src/weights/mod.rs index 90afa8388a..487bd01819 100644 --- a/polkadot-parachains/westmint/src/weights/mod.rs +++ b/polkadot-parachains/westmint/src/weights/mod.rs @@ -1,3 +1,4 @@ +pub mod frame_system; pub mod pallet_assets; pub mod pallet_balances; pub mod pallet_collator_selection; diff --git a/scripts/benchmarks.sh b/scripts/benchmarks.sh index 6bcb2d3980..2cd207a103 100755 --- a/scripts/benchmarks.sh +++ b/scripts/benchmarks.sh @@ -21,6 +21,7 @@ pallets=( pallet_timestamp pallet_utility pallet_uniques + frame_system ) for p in ${pallets[@]}