Skip to content

Commit

Permalink
run quick benchmarks, remove benchmarks not present in kusama
Browse files Browse the repository at this point in the history
  • Loading branch information
nanocryk committed Feb 10, 2025
1 parent 93500fd commit 7e03e9a
Show file tree
Hide file tree
Showing 5 changed files with 389 additions and 7 deletions.
13 changes: 6 additions & 7 deletions chains/orchestrator-relays/runtime/dancelight/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,7 @@ impl pallet_babe::Config for Runtime {
// session module is the trigger
type EpochChangeTrigger = pallet_babe::ExternalTrigger;
type DisabledValidators = Session;
// Not benchmarked in Kusama
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
Expand Down Expand Up @@ -686,6 +687,7 @@ parameter_types! {

impl pallet_grandpa::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
// Not benchmarked in Kusama, benchmarking code also don't match WeightInfo trait.
type WeightInfo = ();
type MaxAuthorities = MaxAuthorities;
type MaxNominators = ConstU32<0>;
Expand Down Expand Up @@ -1319,7 +1321,7 @@ impl pallet_mmr::Config for Runtime {
const INDEXING_PREFIX: &'static [u8] = mmr::INDEXING_PREFIX;
type Hashing = Keccak256;
type OnNewRoot = pallet_beefy_mmr::DepositBeefyDigest<Runtime>;
type WeightInfo = ();
type WeightInfo = weights::pallet_mmr::SubstrateWeight<Runtime>;
type LeafData = pallet_beefy_mmr::Pallet<Runtime>;
type BlockHashProvider = pallet_mmr::DefaultBlockHashProvider<Runtime>;
#[cfg(feature = "runtime-benchmarks")]
Expand Down Expand Up @@ -1365,7 +1367,7 @@ impl pallet_beefy_mmr::Config for Runtime {
type BeefyAuthorityToMerkleLeaf = pallet_beefy_mmr::BeefyEcdsaToEthereum;
type LeafExtra = LeafExtraData;
type BeefyDataProvider = LeafExtraDataProvider;
type WeightInfo = ();
type WeightInfo = weights::pallet_beefy_mmr::SubstrateWeight<Runtime>;
}

impl paras_sudo_wrapper::Config for Runtime {}
Expand Down Expand Up @@ -1547,6 +1549,7 @@ impl pallet_configuration::Config for Runtime {
type SessionIndex = SessionIndex;
type CurrentSessionIndex = CurrentSessionIndexGetter;
type ForceEmptyOrchestrator = ConstBool<true>;
// Not present in Kusama, benchmarking code doesn't match WeightInfo trait.
type WeightInfo = ();
}

Expand All @@ -1572,7 +1575,7 @@ impl pallet_multiblock_migrations::Config for Runtime {
type MigrationStatusHandler = ();
type FailedMigrationHandler = frame_support::migrations::FreezeChainOnFailedMigration;
type MaxServiceWeight = MbmServiceWeight;
type WeightInfo = ();
type WeightInfo = weights::pallet_multiblock_migrations::SubstrateWeight<Runtime>;
}

pub const FIXED_BLOCK_PRODUCTION_COST: u128 = 1 * MICROUNITS;
Expand Down Expand Up @@ -2309,13 +2312,9 @@ mod benches {
[pallet_asset_rate, AssetRate]
[pallet_whitelist, Whitelist]
[pallet_services_payment, ServicesPayment]
[pallet_babe, Babe]
[pallet_grandpa, Grandpa]
[pallet_mmr, Mmr]
[pallet_beefy_mmr, BeefyMmrLeaf]
[pallet_configuration, Configuration]
[pallet_multiblock_migrations, MultiBlockMigrations]
// [pallet_session, SessionBench::<Runtime>]

// Tanssi
[pallet_author_noting, AuthorNoting]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub mod frame_system;
pub mod pallet_asset_rate;
pub mod pallet_author_noting;
pub mod pallet_balances;
pub mod pallet_beefy_mmr;
pub mod pallet_collator_assignment;
pub mod pallet_conviction_voting;
pub mod pallet_data_preservers;
Expand All @@ -27,6 +28,8 @@ pub mod pallet_external_validators_rewards;
pub mod pallet_identity;
pub mod pallet_invulnerables;
pub mod pallet_message_queue;
pub mod pallet_mmr;
pub mod pallet_multiblock_migrations;
pub mod pallet_multisig;
pub mod pallet_parameters;
pub mod pallet_pooled_staking;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
// Copyright (C) Moondance Labs Ltd.
// This file is part of Tanssi.

// Tanssi 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.

// Tanssi 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 Tanssi. If not, see <http://www.gnu.org/licenses/>


//! Autogenerated weights for pallet_beefy_mmr
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0
//! DATE: 2025-02-07, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `pop-os`, CPU: `12th Gen Intel(R) Core(TM) i7-1260P`
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dancelight-dev"), DB CACHE: 1024
// Executed Command:
// target/release/tanssi-relay
// benchmark
// pallet
// --execution=wasm
// --wasm-execution=compiled
// --pallet
// pallet_beefy_mmr
// --extrinsic
// *
// --chain=dancelight-dev
// --steps
// 2
// --repeat
// 2
// --template=benchmarking/frame-weight-runtime-template.hbs
// --json-file
// raw.json
// --output
// tmp/dancelight_weights/pallet_beefy_mmr.rs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weights for pallet_beefy_mmr using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_beefy_mmr::WeightInfo for SubstrateWeight<T> {
/// Storage: `System::BlockHash` (r:1 w:0)
/// Proof: `System::BlockHash` (`max_values`: None, `max_size`: Some(44), added: 2519, mode: `MaxEncodedLen`)
fn extract_validation_context() -> Weight {
// Proof Size summary in bytes:
// Measured: `92`
// Estimated: `3509`
// Minimum execution time: 7_643_000 picoseconds.
Weight::from_parts(8_243_000, 3509)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: `Mmr::Nodes` (r:1 w:0)
/// Proof: `Mmr::Nodes` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
fn read_peak() -> Weight {
// Proof Size summary in bytes:
// Measured: `254`
// Estimated: `3505`
// Minimum execution time: 5_980_000 picoseconds.
Weight::from_parts(6_080_000, 3505)
.saturating_add(T::DbWeight::get().reads(1_u64))
}
/// Storage: `Mmr::RootHash` (r:1 w:0)
/// Proof: `Mmr::RootHash` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Mmr::NumberOfLeaves` (r:1 w:0)
/// Proof: `Mmr::NumberOfLeaves` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// The range of component `n` is `[2, 512]`.
fn n_items_proof_is_non_canonical(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `246`
// Estimated: `1517`
// Minimum execution time: 15_086_000 picoseconds.
Weight::from_parts(12_589_666, 1517)
// Standard Error: 42_062
.saturating_add(Weight::from_parts(1_281_166, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(2_u64))
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright (C) Moondance Labs Ltd.
// This file is part of Tanssi.

// Tanssi 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.

// Tanssi 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 Tanssi. If not, see <http://www.gnu.org/licenses/>


//! Autogenerated weights for pallet_mmr
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 43.0.0
//! DATE: 2025-02-07, STEPS: `2`, REPEAT: `2`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `pop-os`, CPU: `12th Gen Intel(R) Core(TM) i7-1260P`
//! EXECUTION: , WASM-EXECUTION: Compiled, CHAIN: Some("dancelight-dev"), DB CACHE: 1024
// Executed Command:
// target/release/tanssi-relay
// benchmark
// pallet
// --execution=wasm
// --wasm-execution=compiled
// --pallet
// pallet_mmr
// --extrinsic
// *
// --chain=dancelight-dev
// --steps
// 2
// --repeat
// 2
// --template=benchmarking/frame-weight-runtime-template.hbs
// --json-file
// raw.json
// --output
// tmp/dancelight_weights/pallet_mmr.rs

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]

use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}};
use sp_std::marker::PhantomData;

/// Weights for pallet_mmr using the Substrate node and recommended hardware.
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_mmr::WeightInfo for SubstrateWeight<T> {
/// Storage: `Mmr::NumberOfLeaves` (r:1 w:1)
/// Proof: `Mmr::NumberOfLeaves` (`max_values`: Some(1), `max_size`: Some(8), added: 503, mode: `MaxEncodedLen`)
/// Storage: `System::ParentHash` (r:1 w:0)
/// Proof: `System::ParentHash` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `Paras::Parachains` (r:1 w:0)
/// Proof: `Paras::Parachains` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `OutboundMessageCommitmentRecorder::RecordedCommitment` (r:1 w:0)
/// Proof: `OutboundMessageCommitmentRecorder::RecordedCommitment` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// Storage: `BeefyMmrLeaf::BeefyNextAuthorities` (r:1 w:0)
/// Proof: `BeefyMmrLeaf::BeefyNextAuthorities` (`max_values`: Some(1), `max_size`: Some(44), added: 539, mode: `MaxEncodedLen`)
/// Storage: `Mmr::Nodes` (r:8 w:4)
/// Proof: `Mmr::Nodes` (`max_values`: None, `max_size`: Some(40), added: 2515, mode: `MaxEncodedLen`)
/// Storage: `Mmr::UseLocalStorage` (r:1 w:0)
/// Proof: `Mmr::UseLocalStorage` (`max_values`: Some(1), `max_size`: Some(1), added: 496, mode: `MaxEncodedLen`)
/// Storage: `System::Digest` (r:1 w:1)
/// Proof: `System::Digest` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `Mmr::RootHash` (r:0 w:1)
/// Proof: `Mmr::RootHash` (`max_values`: Some(1), `max_size`: Some(32), added: 527, mode: `MaxEncodedLen`)
/// The range of component `x` is `[1, 1000]`.
fn on_initialize(x: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `347 + x * (39 ±0)`
// Estimated: `1833 + x * (39 ±0)`
// Minimum execution time: 26_038_000 picoseconds.
Weight::from_parts(27_790_287, 1833)
// Standard Error: 2_013
.saturating_add(Weight::from_parts(79_212, 0).saturating_mul(x.into()))
.saturating_add(T::DbWeight::get().reads(7_u64))
.saturating_add(T::DbWeight::get().writes(4_u64))
.saturating_add(Weight::from_parts(0, 39).saturating_mul(x.into()))
}
}
Loading

0 comments on commit 7e03e9a

Please sign in to comment.