Skip to content

Commit c76beef

Browse files
committed
Setup benchmarking
1 parent 24d394d commit c76beef

File tree

9 files changed

+522
-102
lines changed

9 files changed

+522
-102
lines changed

runtimes/bulletin-polkadot/src/lib.rs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ impl frame_system::Config for Runtime {
256256

257257
impl pallet_validator_set::Config for Runtime {
258258
type RuntimeEvent = RuntimeEvent;
259-
type WeightInfo = pallet_validator_set::weights::SubstrateWeight<Runtime>;
259+
type WeightInfo = weights::pallet_validator_set::WeightInfo<Runtime>;
260260
type AddRemoveOrigin = EnsureRoot<AccountId>;
261261
type MaxAuthorities = MaxAuthorities;
262262
type SetKeysCooldownBlocks = SetKeysCooldownBlocks;
@@ -336,13 +336,12 @@ impl pallet_timestamp::Config for Runtime {
336336
type Moment = u64;
337337
type OnTimestampSet = Babe;
338338
type MinimumPeriod = ConstU64<{ SLOT_DURATION / 2 }>;
339-
// TODO: weights
340-
type WeightInfo = ();
339+
type WeightInfo = weights::pallet_timestamp::WeightInfo<Runtime>;
341340
}
342341

343342
impl pallet_transaction_storage::Config for Runtime {
344343
type RuntimeEvent = RuntimeEvent;
345-
type WeightInfo = pallet_transaction_storage::weights::SubstrateWeight<Runtime>;
344+
type WeightInfo = weights::pallet_transaction_storage::WeightInfo<Runtime>;
346345
type MaxBlockTransactions = ConstU32<512>;
347346
// TODO: add here comment
348347
type MaxTransactionSize = ConstU32<{ 8 * 1024 * 1024 }>;
@@ -357,7 +356,7 @@ impl pallet_transaction_storage::Config for Runtime {
357356

358357
impl pallet_relayer_set::Config for Runtime {
359358
type RuntimeEvent = RuntimeEvent;
360-
type WeightInfo = pallet_relayer_set::weights::SubstrateWeight<Runtime>;
359+
type WeightInfo = weights::pallet_relayer_set::WeightInfo<Runtime>;
361360
type AddRemoveOrigin = EnsureRoot<AccountId>;
362361
type BridgeTxFailCooldownBlocks = BridgeTxFailCooldownBlocks;
363362
}
@@ -647,9 +646,7 @@ mod benches {
647646
// [pallet_bridge_messages, BridgeMessagesBench::<Runtime, bridge_config::WithPeoplePolkadotMessagesInstance>]
648647
);
649648

650-
pub use frame_benchmarking::{
651-
baseline::Pallet as Baseline, BenchmarkBatch, BenchmarkList,
652-
};
649+
pub use frame_benchmarking::{baseline::Pallet as Baseline, BenchmarkBatch, BenchmarkList};
653650
pub use frame_system_benchmarking::Pallet as SystemBench;
654651

655652
pub use frame_support::traits::{StorageInfoTrait, WhitelistedStorageKeys};

runtimes/bulletin-polkadot/src/polkadot_bridge_config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ parameter_types! {
201201
pub type WithPolkadotBridgeGrandpaInstance = ();
202202
impl pallet_bridge_grandpa::Config<WithPolkadotBridgeGrandpaInstance> for Runtime {
203203
type RuntimeEvent = RuntimeEvent;
204-
type WeightInfo = crate::weights::bridge_polkadot_grandpa::WeightInfo<Runtime>;
204+
type WeightInfo = crate::weights::pallet_bridge_grandpa::WeightInfo<Runtime>;
205205

206206
type BridgedChain = bp_polkadot::Polkadot;
207207
type MaxFreeHeadersPerBlock = MaxFreePolkadotHeadersPerBlock;

runtimes/bulletin-polkadot/src/weights/bridge_polkadot_grandpa.rs

Lines changed: 0 additions & 84 deletions
This file was deleted.

runtimes/bulletin-polkadot/src/weights/mod.rs

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,21 @@
11
//! Expose the auto generated weight files.
22
3+
use ::pallet_bridge_grandpa::WeightInfoExt as GrandpaWeightInfoExt;
4+
use ::pallet_bridge_messages::WeightInfoExt as MessagesWeightInfoExt;
5+
use ::pallet_bridge_parachains::WeightInfoExt as ParachainsWeightInfoExt;
6+
use ::pallet_bridge_relayers::WeightInfo as _;
37
use frame_support::weights::Weight;
4-
use pallet_bridge_relayers::WeightInfo;
58

6-
pub mod bridge_polkadot_grandpa;
79
pub mod bridge_polkadot_messages;
810
pub mod bridge_polkadot_parachains;
911
pub mod bridge_polkadot_relayers;
12+
pub mod pallet_bridge_grandpa;
13+
pub mod pallet_relayer_set;
14+
pub mod pallet_timestamp;
15+
pub mod pallet_transaction_storage;
16+
pub mod pallet_validator_set;
1017

11-
impl pallet_bridge_grandpa::WeightInfoExt for bridge_polkadot_grandpa::WeightInfo<crate::Runtime> {
18+
impl GrandpaWeightInfoExt for pallet_bridge_grandpa::WeightInfo<crate::Runtime> {
1219
fn submit_finality_proof_overhead_from_runtime() -> Weight {
1320
// our signed extension:
1421
// 1) checks whether relayer registration is active from validate/pre_dispatch;
@@ -18,9 +25,7 @@ impl pallet_bridge_grandpa::WeightInfoExt for bridge_polkadot_grandpa::WeightInf
1825
}
1926
}
2027

21-
impl pallet_bridge_parachains::WeightInfoExt
22-
for bridge_polkadot_parachains::WeightInfo<crate::Runtime>
23-
{
28+
impl ParachainsWeightInfoExt for bridge_polkadot_parachains::WeightInfo<crate::Runtime> {
2429
fn expected_extra_storage_proof_size() -> u32 {
2530
crate::bp_people_polkadot::EXTRA_STORAGE_PROOF_SIZE
2631
}
@@ -34,9 +39,7 @@ impl pallet_bridge_parachains::WeightInfoExt
3439
}
3540
}
3641

37-
impl pallet_bridge_messages::WeightInfoExt
38-
for bridge_polkadot_messages::WeightInfo<crate::Runtime>
39-
{
42+
impl MessagesWeightInfoExt for bridge_polkadot_messages::WeightInfo<crate::Runtime> {
4043
fn expected_extra_storage_proof_size() -> u32 {
4144
crate::bp_people_polkadot::EXTRA_STORAGE_PROOF_SIZE
4245
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md
2+
// for a list of specific contributors.
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
//! Autogenerated weights for `pallet_bridge_grandpa`
18+
//!
19+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
20+
//! DATE: 2025-08-28, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
21+
//! WORST CASE MAP SIZE: `1000000`
22+
//! HOSTNAME: `toaster1`, CPU: `AMD Ryzen Threadripper 7980X 64-Cores`
23+
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
24+
25+
// Executed Command:
26+
// frame-omni-bencher
27+
// v1
28+
// benchmark
29+
// pallet
30+
// --extrinsic=*
31+
// --runtime=target/production/wbuild/bulletin-polkadot-runtime/bulletin_polkadot_runtime.wasm
32+
// --pallet=pallet_bridge_grandpa
33+
// --header=/home/bkontur/cargo-remote-builds-bulletin/9907520327012243881/scripts/cmd/file_header.txt
34+
// --output=./runtimes/bulletin-polkadot/src/weights
35+
// --wasm-execution=compiled
36+
// --steps=2
37+
// --repeat=1
38+
// --heap-pages=4096
39+
40+
#![cfg_attr(rustfmt, rustfmt_skip)]
41+
#![allow(unused_parens)]
42+
#![allow(unused_imports)]
43+
#![allow(missing_docs)]
44+
45+
use frame_support::{traits::Get, weights::Weight};
46+
use core::marker::PhantomData;
47+
48+
/// Weight functions for `pallet_bridge_grandpa`.
49+
pub struct WeightInfo<T>(PhantomData<T>);
50+
impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T> {
51+
/// Storage: `BridgePolkadotGrandpa::CurrentAuthoritySet` (r:1 w:0)
52+
/// Proof: `BridgePolkadotGrandpa::CurrentAuthoritySet` (`max_values`: Some(1), `max_size`: Some(50250), added: 50745, mode: `MaxEncodedLen`)
53+
/// Storage: `BridgePolkadotGrandpa::PalletOperatingMode` (r:1 w:0)
54+
/// Proof: `BridgePolkadotGrandpa::PalletOperatingMode` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
55+
/// Storage: `BridgePolkadotGrandpa::BestFinalized` (r:1 w:1)
56+
/// Proof: `BridgePolkadotGrandpa::BestFinalized` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
57+
/// Storage: `BridgePolkadotGrandpa::ImportedHashesPointer` (r:1 w:1)
58+
/// Proof: `BridgePolkadotGrandpa::ImportedHashesPointer` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
59+
/// Storage: `BridgePolkadotGrandpa::ImportedHashes` (r:1 w:1)
60+
/// Proof: `BridgePolkadotGrandpa::ImportedHashes` (`max_values`: Some(1200), `max_size`: Some(36), added: 1521, mode: `MaxEncodedLen`)
61+
/// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:0 w:2)
62+
/// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`)
63+
/// The range of component `p` is `[1, 168]`.
64+
/// The range of component `v` is `[50, 100]`.
65+
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
66+
// Proof Size summary in bytes:
67+
// Measured: `49 + p * (59 ±0)`
68+
// Estimated: `51735`
69+
// Minimum execution time: 258_153_000 picoseconds.
70+
Weight::from_parts(40_939_721, 0)
71+
.saturating_add(Weight::from_parts(0, 51735))
72+
// Standard Error: 148_691
73+
.saturating_add(Weight::from_parts(25_170_278, 0).saturating_mul(p.into()))
74+
// Standard Error: 496_630
75+
.saturating_add(Weight::from_parts(1_920_430, 0).saturating_mul(v.into()))
76+
.saturating_add(T::DbWeight::get().reads(5))
77+
.saturating_add(T::DbWeight::get().writes(5))
78+
}
79+
/// Storage: `BridgePolkadotGrandpa::CurrentAuthoritySet` (r:1 w:1)
80+
/// Proof: `BridgePolkadotGrandpa::CurrentAuthoritySet` (`max_values`: Some(1), `max_size`: Some(50250), added: 50745, mode: `MaxEncodedLen`)
81+
/// Storage: `BridgePolkadotGrandpa::ImportedHashesPointer` (r:1 w:1)
82+
/// Proof: `BridgePolkadotGrandpa::ImportedHashesPointer` (`max_values`: Some(1), `max_size`: Some(4), added: 499, mode: `MaxEncodedLen`)
83+
/// Storage: `BridgePolkadotGrandpa::ImportedHashes` (r:1 w:1)
84+
/// Proof: `BridgePolkadotGrandpa::ImportedHashes` (`max_values`: Some(1200), `max_size`: Some(36), added: 1521, mode: `MaxEncodedLen`)
85+
/// Storage: `BridgePolkadotGrandpa::BestFinalized` (r:0 w:1)
86+
/// Proof: `BridgePolkadotGrandpa::BestFinalized` (`max_values`: Some(1), `max_size`: Some(36), added: 531, mode: `MaxEncodedLen`)
87+
/// Storage: `BridgePolkadotGrandpa::ImportedHeaders` (r:0 w:2)
88+
/// Proof: `BridgePolkadotGrandpa::ImportedHeaders` (`max_values`: Some(1200), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`)
89+
fn force_set_pallet_state() -> Weight {
90+
// Proof Size summary in bytes:
91+
// Measured: `84`
92+
// Estimated: `51735`
93+
// Minimum execution time: 92_470_000 picoseconds.
94+
Weight::from_parts(92_470_000, 0)
95+
.saturating_add(Weight::from_parts(0, 51735))
96+
.saturating_add(T::DbWeight::get().reads(3))
97+
.saturating_add(T::DbWeight::get().writes(6))
98+
}
99+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
// Copyright (C) Parity Technologies and the various Polkadot contributors, see Contributions.md
2+
// for a list of specific contributors.
3+
// SPDX-License-Identifier: Apache-2.0
4+
5+
// Licensed under the Apache License, Version 2.0 (the "License");
6+
// you may not use this file except in compliance with the License.
7+
// You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing, software
12+
// distributed under the License is distributed on an "AS IS" BASIS,
13+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
// See the License for the specific language governing permissions and
15+
// limitations under the License.
16+
17+
//! Autogenerated weights for `pallet_relayer_set`
18+
//!
19+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
20+
//! DATE: 2025-08-28, STEPS: `2`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
21+
//! WORST CASE MAP SIZE: `1000000`
22+
//! HOSTNAME: `toaster1`, CPU: `AMD Ryzen Threadripper 7980X 64-Cores`
23+
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
24+
25+
// Executed Command:
26+
// frame-omni-bencher
27+
// v1
28+
// benchmark
29+
// pallet
30+
// --extrinsic=*
31+
// --runtime=target/production/wbuild/bulletin-polkadot-runtime/bulletin_polkadot_runtime.wasm
32+
// --pallet=pallet_relayer_set
33+
// --header=/home/bkontur/cargo-remote-builds-bulletin/9907520327012243881/scripts/cmd/file_header.txt
34+
// --output=./runtimes/bulletin-polkadot/src/weights
35+
// --wasm-execution=compiled
36+
// --steps=2
37+
// --repeat=1
38+
// --heap-pages=4096
39+
40+
#![cfg_attr(rustfmt, rustfmt_skip)]
41+
#![allow(unused_parens)]
42+
#![allow(unused_imports)]
43+
#![allow(missing_docs)]
44+
45+
use frame_support::{traits::Get, weights::Weight};
46+
use core::marker::PhantomData;
47+
48+
/// Weight functions for `pallet_relayer_set`.
49+
pub struct WeightInfo<T>(PhantomData<T>);
50+
impl<T: frame_system::Config> pallet_relayer_set::WeightInfo for WeightInfo<T> {
51+
/// Storage: `RelayerSet::Relayers` (r:1 w:1)
52+
/// Proof: `RelayerSet::Relayers` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
53+
/// Storage: `System::Account` (r:1 w:1)
54+
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`)
55+
fn add_relayer() -> Weight {
56+
// Proof Size summary in bytes:
57+
// Measured: `154`
58+
// Estimated: `3529`
59+
// Minimum execution time: 11_948_000 picoseconds.
60+
Weight::from_parts(11_948_000, 0)
61+
.saturating_add(Weight::from_parts(0, 3529))
62+
.saturating_add(T::DbWeight::get().reads(2))
63+
.saturating_add(T::DbWeight::get().writes(2))
64+
}
65+
/// Storage: `RelayerSet::Relayers` (r:1 w:1)
66+
/// Proof: `RelayerSet::Relayers` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
67+
/// Storage: `System::Account` (r:1 w:1)
68+
/// Proof: `System::Account` (`max_values`: None, `max_size`: Some(64), added: 2539, mode: `MaxEncodedLen`)
69+
fn remove_relayer() -> Weight {
70+
// Proof Size summary in bytes:
71+
// Measured: `227`
72+
// Estimated: `3529`
73+
// Minimum execution time: 12_339_000 picoseconds.
74+
Weight::from_parts(12_339_000, 0)
75+
.saturating_add(Weight::from_parts(0, 3529))
76+
.saturating_add(T::DbWeight::get().reads(2))
77+
.saturating_add(T::DbWeight::get().writes(2))
78+
}
79+
}

0 commit comments

Comments
 (0)