# Note for reviewer

Most changes are just syntax changes necessary for the new version.
Most important files should be the ones under the `xcm` folder.

# Description 

Added XCMv4.

## Removed `Multi` prefix
The following types have been renamed:
- MultiLocation -> Location
- MultiAsset -> Asset
- MultiAssets -> Assets
- InteriorMultiLocation -> InteriorLocation
- MultiAssetFilter -> AssetFilter
- VersionedMultiAsset -> VersionedAsset
- WildMultiAsset -> WildAsset
- VersionedMultiLocation -> VersionedLocation

In order to fix a name conflict, the `Assets` in `xcm-executor` were
renamed to `HoldingAssets`, as they represent assets in holding.

## Removed `Abstract` asset id

It was not being used anywhere and this simplifies the code.

Now assets are just constructed as follows:

```rust
let asset: Asset = (AssetId(Location::new(1, Here)), 100u128).into();
```

No need for specifying `Concrete` anymore.

## Outcome is now a named fields struct

Instead of

```rust
pub enum Outcome {
  Complete(Weight),
  Incomplete(Weight, Error),
  Error(Error),
}
```

we now have

```rust
pub enum Outcome {
  Complete { used: Weight },
  Incomplete { used: Weight, error: Error },
  Error { error: Error },
}
```

## Added Reanchorable trait

Now both locations and assets implement this trait, making it easier to
reanchor both.

## New syntax for building locations and junctions

Now junctions are built using the following methods:

```rust
let location = Location {
    parents: 1,
    interior: [Parachain(1000), PalletInstance(50), GeneralIndex(1984)].into()
};
```

or

```rust
let location = Location::new(1, [Parachain(1000), PalletInstance(50), GeneralIndex(1984)]);
```

And they are matched like so:

```rust
match location.unpack() {
  (1, [Parachain(id)]) => ...
  (0, Here) => ...,
  (1, [_]) => ...,
}
```

This syntax is mandatory in v4, and has been also implemented for v2 and
v3 for easier migration.

This was needed to make all sizes smaller.

# TODO
- [x] Scaffold v4
- [x] Port github.com/paritytech/polkadot/pull/7236
- [x] Remove `Multi` prefix
- [x] Remove `Abstract` asset id

---------

Co-authored-by: command-bot <>
Co-authored-by: Keith Yeung <kungfukeith11@gmail.com>
This commit is contained in:
Francisco Aguirre
2024-01-16 19:18:04 +01:00
committed by GitHub
parent ec7bfae00a
commit 8428f678fe
255 changed files with 12425 additions and 6726 deletions
@@ -161,13 +161,13 @@ where
{
fn convert_register_token(chain_id: u64, token: H160, fee: u128) -> (Xcm<()>, Balance) {
let network = Ethereum { chain_id };
let xcm_fee: MultiAsset = (MultiLocation::parent(), fee).into();
let deposit: MultiAsset = (MultiLocation::parent(), CreateAssetDeposit::get()).into();
let xcm_fee: Asset = (Location::parent(), fee).into();
let deposit: Asset = (Location::parent(), CreateAssetDeposit::get()).into();
let total_amount = fee + CreateAssetDeposit::get();
let total: MultiAsset = (MultiLocation::parent(), total_amount).into();
let total: Asset = (Location::parent(), total_amount).into();
let bridge_location: MultiLocation = (Parent, Parent, GlobalConsensus(network)).into();
let bridge_location: Location = (Parent, Parent, GlobalConsensus(network)).into();
let owner = GlobalConsensusEthereumConvertsFor::<[u8; 32]>::from_chain_id(&chain_id);
let asset_id = Self::convert_token_address(network, token);
@@ -182,7 +182,7 @@ where
// Fund the snowbridge sovereign with the required deposit for creation.
DepositAsset { assets: Definite(deposit.into()), beneficiary: bridge_location },
// Only our inbound-queue pallet is allowed to invoke `UniversalOrigin`
DescendOrigin(X1(PalletInstance(inbound_queue_pallet_index))),
DescendOrigin(PalletInstance(inbound_queue_pallet_index).into()),
// Change origin to the bridge.
UniversalOrigin(GlobalConsensus(network)),
// Call create_asset on foreign assets pallet.
@@ -216,40 +216,37 @@ where
asset_hub_fee: u128,
) -> (Xcm<()>, Balance) {
let network = Ethereum { chain_id };
let asset_hub_fee_asset: MultiAsset = (MultiLocation::parent(), asset_hub_fee).into();
let asset: MultiAsset = (Self::convert_token_address(network, token), amount).into();
let asset_hub_fee_asset: Asset = (Location::parent(), asset_hub_fee).into();
let asset: Asset = (Self::convert_token_address(network, token), amount).into();
let (dest_para_id, beneficiary, dest_para_fee) = match destination {
// Final destination is a 32-byte account on AssetHub
Destination::AccountId32 { id } => (
None,
MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id }) },
0,
),
Destination::AccountId32 { id } =>
(None, Location::new(0, [AccountId32 { network: None, id }]), 0),
// Final destination is a 32-byte account on a sibling of AssetHub
Destination::ForeignAccountId32 { para_id, id, fee } => (
Some(para_id),
MultiLocation { parents: 0, interior: X1(AccountId32 { network: None, id }) },
Location::new(0, [AccountId32 { network: None, id }]),
// Total fee needs to cover execution on AssetHub and Sibling
fee,
),
// Final destination is a 20-byte account on a sibling of AssetHub
Destination::ForeignAccountId20 { para_id, id, fee } => (
Some(para_id),
MultiLocation { parents: 0, interior: X1(AccountKey20 { network: None, key: id }) },
Location::new(0, [AccountKey20 { network: None, key: id }]),
// Total fee needs to cover execution on AssetHub and Sibling
fee,
),
};
let total_fees = asset_hub_fee.saturating_add(dest_para_fee);
let total_fee_asset: MultiAsset = (MultiLocation::parent(), total_fees).into();
let total_fee_asset: Asset = (Location::parent(), total_fees).into();
let inbound_queue_pallet_index = InboundQueuePalletInstance::get();
let mut instructions = vec![
ReceiveTeleportedAsset(total_fee_asset.into()),
BuyExecution { fees: asset_hub_fee_asset, weight_limit: Unlimited },
DescendOrigin(X1(PalletInstance(inbound_queue_pallet_index))),
DescendOrigin(PalletInstance(inbound_queue_pallet_index).into()),
UniversalOrigin(GlobalConsensus(network)),
ReserveAssetDeposited(asset.clone().into()),
ClearOrigin,
@@ -257,14 +254,13 @@ where
match dest_para_id {
Some(dest_para_id) => {
let dest_para_fee_asset: MultiAsset =
(MultiLocation::parent(), dest_para_fee).into();
let dest_para_fee_asset: Asset = (Location::parent(), dest_para_fee).into();
instructions.extend(vec![
// Perform a deposit reserve to send to destination chain.
DepositReserveAsset {
assets: Definite(vec![dest_para_fee_asset.clone(), asset.clone()].into()),
dest: MultiLocation { parents: 1, interior: X1(Parachain(dest_para_id)) },
dest: Location::new(1, [Parachain(dest_para_id)]),
xcm: vec![
// Buy execution on target.
BuyExecution { fees: dest_para_fee_asset, weight_limit: Unlimited },
@@ -286,15 +282,12 @@ where
(instructions.into(), total_fees.into())
}
// Convert ERC20 token address to a Multilocation that can be understood by Assets Hub.
fn convert_token_address(network: NetworkId, token: H160) -> MultiLocation {
MultiLocation {
parents: 2,
interior: X2(
GlobalConsensus(network),
AccountKey20 { network: None, key: token.into() },
),
}
// Convert ERC20 token address to a location that can be understood by Assets Hub.
fn convert_token_address(network: NetworkId, token: H160) -> Location {
Location::new(
2,
[GlobalConsensus(network), AccountKey20 { network: None, key: token.into() }],
)
}
}
@@ -303,12 +296,11 @@ impl<AccountId> ConvertLocation<AccountId> for GlobalConsensusEthereumConvertsFo
where
AccountId: From<[u8; 32]> + Clone,
{
fn convert_location(location: &MultiLocation) -> Option<AccountId> {
if let MultiLocation { interior: X1(GlobalConsensus(Ethereum { chain_id })), .. } = location
{
Some(Self::from_chain_id(chain_id).into())
} else {
None
fn convert_location(location: &Location) -> Option<AccountId> {
match location.unpack() {
(_, [GlobalConsensus(Ethereum { chain_id })]) =>
Some(Self::from_chain_id(chain_id).into()),
_ => None,
}
}
}
@@ -2,7 +2,7 @@ use super::GlobalConsensusEthereumConvertsFor;
use crate::inbound::CallIndex;
use frame_support::parameter_types;
use hex_literal::hex;
use xcm::v3::prelude::*;
use xcm::v4::prelude::*;
use xcm_executor::traits::ConvertLocation;
const NETWORK: NetworkId = Ethereum { chain_id: 11155111 };
@@ -20,7 +20,7 @@ parameter_types! {
fn test_contract_location_with_network_converts_successfully() {
let expected_account: [u8; 32] =
hex!("ce796ae65569a670d0c1cc1ac12515a3ce21b5fbf729d63d7b289baad070139d");
let contract_location = MultiLocation { parents: 2, interior: X1(GlobalConsensus(NETWORK)) };
let contract_location = Location::new(2, [GlobalConsensus(NETWORK)]);
let account =
GlobalConsensusEthereumConvertsFor::<[u8; 32]>::convert_location(&contract_location)
@@ -31,8 +31,7 @@ fn test_contract_location_with_network_converts_successfully() {
#[test]
fn test_contract_location_with_incorrect_location_fails_convert() {
let contract_location =
MultiLocation { parents: 2, interior: X2(GlobalConsensus(Polkadot), Parachain(1000)) };
let contract_location = Location::new(2, [GlobalConsensus(Polkadot), Parachain(1000)]);
assert_eq!(
GlobalConsensusEthereumConvertsFor::<[u8; 32]>::convert_location(&contract_location),
@@ -16,7 +16,7 @@ use snowbridge_core::{
};
use sp_core::{H160, H256};
use sp_std::{iter::Peekable, marker::PhantomData, prelude::*};
use xcm::v3::prelude::*;
use xcm::v4::prelude::*;
use xcm_executor::traits::{ConvertLocation, ExportXcm};
pub struct EthereumBlobExporter<
@@ -29,7 +29,7 @@ pub struct EthereumBlobExporter<
impl<UniversalLocation, EthereumNetwork, OutboundQueue, AgentHashedDescription> ExportXcm
for EthereumBlobExporter<UniversalLocation, EthereumNetwork, OutboundQueue, AgentHashedDescription>
where
UniversalLocation: Get<InteriorMultiLocation>,
UniversalLocation: Get<InteriorLocation>,
EthereumNetwork: Get<NetworkId>,
OutboundQueue: SendMessage<Balance = u128>,
AgentHashedDescription: ConvertLocation<H256>,
@@ -39,8 +39,8 @@ where
fn validate(
network: NetworkId,
_channel: u32,
universal_source: &mut Option<InteriorMultiLocation>,
destination: &mut Option<InteriorMultiLocation>,
universal_source: &mut Option<InteriorLocation>,
destination: &mut Option<InteriorLocation>,
message: &mut Option<Xcm<()>>,
) -> SendResult<Self::Ticket> {
let expected_network = EthereumNetwork::get();
@@ -74,8 +74,8 @@ where
return Err(SendError::NotApplicable)
}
let para_id = match local_sub {
X1(Parachain(para_id)) => para_id,
let para_id = match local_sub.as_slice() {
[Parachain(para_id)] => *para_id,
_ => {
log::error!(target: "xcm::ethereum_blob_exporter", "could not get parachain id from universal source '{local_sub:?}'.");
return Err(SendError::MissingArgument)
@@ -93,7 +93,7 @@ where
SendError::Unroutable
})?;
let source_location: MultiLocation = MultiLocation { parents: 1, interior: local_sub };
let source_location = Location::new(1, local_sub.clone());
let agent_id = match AgentHashedDescription::convert_location(&source_location) {
Some(id) => id,
None => {
@@ -116,8 +116,8 @@ where
SendError::Unroutable
})?;
// convert fee to MultiAsset
let fee = MultiAsset::from((MultiLocation::parent(), fee.total())).into();
// convert fee to Asset
let fee = Asset::from((Location::parent(), fee.total())).into();
Ok(((ticket.encode(), message_id), fee))
}
@@ -216,8 +216,8 @@ impl<'a, Call> XcmConverter<'a, Call> {
// assert that the beneficiary is AccountKey20.
let recipient = match_expression!(
beneficiary,
MultiLocation { parents: 0, interior: X1(AccountKey20 { network, key }) }
beneficiary.unpack(),
(0, [AccountKey20 { network, key }])
if self.network_matches(network),
H160(*key)
)
@@ -245,14 +245,15 @@ impl<'a, Call> XcmConverter<'a, Call> {
}
}
let (token, amount) = match_expression!(
reserve_asset,
MultiAsset {
id: Concrete(MultiLocation { parents: 0, interior: X1(AccountKey20 { network , key })}),
fun: Fungible(amount)
} if self.network_matches(network),
(H160(*key), *amount)
)
let (token, amount) = match reserve_asset {
Asset { id: AssetId(inner_location), fun: Fungible(amount) } =>
match inner_location.unpack() {
(0, [AccountKey20 { network, key }]) if self.network_matches(network) =>
Some((H160(*key), *amount)),
_ => None,
},
_ => None,
}
.ok_or(AssetResolutionFailed)?;
// transfer amount must be greater than 0.
@@ -11,7 +11,7 @@ use super::*;
parameter_types! {
const MaxMessageSize: u32 = u32::MAX;
const RelayNetwork: NetworkId = Polkadot;
const UniversalLocation: InteriorMultiLocation = X2(GlobalConsensus(RelayNetwork::get()), Parachain(1013));
UniversalLocation: InteriorLocation = [GlobalConsensus(RelayNetwork::get()), Parachain(1013)].into();
const BridgedNetwork: NetworkId = Ethereum{ chain_id: 1 };
const NonBridgedNetwork: NetworkId = Ethereum{ chain_id: 2 };
}
@@ -61,8 +61,8 @@ impl SendMessageFeeProvider for MockErrOutboundQueue {
fn exporter_validate_with_unknown_network_yields_not_applicable() {
let network = Ethereum { chain_id: 1337 };
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = None;
let mut destination: Option<InteriorMultiLocation> = None;
let mut universal_source: Option<InteriorLocation> = None;
let mut destination: Option<InteriorLocation> = None;
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -80,8 +80,8 @@ fn exporter_validate_with_unknown_network_yields_not_applicable() {
fn exporter_validate_with_invalid_destination_yields_missing_argument() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = None;
let mut destination: Option<InteriorMultiLocation> = None;
let mut universal_source: Option<InteriorLocation> = None;
let mut destination: Option<InteriorLocation> = None;
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -99,10 +99,11 @@ fn exporter_validate_with_invalid_destination_yields_missing_argument() {
fn exporter_validate_with_x8_destination_yields_not_applicable() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = None;
let mut destination: Option<InteriorMultiLocation> = Some(X8(
OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild,
));
let mut universal_source: Option<InteriorLocation> = None;
let mut destination: Option<InteriorLocation> = Some(
[OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild, OnlyChild]
.into(),
);
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -120,8 +121,8 @@ fn exporter_validate_with_x8_destination_yields_not_applicable() {
fn exporter_validate_without_universal_source_yields_missing_argument() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = None;
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> = None;
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -139,8 +140,8 @@ fn exporter_validate_without_universal_source_yields_missing_argument() {
fn exporter_validate_without_global_universal_location_yields_unroutable() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = Here.into();
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> = Here.into();
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -158,8 +159,8 @@ fn exporter_validate_without_global_universal_location_yields_unroutable() {
fn exporter_validate_without_global_bridge_location_yields_not_applicable() {
let network = NonBridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = Here.into();
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> = Here.into();
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -177,9 +178,9 @@ fn exporter_validate_without_global_bridge_location_yields_not_applicable() {
fn exporter_validate_with_remote_universal_source_yields_not_applicable() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> =
Some(X2(GlobalConsensus(Kusama), Parachain(1000)));
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> =
Some([GlobalConsensus(Kusama), Parachain(1000)].into());
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -197,8 +198,8 @@ fn exporter_validate_with_remote_universal_source_yields_not_applicable() {
fn exporter_validate_without_para_id_in_source_yields_missing_argument() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> = Some(X1(GlobalConsensus(Polkadot)));
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> = Some(GlobalConsensus(Polkadot).into());
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -216,9 +217,9 @@ fn exporter_validate_without_para_id_in_source_yields_missing_argument() {
fn exporter_validate_complex_para_id_in_source_yields_missing_argument() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> =
Some(X3(GlobalConsensus(Polkadot), Parachain(1000), PalletInstance(12)));
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> =
Some([GlobalConsensus(Polkadot), Parachain(1000), PalletInstance(12)].into());
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -236,9 +237,9 @@ fn exporter_validate_complex_para_id_in_source_yields_missing_argument() {
fn exporter_validate_without_xcm_message_yields_missing_argument() {
let network = BridgedNetwork::get();
let channel: u32 = 0;
let mut universal_source: Option<InteriorMultiLocation> =
Some(X2(GlobalConsensus(Polkadot), Parachain(1000)));
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut universal_source: Option<InteriorLocation> =
Some([GlobalConsensus(Polkadot), Parachain(1000)].into());
let mut destination: Option<InteriorLocation> = Here.into();
let mut message: Option<Xcm<()>> = None;
let result = EthereumBlobExporter::<
@@ -255,23 +256,23 @@ fn exporter_validate_without_xcm_message_yields_missing_argument() {
#[test]
fn exporter_validate_with_max_target_fee_yields_unroutable() {
let network = BridgedNetwork::get();
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut destination: Option<InteriorLocation> = Here.into();
let mut universal_source: Option<InteriorMultiLocation> =
Some(X2(GlobalConsensus(Polkadot), Parachain(1000)));
let mut universal_source: Option<InteriorLocation> =
Some([GlobalConsensus(Polkadot), Parachain(1000)].into());
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let channel: u32 = 0;
let fee = MultiAsset { id: Concrete(Here.into()), fun: Fungible(1000) };
let fees: MultiAssets = vec![fee.clone()].into();
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let fee = Asset { id: AssetId(Here.into()), fun: Fungible(1000) };
let fees: Assets = vec![fee.clone()].into();
let assets: Assets = vec![Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let mut message: Option<Xcm<()>> = Some(
vec![
@@ -280,7 +281,7 @@ fn exporter_validate_with_max_target_fee_yields_unroutable() {
WithdrawAsset(assets),
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: Some(network), key: beneficiary_address })
beneficiary: AccountKey20 { network: Some(network), key: beneficiary_address }
.into(),
},
SetTopic([0; 32]),
@@ -303,14 +304,14 @@ fn exporter_validate_with_max_target_fee_yields_unroutable() {
#[test]
fn exporter_validate_with_unparsable_xcm_yields_unroutable() {
let network = BridgedNetwork::get();
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut destination: Option<InteriorLocation> = Here.into();
let mut universal_source: Option<InteriorMultiLocation> =
Some(X2(GlobalConsensus(Polkadot), Parachain(1000)));
let mut universal_source: Option<InteriorLocation> =
Some([GlobalConsensus(Polkadot), Parachain(1000)].into());
let channel: u32 = 0;
let fee = MultiAsset { id: Concrete(Here.into()), fun: Fungible(1000) };
let fees: MultiAssets = vec![fee.clone()].into();
let fee = Asset { id: AssetId(Here.into()), fun: Fungible(1000) };
let fees: Assets = vec![fee.clone()].into();
let mut message: Option<Xcm<()>> =
Some(vec![WithdrawAsset(fees), BuyExecution { fees: fee, weight_limit: Unlimited }].into());
@@ -330,22 +331,22 @@ fn exporter_validate_with_unparsable_xcm_yields_unroutable() {
#[test]
fn exporter_validate_xcm_success_case_1() {
let network = BridgedNetwork::get();
let mut destination: Option<InteriorMultiLocation> = Here.into();
let mut destination: Option<InteriorLocation> = Here.into();
let mut universal_source: Option<InteriorMultiLocation> =
Some(X2(GlobalConsensus(Polkadot), Parachain(1000)));
let mut universal_source: Option<InteriorLocation> =
Some([GlobalConsensus(Polkadot), Parachain(1000)].into());
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let channel: u32 = 0;
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let fee = assets.clone().get(0).unwrap().clone();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let mut message: Option<Xcm<()>> = Some(
vec![
@@ -354,7 +355,7 @@ fn exporter_validate_xcm_success_case_1() {
BuyExecution { fees: fee, weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -391,12 +392,12 @@ fn xcm_converter_convert_success() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -404,7 +405,7 @@ fn xcm_converter_convert_success() {
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -426,18 +427,18 @@ fn xcm_converter_convert_without_buy_execution_yields_success() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -459,12 +460,12 @@ fn xcm_converter_convert_with_wildcard_all_asset_filter_succeeds() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(All);
let filter: AssetFilter = Wild(All);
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -472,7 +473,7 @@ fn xcm_converter_convert_with_wildcard_all_asset_filter_succeeds() {
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -494,13 +495,12 @@ fn xcm_converter_convert_with_fees_less_than_reserve_yields_success() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let asset_location = X1(AccountKey20 { network: None, key: token_address }).into();
let fee_asset = MultiAsset { id: Concrete(asset_location), fun: Fungible(500) };
let asset_location: Location = [AccountKey20 { network: None, key: token_address }].into();
let fee_asset = Asset { id: AssetId(asset_location.clone()), fun: Fungible(500) };
let assets: MultiAssets =
vec![MultiAsset { id: Concrete(asset_location), fun: Fungible(1000) }].into();
let assets: Assets = vec![Asset { id: AssetId(asset_location), fun: Fungible(1000) }].into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -508,7 +508,7 @@ fn xcm_converter_convert_with_fees_less_than_reserve_yields_success() {
BuyExecution { fees: fee_asset, weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -530,19 +530,19 @@ fn xcm_converter_convert_without_set_topic_yields_set_topic_expected() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
ClearTopic,
]
@@ -557,8 +557,8 @@ fn xcm_converter_convert_with_partial_message_yields_unexpected_end_of_xcm() {
let network = BridgedNetwork::get();
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
@@ -576,16 +576,13 @@ fn xcm_converter_with_different_fee_asset_fails() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let asset_location = X1(AccountKey20 { network: None, key: token_address }).into();
let fee_asset = MultiAsset {
id: Concrete(MultiLocation { parents: 0, interior: Here }),
fun: Fungible(1000),
};
let asset_location = [AccountKey20 { network: None, key: token_address }].into();
let fee_asset =
Asset { id: AssetId(Location { parents: 0, interior: Here }), fun: Fungible(1000) };
let assets: MultiAssets =
vec![MultiAsset { id: Concrete(asset_location), fun: Fungible(1000) }].into();
let assets: Assets = vec![Asset { id: AssetId(asset_location), fun: Fungible(1000) }].into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -593,7 +590,7 @@ fn xcm_converter_with_different_fee_asset_fails() {
BuyExecution { fees: fee_asset, weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -610,13 +607,12 @@ fn xcm_converter_with_fees_greater_than_reserve_fails() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let asset_location = X1(AccountKey20 { network: None, key: token_address }).into();
let fee_asset = MultiAsset { id: Concrete(asset_location), fun: Fungible(1001) };
let asset_location: Location = [AccountKey20 { network: None, key: token_address }].into();
let fee_asset = Asset { id: AssetId(asset_location.clone()), fun: Fungible(1001) };
let assets: MultiAssets =
vec![MultiAsset { id: Concrete(asset_location), fun: Fungible(1000) }].into();
let assets: Assets = vec![Asset { id: AssetId(asset_location), fun: Fungible(1000) }].into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -624,7 +620,7 @@ fn xcm_converter_with_fees_greater_than_reserve_fails() {
BuyExecution { fees: fee_asset, weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -653,12 +649,12 @@ fn xcm_converter_convert_with_extra_instructions_yields_end_of_xcm_message_expec
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -666,7 +662,7 @@ fn xcm_converter_convert_with_extra_instructions_yields_end_of_xcm_message_expec
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
ClearError,
@@ -685,19 +681,19 @@ fn xcm_converter_convert_without_withdraw_asset_yields_withdraw_expected() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId([AccountKey20 { network: None, key: token_address }].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
ClearOrigin,
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -714,8 +710,8 @@ fn xcm_converter_convert_without_withdraw_asset_yields_deposit_expected() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(1000),
}]
.into();
@@ -741,11 +737,11 @@ fn xcm_converter_convert_without_assets_yields_no_reserve_assets() {
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![].into();
let filter: MultiAssetFilter = assets.clone().into();
let assets: Assets = vec![].into();
let filter: AssetFilter = assets.clone().into();
let fee = MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let fee = Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(1000),
};
@@ -755,7 +751,7 @@ fn xcm_converter_convert_without_assets_yields_no_reserve_assets() {
BuyExecution { fees: fee, weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -774,18 +770,18 @@ fn xcm_converter_convert_with_two_assets_yields_too_many_assets() {
let token_address_2: [u8; 20] = hex!("1100000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![
MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address_1 }).into()),
let assets: Assets = vec![
Asset {
id: AssetId(AccountKey20 { network: None, key: token_address_1 }.into()),
fun: Fungible(1000),
},
MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address_2 }).into()),
Asset {
id: AssetId(AccountKey20 { network: None, key: token_address_2 }.into()),
fun: Fungible(500),
},
]
.into();
let filter: MultiAssetFilter = assets.clone().into();
let filter: AssetFilter = assets.clone().into();
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -793,7 +789,7 @@ fn xcm_converter_convert_with_two_assets_yields_too_many_assets() {
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -811,12 +807,12 @@ fn xcm_converter_convert_without_consuming_filter_yields_filter_does_not_consume
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(0));
let filter: AssetFilter = Wild(WildAsset::AllCounted(0));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -824,7 +820,7 @@ fn xcm_converter_convert_without_consuming_filter_yields_filter_does_not_consume
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -842,12 +838,12 @@ fn xcm_converter_convert_with_zero_amount_asset_yields_zero_asset_transfer() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(0),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(1));
let filter: AssetFilter = Wild(WildAsset::AllCounted(1));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -855,7 +851,7 @@ fn xcm_converter_convert_with_zero_amount_asset_yields_zero_asset_transfer() {
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -872,12 +868,12 @@ fn xcm_converter_convert_non_ethereum_asset_yields_asset_resolution_failed() {
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X3(GlobalConsensus(Polkadot), Parachain(1000), GeneralIndex(0)).into()),
let assets: Assets = vec![Asset {
id: AssetId([GlobalConsensus(Polkadot), Parachain(1000), GeneralIndex(0)].into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(1));
let filter: AssetFilter = Wild(WildAsset::AllCounted(1));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -885,7 +881,7 @@ fn xcm_converter_convert_non_ethereum_asset_yields_asset_resolution_failed() {
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -903,14 +899,14 @@ fn xcm_converter_convert_non_ethereum_chain_asset_yields_asset_resolution_failed
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(
X1(AccountKey20 { network: Some(Ethereum { chain_id: 2 }), key: token_address }).into(),
let assets: Assets = vec![Asset {
id: AssetId(
AccountKey20 { network: Some(Ethereum { chain_id: 2 }), key: token_address }.into(),
),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(1));
let filter: AssetFilter = Wild(WildAsset::AllCounted(1));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -918,7 +914,7 @@ fn xcm_converter_convert_non_ethereum_chain_asset_yields_asset_resolution_failed
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -936,14 +932,14 @@ fn xcm_converter_convert_non_ethereum_chain_yields_asset_resolution_failed() {
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(
X1(AccountKey20 { network: Some(NonBridgedNetwork::get()), key: token_address }).into(),
let assets: Assets = vec![Asset {
id: AssetId(
[AccountKey20 { network: Some(NonBridgedNetwork::get()), key: token_address }].into(),
),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(1));
let filter: AssetFilter = Wild(WildAsset::AllCounted(1));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -951,7 +947,7 @@ fn xcm_converter_convert_non_ethereum_chain_yields_asset_resolution_failed() {
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 { network: None, key: beneficiary_address }).into(),
beneficiary: AccountKey20 { network: None, key: beneficiary_address }.into(),
},
SetTopic([0; 32]),
]
@@ -971,23 +967,23 @@ fn xcm_converter_convert_with_non_ethereum_beneficiary_yields_beneficiary_resolu
let beneficiary_address: [u8; 32] =
hex!("2000000000000000000000000000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(1));
let filter: AssetFilter = Wild(WildAsset::AllCounted(1));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
ClearOrigin,
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X3(
beneficiary: [
GlobalConsensus(Polkadot),
Parachain(1000),
AccountId32 { network: Some(Polkadot), id: beneficiary_address },
)
]
.into(),
},
SetTopic([0; 32]),
@@ -1007,12 +1003,12 @@ fn xcm_converter_convert_with_non_ethereum_chain_beneficiary_yields_beneficiary_
let token_address: [u8; 20] = hex!("1000000000000000000000000000000000000000");
let beneficiary_address: [u8; 20] = hex!("2000000000000000000000000000000000000000");
let assets: MultiAssets = vec![MultiAsset {
id: Concrete(X1(AccountKey20 { network: None, key: token_address }).into()),
let assets: Assets = vec![Asset {
id: AssetId(AccountKey20 { network: None, key: token_address }.into()),
fun: Fungible(1000),
}]
.into();
let filter: MultiAssetFilter = Wild(WildMultiAsset::AllCounted(1));
let filter: AssetFilter = Wild(WildAsset::AllCounted(1));
let message: Xcm<()> = vec![
WithdrawAsset(assets.clone()),
@@ -1020,10 +1016,10 @@ fn xcm_converter_convert_with_non_ethereum_chain_beneficiary_yields_beneficiary_
BuyExecution { fees: assets.get(0).unwrap().clone(), weight_limit: Unlimited },
DepositAsset {
assets: filter,
beneficiary: X1(AccountKey20 {
beneficiary: AccountKey20 {
network: Some(Ethereum { chain_id: 2 }),
key: beneficiary_address,
})
}
.into(),
},
SetTopic([0; 32]),
@@ -1037,14 +1033,13 @@ fn xcm_converter_convert_with_non_ethereum_chain_beneficiary_yields_beneficiary_
#[test]
fn test_describe_asset_hub() {
let legacy_location: MultiLocation =
MultiLocation { parents: 0, interior: X1(Parachain(1000)) };
let legacy_location: Location = Location::new(0, [Parachain(1000)]);
let legacy_agent_id = AgentIdOf::convert_location(&legacy_location).unwrap();
assert_eq!(
legacy_agent_id,
hex!("72456f48efed08af20e5b317abf8648ac66e86bb90a411d9b0b713f7364b75b4").into()
);
let location: MultiLocation = MultiLocation { parents: 1, interior: X1(Parachain(1000)) };
let location: Location = Location::new(1, [Parachain(1000)]);
let agent_id = AgentIdOf::convert_location(&location).unwrap();
assert_eq!(
agent_id,
@@ -1054,7 +1049,7 @@ fn test_describe_asset_hub() {
#[test]
fn test_describe_here() {
let location: MultiLocation = MultiLocation { parents: 0, interior: Here };
let location: Location = Location::new(0, []);
let agent_id = AgentIdOf::convert_location(&location).unwrap();
assert_eq!(
agent_id,