Skip to content

Commit

Permalink
Fix bridges grandpa benchmarks (paritytech#2577) (paritytech#4548)
Browse files Browse the repository at this point in the history
Cherry-picked fix from upcoming
paritytech#4494

---------

Co-authored-by: Svyatoslav Nikolsky <[email protected]>
Co-authored-by: command-bot <>
  • Loading branch information
2 people authored and hitchhooker committed Jun 5, 2024
1 parent 5bd966b commit 0ef1679
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
3 changes: 2 additions & 1 deletion bridges/modules/grandpa/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,12 @@ const MAX_VOTE_ANCESTRIES_RANGE_END: u32 =
// the same with validators - if there are too much validators, let's run benchmarks on subrange
fn precommits_range_end<T: Config<I>, I: 'static>() -> u32 {
let max_bridged_authorities = T::BridgedChain::MAX_AUTHORITIES_COUNT;
if max_bridged_authorities > 128 {
let max_bridged_authorities = if max_bridged_authorities > 128 {
sp_std::cmp::max(128, max_bridged_authorities / 5)
} else {
max_bridged_authorities
};

required_justification_precommits(max_bridged_authorities)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_bridge_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-05-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-05-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-unxyhko3-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-vicqj8em-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-rococo-dev")`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -62,17 +62,17 @@ impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T
/// Proof: `BridgeWestendGrandpa::ImportedHashes` (`max_values`: Some(1024), `max_size`: Some(36), added: 1521, mode: `MaxEncodedLen`)
/// Storage: `BridgeWestendGrandpa::ImportedHeaders` (r:0 w:2)
/// Proof: `BridgeWestendGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 838]`.
/// The range of component `p` is `[1, 168]`.
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, _v: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `440 + p * (60 ±0)`
// Measured: `438 + p * (60 ±0)`
// Estimated: `51735`
// Minimum execution time: 306_046_000 picoseconds.
Weight::from_parts(384_361_000, 0)
// Minimum execution time: 300_829_000 picoseconds.
Weight::from_parts(321_573_000, 0)
.saturating_add(Weight::from_parts(0, 51735))
// Standard Error: 14_298
.saturating_add(Weight::from_parts(49_045_748, 0).saturating_mul(p.into()))
// Standard Error: 25_917
.saturating_add(Weight::from_parts(48_613_160, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(5))
}
Expand All @@ -90,8 +90,8 @@ impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T
// Proof Size summary in bytes:
// Measured: `452`
// Estimated: `51735`
// Minimum execution time: 94_965_000 picoseconds.
Weight::from_parts(113_633_000, 0)
// Minimum execution time: 101_007_000 picoseconds.
Weight::from_parts(129_904_000, 0)
.saturating_add(Weight::from_parts(0, 51735))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(6))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
//! Autogenerated weights for `pallet_bridge_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 32.0.0
//! DATE: 2024-05-17, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! DATE: 2024-05-23, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `runner-unxyhko3-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! HOSTNAME: `runner-vicqj8em-project-674-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `Some("bridge-hub-westend-dev")`, DB CACHE: 1024

// Executed Command:
Expand Down Expand Up @@ -62,19 +62,19 @@ impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T
/// Proof: `BridgeRococoGrandpa::ImportedHashes` (`max_values`: Some(1024), `max_size`: Some(36), added: 1521, mode: `MaxEncodedLen`)
/// Storage: `BridgeRococoGrandpa::ImportedHeaders` (r:0 w:2)
/// Proof: `BridgeRococoGrandpa::ImportedHeaders` (`max_values`: Some(1024), `max_size`: Some(68), added: 1553, mode: `MaxEncodedLen`)
/// The range of component `p` is `[1, 838]`.
/// The range of component `p` is `[1, 168]`.
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `270 + p * (60 ±0)`
// Measured: `268 + p * (60 ±0)`
// Estimated: `51735`
// Minimum execution time: 294_098_000 picoseconds.
Weight::from_parts(31_208_540, 0)
// Minimum execution time: 291_721_000 picoseconds.
Weight::from_parts(37_495_589, 0)
.saturating_add(Weight::from_parts(0, 51735))
// Standard Error: 8_832
.saturating_add(Weight::from_parts(40_930_987, 0).saturating_mul(p.into()))
// Standard Error: 147_319
.saturating_add(Weight::from_parts(2_663_839, 0).saturating_mul(v.into()))
// Standard Error: 22_170
.saturating_add(Weight::from_parts(45_403_072, 0).saturating_mul(p.into()))
// Standard Error: 73_977
.saturating_add(Weight::from_parts(2_130_216, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(5))
}
Expand All @@ -92,8 +92,8 @@ impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T
// Proof Size summary in bytes:
// Measured: `282`
// Estimated: `51735`
// Minimum execution time: 112_875_000 picoseconds.
Weight::from_parts(120_861_000, 0)
// Minimum execution time: 77_426_000 picoseconds.
Weight::from_parts(90_926_000, 0)
.saturating_add(Weight::from_parts(0, 51735))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(6))
Expand Down

0 comments on commit 0ef1679

Please sign in to comment.