mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 15:11:02 +00:00
025a9cad59
* Add benchmarking skeleton * Allow runtime to indicate concrete header type for benches * Set up skeleton for benchmark tests * Play around with mutating bench header * Create a working test for benchmarking * Add benches related to enacting authority set changes * Add bench for checking effect of prec-commits/vote ancestries * Use new `no_std` test utils in benchmarks * Support pallet instances in benchmarking * Use correct benchmarking instance macro * Add instance to runtime benchmark helper impl * Start using new justification creation API * Allow mock header's number to be specified * Set up benches with correct fork/depth parameters * Use new pallet name during runtime bench setup * Use correct `set_id` in tests * Limit number of forks as workaround to get tests passing * Use number of authorities which matches number of forks * Make sure test post-conditions are checked properly * Only read `CurrentAuthoritySet` from storage once * Add combined benchmark for `submit_finality_proof` * Add bench test * Introduce config bounds related to justification verification * Use config consts from pallet in benchmarking * Return data relevant to benchmarks from helper functions * Annotate `submit_finality_proof` with autogenerated weights * Return actual weight after call execution * Ignore Clippy warnings in bench template * Update benchmark template * Use `test-utils` to create test headers * Clarify that helper is only for messages benches * Add more documentation to benches * Update TODOs * Clarify return types in comment * Fix pallet name post-merge * Update NOTE to a TODO item * Indicate that Config params are max values, not actual values * Change Config validator count type to be `u32` * Return decoded justification instead of fields * Add missing trait bounds for tests * Correctly issue weight refund Thanks for spotting this Tomek! * Update comment * Add note about SESSION_LENGTH * Fix benchmarking code
142 lines
5.1 KiB
Rust
142 lines
5.1 KiB
Rust
// Copyright 2021 Parity Technologies (UK) Ltd.
|
|
// This file is part of Parity Bridges Common.
|
|
|
|
// Parity Bridges Common 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.
|
|
|
|
// Parity Bridges Common 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 Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
//! Autogenerated weights for pallet_bridge_grandpa
|
|
//!
|
|
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 3.0.0
|
|
//! DATE: 2021-03-26, STEPS: [50, ], REPEAT: 20
|
|
//! LOW RANGE: [], HIGH RANGE: []
|
|
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
|
|
//! CHAIN: Some("dev"), DB CACHE: 128
|
|
|
|
// Executed Command:
|
|
// ./target/release/rialto-bridge-node
|
|
// benchmark
|
|
// --chain
|
|
// dev
|
|
// --execution
|
|
// wasm
|
|
// --extrinsic
|
|
// *
|
|
// --pallet
|
|
// pallet_bridge_grandpa
|
|
// --wasm-execution
|
|
// compiled
|
|
// --steps
|
|
// 50
|
|
// --repeat
|
|
// 20
|
|
// --template
|
|
// ./.maintain/rialto-weight-template.hbs
|
|
// --output
|
|
// ./grandpa-template.txt
|
|
// --raw
|
|
|
|
#![allow(clippy::all)]
|
|
#![allow(unused_parens)]
|
|
#![allow(unused_imports)]
|
|
|
|
use frame_support::{
|
|
traits::Get,
|
|
weights::{constants::RocksDbWeight, Weight},
|
|
};
|
|
use sp_std::marker::PhantomData;
|
|
|
|
/// Weight functions needed for pallet_bridge_grandpa.
|
|
pub trait WeightInfo {
|
|
fn submit_finality_proof(s: u32, p: u32) -> Weight;
|
|
fn submit_finality_proof_on_single_fork(s: u32) -> Weight;
|
|
fn submit_finality_proof_on_many_forks(p: u32) -> Weight;
|
|
fn find_scheduled_change(n: u32) -> Weight;
|
|
fn read_write_authority_sets(n: u32) -> Weight;
|
|
fn write_authority_sets(n: u32) -> Weight;
|
|
}
|
|
|
|
/// Weights for pallet_bridge_grandpa using the Rialto node and recommended hardware.
|
|
pub struct RialtoWeight<T>(PhantomData<T>);
|
|
impl<T: frame_system::Config> WeightInfo for RialtoWeight<T> {
|
|
fn submit_finality_proof(s: u32, p: u32) -> Weight {
|
|
(0 as Weight)
|
|
.saturating_add((3_248_661_000 as Weight).saturating_mul(s as Weight))
|
|
.saturating_add((776_552_000 as Weight).saturating_mul(p as Weight))
|
|
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
|
}
|
|
fn submit_finality_proof_on_single_fork(s: u32) -> Weight {
|
|
(189_213_000 as Weight)
|
|
.saturating_add((12_937_000 as Weight).saturating_mul(s as Weight))
|
|
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
|
}
|
|
fn submit_finality_proof_on_many_forks(p: u32) -> Weight {
|
|
(0 as Weight)
|
|
.saturating_add((138_751_000 as Weight).saturating_mul(p as Weight))
|
|
.saturating_add(T::DbWeight::get().reads(5 as Weight))
|
|
.saturating_add(T::DbWeight::get().writes(3 as Weight))
|
|
}
|
|
fn find_scheduled_change(n: u32) -> Weight {
|
|
(301_000 as Weight).saturating_add((10_000 as Weight).saturating_mul(n as Weight))
|
|
}
|
|
fn read_write_authority_sets(n: u32) -> Weight {
|
|
(6_787_000 as Weight)
|
|
.saturating_add((247_000 as Weight).saturating_mul(n as Weight))
|
|
.saturating_add(T::DbWeight::get().reads(1 as Weight))
|
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
|
}
|
|
fn write_authority_sets(n: u32) -> Weight {
|
|
(3_383_000 as Weight)
|
|
.saturating_add((99_000 as Weight).saturating_mul(n as Weight))
|
|
.saturating_add(T::DbWeight::get().writes(1 as Weight))
|
|
}
|
|
}
|
|
|
|
// For backwards compatibility and tests
|
|
impl WeightInfo for () {
|
|
fn submit_finality_proof(s: u32, p: u32) -> Weight {
|
|
(0 as Weight)
|
|
.saturating_add((3_248_661_000 as Weight).saturating_mul(s as Weight))
|
|
.saturating_add((776_552_000 as Weight).saturating_mul(p as Weight))
|
|
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
|
}
|
|
fn submit_finality_proof_on_single_fork(s: u32) -> Weight {
|
|
(189_213_000 as Weight)
|
|
.saturating_add((12_937_000 as Weight).saturating_mul(s as Weight))
|
|
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
|
}
|
|
fn submit_finality_proof_on_many_forks(p: u32) -> Weight {
|
|
(0 as Weight)
|
|
.saturating_add((138_751_000 as Weight).saturating_mul(p as Weight))
|
|
.saturating_add(RocksDbWeight::get().reads(5 as Weight))
|
|
.saturating_add(RocksDbWeight::get().writes(3 as Weight))
|
|
}
|
|
fn find_scheduled_change(n: u32) -> Weight {
|
|
(301_000 as Weight).saturating_add((10_000 as Weight).saturating_mul(n as Weight))
|
|
}
|
|
fn read_write_authority_sets(n: u32) -> Weight {
|
|
(6_787_000 as Weight)
|
|
.saturating_add((247_000 as Weight).saturating_mul(n as Weight))
|
|
.saturating_add(RocksDbWeight::get().reads(1 as Weight))
|
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
|
}
|
|
fn write_authority_sets(n: u32) -> Weight {
|
|
(3_383_000 as Weight)
|
|
.saturating_add((99_000 as Weight).saturating_mul(n as Weight))
|
|
.saturating_add(RocksDbWeight::get().writes(1 as Weight))
|
|
}
|
|
}
|