Skip to content

Commit

Permalink
report congestion status: changes at the bridge hub
Browse files Browse the repository at this point in the history
  • Loading branch information
svyatonik committed Aug 3, 2023
1 parent d78f106 commit c364846
Show file tree
Hide file tree
Showing 8 changed files with 222 additions and 302 deletions.
13 changes: 11 additions & 2 deletions bin/millau/runtime/src/rialto_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ parameter_types! {
pub const WeightCredit: Weight = BASE_XCM_WEIGHT_TWICE;
/// Lane used by the with-Rialto bridge.
pub RialtoSenderAndLane: SenderAndLane = SenderAndLane::new(Here.into(), XCM_LANE);

/// Dummy message used in configuration.
pub DummyXcmMessage: Xcm<()> = Xcm::new();
}

/// Message payload for Millau -> Rialto messages.
Expand Down Expand Up @@ -126,10 +129,16 @@ pub type ToRialtoBlobExporter = HaulBlobExporter<
pub struct ToRialtoXcmBlobHauler;

impl XcmBlobHauler for ToRialtoXcmBlobHauler {
type MessageSender = pallet_bridge_messages::Pallet<Runtime, WithRialtoMessagesInstance>;
type MessageSenderOrigin = RuntimeOrigin;
type Runtime = Runtime;
type MessagesInstance = WithRialtoMessagesInstance;
type SenderAndLane = RialtoSenderAndLane;

type ToSendingChainSender = crate::xcm_config::XcmRouter;
type CongestedMessage = DummyXcmMessage;
type UncongestedMessage = DummyXcmMessage;

type MessageSenderOrigin = RuntimeOrigin;

fn message_sender_origin() -> RuntimeOrigin {
pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get()))
.into()
Expand Down
14 changes: 11 additions & 3 deletions bin/millau/runtime/src/rialto_parachain_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ parameter_types! {
pub const WeightCredit: Weight = BASE_XCM_WEIGHT_TWICE;
/// Lane used by the with-RialtoParachain bridge.
pub RialtoParachainSenderAndLane: SenderAndLane = SenderAndLane::new(Here.into(), XCM_LANE);

/// Dummy message used in configuration.
pub DummyXcmMessage: Xcm<()> = Xcm::new();
}

/// Message payload for Millau -> RialtoParachain messages.
Expand Down Expand Up @@ -126,11 +129,16 @@ pub type ToRialtoParachainBlobExporter = HaulBlobExporter<
pub struct ToRialtoParachainXcmBlobHauler;

impl XcmBlobHauler for ToRialtoParachainXcmBlobHauler {
type MessageSender =
pallet_bridge_messages::Pallet<Runtime, WithRialtoParachainMessagesInstance>;
type MessageSenderOrigin = RuntimeOrigin;
type Runtime = Runtime;
type MessagesInstance = WithRialtoParachainMessagesInstance;
type SenderAndLane = RialtoParachainSenderAndLane;

type ToSendingChainSender = crate::xcm_config::XcmRouter;
type CongestedMessage = DummyXcmMessage;
type UncongestedMessage = DummyXcmMessage;

type MessageSenderOrigin = RuntimeOrigin;

fn message_sender_origin() -> RuntimeOrigin {
pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get()))
.into()
Expand Down
4 changes: 2 additions & 2 deletions bin/millau/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ mod tests {
let dispatch_result = FromRialtoMessageDispatch::dispatch(incoming_message);
assert!(matches!(
dispatch_result.dispatch_level_result,
XcmBlobMessageDispatchResult::NotDispatched(_),
XcmBlobMessageDispatchResult::Dispatched,
));
}

Expand All @@ -404,7 +404,7 @@ mod tests {
let dispatch_result = FromRialtoMessageDispatch::dispatch(incoming_message);
assert!(matches!(
dispatch_result.dispatch_level_result,
XcmBlobMessageDispatchResult::NotDispatched(_),
XcmBlobMessageDispatchResult::Dispatched,
));
}
}
13 changes: 11 additions & 2 deletions bin/rialto-parachain/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ parameter_types! {
pub const WeightCredit: Weight = BASE_XCM_WEIGHT_TWICE;
/// Lane used by the with-Millau bridge.
pub MullauSenderAndLane: SenderAndLane = SenderAndLane::new(Here.into(), XCM_LANE);

/// Dummy message used in configuration.
pub DummyXcmMessage: Xcm<()> = Xcm::new();
}

/// Message payload for RialtoParachain -> Millau messages.
Expand Down Expand Up @@ -126,10 +129,16 @@ pub type ToMillauBlobExporter =
pub struct ToMillauXcmBlobHauler;

impl XcmBlobHauler for ToMillauXcmBlobHauler {
type MessageSender = pallet_bridge_messages::Pallet<Runtime, WithMillauMessagesInstance>;
type MessageSenderOrigin = RuntimeOrigin;
type Runtime = Runtime;
type MessagesInstance = WithMillauMessagesInstance;
type SenderAndLane = MullauSenderAndLane;

type ToSendingChainSender = crate::XcmRouter;
type CongestedMessage = DummyXcmMessage;
type UncongestedMessage = DummyXcmMessage;

type MessageSenderOrigin = RuntimeOrigin;

fn message_sender_origin() -> RuntimeOrigin {
pallet_xcm::Origin::from(MultiLocation::new(1, crate::UniversalLocation::get())).into()
}
Expand Down
13 changes: 11 additions & 2 deletions bin/rialto/runtime/src/millau_messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ parameter_types! {
pub const WeightCredit: Weight = BASE_XCM_WEIGHT_TWICE;
/// Lane used by the with-Millau bridge.
pub MullauSenderAndLane: SenderAndLane = SenderAndLane::new(Here.into(), XCM_LANE);

/// Dummy message used in configuration.
pub DummyXcmMessage: Xcm<()> = Xcm::new();
}

/// Message payload for Rialto -> Millau messages.
Expand Down Expand Up @@ -125,10 +128,16 @@ pub type ToMillauBlobExporter = HaulBlobExporter<
pub struct ToMillauXcmBlobHauler;

impl XcmBlobHauler for ToMillauXcmBlobHauler {
type MessageSender = pallet_bridge_messages::Pallet<Runtime, WithMillauMessagesInstance>;
type MessageSenderOrigin = RuntimeOrigin;
type Runtime = Runtime;
type MessagesInstance = WithMillauMessagesInstance;
type SenderAndLane = MullauSenderAndLane;

type ToSendingChainSender = crate::xcm_config::XcmRouter;
type CongestedMessage = DummyXcmMessage;
type UncongestedMessage = DummyXcmMessage;

type MessageSenderOrigin = RuntimeOrigin;

fn message_sender_origin() -> RuntimeOrigin {
pallet_xcm::Origin::from(MultiLocation::new(1, crate::xcm_config::UniversalLocation::get()))
.into()
Expand Down
Loading

0 comments on commit c364846

Please sign in to comment.