mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 04:01:02 +00:00
Fix benchmarks (#1919)
* fixed benchmarks broken by rejecting storage proofs with excessive trie nodes and justifications with extra prevotes * update weights * fmt * accidental paste * revert changes to millau runtime (separate PR) * revert comment change
This commit is contained in:
committed by
Bastian Köcher
parent
7be2cb1cdd
commit
aa466a485d
@@ -41,6 +41,7 @@
|
||||
|
||||
use crate::*;
|
||||
|
||||
use bp_header_chain::justification::required_justification_precommits;
|
||||
use bp_runtime::BasicOperatingMode;
|
||||
use bp_test_utils::{
|
||||
accounts, make_justification_for_header, JustificationGeneratorParams, TEST_GRANDPA_ROUND,
|
||||
@@ -66,13 +67,14 @@ const MAX_VOTE_ANCESTRIES_RANGE_END: u32 =
|
||||
MAX_VOTE_ANCESTRIES_RANGE_BEGIN + MAX_VOTE_ANCESTRIES_RANGE_BEGIN;
|
||||
|
||||
// the same with validators - if there are too much validators, let's run benchmarks on subrange
|
||||
fn validator_set_range_end<T: Config<I>, I: 'static>() -> u32 {
|
||||
fn precommits_range_end<T: Config<I>, I: 'static>() -> u32 {
|
||||
let max_bridged_authorities = T::BridgedChain::MAX_AUTHORITIES_COUNT;
|
||||
if max_bridged_authorities > 128 {
|
||||
sp_std::cmp::max(128, max_bridged_authorities / 5)
|
||||
} else {
|
||||
max_bridged_authorities
|
||||
}
|
||||
};
|
||||
required_justification_precommits(max_bridged_authorities)
|
||||
}
|
||||
|
||||
/// Prepare header and its justification to submit using `submit_finality_proof`.
|
||||
@@ -80,7 +82,10 @@ fn prepare_benchmark_data<T: Config<I>, I: 'static>(
|
||||
precommits: u32,
|
||||
ancestors: u32,
|
||||
) -> (BridgedHeader<T, I>, GrandpaJustification<BridgedHeader<T, I>>) {
|
||||
let authority_list = accounts(precommits as u16)
|
||||
// going from precommits to total authorities count
|
||||
let total_authorities_count = (3 * precommits - 1) / 2;
|
||||
|
||||
let authority_list = accounts(total_authorities_count as u16)
|
||||
.iter()
|
||||
.map(|id| (AuthorityId::from(*id), 1))
|
||||
.collect::<Vec<_>>();
|
||||
@@ -114,7 +119,7 @@ benchmarks_instance_pallet! {
|
||||
// This is the "gold standard" benchmark for this extrinsic, and it's what should be used to
|
||||
// annotate the weight in the pallet.
|
||||
submit_finality_proof {
|
||||
let p in 1 .. validator_set_range_end::<T, I>();
|
||||
let p in 1 .. precommits_range_end::<T, I>();
|
||||
let v in MAX_VOTE_ANCESTRIES_RANGE_BEGIN..MAX_VOTE_ANCESTRIES_RANGE_END;
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let (header, justification) = prepare_benchmark_data::<T, I>(p, v);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
//! Autogenerated weights for pallet_bridge_grandpa
|
||||
//!
|
||||
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
|
||||
//! DATE: 2023-02-07, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! DATE: 2023-03-01, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
|
||||
//! WORST CASE MAP SIZE: `1000000`
|
||||
//! HOSTNAME: `covid`, CPU: `11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz`
|
||||
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("dev"), DB CACHE: 1024
|
||||
@@ -93,19 +93,19 @@ impl<T: frame_system::Config> WeightInfo for BridgeWeight<T> {
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// The range of component `p` is `[1, 5]`.
|
||||
/// The range of component `p` is `[1, 4]`.
|
||||
///
|
||||
/// The range of component `v` is `[50, 100]`.
|
||||
fn submit_finality_proof(p: u32, v: u32) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `416 + p * (40 ±0)`
|
||||
// Measured: `394 + p * (60 ±0)`
|
||||
// Estimated: `4745`
|
||||
// Minimum execution time: 221_703 nanoseconds.
|
||||
Weight::from_parts(39_358_497, 4745)
|
||||
// Standard Error: 85_573
|
||||
.saturating_add(Weight::from_ref_time(40_593_280).saturating_mul(p.into()))
|
||||
// Standard Error: 7_808
|
||||
.saturating_add(Weight::from_ref_time(1_529_400).saturating_mul(v.into()))
|
||||
// Minimum execution time: 221_810 nanoseconds.
|
||||
Weight::from_parts(33_157_392, 4745)
|
||||
// Standard Error: 109_045
|
||||
.saturating_add(Weight::from_ref_time(41_100_656).saturating_mul(p.into()))
|
||||
// Standard Error: 7_754
|
||||
.saturating_add(Weight::from_ref_time(1_534_466).saturating_mul(v.into()))
|
||||
.saturating_add(T::DbWeight::get().reads(6_u64))
|
||||
.saturating_add(T::DbWeight::get().writes(6_u64))
|
||||
}
|
||||
@@ -148,19 +148,19 @@ impl WeightInfo for () {
|
||||
/// Proof: BridgeRialtoGrandpa ImportedHeaders (max_values: Some(14400), max_size: Some(68),
|
||||
/// added: 2048, mode: MaxEncodedLen)
|
||||
///
|
||||
/// The range of component `p` is `[1, 5]`.
|
||||
/// The range of component `p` is `[1, 4]`.
|
||||
///
|
||||
/// The range of component `v` is `[50, 100]`.
|
||||
fn submit_finality_proof(p: u32, v: u32) -> Weight {
|
||||
// Proof Size summary in bytes:
|
||||
// Measured: `416 + p * (40 ±0)`
|
||||
// Measured: `394 + p * (60 ±0)`
|
||||
// Estimated: `4745`
|
||||
// Minimum execution time: 221_703 nanoseconds.
|
||||
Weight::from_parts(39_358_497, 4745)
|
||||
// Standard Error: 85_573
|
||||
.saturating_add(Weight::from_ref_time(40_593_280).saturating_mul(p.into()))
|
||||
// Standard Error: 7_808
|
||||
.saturating_add(Weight::from_ref_time(1_529_400).saturating_mul(v.into()))
|
||||
// Minimum execution time: 221_810 nanoseconds.
|
||||
Weight::from_parts(33_157_392, 4745)
|
||||
// Standard Error: 109_045
|
||||
.saturating_add(Weight::from_ref_time(41_100_656).saturating_mul(p.into()))
|
||||
// Standard Error: 7_754
|
||||
.saturating_add(Weight::from_ref_time(1_534_466).saturating_mul(v.into()))
|
||||
.saturating_add(RocksDbWeight::get().reads(6_u64))
|
||||
.saturating_add(RocksDbWeight::get().writes(6_u64))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user