Skip to content

[asset-hubs] Investigate usage of MultiLocation vs VersionedMultiLocation #1130

@bkontur

Description

@bkontur

Summary

Investigate and setup proper usage of MultiLocation for storage items.

Problem 1 - ForeignAssets - asset_id as xcm::prelude::MultiLocation

MultiLocation is used as pallet_assets::AssetId.

// AssetId type definition
pub type MultiLocationForAssetId = xcm::prelude::MultiLocation;
// ForeignAssets pallet instance
pub type ForeignAssetsInstance = pallet_assets::Instance2;
impl pallet_assets::Config<ForeignAssetsInstance> for Runtime {
  ...
	type AssetId = MultiLocationForAssetId;
  ...
}
//  `pallet_assets::AssetId` used by storage item
pub(super) type Asset<T: Config<I>, I: 'static = ()> = StorageMap<
		_,
		Blake2_128Concat,
		T::AssetId,
		...
	>;

Problem 2 - asset-conversion uses Box<xcm::opaque::v3::MultiLocation> for storage item

See asset conversion pallet MultiAssetId definition:

impl pallet_asset_conversion::Config for Runtime {
...
	type MultiAssetId = Box<xcm::opaque::v3::MultiLocation>;
...
}
// MultiAssetId is used for PoolId
pub(super) type PoolIdOf<T> = (<T as Config>::MultiAssetId, <T as Config>::MultiAssetId);
// PoolId is used by storage item 
pub type Pools<T: Config> =
		StorageMap<_, Blake2_128Concat, PoolIdOf<T>, PoolInfo<T::PoolAssetId>, OptionQuery>;

Problem 3 - asset-conversion uses Box<xcm::opaque::v3::MultiLocation> for public runtime api

See more description here.

Questions:

How should we handle MultiLocation vs VersionedMultiLocation in proper way?

TODO

  • should we change xcm::prelude::MultiLocation to xcm::VersionedMultiLocation ?
    • prepare some migration for that?
  • add some test that ensures compatibility of actually used xcm::v3::MultiLocation against xcm::prelude::MultiLocation ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    T6-XCMThis PR/Issue is related to XCM.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions