Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
New weights (#2315)
Browse files Browse the repository at this point in the history
* New weights

* Fix compile benchmarks

* Fix import

* Fix all weights
  • Loading branch information
bkontur committed Mar 15, 2023
1 parent 1392b9d commit 9e81c9f
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 248 deletions.
30 changes: 24 additions & 6 deletions parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,17 @@ impl_runtime_apis! {

impl BridgeMessagesConfig<WithBridgeHubWococoMessagesInstance> for Runtime {
fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool {
use bridge_runtime_common::messages::MessageBridge;
let bench_lane_id = <Self as BridgeMessagesConfig<WithBridgeHubWococoMessagesInstance>>::bench_lane_id();
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(relayer, &bench_lane_id).is_some()
let bridged_chain_id = bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge::BRIDGED_CHAIN_ID;
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(
relayer,
bp_relayers::RewardsAccountParams::new(
bench_lane_id,
bridged_chain_id,
bp_relayers::RewardsAccountOwner::BridgedChain
)
).is_some()
}

fn prepare_message_proof(
Expand All @@ -1004,8 +1013,17 @@ impl_runtime_apis! {

impl BridgeMessagesConfig<WithBridgeHubRococoMessagesInstance> for Runtime {
fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool {
use bridge_runtime_common::messages::MessageBridge;
let bench_lane_id = <Self as BridgeMessagesConfig<WithBridgeHubRococoMessagesInstance>>::bench_lane_id();
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(relayer, &bench_lane_id).is_some()
let bridged_chain_id = bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge::BRIDGED_CHAIN_ID;
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(
relayer,
bp_relayers::RewardsAccountParams::new(
bench_lane_id,
bridged_chain_id,
bp_relayers::RewardsAccountOwner::BridgedChain
)
).is_some()
}

fn prepare_message_proof(
Expand Down Expand Up @@ -1089,15 +1107,15 @@ impl_runtime_apis! {

impl BridgeRelayersConfig for Runtime {
fn prepare_environment(
lane: bp_messages::LaneId,
account_params: bp_relayers::RewardsAccountParams,
reward: Balance,
) {
use frame_support::traits::fungible::Mutate;
let lane_rewards_account = bp_relayers::PayLaneRewardFromAccount::<
let rewards_account = bp_relayers::PayRewardFromAccount::<
Balances,
AccountId
>::lane_rewards_account(lane);
Balances::mint_into(&lane_rewards_account, reward).unwrap();
>::rewards_account(account_params);
Balances::mint_into(&rewards_account, reward).unwrap();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,26 @@
//! Autogenerated weights for `pallet_bridge_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-01-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2023-03-15, STEPS: `10`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024

// Executed Command:
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --steps=10
// --repeat=1
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --pallet=pallet_bridge_grandpa
// --chain=bridge-hub-rococo-dev
// --json-file=./bench.json
// --header=./file_header.txt
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/
// --chain=bridge-hub-rococo-dev
// --pallet=pallet_bridge_grandpa
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -47,24 +48,35 @@ use sp_std::marker::PhantomData;
/// Weight functions for `pallet_bridge_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T> {
// Storage: BridgeRococoGrandpa PalletOperatingMode (r:1 w:0)
// Storage: BridgeRococoGrandpa RequestCount (r:1 w:1)
// Storage: BridgeRococoGrandpa BestFinalized (r:1 w:1)
// Storage: BridgeRococoGrandpa CurrentAuthoritySet (r:1 w:0)
// Storage: BridgeRococoGrandpa ImportedHashesPointer (r:1 w:1)
// Storage: BridgeRococoGrandpa ImportedHashes (r:1 w:1)
// Storage: BridgeRococoGrandpa ImportedHeaders (r:0 w:2)
/// The range of component `p` is `[51, 102]`.
/// Storage: BridgeRococoGrandpa PalletOperatingMode (r:1 w:0)
/// Proof: BridgeRococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
/// Storage: BridgeRococoGrandpa RequestCount (r:1 w:1)
/// Proof: BridgeRococoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: BridgeRococoGrandpa BestFinalized (r:1 w:1)
/// Proof: BridgeRococoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen)
/// Storage: BridgeRococoGrandpa CurrentAuthoritySet (r:1 w:0)
/// Proof: BridgeRococoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(50250), added: 50745, mode: MaxEncodedLen)
/// Storage: BridgeRococoGrandpa ImportedHashesPointer (r:1 w:1)
/// Proof: BridgeRococoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: BridgeRococoGrandpa ImportedHashes (r:1 w:1)
/// 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 `v` is `[50, 100]`.
/// The range of component `p` is `[51, 102]`.
/// The range of component `p` is `[1, 838]`.
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
// Minimum execution time: 2_561_902 nanoseconds.
Weight::from_ref_time(86_419_230)
// Standard Error: 32_880
.saturating_add(Weight::from_ref_time(46_938_159).saturating_mul(p.into()))
// Standard Error: 33_661
.saturating_add(Weight::from_ref_time(1_134_973).saturating_mul(v.into()))
// Proof Size summary in bytes:
// Measured: `295 + p * (60 ±0)`
// Estimated: `60231`
// Minimum execution time: 616_404_000 picoseconds.
Weight::from_parts(616_404_000, 0)
.saturating_add(Weight::from_parts(0, 60231))
// Standard Error: 10_615_697
.saturating_add(Weight::from_parts(107_372_374, 0).saturating_mul(p.into()))
// Standard Error: 81_776_733
.saturating_add(Weight::from_parts(97_333_232, 0).saturating_mul(v.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,26 @@
//! Autogenerated weights for `pallet_bridge_grandpa`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
//! DATE: 2023-01-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
//! DATE: 2023-03-15, STEPS: `10`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz`
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024

// Executed Command:
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
// ./target/production/polkadot-parachain
// benchmark
// pallet
// --steps=50
// --repeat=20
// --steps=10
// --repeat=1
// --extrinsic=*
// --execution=wasm
// --wasm-execution=compiled
// --heap-pages=4096
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
// --pallet=pallet_bridge_grandpa
// --chain=bridge-hub-rococo-dev
// --json-file=./bench.json
// --header=./file_header.txt
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/
// --chain=bridge-hub-rococo-dev
// --pallet=pallet_bridge_grandpa
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
Expand All @@ -47,24 +48,33 @@ use sp_std::marker::PhantomData;
/// Weight functions for `pallet_bridge_grandpa`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T> {
// Storage: BridgeWococoGrandpa PalletOperatingMode (r:1 w:0)
// Storage: BridgeWococoGrandpa RequestCount (r:1 w:1)
// Storage: BridgeWococoGrandpa BestFinalized (r:1 w:1)
// Storage: BridgeWococoGrandpa CurrentAuthoritySet (r:1 w:0)
// Storage: BridgeWococoGrandpa ImportedHashesPointer (r:1 w:1)
// Storage: BridgeWococoGrandpa ImportedHashes (r:1 w:1)
// Storage: BridgeWococoGrandpa ImportedHeaders (r:0 w:2)
/// The range of component `p` is `[51, 102]`.
/// Storage: BridgeWococoGrandpa PalletOperatingMode (r:1 w:0)
/// Proof: BridgeWococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
/// Storage: BridgeWococoGrandpa RequestCount (r:1 w:1)
/// Proof: BridgeWococoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: BridgeWococoGrandpa BestFinalized (r:1 w:1)
/// Proof: BridgeWococoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen)
/// Storage: BridgeWococoGrandpa CurrentAuthoritySet (r:1 w:0)
/// Proof: BridgeWococoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(50250), added: 50745, mode: MaxEncodedLen)
/// Storage: BridgeWococoGrandpa ImportedHashesPointer (r:1 w:1)
/// Proof: BridgeWococoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
/// Storage: BridgeWococoGrandpa ImportedHashes (r:1 w:1)
/// Proof: BridgeWococoGrandpa ImportedHashes (max_values: Some(1024), max_size: Some(36), added: 1521, mode: MaxEncodedLen)
/// Storage: BridgeWococoGrandpa ImportedHeaders (r:0 w:2)
/// Proof: BridgeWococoGrandpa 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 `v` is `[50, 100]`.
/// The range of component `p` is `[51, 102]`.
/// The range of component `p` is `[1, 838]`.
/// The range of component `v` is `[50, 100]`.
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
// Minimum execution time: 2_565_169 nanoseconds.
Weight::from_ref_time(67_834_502)
// Standard Error: 35_710
.saturating_add(Weight::from_ref_time(47_043_118).saturating_mul(p.into()))
// Standard Error: 36_557
.saturating_add(Weight::from_ref_time(1_301_551).saturating_mul(v.into()))
fn submit_finality_proof(p: u32, _v: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `332 + p * (60 ±0)`
// Estimated: `60231`
// Minimum execution time: 672_054_000 picoseconds.
Weight::from_parts(47_309_240_121, 0)
.saturating_add(Weight::from_parts(0, 60231))
// Standard Error: 16_649_480
.saturating_add(Weight::from_parts(98_202_871, 0).saturating_mul(p.into()))
.saturating_add(T::DbWeight::get().reads(6))
.saturating_add(T::DbWeight::get().writes(6))
}
Expand Down
Loading

0 comments on commit 9e81c9f

Please sign in to comment.