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

Commit a08526f

Browse files
committed
Update to new version with dynamic fees
1 parent 718d493 commit a08526f

File tree

6 files changed

+60
-20
lines changed

6 files changed

+60
-20
lines changed

parachains/runtimes/bridge-hubs/bridge-hub-kusama/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-fea
6363
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
6464
cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
6565
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
66-
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
66+
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false, features = ["bridging"] }
6767
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
6868
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
6969
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }

parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/bridge_hub_config.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use bridge_runtime_common::{
2727
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
2828
MessageBridge, ThisChainWithMessages, UnderlyingChainProvider,
2929
},
30-
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
30+
messages_xcm_extension::{SenderAndLane, XcmBlobHauler, XcmBlobHaulerAdapter},
3131
refund_relayer_extension::{
3232
ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
3333
RefundableParachain,
@@ -47,6 +47,16 @@ parameter_types! {
4747
pub PolkadotGlobalConsensusNetwork: NetworkId = NetworkId::Polkadot;
4848
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
4949
pub PriorityBoostPerMessage: u64 = 91_022_222_222_222;
50+
51+
pub AssetHubKusamaParaId: cumulus_primitives_core::ParaId = 1000.into();
52+
53+
pub FromAssetHubKusamaToAssetHubPolkadotRoute: SenderAndLane = SenderAndLane::new(
54+
ParentThen(X1(Parachain(AssetHubKusamaParaId::get().into()))).into(),
55+
ASSET_HUB_KUSAMA_TO_ASSET_HUB_POLKADOT_LANE_ID,
56+
);
57+
58+
pub CongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
59+
pub UncongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
5060
}
5161

5262
/// Proof of messages, coming from BridgeHubPolkadot.
@@ -68,15 +78,18 @@ pub type ToBridgeHubPolkadotHaulBlobExporter = HaulBlobExporter<
6878
>;
6979
pub struct ToBridgeHubPolkadotXcmBlobHauler;
7080
impl XcmBlobHauler for ToBridgeHubPolkadotXcmBlobHauler {
71-
type MessageSender =
72-
pallet_bridge_messages::Pallet<Runtime, WithBridgeHubPolkadotMessagesInstance>;
81+
type Runtime = Runtime;
82+
type MessagesInstance = WithBridgeHubPolkadotMessagesInstance;
83+
type SenderAndLane = FromAssetHubKusamaToAssetHubPolkadotRoute;
7384

74-
fn xcm_lane() -> LaneId {
75-
// TODO: rework once dynamic lanes are supported (https://github.com/paritytech/parity-bridges-common/issues/1760)
76-
ASSET_HUB_KUSAMA_TO_ASSET_HUB_POLKADOT_LANE_ID
77-
}
85+
type ToSourceChainSender = crate::XcmRouter;
86+
type CongestedMessage = CongestedMessage;
87+
type UncongestedMessage = UncongestedMessage;
7888
}
7989

90+
/// On messages delivered callback.
91+
pub type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubPolkadotXcmBlobHauler>;
92+
8093
/// Messaging Bridge configuration for ThisChain -> BridgeHubPolkadot
8194
pub struct WithBridgeHubPolkadotMessageBridge;
8295
impl MessageBridge for WithBridgeHubPolkadotMessageBridge {

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,15 @@ impl pallet_bridge_messages::Config<WithBridgeHubPolkadotMessagesInstance> for R
485485
DeliveryRewardInBalance,
486486
>;
487487
type SourceHeaderChain = SourceHeaderChainAdapter<WithBridgeHubPolkadotMessageBridge>;
488-
type MessageDispatch =
489-
XcmBlobMessageDispatch<OnThisChainBlobDispatcher<UniversalLocation>, Self::WeightInfo>;
488+
type MessageDispatch = XcmBlobMessageDispatch<
489+
OnThisChainBlobDispatcher<UniversalLocation>,
490+
Self::WeightInfo,
491+
cumulus_pallet_xcmp_queue::bridging::OutboundXcmpChannelCongestionStatusProvider<
492+
bridge_hub_config::AssetHubKusamaParaId,
493+
Runtime,
494+
>,
495+
>;
496+
type OnMessagesDelivered = bridge_hub_config::OnMessagesDelivered;
490497
}
491498

492499
/// Allows collect and claim rewards for relayers

parachains/runtimes/bridge-hubs/bridge-hub-polkadot/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-fea
6363
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
6464
cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
6565
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
66-
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
66+
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false, features = ["bridging"] }
6767
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
6868
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
6969
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }

parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/bridge_hub_config.rs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use bridge_runtime_common::{
2727
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
2828
MessageBridge, ThisChainWithMessages, UnderlyingChainProvider,
2929
},
30-
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
30+
messages_xcm_extension::{SenderAndLane, XcmBlobHauler, XcmBlobHaulerAdapter},
3131
refund_relayer_extension::{
3232
ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
3333
RefundableParachain,
@@ -47,6 +47,16 @@ parameter_types! {
4747
pub KusamaGlobalConsensusNetwork: NetworkId = NetworkId::Kusama;
4848
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
4949
pub PriorityBoostPerMessage: u64 = 4_551_111_111_111;
50+
51+
pub AssetHubPolkadotParaId: cumulus_primitives_core::ParaId = 1000.into();
52+
53+
pub FromAssetHubPolkadotToAssetHubKusamaRoute: SenderAndLane = SenderAndLane::new(
54+
ParentThen(X1(Parachain(AssetHubPolkadotParaId::get().into()))).into(),
55+
ASSET_HUB_POLKADOT_TO_ASSET_HUB_KUSAMA_LANE_ID,
56+
);
57+
58+
pub CongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
59+
pub UncongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
5060
}
5161

5262
/// Proof of messages, coming from BridgeHubKusama.
@@ -68,15 +78,18 @@ pub type ToBridgeHubKusamaHaulBlobExporter = HaulBlobExporter<
6878
>;
6979
pub struct ToBridgeHubKusamaXcmBlobHauler;
7080
impl XcmBlobHauler for ToBridgeHubKusamaXcmBlobHauler {
71-
type MessageSender =
72-
pallet_bridge_messages::Pallet<Runtime, WithBridgeHubKusamaMessagesInstance>;
81+
type Runtime = Runtime;
82+
type MessagesInstance = WithBridgeHubKusamaMessagesInstance;
83+
type SenderAndLane = FromAssetHubPolkadotToAssetHubKusamaRoute;
7384

74-
fn xcm_lane() -> LaneId {
75-
// TODO: rework once dynamic lanes are supported (https://github.com/paritytech/parity-bridges-common/issues/1760)
76-
ASSET_HUB_POLKADOT_TO_ASSET_HUB_KUSAMA_LANE_ID
77-
}
85+
type ToSourceChainSender = crate::XcmRouter;
86+
type CongestedMessage = CongestedMessage;
87+
type UncongestedMessage = UncongestedMessage;
7888
}
7989

90+
/// On messages delivered callback.
91+
pub type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubKusamaXcmBlobHauler>;
92+
8093
/// Messaging Bridge configuration for ThisChain -> BridgeHubKusama
8194
pub struct WithBridgeHubKusamaMessageBridge;
8295
impl MessageBridge for WithBridgeHubKusamaMessageBridge {

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -486,8 +486,15 @@ impl pallet_bridge_messages::Config<WithBridgeHubKusamaMessagesInstance> for Run
486486
DeliveryRewardInBalance,
487487
>;
488488
type SourceHeaderChain = SourceHeaderChainAdapter<WithBridgeHubKusamaMessageBridge>;
489-
type MessageDispatch =
490-
XcmBlobMessageDispatch<OnThisChainBlobDispatcher<UniversalLocation>, Self::WeightInfo>;
489+
type MessageDispatch = XcmBlobMessageDispatch<
490+
OnThisChainBlobDispatcher<UniversalLocation>,
491+
Self::WeightInfo,
492+
cumulus_pallet_xcmp_queue::bridging::OutboundXcmpChannelCongestionStatusProvider<
493+
bridge_hub_config::AssetHubPolkadotParaId,
494+
Runtime,
495+
>,
496+
>;
497+
type OnMessagesDelivered = bridge_hub_config::OnMessagesDelivered;
491498
}
492499

493500
/// Allows collect and claim rewards for relayers

0 commit comments

Comments
 (0)