diff --git a/Cargo.lock b/Cargo.lock
index 390402ce88..e8e2fab659 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -384,6 +384,7 @@ name = "asset-test-utils"
version = "1.0.0"
dependencies = [
"assets-common",
+ "cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
"cumulus-pallet-xcmp-queue",
"cumulus-primitives-core",
@@ -758,6 +759,44 @@ dependencies = [
"thiserror",
]
+[[package]]
+name = "bp-bridge-hub-cumulus"
+version = "0.1.0"
+dependencies = [
+ "bp-messages",
+ "bp-polkadot-core",
+ "bp-runtime",
+ "frame-support",
+ "frame-system",
+ "polkadot-primitives",
+ "sp-api",
+ "sp-std",
+]
+
+[[package]]
+name = "bp-bridge-hub-rococo"
+version = "0.1.0"
+dependencies = [
+ "bp-bridge-hub-cumulus",
+ "bp-messages",
+ "bp-runtime",
+ "frame-support",
+ "sp-api",
+ "sp-std",
+]
+
+[[package]]
+name = "bp-bridge-hub-wococo"
+version = "0.1.0"
+dependencies = [
+ "bp-bridge-hub-cumulus",
+ "bp-messages",
+ "bp-runtime",
+ "frame-support",
+ "sp-api",
+ "sp-std",
+]
+
[[package]]
name = "bp-header-chain"
version = "0.1.0"
@@ -841,6 +880,17 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "bp-rococo"
+version = "0.1.0"
+dependencies = [
+ "bp-header-chain",
+ "bp-polkadot-core",
+ "bp-runtime",
+ "frame-support",
+ "sp-api",
+]
+
[[package]]
name = "bp-runtime"
version = "0.1.0"
@@ -877,6 +927,18 @@ dependencies = [
"sp-std",
]
+[[package]]
+name = "bp-wococo"
+version = "0.1.0"
+dependencies = [
+ "bp-header-chain",
+ "bp-polkadot-core",
+ "bp-rococo",
+ "bp-runtime",
+ "frame-support",
+ "sp-api",
+]
+
[[package]]
name = "bridge-hub-kusama-runtime"
version = "0.1.0"
@@ -1007,7 +1069,17 @@ dependencies = [
name = "bridge-hub-rococo-runtime"
version = "0.1.0"
dependencies = [
+ "bp-bridge-hub-rococo",
+ "bp-bridge-hub-wococo",
+ "bp-messages",
+ "bp-parachains",
+ "bp-polkadot-core",
+ "bp-relayers",
+ "bp-rococo",
+ "bp-runtime",
+ "bp-wococo",
"bridge-hub-test-utils",
+ "bridge-runtime-common",
"cumulus-pallet-aura-ext",
"cumulus-pallet-dmp-queue",
"cumulus-pallet-parachain-system",
@@ -1029,6 +1101,10 @@ dependencies = [
"pallet-aura",
"pallet-authorship",
"pallet-balances",
+ "pallet-bridge-grandpa",
+ "pallet-bridge-messages",
+ "pallet-bridge-parachains",
+ "pallet-bridge-relayers",
"pallet-collator-selection",
"pallet-multisig",
"pallet-session",
@@ -1060,6 +1136,7 @@ dependencies = [
"sp-std",
"sp-transaction-pool",
"sp-version",
+ "static_assertions",
"substrate-wasm-builder",
"xcm",
"xcm-builder",
@@ -1071,6 +1148,32 @@ name = "bridge-hub-test-utils"
version = "0.1.0"
dependencies = [
"asset-test-utils",
+ "bp-header-chain",
+ "bp-messages",
+ "bp-polkadot-core",
+ "bp-runtime",
+ "bp-test-utils",
+ "bridge-runtime-common",
+ "cumulus-pallet-dmp-queue",
+ "cumulus-pallet-parachain-system",
+ "cumulus-pallet-xcmp-queue",
+ "frame-support",
+ "frame-system",
+ "log",
+ "pallet-balances",
+ "pallet-bridge-grandpa",
+ "pallet-bridge-messages",
+ "pallet-collator-selection",
+ "pallet-session",
+ "pallet-xcm",
+ "pallet-xcm-benchmarks",
+ "parachain-info",
+ "parity-scale-codec",
+ "sp-io",
+ "sp-runtime",
+ "xcm",
+ "xcm-builder",
+ "xcm-executor",
]
[[package]]
@@ -4318,6 +4421,15 @@ dependencies = [
"libc",
]
+[[package]]
+name = "hermit-abi"
+version = "0.2.6"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
+dependencies = [
+ "libc",
+]
+
[[package]]
name = "hermit-abi"
version = "0.3.1"
@@ -6229,11 +6341,11 @@ dependencies = [
[[package]]
name = "num_cpus"
-version = "1.13.0"
+version = "1.15.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "05499f3756671c15885fee9034446956fff3f243d6077b91e5767df161f766b3"
+checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
dependencies = [
- "hermit-abi 0.1.19",
+ "hermit-abi 0.2.6",
"libc",
]
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/Cargo.toml b/system-parachains/bridge-hubs/bridge-hub-rococo/Cargo.toml
index d758e002cf..5722136abb 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/Cargo.toml
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/Cargo.toml
@@ -71,14 +71,42 @@ pallet-collator-selection = { path = "../../../../pallets/collator-selection", d
parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../../parachains/common", default-features = false }
+# Bridges
+bp-bridge-hub-rococo = { path = "../../../../bridges/primitives/chain-bridge-hub-rococo", default-features = false }
+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-relayers = { path = "../../../../bridges/primitives/relayers", 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 }
+pallet-bridge-grandpa = { path = "../../../../bridges/modules/grandpa", default-features = false }
+pallet-bridge-messages = { path = "../../../../bridges/modules/messages", default-features = false }
+pallet-bridge-parachains = { path = "../../../../bridges/modules/parachains", default-features = false }
+pallet-bridge-relayers = { path = "../../../../bridges/modules/relayers", default-features = false }
+bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", default-features = false }
+
[dev-dependencies]
+static_assertions = "1.1"
bridge-hub-test-utils = { path = "../test-utils"}
+bridge-runtime-common = { path = "../../../../bridges/bin/runtime-common", features = ["integrity-test"] }
[features]
default = [
"std",
]
std = [
+ "bp-bridge-hub-rococo/std",
+ "bp-bridge-hub-wococo/std",
+ "bp-messages/std",
+ "bp-parachains/std",
+ "bp-polkadot-core/std",
+ "bp-relayers/std",
+ "bp-runtime/std",
+ "bp-rococo/std",
+ "bp-wococo/std",
+ "bridge-runtime-common/std",
"codec/std",
"log/std",
"scale-info/std",
@@ -98,6 +126,10 @@ std = [
"pallet-aura/std",
"pallet-authorship/std",
"pallet-balances/std",
+ "pallet-bridge-grandpa/std",
+ "pallet-bridge-messages/std",
+ "pallet-bridge-parachains/std",
+ "pallet-bridge-relayers/std",
"pallet-collator-selection/std",
"pallet-multisig/std",
"pallet-session/std",
@@ -131,24 +163,34 @@ 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",
+ "cumulus-pallet-parachain-system/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-utility/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"cumulus-pallet-session-benchmarking/runtime-benchmarks",
- "pallet-collator-selection/runtime-benchmarks",
"cumulus-pallet-xcmp-queue/runtime-benchmarks",
"pallet-xcm-benchmarks/runtime-benchmarks",
]
try-runtime = [
+ "pallet-bridge-grandpa/try-runtime",
+ "pallet-bridge-messages/try-runtime",
+ "pallet-bridge-parachains/try-runtime",
+ "pallet-bridge-relayers/try-runtime",
"cumulus-pallet-aura-ext/try-runtime",
"cumulus-pallet-dmp-queue/try-runtime",
"cumulus-pallet-parachain-system/try-runtime",
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs
new file mode 100644
index 0000000000..bfa6f98eba
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs
@@ -0,0 +1,217 @@
+// Copyright 2022 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 .
+
+//! Bridge definitions that are used on Rococo to bridge with Wococo.
+
+use crate::{
+ BridgeParachainWococoInstance, ParachainInfo, Runtime, WithBridgeHubWococoMessagesInstance,
+ XcmRouter,
+};
+use bp_messages::LaneId;
+use bridge_runtime_common::{
+ messages,
+ messages::{
+ source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
+ MessageBridge, ThisChainWithMessages, UnderlyingChainProvider,
+ },
+ messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
+ refund_relayer_extension::{
+ ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
+ RefundableParachain,
+ },
+};
+use frame_support::{parameter_types, RuntimeDebug};
+use xcm::{
+ latest::prelude::*,
+ prelude::{InteriorMultiLocation, NetworkId},
+};
+use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter};
+
+parameter_types! {
+ pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce =
+ bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
+ pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
+ bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
+ pub const BridgeHubWococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID;
+ pub BridgeHubRococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Rococo), Parachain(ParachainInfo::parachain_id().into()));
+ pub WococoGlobalConsensusNetwork: NetworkId = NetworkId::Wococo;
+ pub ActiveOutboundLanesToBridgeHubWococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO];
+ pub PriorityBoostPerMessage: u64 = 921_900_294;
+}
+
+/// 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;
+
+/// Export XCM messages to be relayed to the otherside
+pub type ToBridgeHubWococoHaulBlobExporter = HaulBlobExporter<
+ XcmBlobHaulerAdapter,
+ WococoGlobalConsensusNetwork,
+ (),
+>;
+pub struct ToBridgeHubWococoXcmBlobHauler;
+impl XcmBlobHauler for ToBridgeHubWococoXcmBlobHauler {
+ type MessageSender =
+ pallet_bridge_messages::Pallet;
+
+ type MessageSenderOrigin = super::RuntimeOrigin;
+
+ fn message_sender_origin() -> Self::MessageSenderOrigin {
+ pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get()))
+ .into()
+ }
+
+ fn xcm_lane() -> LaneId {
+ DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO
+ }
+}
+pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO: LaneId = LaneId([0, 0, 0, 1]);
+
+/// Messaging Bridge configuration for BridgeHubRococo -> BridgeHubWococo
+pub struct WithBridgeHubWococoMessageBridge;
+impl MessageBridge for WithBridgeHubWococoMessageBridge {
+ const BRIDGED_MESSAGES_PALLET_NAME: &'static str =
+ bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME;
+ type ThisChain = BridgeHubRococo;
+ type BridgedChain = BridgeHubWococo;
+ type BridgedHeaderChain = pallet_bridge_parachains::ParachainHeaders<
+ Runtime,
+ BridgeParachainWococoInstance,
+ bp_bridge_hub_wococo::BridgeHubWococo,
+ >;
+}
+
+/// Message verifier for BridgeHubWococo messages sent from BridgeHubRococo
+pub type ToBridgeHubWococoMessageVerifier =
+ messages::source::FromThisChainMessageVerifier;
+
+/// Maximal outbound payload size of BridgeHubRococo -> BridgeHubWococo messages.
+pub type ToBridgeHubWococoMaximalOutboundPayloadSize =
+ messages::source::FromThisChainMaximalOutboundPayloadSize;
+
+/// BridgeHubWococo chain from message lane point of view.
+#[derive(RuntimeDebug, Clone, Copy)]
+pub struct BridgeHubWococo;
+
+impl UnderlyingChainProvider for BridgeHubWococo {
+ type Chain = bp_bridge_hub_wococo::BridgeHubWococo;
+}
+
+impl messages::BridgedChainWithMessages for BridgeHubWococo {}
+
+/// BridgeHubRococo chain from message lane point of view.
+#[derive(RuntimeDebug, Clone, Copy)]
+pub struct BridgeHubRococo;
+
+impl UnderlyingChainProvider for BridgeHubRococo {
+ type Chain = bp_bridge_hub_rococo::BridgeHubRococo;
+}
+
+impl ThisChainWithMessages for BridgeHubRococo {
+ type RuntimeOrigin = crate::RuntimeOrigin;
+}
+
+/// Signed extension that refunds relayers that are delivering messages from the Wococo parachain.
+pub type BridgeRefundBridgeHubWococoMessages = RefundBridgedParachainMessages<
+ Runtime,
+ RefundableParachain,
+ RefundableMessagesLane,
+ ActualFeeRefund,
+ PriorityBoostPerMessage,
+ StrBridgeRefundBridgeHubWococoMessages,
+>;
+bp_runtime::generate_static_str_provider!(BridgeRefundBridgeHubWococoMessages);
+
+parameter_types! {
+ pub const BridgeHubWococoMessagesLane: bp_messages::LaneId = DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO;
+ pub const BridgeHubWococoParachainId: u32 = {
+ use bp_runtime::Parachain;
+ BridgeHubWococo::PARACHAIN_ID
+ };
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::BridgeGrandpaWococoInstance;
+ use bridge_runtime_common::{
+ assert_complete_bridge_types,
+ integrity::{
+ assert_complete_bridge_constants, check_message_lane_weights,
+ AssertBridgeMessagesPalletConstants, AssertBridgePalletNames, AssertChainConstants,
+ AssertCompleteBridgeConstants,
+ },
+ };
+
+ #[test]
+ fn ensure_bridge_hub_rococo_message_lane_weights_are_correct() {
+ check_message_lane_weights::<
+ bp_bridge_hub_rococo::BridgeHubRococo,
+ Runtime,
+ WithBridgeHubWococoMessagesInstance,
+ >(
+ bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE,
+ bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
+ bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
+ true,
+ );
+ }
+
+ #[test]
+ fn ensure_bridge_integrity() {
+ assert_complete_bridge_types!(
+ runtime: Runtime,
+ with_bridged_chain_grandpa_instance: BridgeGrandpaWococoInstance,
+ with_bridged_chain_messages_instance: WithBridgeHubWococoMessagesInstance,
+ bridge: WithBridgeHubWococoMessageBridge,
+ this_chain: bp_rococo::Rococo,
+ bridged_chain: bp_wococo::Wococo,
+ );
+
+ assert_complete_bridge_constants::<
+ Runtime,
+ BridgeGrandpaWococoInstance,
+ WithBridgeHubWococoMessagesInstance,
+ WithBridgeHubWococoMessageBridge,
+ >(AssertCompleteBridgeConstants {
+ this_chain_constants: AssertChainConstants {
+ block_length: bp_bridge_hub_rococo::BlockLength::get(),
+ block_weights: bp_bridge_hub_rococo::BlockWeights::get(),
+ },
+ messages_pallet_constants: AssertBridgeMessagesPalletConstants {
+ max_unrewarded_relayers_in_bridged_confirmation_tx:
+ bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
+ max_unconfirmed_messages_in_bridged_confirmation_tx:
+ bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
+ bridged_chain_id: bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID,
+ },
+ pallet_names: AssertBridgePalletNames {
+ with_this_chain_messages_pallet_name:
+ bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME,
+ with_bridged_chain_grandpa_pallet_name: bp_wococo::WITH_WOCOCO_GRANDPA_PALLET_NAME,
+ with_bridged_chain_messages_pallet_name:
+ bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME,
+ },
+ });
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs
new file mode 100644
index 0000000000..2c9ec3c82b
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs
@@ -0,0 +1,217 @@
+// Copyright 2022 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 .
+
+//! Bridge definitions that are used on Wococo to bridge with Rococo.
+
+use crate::{
+ BridgeParachainRococoInstance, ParachainInfo, Runtime, WithBridgeHubRococoMessagesInstance,
+ XcmRouter,
+};
+use bp_messages::LaneId;
+use bridge_runtime_common::{
+ messages,
+ messages::{
+ source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
+ MessageBridge, ThisChainWithMessages, UnderlyingChainProvider,
+ },
+ messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
+ refund_relayer_extension::{
+ ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
+ RefundableParachain,
+ },
+};
+use frame_support::{parameter_types, RuntimeDebug};
+use xcm::{
+ latest::prelude::*,
+ prelude::{InteriorMultiLocation, NetworkId},
+};
+use xcm_builder::{BridgeBlobDispatcher, HaulBlobExporter};
+
+parameter_types! {
+ pub const MaxUnrewardedRelayerEntriesAtInboundLane: bp_messages::MessageNonce =
+ bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX;
+ pub const MaxUnconfirmedMessagesAtInboundLane: bp_messages::MessageNonce =
+ bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX;
+ pub const BridgeHubRococoChainId: bp_runtime::ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
+ pub BridgeHubWococoUniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(Wococo), Parachain(ParachainInfo::parachain_id().into()));
+ pub RococoGlobalConsensusNetwork: NetworkId = NetworkId::Rococo;
+ pub ActiveOutboundLanesToBridgeHubRococo: &'static [bp_messages::LaneId] = &[DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO];
+ pub PriorityBoostPerMessage: u64 = 921_900_294;
+}
+
+/// 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;
+
+/// Export XCM messages to be relayed to the otherside
+pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter<
+ XcmBlobHaulerAdapter,
+ RococoGlobalConsensusNetwork,
+ (),
+>;
+pub struct ToBridgeHubRococoXcmBlobHauler;
+impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler {
+ type MessageSender =
+ pallet_bridge_messages::Pallet;
+
+ type MessageSenderOrigin = super::RuntimeOrigin;
+
+ fn message_sender_origin() -> super::RuntimeOrigin {
+ pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get()))
+ .into()
+ }
+
+ fn xcm_lane() -> LaneId {
+ DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO
+ }
+}
+pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO: LaneId = LaneId([0, 0, 0, 1]);
+
+/// Messaging Bridge configuration for BridgeHubWococo -> BridgeHubRococo
+pub struct WithBridgeHubRococoMessageBridge;
+impl MessageBridge for WithBridgeHubRococoMessageBridge {
+ const BRIDGED_MESSAGES_PALLET_NAME: &'static str =
+ bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME;
+ type ThisChain = BridgeHubWococo;
+ type BridgedChain = BridgeHubRococo;
+ type BridgedHeaderChain = pallet_bridge_parachains::ParachainHeaders<
+ Runtime,
+ BridgeParachainRococoInstance,
+ bp_bridge_hub_rococo::BridgeHubRococo,
+ >;
+}
+
+/// Message verifier for BridgeHubRococo messages sent from BridgeHubWococo
+pub type ToBridgeHubRococoMessageVerifier =
+ messages::source::FromThisChainMessageVerifier;
+
+/// Maximal outbound payload size of BridgeHubWococo -> BridgeHubRococo messages.
+pub type ToBridgeHubRococoMaximalOutboundPayloadSize =
+ messages::source::FromThisChainMaximalOutboundPayloadSize;
+
+/// BridgeHubRococo chain from message lane point of view.
+#[derive(RuntimeDebug, Clone, Copy)]
+pub struct BridgeHubRococo;
+
+impl UnderlyingChainProvider for BridgeHubRococo {
+ type Chain = bp_bridge_hub_rococo::BridgeHubRococo;
+}
+
+impl messages::BridgedChainWithMessages for BridgeHubRococo {}
+
+/// BridgeHubWococo chain from message lane point of view.
+#[derive(RuntimeDebug, Clone, Copy)]
+pub struct BridgeHubWococo;
+
+impl UnderlyingChainProvider for BridgeHubWococo {
+ type Chain = bp_bridge_hub_wococo::BridgeHubWococo;
+}
+
+impl ThisChainWithMessages for BridgeHubWococo {
+ type RuntimeOrigin = crate::RuntimeOrigin;
+}
+
+/// Signed extension that refunds relayers that are delivering messages from the Rococo parachain.
+pub type BridgeRefundBridgeHubRococoMessages = RefundBridgedParachainMessages<
+ Runtime,
+ RefundableParachain,
+ RefundableMessagesLane,
+ ActualFeeRefund,
+ PriorityBoostPerMessage,
+ StrBridgeRefundBridgeHubRococoMessages,
+>;
+bp_runtime::generate_static_str_provider!(BridgeRefundBridgeHubRococoMessages);
+
+parameter_types! {
+ pub const BridgeHubRococoMessagesLane: bp_messages::LaneId = DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO;
+ pub const BridgeHubRococoParachainId: u32 = {
+ use bp_runtime::Parachain;
+ BridgeHubRococo::PARACHAIN_ID
+ };
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use crate::BridgeGrandpaRococoInstance;
+ use bridge_runtime_common::{
+ assert_complete_bridge_types,
+ integrity::{
+ assert_complete_bridge_constants, check_message_lane_weights,
+ AssertBridgeMessagesPalletConstants, AssertBridgePalletNames, AssertChainConstants,
+ AssertCompleteBridgeConstants,
+ },
+ };
+
+ #[test]
+ fn ensure_bridge_hub_wococo_message_lane_weights_are_correct() {
+ check_message_lane_weights::<
+ bp_bridge_hub_wococo::BridgeHubWococo,
+ Runtime,
+ WithBridgeHubRococoMessagesInstance,
+ >(
+ bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE,
+ bp_bridge_hub_wococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
+ bp_bridge_hub_wococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
+ true,
+ );
+ }
+
+ #[test]
+ fn ensure_bridge_integrity() {
+ assert_complete_bridge_types!(
+ runtime: Runtime,
+ with_bridged_chain_grandpa_instance: BridgeGrandpaRococoInstance,
+ with_bridged_chain_messages_instance: WithBridgeHubRococoMessagesInstance,
+ bridge: WithBridgeHubRococoMessageBridge,
+ this_chain: bp_wococo::Wococo,
+ bridged_chain: bp_rococo::Rococo,
+ );
+
+ assert_complete_bridge_constants::<
+ Runtime,
+ BridgeGrandpaRococoInstance,
+ WithBridgeHubRococoMessagesInstance,
+ WithBridgeHubRococoMessageBridge,
+ >(AssertCompleteBridgeConstants {
+ this_chain_constants: AssertChainConstants {
+ block_length: bp_bridge_hub_wococo::BlockLength::get(),
+ block_weights: bp_bridge_hub_wococo::BlockWeights::get(),
+ },
+ messages_pallet_constants: AssertBridgeMessagesPalletConstants {
+ max_unrewarded_relayers_in_bridged_confirmation_tx:
+ bp_bridge_hub_rococo::MAX_UNREWARDED_RELAYERS_IN_CONFIRMATION_TX,
+ max_unconfirmed_messages_in_bridged_confirmation_tx:
+ bp_bridge_hub_rococo::MAX_UNCONFIRMED_MESSAGES_IN_CONFIRMATION_TX,
+ bridged_chain_id: bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID,
+ },
+ pallet_names: AssertBridgePalletNames {
+ with_this_chain_messages_pallet_name:
+ bp_bridge_hub_wococo::WITH_BRIDGE_HUB_WOCOCO_MESSAGES_PALLET_NAME,
+ with_bridged_chain_grandpa_pallet_name: bp_rococo::WITH_ROCOCO_GRANDPA_PALLET_NAME,
+ with_bridged_chain_messages_pallet_name:
+ bp_bridge_hub_rococo::WITH_BRIDGE_HUB_ROCOCO_MESSAGES_PALLET_NAME,
+ },
+ });
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/constants.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/constants.rs
index 86cf8d6f7d..ba80cd2b6d 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/src/constants.rs
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/constants.rs
@@ -22,6 +22,7 @@ pub mod currency {
pub const UNITS: Balance = constants::currency::UNITS;
pub const CENTS: Balance = constants::currency::CENTS;
+ pub const MILLICENTS: Balance = constants::currency::MILLICENTS;
pub const fn deposit(items: u32, bytes: u32) -> Balance {
// map to 1/100 of what the rococo relay chain charges
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/lib.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/lib.rs
index 2e985546e0..21f02ce476 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/src/lib.rs
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/lib.rs
@@ -22,12 +22,14 @@
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
+pub mod bridge_hub_rococo_config;
+pub mod bridge_hub_wococo_config;
pub mod constants;
mod weights;
pub mod xcm_config;
+use constants::currency::*;
use cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases;
-use smallvec::smallvec;
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{
@@ -42,17 +44,12 @@ use sp_std::prelude::*;
use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
-use constants::currency::*;
use frame_support::{
construct_runtime,
dispatch::DispatchClass,
- pallet_prelude::Weight,
parameter_types,
traits::{ConstU32, ConstU64, ConstU8, Everything},
- weights::{
- ConstantMultiplier, FeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients,
- WeightToFeePolynomial,
- },
+ weights::{ConstantMultiplier, Weight},
PalletId,
};
use frame_system::{
@@ -63,21 +60,40 @@ pub use sp_consensus_aura::sr25519::AuthorityId as AuraId;
pub use sp_runtime::{MultiAddress, Perbill, Permill};
use xcm_config::{XcmConfig, XcmOriginToTransactDispatchOrigin};
+use bp_parachains::SingleParaStoredHeaderDataBuilder;
+use bp_runtime::HeaderId;
+
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
-// Polkadot imports
use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
-// XCM Imports
+use crate::{
+ bridge_hub_rococo_config::{
+ BridgeRefundBridgeHubWococoMessages, OnBridgeHubRococoBlobDispatcher,
+ WithBridgeHubWococoMessageBridge,
+ },
+ bridge_hub_wococo_config::{
+ BridgeRefundBridgeHubRococoMessages, OnBridgeHubWococoBlobDispatcher,
+ WithBridgeHubRococoMessageBridge,
+ },
+ constants::fee::WeightToFee,
+ xcm_config::XcmRouter,
+};
+use bridge_runtime_common::{
+ messages::{source::TargetHeaderChainAdapter, target::SourceHeaderChainAdapter},
+ messages_xcm_extension::{XcmAsPlainPayload, XcmBlobMessageDispatch},
+};
use parachains_common::{
impls::DealWithFees, opaque, AccountId, Balance, BlockNumber, Hash, Header, Index, Signature,
AVERAGE_ON_INITIALIZE_RATIO, HOURS, MAXIMUM_BLOCK_WEIGHT, NORMAL_DISPATCH_RATIO, SLOT_DURATION,
};
use xcm_executor::XcmExecutor;
+pub const LOG_TARGET: &str = "runtime::bridge-hub";
+
/// The address format for describing accounts.
pub type Address = MultiAddress;
@@ -100,6 +116,8 @@ pub type SignedExtra = (
frame_system::CheckNonce,
frame_system::CheckWeight,
pallet_transaction_payment::ChargeTransactionPayment,
+ BridgeRejectObsoleteHeadersAndMessages,
+ (BridgeRefundBridgeHubRococoMessages, BridgeRefundBridgeHubWococoMessages),
);
/// Unchecked extrinsic type as expected by this runtime.
@@ -118,64 +136,6 @@ pub type Executive = frame_executive::Executive<
AllPalletsWithSystem,
>;
-/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
-/// node's balance type.
-///
-/// This should typically create a mapping between the following ranges:
-/// - `[0, MAXIMUM_BLOCK_WEIGHT]`
-/// - `[Balance::min, Balance::max]`
-///
-/// Yet, it can be used for any other sort of change to weight-fee. Some examples being:
-/// - Setting it to `0` will essentially disable the weight fee.
-/// - Setting it to `1` will cause the literal `#[weight = x]` values to be charged.
-pub struct WeightToFee;
-impl frame_support::weights::WeightToFee for WeightToFee {
- type Balance = Balance;
-
- fn weight_to_fee(weight: &Weight) -> Self::Balance {
- let time_poly: FeePolynomial = RefTimeToFee::polynomial().into();
- let proof_poly: FeePolynomial = ProofSizeToFee::polynomial().into();
-
- // Take the maximum instead of the sum to charge by the more scarce resource.
- time_poly.eval(weight.ref_time()).max(proof_poly.eval(weight.proof_size()))
- }
-}
-
-/// Maps the reference time component of `Weight` to a fee.
-pub struct RefTimeToFee;
-impl WeightToFeePolynomial for RefTimeToFee {
- type Balance = Balance;
- fn polynomial() -> WeightToFeeCoefficients {
- let p = MILLIUNIT / 10;
- let q = 100 * Balance::from(ExtrinsicBaseWeight::get().ref_time());
-
- smallvec![WeightToFeeCoefficient {
- degree: 1,
- negative: false,
- coeff_frac: Perbill::from_rational(p % q, q),
- coeff_integer: p / q,
- }]
- }
-}
-
-/// Maps the proof size component of `Weight` to a fee.
-pub struct ProofSizeToFee;
-impl WeightToFeePolynomial for ProofSizeToFee {
- type Balance = Balance;
- fn polynomial() -> WeightToFeeCoefficients {
- // Map 10kb proof to 1/10 MILLIUNIT.
- let p = MILLIUNIT / 10;
- let q = 10_000;
-
- smallvec![WeightToFeeCoefficient {
- degree: 1,
- negative: false,
- coeff_frac: Perbill::from_rational(p % q, q),
- coeff_integer: p / q,
- }]
- }
-}
-
impl_opaque_keys! {
pub struct SessionKeys {
pub aura: Aura,
@@ -194,13 +154,6 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
state_version: 1,
};
-// Unit = the base number of indivisible units for balances
-pub const MILLIUNIT: Balance = 1_000_000_000;
-pub const MICROUNIT: Balance = 1_000_000;
-
-/// The existential deposit. Set to 1/10 of the Connected Relay Chain.
-pub const EXISTENTIAL_DEPOSIT: Balance = MILLIUNIT;
-
/// The version information used to identify this runtime when compiled natively.
#[cfg(feature = "std")]
pub fn native_version() -> NativeVersion {
@@ -281,7 +234,7 @@ impl frame_system::Config for Runtime {
type SS58Prefix = SS58Prefix;
/// The action to take on a Runtime Upgrade
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode;
- type MaxConsumers = ConstU32<16>;
+ type MaxConsumers = frame_support::traits::ConstU32<16>;
}
impl pallet_timestamp::Config for Runtime {
@@ -321,7 +274,7 @@ impl pallet_balances::Config for Runtime {
parameter_types! {
/// Relay Chain `TransactionByteFee` / 10
- pub const TransactionByteFee: Balance = 10 * MICROUNIT;
+ pub const TransactionByteFee: Balance = 1 * MILLICENTS;
}
impl pallet_transaction_payment::Config for Runtime {
@@ -443,6 +396,153 @@ impl pallet_utility::Config for Runtime {
type WeightInfo = weights::pallet_utility::WeightInfo;
}
+// Add bridge pallets (GPA)
+
+/// Add GRANDPA bridge pallet to track Wococo relay chain on Rococo BridgeHub
+pub type BridgeGrandpaWococoInstance = pallet_bridge_grandpa::Instance1;
+impl pallet_bridge_grandpa::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type BridgedChain = bp_wococo::Wococo;
+ type MaxFreeMandatoryHeadersPerBlock = ConstU32<4>;
+ type HeadersToKeep = RelayChainHeadersToKeep;
+ type WeightInfo = weights::pallet_bridge_grandpa_bridge_wococo_grandpa::WeightInfo;
+}
+
+/// Add GRANDPA bridge pallet to track Rococo relay chain on Wococo BridgeHub
+pub type BridgeGrandpaRococoInstance = pallet_bridge_grandpa::Instance2;
+impl pallet_bridge_grandpa::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type BridgedChain = bp_rococo::Rococo;
+ type MaxFreeMandatoryHeadersPerBlock = ConstU32<4>;
+ type HeadersToKeep = RelayChainHeadersToKeep;
+ type WeightInfo = weights::pallet_bridge_grandpa_bridge_rococo_grandpa::WeightInfo;
+}
+
+parameter_types! {
+ pub const RelayChainHeadersToKeep: u32 = 1024;
+ pub const ParachainHeadsToKeep: u32 = 64;
+ pub const RelayerStakeLease: u32 = 8;
+
+ pub const RococoBridgeParachainPalletName: &'static str = "Paras";
+ pub const WococoBridgeParachainPalletName: &'static str = "Paras";
+ pub const MaxRococoParaHeadDataSize: u32 = bp_rococo::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE;
+ pub const MaxWococoParaHeadDataSize: u32 = bp_wococo::MAX_NESTED_PARACHAIN_HEAD_DATA_SIZE;
+
+ pub storage DeliveryRewardInBalance: u64 = 1_000_000;
+ pub storage RequiredStakeForStakeAndSlash: Balance = 1_000_000;
+
+ pub const RelayerStakeReserveId: [u8; 8] = *b"brdgrlrs";
+}
+
+/// Add parachain bridge pallet to track Wococo bridge hub parachain
+pub type BridgeParachainWococoInstance = pallet_bridge_parachains::Instance1;
+impl pallet_bridge_parachains::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type WeightInfo = weights::pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance::WeightInfo;
+ type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance;
+ type ParasPalletName = WococoBridgeParachainPalletName;
+ type ParaStoredHeaderDataBuilder =
+ SingleParaStoredHeaderDataBuilder;
+ type HeadsToKeep = ParachainHeadsToKeep;
+ type MaxParaHeadDataSize = MaxWococoParaHeadDataSize;
+}
+
+/// Add parachain bridge pallet to track Rococo bridge hub parachain
+pub type BridgeParachainRococoInstance = pallet_bridge_parachains::Instance2;
+impl pallet_bridge_parachains::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type WeightInfo = weights::pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance::WeightInfo;
+ type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance;
+ type ParasPalletName = RococoBridgeParachainPalletName;
+ type ParaStoredHeaderDataBuilder =
+ SingleParaStoredHeaderDataBuilder;
+ type HeadsToKeep = ParachainHeadsToKeep;
+ type MaxParaHeadDataSize = MaxRococoParaHeadDataSize;
+}
+
+/// Add XCM messages support for BridgeHubRococo to support Rococo->Wococo XCM messages
+pub type WithBridgeHubWococoMessagesInstance = pallet_bridge_messages::Instance1;
+impl pallet_bridge_messages::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ 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 =
+ bridge_hub_rococo_config::MaxUnrewardedRelayerEntriesAtInboundLane;
+ type MaxUnconfirmedMessagesAtInboundLane =
+ bridge_hub_rococo_config::MaxUnconfirmedMessagesAtInboundLane;
+
+ type MaximalOutboundPayloadSize =
+ bridge_hub_rococo_config::ToBridgeHubWococoMaximalOutboundPayloadSize;
+ type OutboundPayload = XcmAsPlainPayload;
+
+ type InboundPayload = XcmAsPlainPayload;
+ type InboundRelayer = AccountId;
+ type DeliveryPayments = ();
+
+ type TargetHeaderChain = TargetHeaderChainAdapter;
+ type LaneMessageVerifier = bridge_hub_rococo_config::ToBridgeHubWococoMessageVerifier;
+ type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
+ Runtime,
+ WithBridgeHubWococoMessagesInstance,
+ DeliveryRewardInBalance,
+ >;
+
+ type SourceHeaderChain = SourceHeaderChainAdapter;
+ type MessageDispatch =
+ XcmBlobMessageDispatch;
+}
+
+/// Add XCM messages support for BridgeHubWococo to support Wococo->Rococo XCM messages
+pub type WithBridgeHubRococoMessagesInstance = pallet_bridge_messages::Instance2;
+impl pallet_bridge_messages::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ 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 =
+ bridge_hub_wococo_config::MaxUnrewardedRelayerEntriesAtInboundLane;
+ type MaxUnconfirmedMessagesAtInboundLane =
+ bridge_hub_wococo_config::MaxUnconfirmedMessagesAtInboundLane;
+
+ type MaximalOutboundPayloadSize =
+ bridge_hub_wococo_config::ToBridgeHubRococoMaximalOutboundPayloadSize;
+ type OutboundPayload = XcmAsPlainPayload;
+
+ type InboundPayload = XcmAsPlainPayload;
+ type InboundRelayer = AccountId;
+ type DeliveryPayments = ();
+
+ type TargetHeaderChain = TargetHeaderChainAdapter;
+ type LaneMessageVerifier = bridge_hub_wococo_config::ToBridgeHubRococoMessageVerifier;
+ type DeliveryConfirmationPayments = pallet_bridge_relayers::DeliveryConfirmationPaymentsAdapter<
+ Runtime,
+ WithBridgeHubRococoMessagesInstance,
+ DeliveryRewardInBalance,
+ >;
+
+ type SourceHeaderChain = SourceHeaderChainAdapter;
+ type MessageDispatch =
+ XcmBlobMessageDispatch;
+}
+
+/// Allows collect and claim rewards for relayers
+impl pallet_bridge_relayers::Config for Runtime {
+ type RuntimeEvent = RuntimeEvent;
+ type Reward = Balance;
+ type PaymentProcedure =
+ bp_relayers::PayRewardFromAccount, AccountId>;
+ type StakeAndSlash = pallet_bridge_relayers::StakeAndSlashNamed<
+ AccountId,
+ BlockNumber,
+ Balances,
+ RelayerStakeReserveId,
+ RequiredStakeForStakeAndSlash,
+ RelayerStakeLease,
+ >;
+ type WeightInfo = weights::pallet_bridge_relayers::WeightInfo;
+}
+
// Create the runtime by composing the FRAME pallets that were previously configured.
construct_runtime!(
pub enum Runtime where
@@ -477,10 +577,36 @@ construct_runtime!(
// Handy utilities.
Utility: pallet_utility::{Pallet, Call, Event} = 40,
- Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 41,
+ Multisig: pallet_multisig::{Pallet, Call, Storage, Event} = 36,
+
+ // 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, Event, Config} = 41,
+ BridgeWococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage, Event} = 42,
+ BridgeWococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 46,
+
+ // With-Rococo bridge modules that are active (used) at Wococo Bridge Hub runtime.
+ BridgeRococoGrandpa: pallet_bridge_grandpa::::{Pallet, Call, Storage, Event, Config} = 43,
+ BridgeRococoParachain: pallet_bridge_parachains::::{Pallet, Call, Storage, Event} = 44,
+ BridgeRococoMessages: pallet_bridge_messages::::{Pallet, Call, Storage, Event, Config} = 45,
+
+ BridgeRelayers: pallet_bridge_relayers::{Pallet, Call, Storage, Event} = 47,
}
);
+bridge_runtime_common::generate_bridge_reject_obsolete_headers_and_messages! {
+ RuntimeCall, AccountId,
+ // Grandpa
+ BridgeRococoGrandpa, BridgeWococoGrandpa,
+ // Parachains
+ BridgeRococoParachain, BridgeWococoParachain,
+ // Messages
+ BridgeRococoMessages, BridgeWococoMessages
+}
+
#[cfg(feature = "runtime-benchmarks")]
#[macro_use]
extern crate frame_benchmarking;
@@ -501,6 +627,16 @@ 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::]
+ // Bridge relayer pallets
+ [pallet_bridge_relayers, BridgeRelayersBench::]
);
}
@@ -625,6 +761,89 @@ impl_runtime_apis! {
}
}
+ impl bp_rococo::RococoFinalityApi for Runtime {
+ fn best_finalized() -> Option> {
+ BridgeRococoGrandpa::best_finalized()
+ }
+ }
+
+ impl bp_wococo::WococoFinalityApi for Runtime {
+ fn best_finalized() -> Option> {
+ BridgeWococoGrandpa::best_finalized()
+ }
+ }
+
+
+ impl bp_bridge_hub_rococo::BridgeHubRococoFinalityApi for Runtime {
+ fn best_finalized() -> Option> {
+ BridgeRococoParachain::best_parachain_head_id::<
+ bp_bridge_hub_rococo::BridgeHubRococo
+ >().unwrap_or(None)
+ }
+ }
+
+ impl bp_bridge_hub_wococo::BridgeHubWococoFinalityApi for Runtime {
+ fn best_finalized() -> Option> {
+ BridgeWococoParachain::best_parachain_head_id::<
+ bp_bridge_hub_wococo::BridgeHubWococo
+ >().unwrap_or(None)
+ }
+ }
+
+ // This exposed by BridgeHubRococo
+ impl bp_bridge_hub_wococo::FromBridgeHubWococoInboundLaneApi for Runtime {
+ fn message_details(
+ lane: bp_messages::LaneId,
+ messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>,
+ ) -> Vec {
+ bridge_runtime_common::messages_api::inbound_message_details::<
+ Runtime,
+ WithBridgeHubWococoMessagesInstance,
+ >(lane, messages)
+ }
+ }
+
+ // This exposed by BridgeHubRococo
+ impl bp_bridge_hub_wococo::ToBridgeHubWococoOutboundLaneApi for Runtime {
+ fn message_details(
+ lane: bp_messages::LaneId,
+ begin: bp_messages::MessageNonce,
+ end: bp_messages::MessageNonce,
+ ) -> Vec {
+ bridge_runtime_common::messages_api::outbound_message_details::<
+ Runtime,
+ WithBridgeHubWococoMessagesInstance,
+ >(lane, begin, end)
+ }
+ }
+
+ // This is exposed by BridgeHubWococo
+ impl bp_bridge_hub_rococo::FromBridgeHubRococoInboundLaneApi for Runtime {
+ fn message_details(
+ lane: bp_messages::LaneId,
+ messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>,
+ ) -> Vec {
+ bridge_runtime_common::messages_api::inbound_message_details::<
+ Runtime,
+ WithBridgeHubRococoMessagesInstance,
+ >(lane, messages)
+ }
+ }
+
+ // This is exposed by BridgeHubWococo
+ impl bp_bridge_hub_rococo::ToBridgeHubRococoOutboundLaneApi for Runtime {
+ fn message_details(
+ lane: bp_messages::LaneId,
+ begin: bp_messages::MessageNonce,
+ end: bp_messages::MessageNonce,
+ ) -> Vec {
+ bridge_runtime_common::messages_api::outbound_message_details::<
+ Runtime,
+ WithBridgeHubRococoMessagesInstance,
+ >(lane, begin, end)
+ }
+ }
+
#[cfg(feature = "try-runtime")]
impl frame_try_runtime::TryRuntime for Runtime {
fn on_runtime_upgrade(checks: frame_try_runtime::UpgradeCheckSelect) -> (Weight, Weight) {
@@ -661,6 +880,10 @@ 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;
+ use pallet_bridge_relayers::benchmarking::Pallet as BridgeRelayersBench;
+
let mut list = Vec::::new();
list_benchmarks!(list, extra);
@@ -758,13 +981,183 @@ impl_runtime_apis! {
fn export_message_origin_and_destination(
) -> Result<(MultiLocation, NetworkId, InteriorMultiLocation), BenchmarkError> {
- Err(BenchmarkError::Skip)
+ Ok((RelayLocation::get(), NetworkId::Wococo, X1(Parachain(100))))
}
}
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(relayer: &Self::AccountId) -> bool {
+ let bench_lane_id = >::bench_lane_id();
+ let bridged_chain_id = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID;
+ pallet_bridge_relayers::Pallet::::relayer_reward(
+ relayer,
+ bp_relayers::RewardsAccountParams::new(
+ bench_lane_id,
+ bridged_chain_id,
+ bp_relayers::RewardsAccountOwner::BridgedChain
+ )
+ ).is_some()
+ }
+
+ fn prepare_message_proof(
+ params: MessageProofParams,
+ ) -> (bridge_hub_rococo_config::FromWococoBridgeHubMessagesProof, Weight) {
+ use cumulus_primitives_core::XcmpMessageSource;
+ assert!(XcmpQueue::take_outbound_messages(usize::MAX).is_empty());
+ ParachainSystem::open_outbound_hrmp_channel_for_benchmarks(42.into());
+ prepare_message_proof_from_parachain::<
+ Runtime,
+ BridgeGrandpaWococoInstance,
+ bridge_hub_rococo_config::WithBridgeHubWococoMessageBridge,
+ >(params, X2(GlobalConsensus(Rococo), Parachain(42)))
+ }
+
+ 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)
+ }
+
+ fn is_message_successfully_dispatched(_nonce: bp_messages::MessageNonce) -> bool {
+ use cumulus_primitives_core::XcmpMessageSource;
+ !XcmpQueue::take_outbound_messages(usize::MAX).is_empty()
+ }
+ }
+
+ impl BridgeMessagesConfig for Runtime {
+ fn is_relayer_rewarded(relayer: &Self::AccountId) -> bool {
+ let bench_lane_id = >::bench_lane_id();
+ let bridged_chain_id = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID;
+ pallet_bridge_relayers::Pallet::::relayer_reward(
+ relayer,
+ bp_relayers::RewardsAccountParams::new(
+ bench_lane_id,
+ bridged_chain_id,
+ bp_relayers::RewardsAccountOwner::BridgedChain
+ )
+ ).is_some()
+ }
+
+ fn prepare_message_proof(
+ params: MessageProofParams,
+ ) -> (bridge_hub_wococo_config::FromRococoBridgeHubMessagesProof, Weight) {
+ use cumulus_primitives_core::XcmpMessageSource;
+ assert!(XcmpQueue::take_outbound_messages(usize::MAX).is_empty());
+ ParachainSystem::open_outbound_hrmp_channel_for_benchmarks(42.into());
+ prepare_message_proof_from_parachain::<
+ Runtime,
+ BridgeGrandpaRococoInstance,
+ bridge_hub_wococo_config::WithBridgeHubRococoMessageBridge,
+ >(params, X2(GlobalConsensus(Wococo), Parachain(42)))
+ }
+
+ 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)
+ }
+
+ fn is_message_successfully_dispatched(_nonce: bp_messages::MessageNonce) -> bool {
+ use cumulus_primitives_core::XcmpMessageSource;
+ !XcmpQueue::take_outbound_messages(usize::MAX).is_empty()
+ }
+ }
+
+ use bridge_runtime_common::parachains_benchmarking::prepare_parachain_heads_proof;
+ use pallet_bridge_parachains::benchmarking::{
+ Config as BridgeParachainsConfig,
+ Pallet as BridgeParachainsBench,
+ };
+ use pallet_bridge_relayers::benchmarking::{
+ Pallet as BridgeRelayersBench,
+ Config as BridgeRelayersConfig,
+ };
+
+ 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,
+ )
+ }
+ }
+
+ impl BridgeRelayersConfig for Runtime {
+ fn prepare_rewards_account(
+ account_params: bp_relayers::RewardsAccountParams,
+ reward: Balance,
+ ) {
+ let rewards_account = bp_relayers::PayRewardFromAccount::<
+ Balances,
+ AccountId
+ >::rewards_account(account_params);
+ Self::deposit_account(rewards_account, reward);
+ }
+
+ fn deposit_account(account: AccountId, balance: Balance) {
+ use frame_support::traits::fungible::Mutate;
+ Balances::mint_into(&account, balance.saturating_add(ExistentialDeposit::get())).unwrap();
+ }
+ }
+
let whitelist: Vec = vec![
// Block Number
hex_literal::hex!("26aa394eea5630e07c48ae0c9558cef702a5c1b19ab7a04f536c519aca4983ac").to_vec().into(),
@@ -815,3 +1208,59 @@ cumulus_pallet_parachain_system::register_validate_block! {
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::,
CheckInherents = CheckInherents,
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+ use bp_runtime::TransactionEra;
+ use bridge_hub_test_utils::test_header;
+ use codec::Encode;
+
+ pub type TestBlockHeader =
+ sp_runtime::generic::Header;
+
+ #[test]
+ fn ensure_signed_extension_definition_is_compatible_with_relay() {
+ let payload: SignedExtra = (
+ frame_system::CheckNonZeroSender::new(),
+ frame_system::CheckSpecVersion::new(),
+ frame_system::CheckTxVersion::new(),
+ frame_system::CheckGenesis::new(),
+ frame_system::CheckEra::from(sp_runtime::generic::Era::Immortal),
+ frame_system::CheckNonce::from(10),
+ frame_system::CheckWeight::new(),
+ pallet_transaction_payment::ChargeTransactionPayment::from(10),
+ BridgeRejectObsoleteHeadersAndMessages {},
+ (
+ BridgeRefundBridgeHubRococoMessages::default(),
+ BridgeRefundBridgeHubWococoMessages::default(),
+ ),
+ );
+
+ {
+ use bp_bridge_hub_rococo::BridgeHubSignedExtension;
+ let bhr_indirect_payload = bp_bridge_hub_rococo::SignedExtension::from_params(
+ 10,
+ 10,
+ TransactionEra::Immortal,
+ test_header::(1).hash(),
+ 10,
+ 10,
+ );
+ assert_eq!(payload.encode(), bhr_indirect_payload.encode());
+ }
+
+ {
+ use bp_bridge_hub_wococo::BridgeHubSignedExtension;
+ let bhw_indirect_payload = bp_bridge_hub_wococo::SignedExtension::from_params(
+ 10,
+ 10,
+ TransactionEra::Immortal,
+ test_header::(1).hash(),
+ 10,
+ 10,
+ );
+ assert_eq!(payload.encode(), bhw_indirect_payload.encode());
+ }
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs
index d5722374de..286c8010f8 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/mod.rs
@@ -22,6 +22,13 @@ 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_bridge_relayers;
pub mod pallet_collator_selection;
pub mod pallet_multisig;
pub mod pallet_session;
@@ -36,3 +43,49 @@ pub use block_weights::constants::BlockExecutionWeight;
pub use extrinsic_weights::constants::ExtrinsicBaseWeight;
pub use paritydb_weights::constants::ParityDbWeight;
pub use rocksdb_weights::constants::RocksDbWeight;
+
+use crate::Runtime;
+use frame_support::weights::Weight;
+
+// import trait from dependency module
+use ::pallet_bridge_relayers::WeightInfoExt as _;
+
+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
+ }
+
+ fn receive_messages_proof_overhead_from_runtime() -> Weight {
+ pallet_bridge_relayers::WeightInfo::::receive_messages_proof_overhead_from_runtime()
+ }
+
+ fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight {
+ pallet_bridge_relayers::WeightInfo::::receive_messages_delivery_proof_overhead_from_runtime()
+ }
+}
+
+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
+ }
+
+ fn receive_messages_proof_overhead_from_runtime() -> Weight {
+ pallet_bridge_relayers::WeightInfo::::receive_messages_proof_overhead_from_runtime()
+ }
+
+ fn receive_messages_delivery_proof_overhead_from_runtime() -> Weight {
+ pallet_bridge_relayers::WeightInfo::::receive_messages_delivery_proof_overhead_from_runtime()
+ }
+}
+
+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/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs
new file mode 100644
index 0000000000..68e540adb7
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_rococo_grandpa.rs
@@ -0,0 +1,80 @@
+// Copyright 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-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::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)
+ /// Proof: BridgeRococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, 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 `[1, 838]`.
+ /// The range of component `v` is `[50, 100]`.
+ fn submit_finality_proof(p: u32, _v: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `231 + p * (60 ±0)`
+ // Estimated: `51735`
+ // Minimum execution time: 224_590_000 picoseconds.
+ Weight::from_parts(225_581_000, 0)
+ .saturating_add(Weight::from_parts(0, 51735))
+ // Standard Error: 5_887
+ .saturating_add(Weight::from_parts(47_424_657, 0).saturating_mul(p.into()))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(5))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs
new file mode 100644
index 0000000000..1c3bfb2fee
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_grandpa_bridge_wococo_grandpa.rs
@@ -0,0 +1,80 @@
+// Copyright 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-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::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)
+ /// Proof: BridgeWococoGrandpa PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, 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 `[1, 838]`.
+ /// The range of component `v` is `[50, 100]`.
+ fn submit_finality_proof(p: u32, _v: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `268 + p * (60 ±0)`
+ // Estimated: `51735`
+ // Minimum execution time: 224_665_000 picoseconds.
+ Weight::from_parts(225_737_000, 0)
+ .saturating_add(Weight::from_parts(0, 51735))
+ // Standard Error: 5_325
+ .saturating_add(Weight::from_parts(47_412_944, 0).saturating_mul(p.into()))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(5))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs b/system-parachains/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 0000000000..47d1ec8d47
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_rococo_messages_instance.rs
@@ -0,0 +1,232 @@
+// Copyright 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-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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_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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::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)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ fn receive_single_message_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `367`
+ // Estimated: `52645`
+ // Minimum execution time: 42_364_000 picoseconds.
+ Weight::from_parts(43_780_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ fn receive_two_messages_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `367`
+ // Estimated: `52645`
+ // Minimum execution time: 54_010_000 picoseconds.
+ Weight::from_parts(66_691_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `367`
+ // Estimated: `52645`
+ // Minimum execution time: 48_066_000 picoseconds.
+ Weight::from_parts(48_635_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ fn receive_single_message_proof_1_kb() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `335`
+ // Estimated: `52645`
+ // Minimum execution time: 40_997_000 picoseconds.
+ Weight::from_parts(41_710_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ fn receive_single_message_proof_16_kb() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `335`
+ // Estimated: `52645`
+ // Minimum execution time: 67_556_000 picoseconds.
+ Weight::from_parts(68_573_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages OutboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn receive_delivery_proof_for_single_message() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `339`
+ // Estimated: `3804`
+ // Minimum execution time: 32_221_000 picoseconds.
+ Weight::from_parts(32_582_000, 0)
+ .saturating_add(Weight::from_parts(0, 3804))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages OutboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `339`
+ // Estimated: `3804`
+ // Minimum execution time: 32_395_000 picoseconds.
+ Weight::from_parts(32_703_000, 0)
+ .saturating_add(Weight::from_parts(0, 3804))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages OutboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Storage: BridgeRelayers RelayerRewards (r:2 w:2)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `339`
+ // Estimated: `6086`
+ // Minimum execution time: 34_409_000 picoseconds.
+ Weight::from_parts(34_927_000, 0)
+ .saturating_add(Weight::from_parts(0, 6086))
+ .saturating_add(T::DbWeight::get().reads(6))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeRococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeRococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem RelevantMessagingState (r:1 w:0)
+ /// Proof Skipped: ParachainSystem RelevantMessagingState (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: XcmpQueue OutboundXcmpStatus (r:1 w:1)
+ /// Proof Skipped: XcmpQueue OutboundXcmpStatus (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: XcmpQueue OutboundXcmpMessages (r:0 w:1)
+ /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured)
+ /// The range of component `i` is `[128, 2048]`.
+ /// The range of component `i` is `[128, 2048]`.
+ fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `635`
+ // Estimated: `52645`
+ // Minimum execution time: 129_154_000 picoseconds.
+ Weight::from_parts(103_525_480, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ // Standard Error: 2_595
+ .saturating_add(Weight::from_parts(536_761, 0).saturating_mul(i.into()))
+ .saturating_add(T::DbWeight::get().reads(9))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs b/system-parachains/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 0000000000..0b2aceb489
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_messages_bridge_messages_bench_runtime_with_bridge_hub_wococo_messages_instance.rs
@@ -0,0 +1,232 @@
+// Copyright 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-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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_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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::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)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ fn receive_single_message_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `404`
+ // Estimated: `52645`
+ // Minimum execution time: 43_745_000 picoseconds.
+ Weight::from_parts(45_462_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ fn receive_two_messages_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `404`
+ // Estimated: `52645`
+ // Minimum execution time: 55_455_000 picoseconds.
+ Weight::from_parts(65_023_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ fn receive_single_message_proof_with_outbound_lane_state() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `404`
+ // Estimated: `52645`
+ // Minimum execution time: 48_603_000 picoseconds.
+ Weight::from_parts(50_377_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ fn receive_single_message_proof_1_kb() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `372`
+ // Estimated: `52645`
+ // Minimum execution time: 42_777_000 picoseconds.
+ Weight::from_parts(43_499_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ fn receive_single_message_proof_16_kb() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `372`
+ // Estimated: `52645`
+ // Minimum execution time: 69_408_000 picoseconds.
+ Weight::from_parts(69_916_000, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages OutboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn receive_delivery_proof_for_single_message() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `376`
+ // Estimated: `3841`
+ // Minimum execution time: 33_122_000 picoseconds.
+ Weight::from_parts(34_379_000, 0)
+ .saturating_add(Weight::from_parts(0, 3841))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages OutboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn receive_delivery_proof_for_two_messages_by_single_relayer() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `376`
+ // Estimated: `3841`
+ // Minimum execution time: 33_049_000 picoseconds.
+ Weight::from_parts(33_747_000, 0)
+ .saturating_add(Weight::from_parts(0, 3841))
+ .saturating_add(T::DbWeight::get().reads(5))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages OutboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ /// Storage: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Proof Skipped: unknown `0x6e0a18b62a1de81c5f519181cc611e18` (r:1 w:0)
+ /// Storage: BridgeRelayers RelayerRewards (r:2 w:2)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn receive_delivery_proof_for_two_messages_by_two_relayers() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `376`
+ // Estimated: `6086`
+ // Minimum execution time: 35_578_000 picoseconds.
+ Weight::from_parts(36_007_000, 0)
+ .saturating_add(Weight::from_parts(0, 6086))
+ .saturating_add(T::DbWeight::get().reads(6))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:1 w:0)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoMessages InboundLanes (r:1 w:1)
+ /// Proof: BridgeWococoMessages InboundLanes (max_values: None, max_size: Some(49180), added: 51655, mode: MaxEncodedLen)
+ /// Storage: ParachainInfo ParachainId (r:1 w:0)
+ /// Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ /// Storage: PolkadotXcm SupportedVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SupportedVersion (max_values: None, max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm VersionDiscoveryQueue (r:1 w:1)
+ /// Proof Skipped: PolkadotXcm VersionDiscoveryQueue (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: PolkadotXcm SafeXcmVersion (r:1 w:0)
+ /// Proof Skipped: PolkadotXcm SafeXcmVersion (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: ParachainSystem RelevantMessagingState (r:1 w:0)
+ /// Proof Skipped: ParachainSystem RelevantMessagingState (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: XcmpQueue OutboundXcmpStatus (r:1 w:1)
+ /// Proof Skipped: XcmpQueue OutboundXcmpStatus (max_values: Some(1), max_size: None, mode: Measured)
+ /// Storage: XcmpQueue OutboundXcmpMessages (r:0 w:1)
+ /// Proof Skipped: XcmpQueue OutboundXcmpMessages (max_values: None, max_size: None, mode: Measured)
+ /// The range of component `i` is `[128, 2048]`.
+ /// The range of component `i` is `[128, 2048]`.
+ fn receive_single_message_proof_with_dispatch(i: u32, ) -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `672`
+ // Estimated: `52645`
+ // Minimum execution time: 130_070_000 picoseconds.
+ Weight::from_parts(104_597_637, 0)
+ .saturating_add(Weight::from_parts(0, 52645))
+ // Standard Error: 2_607
+ .saturating_add(Weight::from_parts(538_698, 0).saturating_mul(i.into()))
+ .saturating_add(T::DbWeight::get().reads(9))
+ .saturating_add(T::DbWeight::get().writes(4))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs
new file mode 100644
index 0000000000..9e88bd08b7
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_rococo_instance.rs
@@ -0,0 +1,114 @@
+// Copyright 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-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::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)
+ /// Proof: BridgeRococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0)
+ /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ParasInfo (r:1 w:1)
+ /// Proof: BridgeRococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1)
+ /// Proof: BridgeRococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// 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 {
+ // Proof Size summary in bytes:
+ // Measured: `294`
+ // Estimated: `2543`
+ // Minimum execution time: 33_300_000 picoseconds.
+ Weight::from_parts(34_117_420, 0)
+ .saturating_add(Weight::from_parts(0, 2543))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0)
+ /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ParasInfo (r:1 w:1)
+ /// Proof: BridgeRococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1)
+ /// Proof: BridgeRococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ fn submit_parachain_heads_with_1kb_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `294`
+ // Estimated: `2543`
+ // Minimum execution time: 34_550_000 picoseconds.
+ Weight::from_parts(35_046_000, 0)
+ .saturating_add(Weight::from_parts(0, 2543))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeRococoParachain PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeRococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoGrandpa ImportedHeaders (r:1 w:0)
+ /// Proof: BridgeRococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ParasInfo (r:1 w:1)
+ /// Proof: BridgeRococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHashes (r:1 w:1)
+ /// Proof: BridgeRococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen)
+ /// Storage: BridgeRococoParachain ImportedParaHeads (r:0 w:1)
+ /// Proof: BridgeRococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ fn submit_parachain_heads_with_16kb_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `294`
+ // Estimated: `2543`
+ // Minimum execution time: 61_071_000 picoseconds.
+ Weight::from_parts(61_554_000, 0)
+ .saturating_add(Weight::from_parts(0, 2543))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs
new file mode 100644
index 0000000000..238fa8725d
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_parachains_bridge_parachains_bench_runtime_bridge_parachain_wococo_instance.rs
@@ -0,0 +1,114 @@
+// Copyright 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-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::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)
+ /// Proof: BridgeWococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0)
+ /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ParasInfo (r:1 w:1)
+ /// Proof: BridgeWococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1)
+ /// Proof: BridgeWococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ /// 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 {
+ // Proof Size summary in bytes:
+ // Measured: `367`
+ // Estimated: `2543`
+ // Minimum execution time: 34_469_000 picoseconds.
+ Weight::from_parts(35_382_374, 0)
+ .saturating_add(Weight::from_parts(0, 2543))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0)
+ /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ParasInfo (r:1 w:1)
+ /// Proof: BridgeWococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1)
+ /// Proof: BridgeWococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ fn submit_parachain_heads_with_1kb_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `367`
+ // Estimated: `2543`
+ // Minimum execution time: 35_690_000 picoseconds.
+ Weight::from_parts(36_400_000, 0)
+ .saturating_add(Weight::from_parts(0, 2543))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeWococoParachain PalletOperatingMode (r:1 w:0)
+ /// Proof: BridgeWococoParachain PalletOperatingMode (max_values: Some(1), max_size: Some(1), added: 496, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoGrandpa ImportedHeaders (r:1 w:0)
+ /// Proof: BridgeWococoGrandpa ImportedHeaders (max_values: Some(1024), max_size: Some(68), added: 1553, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ParasInfo (r:1 w:1)
+ /// Proof: BridgeWococoParachain ParasInfo (max_values: Some(1), max_size: Some(60), added: 555, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHashes (r:1 w:1)
+ /// Proof: BridgeWococoParachain ImportedParaHashes (max_values: Some(64), max_size: Some(64), added: 1054, mode: MaxEncodedLen)
+ /// Storage: BridgeWococoParachain ImportedParaHeads (r:0 w:1)
+ /// Proof: BridgeWococoParachain ImportedParaHeads (max_values: Some(64), max_size: Some(196), added: 1186, mode: MaxEncodedLen)
+ fn submit_parachain_heads_with_16kb_proof() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `367`
+ // Estimated: `2543`
+ // Minimum execution time: 62_242_000 picoseconds.
+ Weight::from_parts(62_690_000, 0)
+ .saturating_add(Weight::from_parts(0, 2543))
+ .saturating_add(T::DbWeight::get().reads(4))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs
new file mode 100644
index 0000000000..418f132676
--- /dev/null
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/pallet_bridge_relayers.rs
@@ -0,0 +1,124 @@
+// Copyright 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_relayers`
+//!
+//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 4.0.0-dev
+//! DATE: 2023-05-03, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
+//! WORST CASE MAP SIZE: `1000000`
+//! 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:
+// target/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_relayers
+// --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)]
+#![allow(missing_docs)]
+
+use frame_support::{traits::Get, weights::Weight};
+use core::marker::PhantomData;
+
+/// Weight functions for `pallet_bridge_relayers`.
+pub struct WeightInfo(PhantomData);
+impl pallet_bridge_relayers::WeightInfo for WeightInfo {
+ /// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ fn claim_rewards() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `207`
+ // Estimated: `3593`
+ // Minimum execution time: 53_286_000 picoseconds.
+ Weight::from_parts(53_905_000, 0)
+ .saturating_add(Weight::from_parts(0, 3593))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1)
+ /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen)
+ /// Storage: unknown `0x1e8445dc201eeb8560e5579a5dd54655` (r:1 w:0)
+ /// Proof Skipped: unknown `0x1e8445dc201eeb8560e5579a5dd54655` (r:1 w:0)
+ /// Storage: Balances Reserves (r:1 w:1)
+ /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen)
+ fn register() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `61`
+ // Estimated: `4714`
+ // Minimum execution time: 29_145_000 picoseconds.
+ Weight::from_parts(29_698_000, 0)
+ .saturating_add(Weight::from_parts(0, 4714))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1)
+ /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen)
+ /// Storage: Balances Reserves (r:1 w:1)
+ /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen)
+ fn deregister() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `160`
+ // Estimated: `4714`
+ // Minimum execution time: 30_298_000 picoseconds.
+ Weight::from_parts(30_754_000, 0)
+ .saturating_add(Weight::from_parts(0, 4714))
+ .saturating_add(T::DbWeight::get().reads(2))
+ .saturating_add(T::DbWeight::get().writes(2))
+ }
+ /// Storage: BridgeRelayers RegisteredRelayers (r:1 w:1)
+ /// Proof: BridgeRelayers RegisteredRelayers (max_values: None, max_size: Some(68), added: 2543, mode: MaxEncodedLen)
+ /// Storage: Balances Reserves (r:1 w:1)
+ /// Proof: Balances Reserves (max_values: None, max_size: Some(1249), added: 3724, mode: MaxEncodedLen)
+ /// Storage: System Account (r:1 w:1)
+ /// Proof: System Account (max_values: None, max_size: Some(128), added: 2603, mode: MaxEncodedLen)
+ fn slash_and_deregister() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `263`
+ // Estimated: `4714`
+ // Minimum execution time: 30_109_000 picoseconds.
+ Weight::from_parts(30_330_000, 0)
+ .saturating_add(Weight::from_parts(0, 4714))
+ .saturating_add(T::DbWeight::get().reads(3))
+ .saturating_add(T::DbWeight::get().writes(3))
+ }
+ /// Storage: BridgeRelayers RelayerRewards (r:1 w:1)
+ /// Proof: BridgeRelayers RelayerRewards (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
+ fn register_relayer_reward() -> Weight {
+ // Proof Size summary in bytes:
+ // Measured: `6`
+ // Estimated: `3538`
+ // Minimum execution time: 3_016_000 picoseconds.
+ Weight::from_parts(3_130_000, 0)
+ .saturating_add(Weight::from_parts(0, 3538))
+ .saturating_add(T::DbWeight::get().reads(1))
+ .saturating_add(T::DbWeight::get().writes(1))
+ }
+}
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs
index b05c554580..a0aaac56f5 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/mod.rs
@@ -18,6 +18,7 @@ mod pallet_xcm_benchmarks_fungible;
mod pallet_xcm_benchmarks_generic;
use crate::{xcm_config::MaxAssetsIntoHolding, Runtime};
+use codec::Encode;
use frame_support::weights::Weight;
use pallet_xcm_benchmarks_fungible::WeightInfo as XcmFungibleWeight;
use pallet_xcm_benchmarks_generic::WeightInfo as XcmGeneric;
@@ -217,8 +218,9 @@ impl XcmWeightInfo for BridgeHubRococoXcmWeight {
fn universal_origin(_: &Junction) -> Weight {
Weight::MAX
}
- fn export_message(_: &NetworkId, _: &Junctions, _: &Xcm<()>) -> Weight {
- Weight::MAX
+ fn export_message(_: &NetworkId, _: &Junctions, inner: &Xcm<()>) -> Weight {
+ let inner_encoded_len = inner.encode().len() as u32;
+ XcmGeneric::::export_message(inner_encoded_len)
}
fn lock_asset(_: &MultiAsset, _: &MultiLocation) -> Weight {
Weight::MAX
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
index 8572163a52..0773dca274 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/weights/xcm/pallet_xcm_benchmarks_generic.rs
@@ -338,6 +338,21 @@ impl WeightInfo {
// Minimum execution time: 3_710_000 picoseconds.
Weight::from_parts(3_820_000, 0)
}
+ // Storage: ParachainInfo ParachainId (r:1 w:0)
+ // Proof: ParachainInfo ParachainId (max_values: Some(1), max_size: Some(4), added: 499, mode: MaxEncodedLen)
+ // Storage: BridgeWococoMessages PalletOperatingMode (r:1 w:0)
+ // Proof: BridgeWococoMessages PalletOperatingMode (max_values: Some(1), max_size: Some(2), added: 497, mode: MaxEncodedLen)
+ // Storage: BridgeWococoMessages OutboundLanes (r:1 w:1)
+ // Proof: BridgeWococoMessages OutboundLanes (max_values: Some(1), max_size: Some(44), added: 539, mode: MaxEncodedLen)
+ // Storage: BridgeWococoMessages OutboundMessages (r:0 w:1)
+ // Proof: BridgeWococoMessages OutboundMessages (max_values: None, max_size: Some(2621472), added: 2623947, mode: MaxEncodedLen)
+ pub(crate) fn export_message(x: u32, ) -> Weight {
+ Weight::from_parts(31_677_716 as u64, 0)
+ // Standard Error: 4_158
+ .saturating_add(Weight::from_parts(123_901, 0).saturating_mul(x as u64))
+ .saturating_add(T::DbWeight::get().reads(3 as u64))
+ .saturating_add(T::DbWeight::get().writes(2 as u64))
+ }
pub fn unpaid_execution() -> Weight {
// Proof Size summary in bytes:
// Measured: `0`
diff --git a/system-parachains/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/system-parachains/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
index c629c18e0c..91fd15136b 100644
--- a/system-parachains/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
+++ b/system-parachains/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs
@@ -15,8 +15,13 @@
// along with Cumulus. If not, see .
use super::{
- AccountId, AllPalletsWithSystem, Balances, ParachainInfo, ParachainSystem, PolkadotXcm,
- Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
+ AccountId, AllPalletsWithSystem, Balances, BridgeGrandpaRococoInstance,
+ BridgeGrandpaWococoInstance, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime, RuntimeCall,
+ RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
+};
+use crate::{
+ bridge_hub_rococo_config::ToBridgeHubWococoHaulBlobExporter,
+ bridge_hub_wococo_config::ToBridgeHubRococoHaulBlobExporter,
};
use frame_support::{
match_types, parameter_types,
@@ -29,27 +34,46 @@ use parachains_common::{
xcm_config::{ConcreteNativeAssetFrom, DenyReserveTransferToRelayChain, DenyThenTry},
};
use polkadot_parachain::primitives::Sibling;
+use sp_core::Get;
use xcm::latest::prelude::*;
use xcm_builder::{
AccountId32Aliases, AllowExplicitUnpaidExecutionFrom, AllowKnownQueryResponses,
- AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, CurrencyAdapter, EnsureXcmOrigin,
- IsConcrete, ParentAsSuperuser, ParentIsPreset, RelayChainAsNative, SiblingParachainAsNative,
- SiblingParachainConvertsVia, SignedAccountId32AsNative, SignedToAccountId32,
- SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, WeightInfoBounds,
- WithComputedOrigin,
+ AllowSubscriptionsFrom, AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom,
+ CurrencyAdapter, EnsureXcmOrigin, IsConcrete, ParentAsSuperuser, ParentIsPreset,
+ RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
+ SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
+ UsingComponents, WeightInfoBounds, WithComputedOrigin,
+};
+use xcm_executor::{
+ traits::{ExportXcm, WithOriginFilter},
+ XcmExecutor,
};
-use xcm_executor::{traits::WithOriginFilter, XcmExecutor};
parameter_types! {
pub const RelayLocation: MultiLocation = MultiLocation::parent();
- pub const RelayNetwork: Option = Some(NetworkId::Rococo);
pub RelayChainOrigin: RuntimeOrigin = cumulus_pallet_xcm::Origin::Relay.into();
pub UniversalLocation: InteriorMultiLocation =
- X2(GlobalConsensus(RelayNetwork::get().unwrap()), Parachain(ParachainInfo::parachain_id().into()));
+ X2(GlobalConsensus(RelayNetwork::get()), Parachain(ParachainInfo::parachain_id().into()));
pub const MaxInstructions: u32 = 100;
pub const MaxAssetsIntoHolding: u32 = 64;
}
+pub struct RelayNetwork;
+impl Get