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

Commit 9e81c9f

Browse files
authored
New weights (#2315)
* New weights * Fix compile benchmarks * Fix import * Fix all weights
1 parent 1392b9d commit 9e81c9f

10 files changed

+494
-248
lines changed

parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -977,8 +977,17 @@ impl_runtime_apis! {
977977

978978
impl BridgeMessagesConfig<WithBridgeHubWococoMessagesInstance> for Runtime {
979979
fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool {
980+
use bridge_runtime_common::messages::MessageBridge;
980981
let bench_lane_id = <Self as BridgeMessagesConfig<WithBridgeHubWococoMessagesInstance>>::bench_lane_id();
981-
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(relayer, &bench_lane_id).is_some()
982+
let bridged_chain_id = bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge::BRIDGED_CHAIN_ID;
983+
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(
984+
relayer,
985+
bp_relayers::RewardsAccountParams::new(
986+
bench_lane_id,
987+
bridged_chain_id,
988+
bp_relayers::RewardsAccountOwner::BridgedChain
989+
)
990+
).is_some()
982991
}
983992

984993
fn prepare_message_proof(
@@ -1004,8 +1013,17 @@ impl_runtime_apis! {
10041013

10051014
impl BridgeMessagesConfig<WithBridgeHubRococoMessagesInstance> for Runtime {
10061015
fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool {
1016+
use bridge_runtime_common::messages::MessageBridge;
10071017
let bench_lane_id = <Self as BridgeMessagesConfig<WithBridgeHubRococoMessagesInstance>>::bench_lane_id();
1008-
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(relayer, &bench_lane_id).is_some()
1018+
let bridged_chain_id = bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge::BRIDGED_CHAIN_ID;
1019+
pallet_bridge_relayers::Pallet::<Runtime>::relayer_reward(
1020+
relayer,
1021+
bp_relayers::RewardsAccountParams::new(
1022+
bench_lane_id,
1023+
bridged_chain_id,
1024+
bp_relayers::RewardsAccountOwner::BridgedChain
1025+
)
1026+
).is_some()
10091027
}
10101028

10111029
fn prepare_message_proof(
@@ -1089,15 +1107,15 @@ impl_runtime_apis! {
10891107

10901108
impl BridgeRelayersConfig for Runtime {
10911109
fn prepare_environment(
1092-
lane: bp_messages::LaneId,
1110+
account_params: bp_relayers::RewardsAccountParams,
10931111
reward: Balance,
10941112
) {
10951113
use frame_support::traits::fungible::Mutate;
1096-
let lane_rewards_account = bp_relayers::PayLaneRewardFromAccount::<
1114+
let rewards_account = bp_relayers::PayRewardFromAccount::<
10971115
Balances,
10981116
AccountId
1099-
>::lane_rewards_account(lane);
1100-
Balances::mint_into(&lane_rewards_account, reward).unwrap();
1117+
>::rewards_account(account_params);
1118+
Balances::mint_into(&rewards_account, reward).unwrap();
11011119
}
11021120
}
11031121

parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,26 @@
1717
//! Autogenerated weights for `pallet_bridge_grandpa`
1818
//!
1919
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
20-
//! DATE: 2023-01-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
21-
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
20+
//! DATE: 2023-03-15, STEPS: `10`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
21+
//! WORST CASE MAP SIZE: `1000000`
22+
//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz`
2223
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024
2324
2425
// Executed Command:
25-
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
26+
// ./target/production/polkadot-parachain
2627
// benchmark
2728
// pallet
28-
// --steps=50
29-
// --repeat=20
29+
// --steps=10
30+
// --repeat=1
3031
// --extrinsic=*
3132
// --execution=wasm
3233
// --wasm-execution=compiled
3334
// --heap-pages=4096
34-
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
35-
// --pallet=pallet_bridge_grandpa
36-
// --chain=bridge-hub-rococo-dev
35+
// --json-file=./bench.json
3736
// --header=./file_header.txt
38-
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/
37+
// --chain=bridge-hub-rococo-dev
38+
// --pallet=pallet_bridge_grandpa
39+
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights
3940

4041
#![cfg_attr(rustfmt, rustfmt_skip)]
4142
#![allow(unused_parens)]
@@ -47,24 +48,35 @@ use sp_std::marker::PhantomData;
4748
/// Weight functions for `pallet_bridge_grandpa`.
4849
pub struct WeightInfo<T>(PhantomData<T>);
4950
impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T> {
50-
// Storage: BridgeRococoGrandpa PalletOperatingMode (r:1 w:0)
51-
// Storage: BridgeRococoGrandpa RequestCount (r:1 w:1)
52-
// Storage: BridgeRococoGrandpa BestFinalized (r:1 w:1)
53-
// Storage: BridgeRococoGrandpa CurrentAuthoritySet (r:1 w:0)
54-
// Storage: BridgeRococoGrandpa ImportedHashesPointer (r:1 w:1)
55-
// Storage: BridgeRococoGrandpa ImportedHashes (r:1 w:1)
56-
// Storage: BridgeRococoGrandpa ImportedHeaders (r:0 w:2)
57-
/// The range of component `p` is `[51, 102]`.
51+
/// Storage: BridgeRococoGrandpa PalletOperatingMode (r:1 w:0)
52+
/// Proof: BridgeRococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
53+
/// Storage: BridgeRococoGrandpa RequestCount (r:1 w:1)
54+
/// Proof: BridgeRococoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
55+
/// Storage: BridgeRococoGrandpa BestFinalized (r:1 w:1)
56+
/// Proof: BridgeRococoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen)
57+
/// Storage: BridgeRococoGrandpa CurrentAuthoritySet (r:1 w:0)
58+
/// Proof: BridgeRococoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(50250), added: 50745, mode: MaxEncodedLen)
59+
/// Storage: BridgeRococoGrandpa ImportedHashesPointer (r:1 w:1)
60+
/// Proof: BridgeRococoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
61+
/// Storage: BridgeRococoGrandpa ImportedHashes (r:1 w:1)
62+
/// Proof: BridgeRococoGrandpa ImportedHashes (max_values: Some(1024), max_size: Some(36), added: 1521, mode: MaxEncodedLen)
63+
/// Storage: BridgeRococoGrandpa ImportedHeaders (r:0 w:2)
64+
/// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
65+
/// The range of component `p` is `[1, 838]`.
5866
/// The range of component `v` is `[50, 100]`.
59-
/// The range of component `p` is `[51, 102]`.
67+
/// The range of component `p` is `[1, 838]`.
6068
/// The range of component `v` is `[50, 100]`.
6169
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
62-
// Minimum execution time: 2_561_902 nanoseconds.
63-
Weight::from_ref_time(86_419_230)
64-
// Standard Error: 32_880
65-
.saturating_add(Weight::from_ref_time(46_938_159).saturating_mul(p.into()))
66-
// Standard Error: 33_661
67-
.saturating_add(Weight::from_ref_time(1_134_973).saturating_mul(v.into()))
70+
// Proof Size summary in bytes:
71+
// Measured: `295 + p * (60 ±0)`
72+
// Estimated: `60231`
73+
// Minimum execution time: 616_404_000 picoseconds.
74+
Weight::from_parts(616_404_000, 0)
75+
.saturating_add(Weight::from_parts(0, 60231))
76+
// Standard Error: 10_615_697
77+
.saturating_add(Weight::from_parts(107_372_374, 0).saturating_mul(p.into()))
78+
// Standard Error: 81_776_733
79+
.saturating_add(Weight::from_parts(97_333_232, 0).saturating_mul(v.into()))
6880
.saturating_add(T::DbWeight::get().reads(6))
6981
.saturating_add(T::DbWeight::get().writes(6))
7082
}

parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs

Lines changed: 35 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,26 @@
1717
//! Autogenerated weights for `pallet_bridge_grandpa`
1818
//!
1919
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
20-
//! DATE: 2023-01-22, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]`
21-
//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz`
20+
//! DATE: 2023-03-15, STEPS: `10`, REPEAT: `1`, LOW RANGE: `[]`, HIGH RANGE: `[]`
21+
//! WORST CASE MAP SIZE: `1000000`
22+
//! HOSTNAME: `bkontur-ThinkPad-P14s-Gen-2i`, CPU: `11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz`
2223
//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024
2324
2425
// Executed Command:
25-
// /home/benchbot/cargo_target_dir/production/polkadot-parachain
26+
// ./target/production/polkadot-parachain
2627
// benchmark
2728
// pallet
28-
// --steps=50
29-
// --repeat=20
29+
// --steps=10
30+
// --repeat=1
3031
// --extrinsic=*
3132
// --execution=wasm
3233
// --wasm-execution=compiled
3334
// --heap-pages=4096
34-
// --json-file=/var/lib/gitlab-runner/builds/zyw4fam_/0/parity/mirrors/cumulus/.git/.artifacts/bench.json
35-
// --pallet=pallet_bridge_grandpa
36-
// --chain=bridge-hub-rococo-dev
35+
// --json-file=./bench.json
3736
// --header=./file_header.txt
38-
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/
37+
// --chain=bridge-hub-rococo-dev
38+
// --pallet=pallet_bridge_grandpa
39+
// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights
3940

4041
#![cfg_attr(rustfmt, rustfmt_skip)]
4142
#![allow(unused_parens)]
@@ -47,24 +48,33 @@ use sp_std::marker::PhantomData;
4748
/// Weight functions for `pallet_bridge_grandpa`.
4849
pub struct WeightInfo<T>(PhantomData<T>);
4950
impl<T: frame_system::Config> pallet_bridge_grandpa::WeightInfo for WeightInfo<T> {
50-
// Storage: BridgeWococoGrandpa PalletOperatingMode (r:1 w:0)
51-
// Storage: BridgeWococoGrandpa RequestCount (r:1 w:1)
52-
// Storage: BridgeWococoGrandpa BestFinalized (r:1 w:1)
53-
// Storage: BridgeWococoGrandpa CurrentAuthoritySet (r:1 w:0)
54-
// Storage: BridgeWococoGrandpa ImportedHashesPointer (r:1 w:1)
55-
// Storage: BridgeWococoGrandpa ImportedHashes (r:1 w:1)
56-
// Storage: BridgeWococoGrandpa ImportedHeaders (r:0 w:2)
57-
/// The range of component `p` is `[51, 102]`.
51+
/// Storage: BridgeWococoGrandpa PalletOperatingMode (r:1 w:0)
52+
/// Proof: BridgeWococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
53+
/// Storage: BridgeWococoGrandpa RequestCount (r:1 w:1)
54+
/// Proof: BridgeWococoGrandpa RequestCount (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
55+
/// Storage: BridgeWococoGrandpa BestFinalized (r:1 w:1)
56+
/// Proof: BridgeWococoGrandpa BestFinalized (max_values: Some(1), max_size: Some(36), added: 531, mode: MaxEncodedLen)
57+
/// Storage: BridgeWococoGrandpa CurrentAuthoritySet (r:1 w:0)
58+
/// Proof: BridgeWococoGrandpa CurrentAuthoritySet (max_values: Some(1), max_size: Some(50250), added: 50745, mode: MaxEncodedLen)
59+
/// Storage: BridgeWococoGrandpa ImportedHashesPointer (r:1 w:1)
60+
/// Proof: BridgeWococoGrandpa ImportedHashesPointer (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
61+
/// Storage: BridgeWococoGrandpa ImportedHashes (r:1 w:1)
62+
/// Proof: BridgeWococoGrandpa ImportedHashes (max_values: Some(1024), max_size: Some(36), added: 1521, mode: MaxEncodedLen)
63+
/// Storage: BridgeWococoGrandpa ImportedHeaders (r:0 w:2)
64+
/// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
65+
/// The range of component `p` is `[1, 838]`.
5866
/// The range of component `v` is `[50, 100]`.
59-
/// The range of component `p` is `[51, 102]`.
67+
/// The range of component `p` is `[1, 838]`.
6068
/// The range of component `v` is `[50, 100]`.
61-
fn submit_finality_proof(p: u32, v: u32, ) -> Weight {
62-
// Minimum execution time: 2_565_169 nanoseconds.
63-
Weight::from_ref_time(67_834_502)
64-
// Standard Error: 35_710
65-
.saturating_add(Weight::from_ref_time(47_043_118).saturating_mul(p.into()))
66-
// Standard Error: 36_557
67-
.saturating_add(Weight::from_ref_time(1_301_551).saturating_mul(v.into()))
69+
fn submit_finality_proof(p: u32, _v: u32, ) -> Weight {
70+
// Proof Size summary in bytes:
71+
// Measured: `332 + p * (60 ±0)`
72+
// Estimated: `60231`
73+
// Minimum execution time: 672_054_000 picoseconds.
74+
Weight::from_parts(47_309_240_121, 0)
75+
.saturating_add(Weight::from_parts(0, 60231))
76+
// Standard Error: 16_649_480
77+
.saturating_add(Weight::from_parts(98_202_871, 0).saturating_mul(p.into()))
6878
.saturating_add(T::DbWeight::get().reads(6))
6979
.saturating_add(T::DbWeight::get().writes(6))
7080
}

0 commit comments

Comments
 (0)