From 18a3ea9aafbaddf6c45959acd0455af082f683dc Mon Sep 17 00:00:00 2001 From: Branislav Kontur Date: Wed, 23 Nov 2022 00:09:04 +0100 Subject: [PATCH] Fixes --- Cargo.lock | 25 ++++++- .../src/bridge_common_config.rs | 44 ++++-------- .../src/bridge_hub_rococo_config.rs | 72 ++----------------- .../src/bridge_hub_wococo_config.rs | 72 ++----------------- .../bridge-hubs/bridge-hub-rococo/src/lib.rs | 34 +++------ 5 files changed, 57 insertions(+), 190 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f0a310083e..5c3d6d4653 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -713,6 +713,27 @@ dependencies = [ "thiserror", ] +[[package]] +name = "bp-beefy" +version = "0.1.0" +dependencies = [ + "beefy-merkle-tree", + "beefy-primitives", + "bp-runtime", + "frame-support", + "pallet-beefy-mmr", + "pallet-mmr", + "parity-scale-codec", + "scale-info", + "serde", + "sp-application-crypto", + "sp-core", + "sp-io", + "sp-runtime", + "sp-std", + "static_assertions", +] + [[package]] name = "bp-bridge-hub-rococo" version = "0.1.0" @@ -763,7 +784,6 @@ dependencies = [ name = "bp-messages" version = "0.1.0" dependencies = [ - "bitvec", "bp-runtime", "frame-support", "hex", @@ -780,6 +800,7 @@ dependencies = [ name = "bp-millau" version = "0.1.0" dependencies = [ + "bp-beefy", "bp-messages", "bp-runtime", "fixed-hash 0.7.0", @@ -911,6 +932,7 @@ dependencies = [ "sp-finality-grandpa", "sp-runtime", "sp-std", + "xcm", ] [[package]] @@ -5966,7 +5988,6 @@ dependencies = [ name = "pallet-bridge-messages" version = "0.1.0" dependencies = [ - "bitvec", "bp-messages", "bp-runtime", "bp-test-utils", diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_common_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_common_config.rs index 94c0d1660b..5a2a322d96 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_common_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_common_config.rs @@ -19,7 +19,7 @@ use bp_messages::{ target_chain::{DispatchMessage, MessageDispatch}, LaneId, }; -use bp_runtime::{messages::MessageDispatchResult, AccountIdOf, BalanceOf, Chain}; +use bp_runtime::{messages::MessageDispatchResult, AccountIdOf, Chain}; use codec::Encode; use frame_support::{dispatch::Weight, parameter_types}; use xcm::latest::prelude::*; @@ -43,38 +43,37 @@ pub struct XcmBlobMessageDispatch - MessageDispatch, BalanceOf> + MessageDispatch> for XcmBlobMessageDispatch { type DispatchPayload = XcmAsPlainPayload; - fn dispatch_weight( - message: &mut DispatchMessage>, - ) -> Weight { + fn dispatch_weight(_message: &mut DispatchMessage) -> Weight { log::error!( "[XcmBlobMessageDispatch] TODO: change here to XCMv3 dispatch_weight with XcmExecutor - message: ?...?", ); + // TODO:check-parameter - setup weight? Weight::zero() } fn dispatch( _relayer_account: &AccountIdOf, - message: DispatchMessage>, + message: DispatchMessage, ) -> MessageDispatchResult { - log::warn!("[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob triggering"); + log::warn!("[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob triggering - message_nonce: {:?}", message.key.nonce); let payload = match message.data.payload { Ok(payload) => payload, Err(e) => { - log::error!("[XcmBlobMessageDispatch] payload error: {:?}", e); + log::error!("[XcmBlobMessageDispatch] payload error: {:?} - message_nonce: {:?}", e, message.key.nonce); return MessageDispatchResult { - dispatch_result: false, + // TODO:check-parameter - setup uspent_weight? unspent_weight: Weight::zero(), dispatch_fee_paid_during_dispatch: false, } }, }; - let dispatch_result = match BlobDispatcher::dispatch_blob(payload) { - Ok(_) => true, + match BlobDispatcher::dispatch_blob(payload) { + Ok(_) => log::debug!("[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob was ok - message_nonce: {:?}", message.key.nonce), Err(e) => { let e = match e { DispatchBlobError::Unbridgable => "DispatchBlobError::Unbridgable", @@ -89,14 +88,13 @@ impl "DispatchBlobError::WrongGlobal", }; log::error!( - "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?}", - e + "[XcmBlobMessageDispatch] DispatchBlob::dispatch_blob failed, error: {:?} - message_nonce: {:?}", + e, message.key.nonce ); - false }, - }; + } MessageDispatchResult { - dispatch_result, + // TODO:check-parameter - setup uspent_weight? dispatch_fee_paid_during_dispatch: false, unspent_weight: Weight::zero(), } @@ -106,15 +104,8 @@ impl, - XcmAsPlainPayload, - >; + type MessageSender: MessagesBridge; /// Our location within the Consensus Universe. fn message_sender_origin() -> InteriorMultiLocation; @@ -127,15 +118,10 @@ pub struct XcmBlobHaulerAdapter(sp_std::marker::PhantomData HaulBlob for XcmBlobHaulerAdapter { fn haul_blob(blob: sp_std::prelude::Vec) { let lane = H::xcm_lane(); - // TODO:check-parameter - fee could be taken from BridgeMessage - or add as optional fo send_message - // TODO:check-parameter - or add here something like PriceForSiblingDelivery - let fee = ::Balance::from(0u8); - let result = H::MessageSender::send_message( pallet_xcm::Origin::from(MultiLocation::from(H::message_sender_origin())).into(), lane, blob, - fee, ); let result = result .map(|artifacts| { diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs index c242285c35..2a8e00bb7a 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_rococo_config.rs @@ -27,13 +27,11 @@ use bp_runtime::ChainId; use bridge_runtime_common::{ messages, messages::{ - target::FromBridgedChainMessagesProof, BasicConfirmationTransactionEstimation, - BridgedChain, MessageBridge, MessageTransaction, ThisChain, ThisChainWithMessages, + target::FromBridgedChainMessagesProof, MessageBridge, ThisChainWithMessages, UnderlyingChainProvider, }, }; -use frame_support::{dispatch::Weight, parameter_types, RuntimeDebug}; -use sp_runtime::FixedU128; +use frame_support::{parameter_types, RuntimeDebug}; use xcm::{ latest::prelude::*, prelude::{InteriorMultiLocation, NetworkId}, @@ -49,6 +47,7 @@ parameter_types! { 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]; } /// Dispatches received XCM messages from other bridge @@ -64,7 +63,6 @@ pub type ToBridgeHubWococoHaulBlobExporter = HaulBlobExporter< pub struct ToBridgeHubWococoXcmBlobHauler; pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_WOCOCO: LaneId = [0, 0, 0, 2]; impl XcmBlobHauler for ToBridgeHubWococoXcmBlobHauler { - type SenderChain = bp_bridge_hub_rococo::BridgeHubRococo; type MessageSender = pallet_bridge_messages::Pallet; @@ -80,8 +78,6 @@ impl XcmBlobHauler for ToBridgeHubWococoXcmBlobHauler { /// Messaging Bridge configuration for BridgeHubRococo -> BridgeHubWococo pub struct WithBridgeHubWococoMessageBridge; impl MessageBridge for WithBridgeHubWococoMessageBridge { - // TODO:check-parameter - relayers rewards - const RELAYER_FEE_PERCENT: u32 = 0; const THIS_CHAIN_ID: ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID; const BRIDGED_CHAIN_ID: ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID; const BRIDGED_MESSAGES_PALLET_NAME: &'static str = @@ -93,15 +89,6 @@ impl MessageBridge for WithBridgeHubWococoMessageBridge { BridgeParachainWococoInstance, bp_bridge_hub_wococo::BridgeHubWococo, >; - - fn bridged_balance_to_this_balance( - bridged_balance: bridge_runtime_common::messages::BalanceOf>, - bridged_to_this_conversion_rate_override: Option, - ) -> bridge_runtime_common::messages::BalanceOf> { - log::info!("[WithBridgeHubWococoMessageBridge] bridged_balance_to_this_balance (returns 0 balance, TODO: fix) - bridged_balance: {:?}, bridged_to_this_conversion_rate_override: {:?}", bridged_balance, bridged_to_this_conversion_rate_override); - // TODO:check-parameter - any payment? from sovereign account? - 0 - } } /// Message verifier for BridgeHubWococo messages sent from BridgeHubRococo @@ -120,14 +107,14 @@ impl UnderlyingChainProvider for BridgeHubWococo { type Chain = bp_bridge_hub_wococo::BridgeHubWococo; } -impl SourceHeaderChain for BridgeHubWococo { +impl SourceHeaderChain for BridgeHubWococo { type Error = &'static str; type MessagesProof = FromBridgedChainMessagesProof; fn verify_messages_proof( proof: Self::MessagesProof, messages_count: u32, - ) -> Result>, Self::Error> { + ) -> Result, Self::Error> { bridge_runtime_common::messages::target::verify_messages_proof::< WithBridgeHubWococoMessageBridge, >(proof, messages_count) @@ -155,40 +142,6 @@ impl messages::BridgedChainWithMessages for BridgeHubWococo { fn verify_dispatch_weight(_message_payload: &[u8]) -> bool { true } - - fn estimate_delivery_transaction( - message_payload: &[u8], - include_pay_dispatch_fee_cost: bool, - message_dispatch_weight: Weight, - ) -> MessageTransaction { - let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX); - let extra_bytes_in_payload = message_payload_len - .saturating_sub(pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH); - - MessageTransaction { - dispatch_weight: bp_bridge_hub_wococo::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT - .saturating_mul(extra_bytes_in_payload as u64) - .saturating_add(bp_bridge_hub_wococo::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT) - .saturating_sub(if include_pay_dispatch_fee_cost { - Weight::from_ref_time(0) - } else { - bp_bridge_hub_wococo::PAY_INBOUND_DISPATCH_FEE_WEIGHT - }) - .saturating_add(message_dispatch_weight), - size: message_payload_len - .saturating_add(bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE) - .saturating_add(bp_bridge_hub_wococo::TX_EXTRA_BYTES), - } - } - - fn transaction_payment(transaction: MessageTransaction) -> messages::BalanceOf { - log::info!( - "[BridgeHubWococo::BridgedChainWithMessages] transaction_payment (returns 0 balance, TODO: fix) - transaction: {:?}", - transaction - ); - // TODO:check-parameter - any payment? from sovereign account? - 0 - } } /// BridgeHubRococo chain from message lane point of view. @@ -202,12 +155,6 @@ impl UnderlyingChainProvider for BridgeHubRococo { impl ThisChainWithMessages for BridgeHubRococo { type RuntimeOrigin = crate::RuntimeOrigin; type RuntimeCall = crate::RuntimeCall; - type ConfirmationTransactionEstimation = BasicConfirmationTransactionEstimation< - bp_bridge_hub_rococo::AccountId, - { bp_bridge_hub_rococo::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT.ref_time() }, - { bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE }, - { bp_bridge_hub_rococo::TX_EXTRA_BYTES }, - >; fn is_message_accepted(origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool { log::info!("[BridgeHubRococo::ThisChainWithMessages] is_message_accepted - origin: {:?}, lane: {:?}", origin, lane); @@ -220,13 +167,4 @@ impl ThisChainWithMessages for BridgeHubRococo { ); MessageNonce::MAX / 2 } - - fn transaction_payment(transaction: MessageTransaction) -> messages::BalanceOf { - log::info!( - "[BridgeHubRococo::ThisChainWithMessages] transaction_payment (returns 0 balance, TODO: fix) - transaction: {:?}", - transaction - ); - // TODO:check-parameter - any payment? from sovereign account? - 0 - } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs index c90b3dd29d..2c80ca7807 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/bridge_hub_wococo_config.rs @@ -27,13 +27,11 @@ use bp_runtime::ChainId; use bridge_runtime_common::{ messages, messages::{ - target::FromBridgedChainMessagesProof, BasicConfirmationTransactionEstimation, - BridgedChain, MessageBridge, MessageTransaction, ThisChain, ThisChainWithMessages, + target::FromBridgedChainMessagesProof, MessageBridge, ThisChainWithMessages, UnderlyingChainProvider, }, }; -use frame_support::{dispatch::Weight, parameter_types, RuntimeDebug}; -use sp_runtime::FixedU128; +use frame_support::{parameter_types, RuntimeDebug}; use xcm::{ latest::prelude::*, prelude::{InteriorMultiLocation, NetworkId}, @@ -49,6 +47,7 @@ parameter_types! { 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]; } /// Dispatches received XCM messages from other bridge @@ -64,7 +63,6 @@ pub type ToBridgeHubRococoHaulBlobExporter = HaulBlobExporter< pub struct ToBridgeHubRococoXcmBlobHauler; pub const DEFAULT_XCM_LANE_TO_BRIDGE_HUB_ROCOCO: LaneId = [0, 0, 0, 1]; impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler { - type SenderChain = bp_bridge_hub_wococo::BridgeHubWococo; type MessageSender = pallet_bridge_messages::Pallet; @@ -80,8 +78,6 @@ impl XcmBlobHauler for ToBridgeHubRococoXcmBlobHauler { /// Messaging Bridge configuration for BridgeHubWococo -> BridgeHubRococo pub struct WithBridgeHubRococoMessageBridge; impl MessageBridge for WithBridgeHubRococoMessageBridge { - // TODO:check-parameter - relayers rewards - const RELAYER_FEE_PERCENT: u32 = 0; const THIS_CHAIN_ID: ChainId = bp_runtime::BRIDGE_HUB_WOCOCO_CHAIN_ID; const BRIDGED_CHAIN_ID: ChainId = bp_runtime::BRIDGE_HUB_ROCOCO_CHAIN_ID; const BRIDGED_MESSAGES_PALLET_NAME: &'static str = @@ -93,15 +89,6 @@ impl MessageBridge for WithBridgeHubRococoMessageBridge { BridgeParachainRococoInstance, bp_bridge_hub_rococo::BridgeHubRococo, >; - - fn bridged_balance_to_this_balance( - bridged_balance: bridge_runtime_common::messages::BalanceOf>, - bridged_to_this_conversion_rate_override: Option, - ) -> bridge_runtime_common::messages::BalanceOf> { - log::info!("[WithBridgeHubRococoMessageBridge] bridged_balance_to_this_balance (returns 0 balance, TODO: fix) - bridged_balance: {:?}, bridged_to_this_conversion_rate_override: {:?}", bridged_balance, bridged_to_this_conversion_rate_override); - // TODO:check-parameter - any payment? from sovereign account? - 0 - } } /// Message verifier for BridgeHubRococo messages sent from BridgeHubWococo @@ -120,14 +107,14 @@ impl UnderlyingChainProvider for BridgeHubRococo { type Chain = bp_bridge_hub_rococo::BridgeHubRococo; } -impl SourceHeaderChain for BridgeHubRococo { +impl SourceHeaderChain for BridgeHubRococo { type Error = &'static str; type MessagesProof = FromBridgedChainMessagesProof; fn verify_messages_proof( proof: Self::MessagesProof, messages_count: u32, - ) -> Result>, Self::Error> { + ) -> Result, Self::Error> { bridge_runtime_common::messages::target::verify_messages_proof::< WithBridgeHubRococoMessageBridge, >(proof, messages_count) @@ -155,40 +142,6 @@ impl messages::BridgedChainWithMessages for BridgeHubRococo { fn verify_dispatch_weight(_message_payload: &[u8]) -> bool { true } - - fn estimate_delivery_transaction( - message_payload: &[u8], - include_pay_dispatch_fee_cost: bool, - message_dispatch_weight: Weight, - ) -> MessageTransaction { - let message_payload_len = u32::try_from(message_payload.len()).unwrap_or(u32::MAX); - let extra_bytes_in_payload = message_payload_len - .saturating_sub(pallet_bridge_messages::EXPECTED_DEFAULT_MESSAGE_LENGTH); - - MessageTransaction { - dispatch_weight: bp_bridge_hub_rococo::ADDITIONAL_MESSAGE_BYTE_DELIVERY_WEIGHT - .saturating_mul(extra_bytes_in_payload as u64) - .saturating_add(bp_bridge_hub_rococo::DEFAULT_MESSAGE_DELIVERY_TX_WEIGHT) - .saturating_sub(if include_pay_dispatch_fee_cost { - Weight::from_ref_time(0) - } else { - bp_bridge_hub_rococo::PAY_INBOUND_DISPATCH_FEE_WEIGHT - }) - .saturating_add(message_dispatch_weight), - size: message_payload_len - .saturating_add(bp_bridge_hub_wococo::EXTRA_STORAGE_PROOF_SIZE) - .saturating_add(bp_bridge_hub_rococo::TX_EXTRA_BYTES), - } - } - - fn transaction_payment(transaction: MessageTransaction) -> messages::BalanceOf { - log::info!( - "[BridgeHubRococo::BridgedChainWithMessages] transaction_payment (returns 0 balance, TODO: fix) - transaction: {:?}", - transaction - ); - // TODO:check-parameter - any payment? from sovereign account? - 0 - } } /// BridgeHubWococo chain from message lane point of view. @@ -202,12 +155,6 @@ impl UnderlyingChainProvider for BridgeHubWococo { impl ThisChainWithMessages for BridgeHubWococo { type RuntimeOrigin = crate::RuntimeOrigin; type RuntimeCall = crate::RuntimeCall; - type ConfirmationTransactionEstimation = BasicConfirmationTransactionEstimation< - bp_bridge_hub_wococo::AccountId, - { bp_bridge_hub_wococo::MAX_SINGLE_MESSAGE_DELIVERY_CONFIRMATION_TX_WEIGHT.ref_time() }, - { bp_bridge_hub_rococo::EXTRA_STORAGE_PROOF_SIZE }, - { bp_bridge_hub_wococo::TX_EXTRA_BYTES }, - >; fn is_message_accepted(origin: &Self::RuntimeOrigin, lane: &LaneId) -> bool { log::info!("[BridgeHubWococo::ThisChainWithMessages] is_message_accepted - origin: {:?}, lane: {:?}", origin, lane); @@ -220,13 +167,4 @@ impl ThisChainWithMessages for BridgeHubWococo { ); MessageNonce::MAX / 2 } - - fn transaction_payment(transaction: MessageTransaction) -> messages::BalanceOf { - log::info!( - "[BridgeHubWococo::ThisChainWithMessages] transaction_payment (returns 0 balance, TODO: fix) - transaction: {:?}", - transaction - ); - // TODO:check-parameter - any payment? from sovereign account? - 0 - } } diff --git a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs index 61063c8297..ba0c67cb2b 100644 --- a/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs +++ b/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/lib.rs @@ -216,7 +216,6 @@ pub mod runtime_api { use bp_messages::{ InboundMessageDetails, LaneId, MessageNonce, MessagePayload, OutboundMessageDetails, }; - use frame_support::{sp_runtime::FixedU128, Parameter}; use sp_std::prelude::Vec; bp_runtime::decl_bridge_messages_runtime_apis!(bridge_hub_rococo); bp_runtime::decl_bridge_messages_runtime_apis!(bridge_hub_wococo); @@ -522,8 +521,7 @@ impl pallet_bridge_messages::Config for Run type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_bridge_messages::weights::BridgeWeight; type BridgedChainId = bridge_hub_rococo_config::BridgeHubWococoChainId; - type Parameter = (); - type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type ActiveOutboundLanes = bridge_hub_rococo_config::ActiveOutboundLanesToBridgeHubWococo; type MaxUnrewardedRelayerEntriesAtInboundLane = bridge_hub_rococo_config::MaxUnrewardedRelayerEntriesAtInboundLane; type MaxUnconfirmedMessagesAtInboundLane = @@ -532,17 +530,13 @@ impl pallet_bridge_messages::Config for Run type MaximalOutboundPayloadSize = bridge_hub_rococo_config::ToBridgeHubWococoMaximalOutboundPayloadSize; type OutboundPayload = XcmAsPlainPayload; - type OutboundMessageFee = Balance; type InboundPayload = XcmAsPlainPayload; - type InboundMessageFee = Balance; type InboundRelayer = AccountId; type TargetHeaderChain = bridge_hub_rococo_config::BridgeHubWococo; type LaneMessageVerifier = bridge_hub_rococo_config::ToBridgeHubWococoMessageVerifier; type MessageDeliveryAndDispatchPayment = (); - type OnMessageAccepted = (); - type OnDeliveryConfirmed = (); type SourceHeaderChain = bridge_hub_rococo_config::BridgeHubWococo; type MessageDispatch = XcmBlobMessageDispatch< @@ -550,6 +544,7 @@ impl pallet_bridge_messages::Config for Run bp_bridge_hub_rococo::BridgeHubRococo, OnBridgeHubRococoBlobDispatcher, >; + } /// Add XCM messages support for BrigdeHubWococo to support Wococo->Rococo XCM messages @@ -558,8 +553,7 @@ impl pallet_bridge_messages::Config for Run type RuntimeEvent = RuntimeEvent; type WeightInfo = pallet_bridge_messages::weights::BridgeWeight; type BridgedChainId = bridge_hub_wococo_config::BridgeHubRococoChainId; - type Parameter = (); - type MaxMessagesToPruneAtOnce = MaxMessagesToPruneAtOnce; + type ActiveOutboundLanes = bridge_hub_wococo_config::ActiveOutboundLanesToBridgeHubRococo; type MaxUnrewardedRelayerEntriesAtInboundLane = bridge_hub_wococo_config::MaxUnrewardedRelayerEntriesAtInboundLane; type MaxUnconfirmedMessagesAtInboundLane = @@ -568,17 +562,13 @@ impl pallet_bridge_messages::Config for Run type MaximalOutboundPayloadSize = bridge_hub_wococo_config::ToBridgeHubRococoMaximalOutboundPayloadSize; type OutboundPayload = XcmAsPlainPayload; - type OutboundMessageFee = Balance; type InboundPayload = XcmAsPlainPayload; - type InboundMessageFee = Balance; type InboundRelayer = AccountId; type TargetHeaderChain = bridge_hub_wococo_config::BridgeHubRococo; type LaneMessageVerifier = bridge_hub_wococo_config::ToBridgeHubRococoMessageVerifier; type MessageDeliveryAndDispatchPayment = (); - type OnMessageAccepted = (); - type OnDeliveryConfirmed = (); type SourceHeaderChain = bridge_hub_wococo_config::BridgeHubRococo; type MessageDispatch = XcmBlobMessageDispatch< @@ -797,21 +787,15 @@ impl_runtime_apis! { } } - // This exposed by BridgeHubRococo - impl runtime_api::ToBridgeHubWococoOutboundLaneApi for Runtime { - fn estimate_message_delivery_and_dispatch_fee( - _lane_id: bp_messages::LaneId, - payload: XcmAsPlainPayload, - conversion_rate: Option, - ) -> Option { - None - } + // TODO: add here other directions + // This exposed by BridgeHubRococo + impl runtime_api::ToBridgeHubWococoOutboundLaneApi for Runtime { fn message_details( lane: bp_messages::LaneId, begin: bp_messages::MessageNonce, end: bp_messages::MessageNonce, - ) -> Vec> { + ) -> Vec { bridge_runtime_common::messages_api::outbound_message_details::< Runtime, WithBridgeHubWococoMessagesInstance, @@ -820,10 +804,10 @@ impl_runtime_apis! { } // This is exposed by BridgeHubWococo - impl runtime_api::FromBridgeHubRococoInboundLaneApi for Runtime { + impl runtime_api::FromBridgeHubRococoInboundLaneApi for Runtime { fn message_details( lane: bp_messages::LaneId, - messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>, + messages: Vec<(bp_messages::MessagePayload, bp_messages::OutboundMessageDetails)>, ) -> Vec { bridge_runtime_common::messages_api::inbound_message_details::< Runtime,