From 4e2b4ffd3a073289fe0d6ef3aa867450db65bbe2 Mon Sep 17 00:00:00 2001 From: Alistair Singh Date: Thu, 9 Nov 2023 13:33:04 +0200 Subject: [PATCH] use siblings --- .../bridge-hub-rococo/src/xcm_config.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs index 8c8b1e3fd080c..4b86248c7c241 100644 --- a/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs +++ b/cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/xcm_config.rs @@ -50,7 +50,10 @@ use parachains_common::{ use polkadot_parachain_primitives::primitives::Sibling; use polkadot_runtime_common::xcm_sender::ExponentialPrice; use rococo_runtime_constants::system_parachain::SystemParachains; -use snowbridge_core::outbound::SendMessageFee; +use snowbridge_core::{ + outbound::SendMessageFee, + sibling_sovereign_account_raw +}; use snowbridge_router_primitives::{ inbound::GlobalConsensusEthereumConvertsFor, outbound::EthereumBlobExporter, @@ -70,7 +73,7 @@ use xcm_builder::{ XcmFeeManagerFromComponents, XcmFeeToAccount, }; use xcm_executor::{ - traits::{ConvertLocation, ExportXcm, FeeReason, TransactAsset, WithOriginFilter}, + traits::{ExportXcm, FeeReason, TransactAsset, WithOriginFilter}, XcmExecutor, }; @@ -326,7 +329,6 @@ impl xcm_executor::Config for XcmConfig { TokenLocation, EthereumNetwork, SnowbridgeTreasuryAccount, - LocationToAccountId, Self::AssetTransactor, crate::EthereumOutboundQueue, >, @@ -592,7 +594,6 @@ pub struct XcmExportFeeToSnowbridge< TokenLocation, EthereumNetwork, ReceiverAccount, - SovereignAccountOf, AssetTransactor, OutboundQueue, >( @@ -600,7 +601,6 @@ pub struct XcmExportFeeToSnowbridge< TokenLocation, EthereumNetwork, ReceiverAccount, - SovereignAccountOf, AssetTransactor, OutboundQueue, )>, @@ -610,7 +610,6 @@ impl< TokenLocation: Get, EthereumNetwork: Get, ReceiverAccount: Get, - SovereignAccountOf: ConvertLocation, AssetTransactor: TransactAsset, OutboundQueue: SendMessageFee, > HandleFee @@ -618,7 +617,6 @@ impl< TokenLocation, EthereumNetwork, ReceiverAccount, - SovereignAccountOf, AssetTransactor, OutboundQueue, > @@ -655,8 +653,9 @@ impl< let receiver = ReceiverAccount::get(); // There is an origin so split fee into parts. - if let Some(XcmContext { origin: Some(origin), .. }) = context { - if let Some(origin) = SovereignAccountOf::convert_location(origin) { + if let Some(XcmContext { origin: Some(MultiLocation { parents: 1, interior }), .. }) = context { + if let Some(Parachain(sibling_para_id)) = interior.first() { + let account: AccountId = sibling_sovereign_account_raw((*sibling_para_id).into()).into(); let local_fee = OutboundQueue::local_fee(); if let Fungible(amount) = fee_item.fun { let remote_fee = amount.checked_sub(local_fee).unwrap_or(0); @@ -676,7 +675,7 @@ impl< MultiAsset { id: Concrete(token_location), fun: Fungible(remote_fee) } .into(), context, - origin, + account, ); } else { // Push the fee item back and bail out to let other handlers run.