diff --git a/Cargo.lock b/Cargo.lock index 9d1b0b71d7e..8430cd5d69e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -934,6 +934,7 @@ dependencies = [ "bp-bridge-hub-wococo", "bp-messages", "bp-parachains", + "bp-polkadot-core", "bp-rococo", "bp-runtime", "bp-wococo", diff --git a/bridges/bin/runtime-common/Cargo.toml b/bridges/bin/runtime-common/Cargo.toml index 9e8e6b29db2..7d538671646 100644 --- a/bridges/bin/runtime-common/Cargo.toml +++ b/bridges/bin/runtime-common/Cargo.toml @@ -82,6 +82,7 @@ std = [ runtime-benchmarks = [ "pallet-bridge-grandpa/runtime-benchmarks", "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", "xcm-builder/runtime-benchmarks", ] integrity-test = [ diff --git a/bridges/bin/runtime-common/src/messages_benchmarking.rs b/bridges/bin/runtime-common/src/messages_benchmarking.rs index afe95422d18..e7ca26d952e 100644 --- a/bridges/bin/runtime-common/src/messages_benchmarking.rs +++ b/bridges/bin/runtime-common/src/messages_benchmarking.rs @@ -22,7 +22,7 @@ use crate::{ messages::{ source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof, - AccountIdOf, BalanceOf, BridgedChain, CallOf, HashOf, MessageBridge, ThisChain, + AccountIdOf, BridgedChain, HashOf, HasherOf, MessageBridge, RawStorageProof, ThisChain, }, messages_generation::{ encode_all_messages, encode_lane_data, grow_trie, prepare_messages_storage_proof, @@ -30,52 +30,46 @@ use crate::{ }; use bp_messages::storage_keys; -use bp_runtime::{record_all_trie_keys, StorageProofSize}; +use bp_polkadot_core::parachains::ParaHash; +use bp_runtime::{record_all_trie_keys, Chain, Parachain, StorageProofSize, UnderlyingChainOf}; use codec::Encode; -use frame_support::{dispatch::GetDispatchInfo, weights::Weight}; +use frame_support::weights::Weight; use pallet_bridge_messages::benchmarking::{MessageDeliveryProofParams, MessageProofParams}; -use sp_core::Hasher; -use sp_runtime::traits::{Header, MaybeSerializeDeserialize, Zero}; -use sp_std::{fmt::Debug, prelude::*}; +use sp_runtime::traits::{Header, Zero}; +use sp_std::prelude::*; use sp_trie::{trie_types::TrieDBMutBuilderV1, LayoutV1, MemoryDB, Recorder, TrieMut}; /// Prepare proof of messages for the `receive_messages_proof` call. /// /// In addition to returning valid messages proof, environment is prepared to verify this message /// proof. -pub fn prepare_message_proof( +/// +/// This method is intended to be used when benchmarking pallet, linked to the chain that +/// uses GRANDPA finality. For parachains, please use the `prepare_message_proof_from_parachain` +/// function. +pub fn prepare_message_proof_from_grandpa_chain( params: MessageProofParams, ) -> (FromBridgedChainMessagesProof>>, Weight) where - R: frame_system::Config>> - + pallet_bridge_grandpa::Config, - R::BridgedChain: bp_runtime::Chain>, Header = BH>, - B: MessageBridge, - BI: 'static, + R: pallet_bridge_grandpa::Config>>, FI: 'static, - BH: Header>>, - BHH: Hasher>>, - AccountIdOf>: PartialEq + sp_std::fmt::Debug, - AccountIdOf>: From<[u8; 32]>, - BalanceOf>: Debug + MaybeSerializeDeserialize, - CallOf>: From> + GetDispatchInfo, - HashOf>: Copy + Default, + B: MessageBridge, { - let message_payload = match params.size { - StorageProofSize::Minimal(ref size) => vec![0u8; *size as _], - _ => vec![], - }; - - // finally - prepare storage proof and update environment + // prepare storage proof let (state_root, storage_proof) = prepare_messages_storage_proof::( params.lane, params.message_nonces.clone(), params.outbound_lane_data, params.size, - message_payload, + match params.size { + StorageProofSize::Minimal(ref size) => vec![0u8; *size as _], + _ => vec![], + }, encode_all_messages, encode_lane_data, ); + + // update runtime storage let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::(state_root); ( @@ -90,18 +84,115 @@ where ) } +/// Prepare proof of messages for the `receive_messages_proof` call. +/// +/// In addition to returning valid messages proof, environment is prepared to verify this message +/// proof. +/// +/// This method is intended to be used when benchmarking pallet, linked to the chain that +/// uses parachain finality. For GRANDPA chains, please use the +/// `prepare_message_proof_from_grandpa_chain` function. +pub fn prepare_message_proof_from_parachain( + params: MessageProofParams, +) -> (FromBridgedChainMessagesProof>>, Weight) +where + R: pallet_bridge_parachains::Config, + PI: 'static, + B: MessageBridge, + UnderlyingChainOf>: Chain + Parachain, +{ + // prepare storage proof + let (state_root, storage_proof) = prepare_messages_storage_proof::( + params.lane, + params.message_nonces.clone(), + params.outbound_lane_data, + params.size, + match params.size { + StorageProofSize::Minimal(ref size) => vec![0u8; *size as _], + _ => vec![], + }, + encode_all_messages, + encode_lane_data, + ); + + // update runtime storage + let (_, bridged_header_hash) = + insert_header_to_parachains_pallet::>>(state_root); + + ( + FromBridgedChainMessagesProof { + bridged_header_hash, + storage_proof, + lane: params.lane, + nonces_start: *params.message_nonces.start(), + nonces_end: *params.message_nonces.end(), + }, + Weight::zero(), + ) +} + /// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call. -pub fn prepare_message_delivery_proof( +/// +/// This method is intended to be used when benchmarking pallet, linked to the chain that +/// uses GRANDPA finality. For parachains, please use the +/// `prepare_message_delivery_proof_from_parachain` function. +pub fn prepare_message_delivery_proof_from_grandpa_chain( params: MessageDeliveryProofParams>>, ) -> FromBridgedChainMessagesDeliveryProof>> where - R: pallet_bridge_grandpa::Config, - R::BridgedChain: bp_runtime::Chain>, Header = BH>, + R: pallet_bridge_grandpa::Config>>, FI: 'static, B: MessageBridge, - BH: Header>>, - BHH: Hasher>>, - HashOf>: Copy + Default, +{ + // prepare storage proof + let lane = params.lane; + let (state_root, storage_proof) = prepare_message_delivery_proof::(params); + + // update runtime storage + let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::(state_root); + + FromBridgedChainMessagesDeliveryProof { + bridged_header_hash: bridged_header_hash.into(), + storage_proof, + lane, + } +} + +/// Prepare proof of messages delivery for the `receive_messages_delivery_proof` call. +/// +/// This method is intended to be used when benchmarking pallet, linked to the chain that +/// uses parachain finality. For GRANDPA chains, please use the +/// `prepare_message_delivery_proof_from_grandpa_chain` function. +pub fn prepare_message_delivery_proof_from_parachain( + params: MessageDeliveryProofParams>>, +) -> FromBridgedChainMessagesDeliveryProof>> +where + R: pallet_bridge_parachains::Config, + PI: 'static, + B: MessageBridge, + UnderlyingChainOf>: Chain + Parachain, +{ + // prepare storage proof + let lane = params.lane; + let (state_root, storage_proof) = prepare_message_delivery_proof::(params); + + // update runtime storage + let (_, bridged_header_hash) = + insert_header_to_parachains_pallet::>>(state_root); + + FromBridgedChainMessagesDeliveryProof { + bridged_header_hash: bridged_header_hash.into(), + storage_proof, + lane, + } +} + +/// Prepare in-memory message delivery proof, without inserting anything to the runtime storage. +fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams>>, +) -> (HashOf>, RawStorageProof) +where + B: MessageBridge, { // prepare Bridged chain storage with inbound lane state let storage_key = @@ -109,7 +200,8 @@ where let mut root = Default::default(); let mut mdb = MemoryDB::default(); { - let mut trie = TrieDBMutBuilderV1::::new(&mut mdb, &mut root).build(); + let mut trie = + TrieDBMutBuilderV1::>>::new(&mut mdb, &mut root).build(); trie.insert(&storage_key, ¶ms.inbound_lane_data.encode()) .map_err(|_| "TrieMut::insert has failed") .expect("TrieMut::insert should not fail in benchmarks"); @@ -117,20 +209,17 @@ where root = grow_trie(root, &mut mdb, params.size); // generate storage proof to be delivered to This chain - let mut proof_recorder = Recorder::>::new(); - record_all_trie_keys::, _>(&mdb, &root, &mut proof_recorder) - .map_err(|_| "record_all_trie_keys has failed") - .expect("record_all_trie_keys should not fail in benchmarks"); + let mut proof_recorder = Recorder::>>>::new(); + record_all_trie_keys::>>, _>( + &mdb, + &root, + &mut proof_recorder, + ) + .map_err(|_| "record_all_trie_keys has failed") + .expect("record_all_trie_keys should not fail in benchmarks"); let storage_proof = proof_recorder.drain().into_iter().map(|n| n.data.to_vec()).collect(); - // finally insert header with given state root to our storage - let (_, bridged_header_hash) = insert_header_to_grandpa_pallet::(root); - - FromBridgedChainMessagesDeliveryProof { - bridged_header_hash: bridged_header_hash.into(), - storage_proof, - lane: params.lane, - } + (root, storage_proof) } /// Insert header to the bridge GRANDPA pallet. @@ -154,3 +243,25 @@ where pallet_bridge_grandpa::initialize_for_benchmarks::(bridged_header); (bridged_block_number, bridged_header_hash) } + +/// Insert header to the bridge parachains pallet. +pub(crate) fn insert_header_to_parachains_pallet( + state_root: bp_runtime::HashOf, +) -> (bp_runtime::BlockNumberOf, bp_runtime::HashOf) +where + R: pallet_bridge_parachains::Config, + PI: 'static, + PC: Chain + Parachain, +{ + let bridged_block_number = Zero::zero(); + let bridged_header = bp_runtime::HeaderOf::::new( + bridged_block_number, + Default::default(), + state_root, + Default::default(), + Default::default(), + ); + let bridged_header_hash = bridged_header.hash(); + pallet_bridge_parachains::initialize_for_benchmarks::(bridged_header); + (bridged_block_number, bridged_header_hash) +} diff --git a/bridges/modules/parachains/src/lib.rs b/bridges/modules/parachains/src/lib.rs index 47ab91928c7..06a1f82e7b0 100644 --- a/bridges/modules/parachains/src/lib.rs +++ b/bridges/modules/parachains/src/lib.rs @@ -33,6 +33,13 @@ use bp_runtime::{Chain, HashOf, HeaderId, HeaderIdOf, Parachain, StorageProofErr use frame_support::dispatch::PostDispatchInfo; use sp_std::{marker::PhantomData, vec::Vec}; +#[cfg(feature = "runtime-benchmarks")] +use bp_parachains::ParaStoredHeaderDataBuilder; +#[cfg(feature = "runtime-benchmarks")] +use bp_runtime::HeaderOf; +#[cfg(feature = "runtime-benchmarks")] +use codec::Encode; + // Re-export in crate namespace for `construct_runtime!`. pub use pallet::*; @@ -654,6 +661,25 @@ impl, I: 'static, C: Parachain> HeaderChain } } +/// (Re)initialize pallet with given header for using it in `pallet-bridge-messages` benchmarks. +#[cfg(feature = "runtime-benchmarks")] +pub fn initialize_for_benchmarks, I: 'static, PC: Parachain>( + header: HeaderOf, +) { + let parachain = ParaId(PC::PARACHAIN_ID); + let parachain_head = ParaHead(header.encode()); + let updated_head_data = T::ParaStoredHeaderDataBuilder::try_build(parachain, ¶chain_head) + .expect("failed to build stored parachain head in benchmarks"); + Pallet::::update_parachain_head( + parachain, + None, + 0, + updated_head_data, + parachain_head.hash(), + ) + .expect("failed to insert parachain head in benchmarks"); +} + #[cfg(test)] mod tests { use super::*; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml index f6c42988383..a7509f30313 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/Cargo.toml @@ -76,6 +76,7 @@ bp-bridge-hub-rococo = { path = "../../../../bridges/primitives/chain-bridge-hub bp-bridge-hub-wococo = { path = "../../../../bridges/primitives/chain-bridge-hub-wococo", default-features = false } bp-messages = { path = "../../../../bridges/primitives/messages", default-features = false } bp-parachains = { path = "../../../../bridges/primitives/parachains", default-features = false } +bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false } bp-runtime = { path = "../../../../bridges/primitives/runtime", default-features = false } bp-rococo = { path = "../../../../bridges/primitives/chain-rococo", default-features = false } bp-wococo = { path = "../../../../bridges/primitives/chain-wococo", default-features = false } @@ -100,6 +101,7 @@ std = [ "bp-bridge-hub-wococo/std", "bp-messages/std", "bp-parachains/std", + "bp-polkadot-core/std", "bp-runtime/std", "bp-rococo/std", "bp-wococo/std", @@ -159,15 +161,20 @@ std = [ ] runtime-benchmarks = [ + "bridge-runtime-common/runtime-benchmarks", "frame-benchmarking/runtime-benchmarks", "frame-support/runtime-benchmarks", "frame-system-benchmarking/runtime-benchmarks", "frame-system/runtime-benchmarks", "pallet-balances/runtime-benchmarks", + "pallet-bridge-grandpa/runtime-benchmarks", + "pallet-bridge-messages/runtime-benchmarks", + "pallet-bridge-parachains/runtime-benchmarks", + "pallet-bridge-relayers/runtime-benchmarks", + "pallet-collator-selection/runtime-benchmarks", "pallet-multisig/runtime-benchmarks", "pallet-timestamp/runtime-benchmarks", "pallet-utility/runtime-benchmarks", - "pallet-collator-selection/runtime-benchmarks", "pallet-xcm/runtime-benchmarks", "sp-runtime/runtime-benchmarks", "xcm-builder/runtime-benchmarks", diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs index cdaaa8bb49e..430cc1ffc66 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . +//! Bridge definitions that are used on Rococo to bridge with Wococo. + use crate::{ BridgeParachainWococoInstance, ParachainInfo, Runtime, WithBridgeHubWococoMessagesInstance, XcmBlobHauler, XcmBlobHaulerAdapter, XcmRouter, @@ -22,7 +24,10 @@ use bp_messages::{LaneId, MessageNonce}; use bp_runtime::ChainId; use bridge_runtime_common::{ messages, - messages::{MessageBridge, ThisChainWithMessages, UnderlyingChainProvider}, + messages::{ + source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof, + MessageBridge, ThisChainWithMessages, UnderlyingChainProvider, + }, }; use frame_support::{parameter_types, RuntimeDebug}; use xcm::{ @@ -43,6 +48,13 @@ parameter_types! { pub ActiveOutboundLanesToBridgeHubWococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO]; } +/// Proof of messages, coming from Wococo. +pub type FromWococoBridgeHubMessagesProof = + FromBridgedChainMessagesProof; +/// Messages delivery proof for Rococo Bridge Hub -> Wococo Bridge Hub messages. +pub type ToWococoBridgeHubMessagesDeliveryProof = + FromBridgedChainMessagesDeliveryProof; + /// Dispatches received XCM messages from other bridge pub type OnBridgeHubRococoBlobDispatcher = BridgeBlobDispatcher; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs index 93b85dde9ed..6578136690c 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with Cumulus. If not, see . +//! Bridge definitions that are used on Wococo to bridge with Rococo. + use crate::{ BridgeParachainRococoInstance, ParachainInfo, Runtime, WithBridgeHubRococoMessagesInstance, XcmBlobHauler, XcmBlobHaulerAdapter, XcmRouter, @@ -22,7 +24,10 @@ use bp_messages::{LaneId, MessageNonce}; use bp_runtime::ChainId; use bridge_runtime_common::{ messages, - messages::{MessageBridge, ThisChainWithMessages, UnderlyingChainProvider}, + messages::{ + source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof, + MessageBridge, ThisChainWithMessages, UnderlyingChainProvider, + }, }; use frame_support::{parameter_types, RuntimeDebug}; use xcm::{ @@ -43,6 +48,13 @@ parameter_types! { pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO]; } +/// Proof of messages, coming from Rococo. +pub type FromRococoBridgeHubMessagesProof = + FromBridgedChainMessagesProof; +/// Messages delivery proof for Rococo Bridge Hub -> Wococo Bridge Hub messages. +pub type ToRococoBridgeHubMessagesDeliveryProof = + FromBridgedChainMessagesDeliveryProof; + /// Dispatches received XCM messages from other bridge pub type OnBridgeHubWococoBlobDispatcher = BridgeBlobDispatcher; diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 6fd79614ba0..02f211987af 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -399,7 +399,7 @@ impl pallet_bridge_grandpa::Config for Runtime { type HeadersToKeep = RelayChainHeadersToKeep; type MaxBridgedAuthorities = frame_support::traits::ConstU32<{ bp_wococo::MAX_AUTHORITIES_COUNT }>; - type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight; + type WeightInfo = weights::pallet_bridge_grandpa_bridge_wococo_grandpa::WeightInfo; } /// Add granda bridge pallet to track Rococo relay chain @@ -410,7 +410,7 @@ impl pallet_bridge_grandpa::Config for Runtime { type HeadersToKeep = RelayChainHeadersToKeep; type MaxBridgedAuthorities = frame_support::traits::ConstU32<{ bp_rococo::MAX_AUTHORITIES_COUNT }>; - type WeightInfo = pallet_bridge_grandpa::weights::BridgeWeight; + type WeightInfo = weights::pallet_bridge_grandpa_bridge_rococo_grandpa::WeightInfo; } pub const ROCOCO_BRIDGE_PARA_PALLET_NAME: &str = "Paras"; @@ -430,7 +430,7 @@ parameter_types! { pub type BridgeParachainWococoInstance = pallet_bridge_parachains::Instance1; impl pallet_bridge_parachains::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_bridge_parachains::weights::BridgeWeight; + type WeightInfo = weights::pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance::WeightInfo; type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance; type ParasPalletName = WococoBridgeParachainPalletName; type ParaStoredHeaderDataBuilder = @@ -443,7 +443,7 @@ impl pallet_bridge_parachains::Config for Runtime pub type BridgeParachainRococoInstance = pallet_bridge_parachains::Instance2; impl pallet_bridge_parachains::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_bridge_parachains::weights::BridgeWeight; + type WeightInfo = weights::pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance::WeightInfo; type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance; type ParasPalletName = RococoBridgeParachainPalletName; type ParaStoredHeaderDataBuilder = @@ -456,7 +456,7 @@ impl pallet_bridge_parachains::Config for Runtime pub type WithBridgeHubWococoMessagesInstance = pallet_bridge_messages::Instance1; impl pallet_bridge_messages::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_bridge_messages::weights::BridgeWeight; + type WeightInfo = weights::pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance::WeightInfo; type BridgedChainId = bridge_hub_rococo_config::BridgeHubWococoChainId; type ActiveOutboundLanes = bridge_hub_rococo_config::ActiveOutboundLanesToBridgeHubWococo; type MaxUnrewardedRelayerEntriesAtInboundLane = @@ -490,7 +490,7 @@ impl pallet_bridge_messages::Config for Run pub type WithBridgeHubRococoMessagesInstance = pallet_bridge_messages::Instance2; impl pallet_bridge_messages::Config for Runtime { type RuntimeEvent = RuntimeEvent; - type WeightInfo = pallet_bridge_messages::weights::BridgeWeight; + type WeightInfo = weights::pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance::WeightInfo; type BridgedChainId = bridge_hub_wococo_config::BridgeHubRococoChainId; type ActiveOutboundLanes = bridge_hub_wococo_config::ActiveOutboundLanesToBridgeHubRococo; type MaxUnrewardedRelayerEntriesAtInboundLane = @@ -557,12 +557,16 @@ construct_runtime!( // TODO:check-parameter - change back to 41 a align bridge pallets Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 36, - // Wococo bridge modules + // Rococo and Wococo Bridge Hubs are sharing the runtime, so this runtime has two sets of + // bridge pallets. Both are deployed at both runtimes, but only one set is actually used + // at particular runtime. + + // With-Wococo bridge modules that are active (used) at Rococo Bridge Hub runtime. BridgeWococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Config} = 41, BridgeWococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage, Event} = 42, BridgeWococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 46, - // Rococo bridge modules + // With-Rococo bridge modules that are active (used) at Wococo Bridge Hub runtime. BridgeRococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Config} = 43, BridgeRococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage, Event} = 44, BridgeRococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 45, @@ -600,6 +604,14 @@ mod benches { // NOTE: Make sure you point to the individual modules below. [pallet_xcm_benchmarks::fungible, XcmBalances] [pallet_xcm_benchmarks::generic, XcmGeneric] + // Bridge pallets at Rococo + [pallet_bridge_grandpa, BridgeWococoGrandpa] + [pallet_bridge_parachains, BridgeParachainsBench::] + [pallet_bridge_messages, BridgeMessagesBench::] + // Bridge pallets at Wococo + [pallet_bridge_grandpa, BridgeRococoGrandpa] + [pallet_bridge_parachains, BridgeParachainsBench::] + [pallet_bridge_messages, BridgeMessagesBench::] ); } @@ -827,6 +839,9 @@ impl_runtime_apis! { type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::; + use pallet_bridge_parachains::benchmarking::Pallet as BridgeParachainsBench; + use pallet_bridge_messages::benchmarking::Pallet as BridgeMessagesBench; + let mut list = Vec::::new(); list_benchmarks!(list, extra); @@ -926,6 +941,122 @@ impl_runtime_apis! { type XcmBalances = pallet_xcm_benchmarks::fungible::Pallet::; type XcmGeneric = pallet_xcm_benchmarks::generic::Pallet::; + use bridge_runtime_common::messages_benchmarking::{prepare_message_delivery_proof_from_parachain, prepare_message_proof_from_parachain}; + use pallet_bridge_messages::benchmarking::{ + Config as BridgeMessagesConfig, + Pallet as BridgeMessagesBench, + MessageDeliveryProofParams, + MessageProofParams, + }; + + impl BridgeMessagesConfig for Runtime { + fn is_relayer_rewarded(_: &Self::AccountId) -> bool { + // TODO: implement me properly + true + } + + fn prepare_message_proof( + params: MessageProofParams, + ) -> (bridge_hub_rococo_config::FromWococoBridgeHubMessagesProof, Weight) { + prepare_message_proof_from_parachain::< + Runtime, + BridgeGrandpaWococoInstance, + bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge, + >(params) + } + + fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams, + ) -> bridge_hub_rococo_config::ToWococoBridgeHubMessagesDeliveryProof { + prepare_message_delivery_proof_from_parachain::< + Runtime, + BridgeGrandpaWococoInstance, + bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge, + >(params) + } + } + + impl BridgeMessagesConfig for Runtime { + fn is_relayer_rewarded(_: &Self::AccountId) -> bool { + // TODO: implement me properly + true + } + + fn prepare_message_proof( + params: MessageProofParams, + ) -> (bridge_hub_wococo_config::FromRococoBridgeHubMessagesProof, Weight) { + prepare_message_proof_from_parachain::< + Runtime, + BridgeGrandpaRococoInstance, + bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge, + >(params) + } + + fn prepare_message_delivery_proof( + params: MessageDeliveryProofParams, + ) -> bridge_hub_wococo_config::ToRococoBridgeHubMessagesDeliveryProof { + prepare_message_delivery_proof_from_parachain::< + Runtime, + BridgeGrandpaRococoInstance, + bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge, + >(params) + } + } + + use bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof; + use pallet_bridge_parachains::benchmarking::{ + Config as BridgeParachainsConfig, + Pallet as BridgeParachainsBench, + }; + + impl BridgeParachainsConfig for Runtime { + fn parachains() -> Vec { + use bp_runtime::Parachain; + vec![bp_polkadot_core::parachains::ParaId(bp_bridge_hub_wococo::BridgeHubWococo::PARACHAIN_ID)] + } + + fn prepare_parachain_heads_proof( + parachains: &[bp_polkadot_core::parachains::ParaId], + parachain_head_size: u32, + proof_size: bp_runtime::StorageProofSize, + ) -> ( + pallet_bridge_parachains::RelayBlockNumber, + pallet_bridge_parachains::RelayBlockHash, + bp_polkadot_core::parachains::ParaHeadsProof, + Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>, + ) { + prepare_parachain_heads_proof::( + parachains, + parachain_head_size, + proof_size, + ) + } + } + + impl BridgeParachainsConfig for Runtime { + fn parachains() -> Vec { + use bp_runtime::Parachain; + vec![bp_polkadot_core::parachains::ParaId(bp_bridge_hub_rococo::BridgeHubRococo::PARACHAIN_ID)] + } + + fn prepare_parachain_heads_proof( + parachains: &[bp_polkadot_core::parachains::ParaId], + parachain_head_size: u32, + proof_size: bp_runtime::StorageProofSize, + ) -> ( + pallet_bridge_parachains::RelayBlockNumber, + pallet_bridge_parachains::RelayBlockHash, + bp_polkadot_core::parachains::ParaHeadsProof, + Vec<(bp_polkadot_core::parachains::ParaId, bp_polkadot_core::parachains::ParaHash)>, + ) { + prepare_parachain_heads_proof::( + parachains, + parachain_head_size, + proof_size, + ) + } + } + let whitelist: Vec = vec![ // Block Number hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(), diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs index d5722374def..1eec4e5c18a 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs @@ -22,6 +22,12 @@ pub mod cumulus_pallet_xcmp_queue; pub mod extrinsic_weights; pub mod frame_system; pub mod pallet_balances; +pub mod pallet_bridge_grandpa_bridge_rococo_grandpa; +pub mod pallet_bridge_grandpa_bridge_wococo_grandpa; +pub mod pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance; +pub mod pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance; +pub mod pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance; +pub mod pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance; pub mod pallet_collator_selection; pub mod pallet_multisig; pub mod pallet_session; @@ -36,3 +42,27 @@ pub use block_weights::constants::BlockExecutionWeight; pub use extrinsic_weights::constants::ExtrinsicBaseWeight; pub use paritydb_weights::constants::ParityDbWeight; pub use rocksdb_weights::constants::RocksDbWeight; + +impl pallet_bridge_messages::WeightInfoExt for pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance::WeightInfo { + fn expected_extra_storage_proof_size() -> u32 { + bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE + } +} + +impl pallet_bridge_messages::WeightInfoExt for pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance::WeightInfo { + fn expected_extra_storage_proof_size() -> u32 { + bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE + } +} + +impl pallet_bridge_parachains::WeightInfoExt for pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance::WeightInfo { + fn expected_extra_storage_proof_size() -> u32 { + bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE + } +} + +impl pallet_bridge_parachains::WeightInfoExt for pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance::WeightInfo { + fn expected_extra_storage_proof_size() -> u32 { + bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs new file mode 100644 index 00000000000..9dfa44f562c --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs @@ -0,0 +1,71 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! 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` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --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 +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_grandpa::WeightInfo for WeightInfo { + // 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]`. + /// The range of component `v` is `[50, 100]`. + /// The range of component `p` is `[51, 102]`. + /// 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())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs new file mode 100644 index 00000000000..a22269e2a7c --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs @@ -0,0 +1,71 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! 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` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --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 +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_grandpa`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_grandpa::WeightInfo for WeightInfo { + // 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]`. + /// The range of component `v` is `[50, 100]`. + /// The range of component `p` is `[51, 102]`. + /// 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())) + .saturating_add(T::DbWeight::get().reads(6)) + .saturating_add(T::DbWeight::get().writes(6)) + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs new file mode 100644 index 00000000000..65a1858a231 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs @@ -0,0 +1,125 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_bridge_messages` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-01-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_bridge_messages +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_messages`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_messages::WeightInfo for WeightInfo { + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn receive_single_message_proof() -> Weight { + // Minimum execution time: 48_515 nanoseconds. + Weight::from_ref_time(50_641_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn receive_two_messages_proof() -> Weight { + // Minimum execution time: 62_891 nanoseconds. + Weight::from_ref_time(66_039_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn receive_single_message_proof_with_outbound_lane_state() -> Weight { + // Minimum execution time: 53_010 nanoseconds. + Weight::from_ref_time(53_855_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + fn receive_single_message_proof_1_kb() -> Weight { + // Minimum execution time: 50_491 nanoseconds. + Weight::from_ref_time(52_570_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages InboundLanes (r:1 w:1) + fn receive_single_message_proof_16_kb() -> Weight { + // Minimum execution time: 116_072 nanoseconds. + Weight::from_ref_time(119_185_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages OutboundLanes (r:1 w:1) + fn receive_delivery_proof_for_single_message() -> Weight { + // Minimum execution time: 31_075 nanoseconds. + Weight::from_ref_time(32_055_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages OutboundLanes (r:1 w:1) + fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { + // Minimum execution time: 31_524 nanoseconds. + Weight::from_ref_time(32_149_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeRococoMessages OutboundLanes (r:1 w:1) + fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { + // Minimum execution time: 31_723 nanoseconds. + Weight::from_ref_time(32_355_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs new file mode 100644 index 00000000000..eaff561d629 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs @@ -0,0 +1,125 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_bridge_messages` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-01-25, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `runner-b3zmxxc-project-238-concurrent-0`, CPU: `Intel(R) Xeon(R) CPU @ 2.60GHz` +//! EXECUTION: Some(Wasm), WASM-EXECUTION: Compiled, CHAIN: Some("bridge-hub-rococo-dev"), DB CACHE: 1024 + +// Executed Command: +// target/production/polkadot-parachain +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --extrinsic=* +// --execution=wasm +// --wasm-execution=compiled +// --heap-pages=4096 +// --json-file=/builds/parity/mirrors/cumulus/.git/.artifacts/bench.json +// --pallet=pallet_bridge_messages +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_messages`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_messages::WeightInfo for WeightInfo { + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn receive_single_message_proof() -> Weight { + // Minimum execution time: 49_348 nanoseconds. + Weight::from_ref_time(52_687_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn receive_two_messages_proof() -> Weight { + // Minimum execution time: 63_755 nanoseconds. + Weight::from_ref_time(67_615_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + // Storage: ParachainInfo ParachainId (r:1 w:0) + fn receive_single_message_proof_with_outbound_lane_state() -> Weight { + // Minimum execution time: 54_597 nanoseconds. + Weight::from_ref_time(56_472_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + fn receive_single_message_proof_1_kb() -> Weight { + // Minimum execution time: 51_363 nanoseconds. + Weight::from_ref_time(54_025_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages InboundLanes (r:1 w:1) + fn receive_single_message_proof_16_kb() -> Weight { + // Minimum execution time: 119_727 nanoseconds. + Weight::from_ref_time(123_138_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + fn receive_delivery_proof_for_single_message() -> Weight { + // Minimum execution time: 32_525 nanoseconds. + Weight::from_ref_time(33_410_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight { + // Minimum execution time: 32_310 nanoseconds. + Weight::from_ref_time(33_208_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } + // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0) + // Storage: BridgeWococoMessages OutboundLanes (r:1 w:1) + fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight { + // Minimum execution time: 32_594 nanoseconds. + Weight::from_ref_time(33_449_000) + .saturating_add(T::DbWeight::get().reads(3)) + .saturating_add(T::DbWeight::get().writes(1)) + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs new file mode 100644 index 00000000000..056617988d5 --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs @@ -0,0 +1,85 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_bridge_parachains` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --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_parachains +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_parachains`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_parachains::WeightInfo for WeightInfo { + // Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0) + // Storage: BridgeRococoParachain ParasInfo (r:1 w:1) + // Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1) + // Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1) + /// The range of component `p` is `[1, 2]`. + /// The range of component `p` is `[1, 2]`. + fn submit_parachain_heads_with_n_parachains(_p: u32, ) -> Weight { + // Minimum execution time: 34_955 nanoseconds. + Weight::from_ref_time(36_400_062) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0) + // Storage: BridgeRococoParachain ParasInfo (r:1 w:1) + // Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1) + // Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1) + fn submit_parachain_heads_with_1kb_proof() -> Weight { + // Minimum execution time: 44_024 nanoseconds. + Weight::from_ref_time(44_604_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0) + // Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0) + // Storage: BridgeRococoParachain ParasInfo (r:1 w:1) + // Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1) + // Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1) + fn submit_parachain_heads_with_16kb_proof() -> Weight { + // Minimum execution time: 96_346 nanoseconds. + Weight::from_ref_time(98_207_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs new file mode 100644 index 00000000000..6a4b86a6def --- /dev/null +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs @@ -0,0 +1,87 @@ +// Copyright 2021 Parity Technologies (UK) Ltd. +// This file is part of Cumulus. + +// Cumulus is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// Cumulus is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with Cumulus. If not, see . + +//! Autogenerated weights for `pallet_bridge_parachains` +//! +//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev +//! DATE: 2023-01-23, STEPS: `50`, REPEAT: 20, LOW RANGE: `[]`, HIGH RANGE: `[]` +//! HOSTNAME: `bm3`, CPU: `Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz` +//! 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 +// benchmark +// pallet +// --steps=50 +// --repeat=20 +// --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_parachains +// --chain=bridge-hub-rococo-dev +// --header=./file_header.txt +// --output=./parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/weights/ + +#![cfg_attr(rustfmt, rustfmt_skip)] +#![allow(unused_parens)] +#![allow(unused_imports)] + +use frame_support::{traits::Get, weights::Weight}; +use sp_std::marker::PhantomData; + +/// Weight functions for `pallet_bridge_parachains`. +pub struct WeightInfo(PhantomData); +impl pallet_bridge_parachains::WeightInfo for WeightInfo { + // Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0) + // Storage: BridgeWococoParachain ParasInfo (r:1 w:1) + // Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1) + // Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1) + /// The range of component `p` is `[1, 2]`. + /// The range of component `p` is `[1, 2]`. + fn submit_parachain_heads_with_n_parachains(p: u32, ) -> Weight { + // Minimum execution time: 36_411 nanoseconds. + Weight::from_ref_time(37_604_452) + // Standard Error: 57_620 + .saturating_add(Weight::from_ref_time(248_648).saturating_mul(p.into())) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0) + // Storage: BridgeWococoParachain ParasInfo (r:1 w:1) + // Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1) + // Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1) + fn submit_parachain_heads_with_1kb_proof() -> Weight { + // Minimum execution time: 45_107 nanoseconds. + Weight::from_ref_time(45_916_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } + // Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0) + // Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0) + // Storage: BridgeWococoParachain ParasInfo (r:1 w:1) + // Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1) + // Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1) + fn submit_parachain_heads_with_16kb_proof() -> Weight { + // Minimum execution time: 97_738 nanoseconds. + Weight::from_ref_time(100_381_000) + .saturating_add(T::DbWeight::get().reads(4)) + .saturating_add(T::DbWeight::get().writes(3)) + } +} diff --git a/scripts/benchmarks-ci.sh b/scripts/benchmarks-ci.sh index d4ad99d7bbe..b97373b390c 100755 --- a/scripts/benchmarks-ci.sh +++ b/scripts/benchmarks-ci.sh @@ -51,6 +51,9 @@ elif [[ $runtimeName == "bridge-hub-rococo" ]] || [[ $runtimeName == "bridge-hub cumulus_pallet_xcmp_queue pallet_xcm_benchmarks::generic pallet_xcm_benchmarks::fungible + pallet_bridge_grandpa + pallet_bridge_parachains + pallet_bridge_messages ) else echo "$runtimeName pallet list not found in benchmarks-ci.sh"