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

Commit

Permalink
Update to new version with dynamic fees
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Aug 14, 2023
1 parent 718d493 commit a08526f
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-fea
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false, features = ["bridging"] }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use bridge_runtime_common::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
MessageBridge, ThisChainWithMessages, UnderlyingChainProvider,
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
messages_xcm_extension::{SenderAndLane, XcmBlobHauler, XcmBlobHaulerAdapter},
refund_relayer_extension::{
ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
RefundableParachain,
Expand All @@ -47,6 +47,16 @@ parameter_types! {
pub PolkadotGlobalConsensusNetwork: NetworkId = NetworkId::Polkadot;
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
pub PriorityBoostPerMessage: u64 = 91_022_222_222_222;

pub AssetHubKusamaParaId: cumulus_primitives_core::ParaId = 1000.into();

pub FromAssetHubKusamaToAssetHubPolkadotRoute: SenderAndLane = SenderAndLane::new(
ParentThen(X1(Parachain(AssetHubKusamaParaId::get().into()))).into(),
ASSET_HUB_KUSAMA_TO_ASSET_HUB_POLKADOT_LANE_ID,
);

pub CongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
pub UncongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
}

/// Proof of messages, coming from BridgeHubPolkadot.
Expand All @@ -68,15 +78,18 @@ pub type ToBridgeHubPolkadotHaulBlobExporter = HaulBlobExporter<
>;
pub struct ToBridgeHubPolkadotXcmBlobHauler;
impl XcmBlobHauler for ToBridgeHubPolkadotXcmBlobHauler {
type MessageSender =
pallet_bridge_messages::Pallet<Runtime, WithBridgeHubPolkadotMessagesInstance>;
type Runtime = Runtime;
type MessagesInstance = WithBridgeHubPolkadotMessagesInstance;
type SenderAndLane = FromAssetHubKusamaToAssetHubPolkadotRoute;

fn xcm_lane() -> LaneId {
// TODO: rework once dynamic lanes are supported (https://github.com/paritytech/parity-bridges-common/issues/1760)
ASSET_HUB_KUSAMA_TO_ASSET_HUB_POLKADOT_LANE_ID
}
type ToSourceChainSender = crate::XcmRouter;
type CongestedMessage = CongestedMessage;
type UncongestedMessage = UncongestedMessage;
}

/// On messages delivered callback.
pub type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubPolkadotXcmBlobHauler>;

/// Messaging Bridge configuration for ThisChain -> BridgeHubPolkadot
pub struct WithBridgeHubPolkadotMessageBridge;
impl MessageBridge for WithBridgeHubPolkadotMessageBridge {
Expand Down
11 changes: 9 additions & 2 deletions parachains/runtimes/bridge-hubs/bridge-hub-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,15 @@ impl pallet_bridge_messages::Config<WithBridgeHubPolkadotMessagesInstance> for R
DeliveryRewardInBalance,
>;
type SourceHeaderChain = SourceHeaderChainAdapter<WithBridgeHubPolkadotMessageBridge>;
type MessageDispatch =
XcmBlobMessageDispatch<OnThisChainBlobDispatcher<UniversalLocation>, Self::WeightInfo>;
type MessageDispatch = XcmBlobMessageDispatch<
OnThisChainBlobDispatcher<UniversalLocation>,
Self::WeightInfo,
cumulus_pallet_xcmp_queue::bridging::OutboundXcmpChannelCongestionStatusProvider<
bridge_hub_config::AssetHubKusamaParaId,
Runtime,
>,
>;
type OnMessagesDelivered = bridge_hub_config::OnMessagesDelivered;
}

/// Allows collect and claim rewards for relayers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ cumulus-pallet-dmp-queue = { path = "../../../../pallets/dmp-queue", default-fea
cumulus-pallet-parachain-system = { path = "../../../../pallets/parachain-system", default-features = false }
cumulus-pallet-session-benchmarking = {path = "../../../../pallets/session-benchmarking", default-features = false, version = "3.0.0"}
cumulus-pallet-xcm = { path = "../../../../pallets/xcm", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false }
cumulus-pallet-xcmp-queue = { path = "../../../../pallets/xcmp-queue", default-features = false, features = ["bridging"] }
cumulus-primitives-core = { path = "../../../../primitives/core", default-features = false }
cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", default-features = false }
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use bridge_runtime_common::{
source::FromBridgedChainMessagesDeliveryProof, target::FromBridgedChainMessagesProof,
MessageBridge, ThisChainWithMessages, UnderlyingChainProvider,
},
messages_xcm_extension::{XcmBlobHauler, XcmBlobHaulerAdapter},
messages_xcm_extension::{SenderAndLane, XcmBlobHauler, XcmBlobHaulerAdapter},
refund_relayer_extension::{
ActualFeeRefund, RefundBridgedParachainMessages, RefundableMessagesLane,
RefundableParachain,
Expand All @@ -47,6 +47,16 @@ parameter_types! {
pub KusamaGlobalConsensusNetwork: NetworkId = NetworkId::Kusama;
// see the `FEE_BOOST_PER_MESSAGE` constant to get the meaning of this value
pub PriorityBoostPerMessage: u64 = 4_551_111_111_111;

pub AssetHubPolkadotParaId: cumulus_primitives_core::ParaId = 1000.into();

pub FromAssetHubPolkadotToAssetHubKusamaRoute: SenderAndLane = SenderAndLane::new(
ParentThen(X1(Parachain(AssetHubPolkadotParaId::get().into()))).into(),
ASSET_HUB_POLKADOT_TO_ASSET_HUB_KUSAMA_LANE_ID,
);

pub CongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
pub UncongestedMessage: Xcm<()> = unimplemented!("TODO: not supported yet!");
}

/// Proof of messages, coming from BridgeHubKusama.
Expand All @@ -68,15 +78,18 @@ pub type ToBridgeHubKusamaHaulBlobExporter = HaulBlobExporter<
>;
pub struct ToBridgeHubKusamaXcmBlobHauler;
impl XcmBlobHauler for ToBridgeHubKusamaXcmBlobHauler {
type MessageSender =
pallet_bridge_messages::Pallet<Runtime, WithBridgeHubKusamaMessagesInstance>;
type Runtime = Runtime;
type MessagesInstance = WithBridgeHubKusamaMessagesInstance;
type SenderAndLane = FromAssetHubPolkadotToAssetHubKusamaRoute;

fn xcm_lane() -> LaneId {
// TODO: rework once dynamic lanes are supported (https://github.com/paritytech/parity-bridges-common/issues/1760)
ASSET_HUB_POLKADOT_TO_ASSET_HUB_KUSAMA_LANE_ID
}
type ToSourceChainSender = crate::XcmRouter;
type CongestedMessage = CongestedMessage;
type UncongestedMessage = UncongestedMessage;
}

/// On messages delivered callback.
pub type OnMessagesDelivered = XcmBlobHaulerAdapter<ToBridgeHubKusamaXcmBlobHauler>;

/// Messaging Bridge configuration for ThisChain -> BridgeHubKusama
pub struct WithBridgeHubKusamaMessageBridge;
impl MessageBridge for WithBridgeHubKusamaMessageBridge {
Expand Down
11 changes: 9 additions & 2 deletions parachains/runtimes/bridge-hubs/bridge-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,8 +486,15 @@ impl pallet_bridge_messages::Config<WithBridgeHubKusamaMessagesInstance> for Run
DeliveryRewardInBalance,
>;
type SourceHeaderChain = SourceHeaderChainAdapter<WithBridgeHubKusamaMessageBridge>;
type MessageDispatch =
XcmBlobMessageDispatch<OnThisChainBlobDispatcher<UniversalLocation>, Self::WeightInfo>;
type MessageDispatch = XcmBlobMessageDispatch<
OnThisChainBlobDispatcher<UniversalLocation>,
Self::WeightInfo,
cumulus_pallet_xcmp_queue::bridging::OutboundXcmpChannelCongestionStatusProvider<
bridge_hub_config::AssetHubPolkadotParaId,
Runtime,
>,
>;
type OnMessagesDelivered = bridge_hub_config::OnMessagesDelivered;
}

/// Allows collect and claim rewards for relayers
Expand Down

0 comments on commit a08526f

Please sign in to comment.