Skip to content

Commit

Permalink
change(system-parachains): Configure bridging (SDK #4488) (SDK #4935)…
Browse files Browse the repository at this point in the history
… (SDK #4949) (SDK #5649)

- Configure Polkadot Asset Hub
- Configure Bridge Hubs
  • Loading branch information
pandres95 committed Oct 19, 2024
1 parent f1bf0ec commit 471ce8d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 64 deletions.
21 changes: 5 additions & 16 deletions system-parachains/asset-hubs/asset-hub-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,7 @@ impl pallet_collator_selection::Config for Runtime {

impl pallet_asset_conversion_tx_payment::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Fungibles = LocalAndForeignAssets;
type AssetId = xcm::v4::Location;
type OnChargeAssetTransaction =
impls::tx_payment::SwapCreditAdapter<DotLocationV3, AssetConversion>;
}
Expand Down Expand Up @@ -842,29 +842,18 @@ impl pallet_nfts::Config for Runtime {
/// consensus with dynamic fees and back-pressure.
pub type ToKusamaXcmRouterInstance = pallet_xcm_bridge_hub_router::Instance1;
impl pallet_xcm_bridge_hub_router::Config<ToKusamaXcmRouterInstance> for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_xcm_bridge_hub_router::WeightInfo<Runtime>;

type UniversalLocation = xcm_config::UniversalLocation;
type BridgedNetworkId = xcm_config::bridging::to_kusama::KusamaNetwork;
type Bridges = xcm_config::bridging::NetworkExportTable;
type DestinationVersion = PolkadotXcm;

#[cfg(not(feature = "runtime-benchmarks"))]
type BridgeHubOrigin = EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>;
#[cfg(feature = "runtime-benchmarks")]
type BridgeHubOrigin = frame_support::traits::EitherOfDiverse<
// for running benchmarks
EnsureRoot<AccountId>,
// for running tests with `--feature runtime-benchmarks`
EnsureXcm<Equals<xcm_config::bridging::SiblingBridgeHub>>,
>;
type SiblingBridgeHubLocation = xcm_config::bridging::SiblingBridgeHub;

type ToBridgeHubSender = XcmpQueue;
type WithBridgeHubChannel =
cumulus_pallet_xcmp_queue::bridging::InAndOutXcmpChannelStatusProvider<
xcm_config::bridging::SiblingBridgeHubParaId,
Runtime,
>;
type LocalXcmChannelManager =
cumulus_pallet_xcmp_queue::bridging::InAndOutXcmpChannelStatusProvider<Runtime>;

type ByteFee = xcm_config::bridging::XcmBridgeHubRouterByteFee;
type FeeAsset = xcm_config::bridging::XcmBridgeHubRouterFeeAssetId;
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub struct BridgeHubKusama;

impl Chain for BridgeHubKusama {
const ID: ChainId = *b"bhks";
const STATE_VERSION: sp_runtime::StateVersion = sp_runtime::StateVersion::V1;

type BlockNumber = BlockNumber;
type Hash = Hash;
Expand Down Expand Up @@ -93,7 +94,8 @@ pub const WITH_BRIDGE_HUB_KUSAMA_RELAYERS_PALLET_NAME: &str = "BridgeRelayers";
pub const WITH_BRIDGE_KUSAMA_TO_POLKADOT_MESSAGES_PALLET_INDEX: u8 = 53;

decl_bridge_finality_runtime_apis!(bridge_hub_kusama);
decl_bridge_messages_runtime_apis!(bridge_hub_kusama);
// TODO: @acatangiu can update this to `HashedLaneId`
decl_bridge_messages_runtime_apis!(bridge_hub_kusama, LegacyLaneId);

frame_support::parameter_types! {
/// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Kusama
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ pub struct BridgeHubPolkadot;

impl Chain for BridgeHubPolkadot {
const ID: ChainId = *b"bhpd";
const STATE_VERSION: sp_runtime::StateVersion = sp_runtime::StateVersion::V1;

type BlockNumber = BlockNumber;
type Hash = Hash;
Expand Down Expand Up @@ -84,7 +85,8 @@ pub const WITH_BRIDGE_HUB_POLKADOT_RELAYERS_PALLET_NAME: &str = "BridgeRelayers"
pub const WITH_BRIDGE_POLKADOT_TO_KUSAMA_MESSAGES_PALLET_INDEX: u8 = 53;

decl_bridge_finality_runtime_apis!(bridge_hub_polkadot);
decl_bridge_messages_runtime_apis!(bridge_hub_polkadot);
// TODO: @acatangiu can update this to `HashedLaneId`
decl_bridge_messages_runtime_apis!(bridge_hub_polkadot, LegacyLaneId);

frame_support::parameter_types! {
/// The XCM fee that is paid for executing XCM program (with `ExportMessage` instruction) at the Polkadot
Expand Down

0 comments on commit 471ce8d

Please sign in to comment.