mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 04:01:02 +00:00
Use Vote Ancestries Directly in Weight Calculations (#862)
* Use more accurate weight calculation in declared weight * Remove session length and validator set size config constants * Remove config params from mock * Allow specifying total number of votes-ancestries per justification * Change limits used during benchmarking * Regenerate weights * Use simplified weight annotation * Remove comment * Address leftover TODO * Prevent possible divide by zero errors * Use correct argument order in weight declaration
This commit is contained in:
committed by
Bastian Köcher
parent
0d7291d729
commit
1928e2b870
@@ -1,4 +1,4 @@
|
||||
// Copyright 2021 Parity Technologies (UK) Ltd.
|
||||
// Copyright 2019-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
|
||||
@@ -17,7 +17,7 @@
|
||||
//! 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
|
||||
//! DATE: 2021-04-02, STEPS: [50, ], REPEAT: 20
|
||||
//! LOW RANGE: [], HIGH RANGE: []
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled
|
||||
//! CHAIN: Some("dev"), DB CACHE: 128
|
||||
@@ -57,85 +57,74 @@ 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(v: u32, p: u32) -> Weight;
|
||||
fn submit_finality_proof_on_single_fork(v: 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 {
|
||||
fn submit_finality_proof(v: 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((160_060_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((640_223_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))
|
||||
fn submit_finality_proof_on_single_fork(v: u32) -> Weight {
|
||||
(189_597_000 as Weight)
|
||||
.saturating_add((11_680_000 as Weight).saturating_mul(v 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((130_061_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))
|
||||
(502_000 as Weight).saturating_add((8_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))
|
||||
(7_677_000 as Weight)
|
||||
.saturating_add((230_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 {
|
||||
fn submit_finality_proof(v: 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((160_060_000 as Weight).saturating_mul(v as Weight))
|
||||
.saturating_add((640_223_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))
|
||||
fn submit_finality_proof_on_single_fork(v: u32) -> Weight {
|
||||
(189_597_000 as Weight)
|
||||
.saturating_add((11_680_000 as Weight).saturating_mul(v 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((130_061_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))
|
||||
(502_000 as Weight).saturating_add((8_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))
|
||||
(7_677_000 as Weight)
|
||||
.saturating_add((230_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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user