Skip to content

Commit

Permalink
".git/.scripts/commands/fmt/fmt.sh"
Browse files Browse the repository at this point in the history
  • Loading branch information
command-bot committed Oct 25, 2024
1 parent 53e0eb1 commit ad7f21a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 21 deletions.
14 changes: 9 additions & 5 deletions bridges/modules/xcm-bridge-hub-router/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
//! queues are congested, it will eventually lead to increased queuing on this chain.
//!
//! **Note on Terminology**: When we refer to the bridge hub here, we mean the chain that
//! has the `pallet-bridge-messages` with an `ExportXcm` implementation deployed, e.g., provided by `pallet-xcm-bridge-hub`.
//! Depending on the deployment setup, `T::ToBridgeHubSender` can be configured accordingly - see `T::ToBridgeHubSender` for more documentation.
//! has the `pallet-bridge-messages` with an `ExportXcm` implementation deployed, e.g., provided by
//! `pallet-xcm-bridge-hub`. Depending on the deployment setup, `T::ToBridgeHubSender` can be
//! configured accordingly - see `T::ToBridgeHubSender` for more documentation.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down Expand Up @@ -97,8 +98,12 @@ pub mod pallet {
type DestinationVersion: GetVersion;

/// The bridge hub may be:
/// - A system (sibling) bridge hub parachain (or another chain), in which case we need an implementation for `T::ToBridgeHubSender` that sends `ExportMessage`, e.g., `SovereignPaidRemoteExporter`.
/// - The local chain, in which case we need an implementation for `T::ToBridgeHubSender` that does not use `ExportMessage` but instead directly calls the `ExportXcm` implementation.
/// - A system (sibling) bridge hub parachain (or another chain), in which case we need an
/// implementation for `T::ToBridgeHubSender` that sends `ExportMessage`, e.g.,
/// `SovereignPaidRemoteExporter`.
/// - The local chain, in which case we need an implementation for `T::ToBridgeHubSender`
/// that does not use `ExportMessage` but instead directly calls the `ExportXcm`
/// implementation.
type ToBridgeHubSender: SendXcm;
/// Local XCM channel manager.
type LocalXcmChannelManager: XcmChannelStatusProvider;
Expand Down Expand Up @@ -229,7 +234,6 @@ pub mod pallet {
}
}


// This pallet acts as the `ExporterFor` for the `SovereignPaidRemoteExporter` to compute
// message fee using fee factor.
impl<T: Config<I>, I: 'static> ExporterFor for Pallet<T, I> {
Expand Down
4 changes: 3 additions & 1 deletion bridges/modules/xcm-bridge-hub-router/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ use frame_support::{
use sp_runtime::{traits::ConstU128, BuildStorage};
use sp_std::cell::RefCell;
use xcm::prelude::*;
use xcm_builder::{InspectMessageQueues, NetworkExportTable, NetworkExportTableItem, SovereignPaidRemoteExporter};
use xcm_builder::{
InspectMessageQueues, NetworkExportTable, NetworkExportTableItem, SovereignPaidRemoteExporter,
};

type Block = frame_system::mocking::MockBlock<TestRuntime>;

Expand Down
11 changes: 8 additions & 3 deletions bridges/modules/xcm-bridge-hub/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ impl pallet_xcm_bridge_hub::Config for TestRuntime {
type BlobDispatcher = TestBlobDispatcher;
}

/// A router instance simulates a scenario where the router is deployed on a different chain than the `MessageExporter`. This means that the router sends an `ExportMessage`.
/// A router instance simulates a scenario where the router is deployed on a different chain than
/// the `MessageExporter`. This means that the router sends an `ExportMessage`.
impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
Expand All @@ -219,10 +220,14 @@ impl pallet_xcm_bridge_hub_router::Config<()> for TestRuntime {
type Bridges = NetworkExportTable<BridgeTable>;
type DestinationVersion = AlwaysLatest;

// We use `SovereignPaidRemoteExporter` here to test and ensure that the `ExportMessage` produced by `pallet_xcm_bridge_hub_router` is compatible with the `ExportXcm` implementation of `pallet_xcm_bridge_hub`.
// We use `SovereignPaidRemoteExporter` here to test and ensure that the `ExportMessage`
// produced by `pallet_xcm_bridge_hub_router` is compatible with the `ExportXcm` implementation
// of `pallet_xcm_bridge_hub`.
type ToBridgeHubSender = SovereignPaidRemoteExporter<
XcmOverBridgeRouter,
// **Note**: The crucial part is that `ExportMessage` is processed by `XcmExecutor`, which calls the `ExportXcm` implementation of `pallet_xcm_bridge_hub` as the `MessageExporter`.
// **Note**: The crucial part is that `ExportMessage` is processed by `XcmExecutor`, which
// calls the `ExportXcm` implementation of `pallet_xcm_bridge_hub` as the
// `MessageExporter`.
ExecuteXcmOverSendXcm,
Self::UniversalLocation,
>;
Expand Down
10 changes: 4 additions & 6 deletions cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,12 +934,10 @@ impl pallet_xcm_bridge_hub_router::Config<ToWestendXcmRouterInstance> for Runtim
type Bridges = xcm_config::bridging::NetworkExportTable;
type DestinationVersion = PolkadotXcm;

// Let's use `SovereignPaidRemoteExporter`, which sends `ExportMessage` over HRMP to the sibling BridgeHub.
type ToBridgeHubSender = SovereignPaidRemoteExporter<
ToWestendXcmRouter,
XcmpQueue,
Self::UniversalLocation,
>;
// Let's use `SovereignPaidRemoteExporter`, which sends `ExportMessage` over HRMP to the sibling
// BridgeHub.
type ToBridgeHubSender =
SovereignPaidRemoteExporter<ToWestendXcmRouter, XcmpQueue, Self::UniversalLocation>;
type LocalXcmChannelManager =
cumulus_pallet_xcmp_queue::bridging::InAndOutXcmpChannelStatusProvider<Runtime>;

Expand Down
10 changes: 4 additions & 6 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -928,12 +928,10 @@ impl pallet_xcm_bridge_hub_router::Config<ToRococoXcmRouterInstance> for Runtime
type Bridges = xcm_config::bridging::NetworkExportTable;
type DestinationVersion = PolkadotXcm;

// Let's use `SovereignPaidRemoteExporter`, which sends `ExportMessage` over HRMP to the sibling BridgeHub.
type ToBridgeHubSender = SovereignPaidRemoteExporter<
ToRococoXcmRouter,
XcmpQueue,
Self::UniversalLocation,
>;
// Let's use `SovereignPaidRemoteExporter`, which sends `ExportMessage` over HRMP to the sibling
// BridgeHub.
type ToBridgeHubSender =
SovereignPaidRemoteExporter<ToRococoXcmRouter, XcmpQueue, Self::UniversalLocation>;
type LocalXcmChannelManager =
cumulus_pallet_xcmp_queue::bridging::InAndOutXcmpChannelStatusProvider<Runtime>;

Expand Down

0 comments on commit ad7f21a

Please sign in to comment.