Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update foreign asset ids from v3 to v4 #472

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

### Changed

Change Polkadot inflation to 120M DOT per year ([polkadot-fellows/runtimes#471](https://github.com/polkadot-fellows/runtimes/pull/471))
- Change Polkadot inflation to 120M DOT per year ([polkadot-fellows/runtimes#471](https://github.com/polkadot-fellows/runtimes/pull/471))
- Update foreign asset ids in Asset Hub Polkadot and Asset Hub Kusama from v3 to v4 locations ([polkadot-fellows/runtimes#472](https://github.com/polkadot-fellows/runtimes/pull/472))

## [1.3.3] 01.10.2024

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ pub fn genesis() -> Storage {
assets: vec![
// Penpal's teleportable asset representation
(
PenpalATeleportableAssetLocation::get().try_into().unwrap(),
PenpalATeleportableAssetLocation::get(),
PenpalASiblingSovereignAccount::get(),
false,
ED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ impl_accounts_helpers_for_parachain!(AssetHubKusama);
impl_assert_events_helpers_for_parachain!(AssetHubKusama);
impl_assets_helpers_for_system_parachain!(AssetHubKusama, Kusama);
impl_assets_helpers_for_parachain!(AssetHubKusama);
impl_foreign_assets_helpers_for_parachain!(AssetHubKusama, xcm::v3::Location);
impl_foreign_assets_helpers_for_parachain!(AssetHubKusama, xcm::v4::Location);
impl_xcm_helpers_for_parachain!(AssetHubKusama);
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ pub fn genesis() -> Storage {
assets: vec![
// Penpal's teleportable asset representation
(
PenpalATeleportableAssetLocation::get().try_into().unwrap(),
PenpalATeleportableAssetLocation::get(),
PenpalASiblingSovereignAccount::get(),
false,
ED,
),
(
PenpalBTeleportableAssetLocation::get().try_into().unwrap(),
PenpalBTeleportableAssetLocation::get(),
PenpalBSiblingSovereignAccount::get(),
false,
ED,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ impl_accounts_helpers_for_parachain!(AssetHubPolkadot);
impl_assert_events_helpers_for_parachain!(AssetHubPolkadot);
impl_assets_helpers_for_system_parachain!(AssetHubPolkadot, Polkadot);
impl_assets_helpers_for_parachain!(AssetHubPolkadot);
impl_foreign_assets_helpers_for_parachain!(AssetHubPolkadot, xcm::v3::Location);
impl_foreign_assets_helpers_for_parachain!(AssetHubPolkadot, xcm::v4::Location);
impl_xcm_helpers_for_parachain!(AssetHubPolkadot);
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub use sp_runtime::traits::Dispatchable;
// Polkadot
pub use xcm::{
prelude::{AccountId32 as AccountId32Junction, *},
v3::{self, Error, NetworkId::Kusama as KusamaId},
v4::{self, Error, NetworkId::Kusama as KusamaId},
};
pub use xcm_executor::traits::TransferType;

Expand All @@ -41,7 +41,7 @@ pub use emulated_integration_tests_common::{
RelayChain as Relay, Test, TestArgs, TestContext, TestExt,
},
xcm_helpers::{xcm_transact_paid_execution, xcm_transact_unpaid_execution},
PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, RESERVABLE_ASSET_ID, XCM_V3,
PROOF_SIZE_THRESHOLD, REF_TIME_THRESHOLD, RESERVABLE_ASSET_ID, XCM_V4,
};
pub use integration_tests_helpers::{
test_parachain_is_trusted_teleporter_for_relay, test_relay_is_trusted_teleporter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,15 +183,15 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
vec![],
);
AssetHubKusama::force_create_foreign_asset(
dot_at_kusama_parachains.clone().try_into().unwrap(),
dot_at_kusama_parachains.clone(),
assets_owner.clone(),
false,
ASSET_MIN_BALANCE,
vec![],
);
AssetHubKusama::mint_foreign_asset(
<AssetHubKusama as Chain>::RuntimeOrigin::signed(assets_owner),
dot_at_kusama_parachains.clone().try_into().unwrap(),
dot_at_kusama_parachains.clone(),
sender.clone(),
foreign_amount_to_send * 2,
);
Expand Down Expand Up @@ -223,10 +223,7 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
let sender_balance_before = test.sender.balance;
let sender_dots_before = AssetHubKusama::execute_with(|| {
type ForeignAssets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&sender,
)
<ForeignAssets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &sender)
});
let receiver_assets_before = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
Expand All @@ -247,10 +244,7 @@ fn transfer_foreign_assets_from_asset_hub_to_para() {
let sender_balance_after = test.sender.balance;
let sender_dots_after = AssetHubKusama::execute_with(|| {
type ForeignAssets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&sender,
)
<ForeignAssets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &sender)
});
let receiver_assets_after = PenpalA::execute_with(|| {
type ForeignAssets = <PenpalA as PenpalAPallet>::ForeignAssets;
Expand Down Expand Up @@ -312,7 +306,7 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
vec![],
);
AssetHubKusama::force_create_foreign_asset(
dot_at_kusama_parachains.clone().try_into().unwrap(),
dot_at_kusama_parachains.clone(),
assets_owner.clone(),
false,
ASSET_MIN_BALANCE,
Expand Down Expand Up @@ -342,7 +336,7 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
AssetHubKusama::fund_accounts(vec![(sov_penpal_on_ahk.clone(), native_amount_to_send * 2)]);
AssetHubKusama::mint_foreign_asset(
<AssetHubKusama as Chain>::RuntimeOrigin::signed(assets_owner),
dot_at_kusama_parachains.clone().try_into().unwrap(),
dot_at_kusama_parachains.clone(),
sov_penpal_on_ahk,
foreign_amount_to_send * 2,
);
Expand Down Expand Up @@ -382,10 +376,7 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
let receiver_native_before = test.receiver.balance;
let receiver_dots_before = AssetHubKusama::execute_with(|| {
type ForeignAssets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&receiver,
)
<ForeignAssets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &receiver)
});

// Set assertions and dispatchables
Expand All @@ -406,10 +397,7 @@ fn transfer_foreign_assets_from_para_to_asset_hub() {
let receiver_native_after = test.receiver.balance;
let receiver_dots_after = AssetHubKusama::execute_with(|| {
type ForeignAssets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<ForeignAssets as Inspect<_>>::balance(
dot_at_kusama_parachains.try_into().unwrap(),
&receiver,
)
<ForeignAssets as Inspect<_>>::balance(dot_at_kusama_parachains, &receiver)
});

// Sender's balance is reduced by amount sent plus delivery fees
Expand Down Expand Up @@ -459,7 +447,7 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
// Register DOT as foreign asset and transfer it around the Kusama ecosystem
let dot_at_kusama_parachains = Location::new(2, [GlobalConsensus(Polkadot)]);
AssetHubKusama::force_create_foreign_asset(
dot_at_kusama_parachains.clone().try_into().unwrap(),
dot_at_kusama_parachains.clone(),
assets_owner.clone(),
false,
ASSET_MIN_BALANCE,
Expand Down Expand Up @@ -497,7 +485,7 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
AssetHubKusama::fund_accounts(vec![(sov_of_sender_on_ah.clone(), ksm_to_send * 2)]);
AssetHubKusama::mint_foreign_asset(
<AssetHubKusama as Chain>::RuntimeOrigin::signed(assets_owner),
dot_at_kusama_parachains.clone().try_into().unwrap(),
dot_at_kusama_parachains.clone(),
sov_of_sender_on_ah.clone(),
dot_to_send * 2,
);
Expand Down Expand Up @@ -541,19 +529,13 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
<AssetHubKusama as Chain>::account_data_of(sov_of_sender_on_ah.clone()).free;
let dots_in_sender_reserve_on_ahk_before = AssetHubKusama::execute_with(|| {
type Assets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<Assets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&sov_of_sender_on_ah,
)
<Assets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &sov_of_sender_on_ah)
});
let ksms_in_receiver_reserve_on_ahk_before =
<AssetHubKusama as Chain>::account_data_of(sov_of_receiver_on_ah.clone()).free;
let dots_in_receiver_reserve_on_ahk_before = AssetHubKusama::execute_with(|| {
type Assets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<Assets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&sov_of_receiver_on_ah,
)
<Assets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &sov_of_receiver_on_ah)
});
let receiver_ksms_before = PenpalB::execute_with(|| {
type ForeignAssets = <PenpalB as PenpalBPallet>::ForeignAssets;
Expand Down Expand Up @@ -582,19 +564,13 @@ fn transfer_foreign_assets_from_para_to_para_through_asset_hub() {
});
let dots_in_sender_reserve_on_ahk_after = AssetHubKusama::execute_with(|| {
type Assets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<Assets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&sov_of_sender_on_ah,
)
<Assets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &sov_of_sender_on_ah)
});
let ksms_in_sender_reserve_on_ahk_after =
<AssetHubKusama as Chain>::account_data_of(sov_of_sender_on_ah).free;
let dots_in_receiver_reserve_on_ahk_after = AssetHubKusama::execute_with(|| {
type Assets = <AssetHubKusama as AssetHubKusamaPallet>::ForeignAssets;
<Assets as Inspect<_>>::balance(
dot_at_kusama_parachains.clone().try_into().unwrap(),
&sov_of_receiver_on_ah,
)
<Assets as Inspect<_>>::balance(dot_at_kusama_parachains.clone(), &sov_of_receiver_on_ah)
});
let ksms_in_receiver_reserve_on_ahk_after =
<AssetHubKusama as Chain>::account_data_of(sov_of_receiver_on_ah).free;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,21 +36,21 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() {
let para_sovereign_account = AssetHubKusama::sovereign_account_id_of(
AssetHubKusama::sibling_location_of(PenpalA::para_id()),
);
let asset_location_on_penpal = v3::Location::new(
let asset_location_on_penpal = v4::Location::new(
0,
[
v3::Junction::PalletInstance(ASSETS_PALLET_ID),
v3::Junction::GeneralIndex(ASSET_ID.into()),
v4::Junction::PalletInstance(ASSETS_PALLET_ID),
v4::Junction::GeneralIndex(ASSET_ID.into()),
],
);
let foreign_asset_at_asset_hub =
v3::Location::new(1, [v3::Junction::Parachain(PenpalA::para_id().into())])
v4::Location::new(1, [v4::Junction::Parachain(PenpalA::para_id().into())])
.appended_with(asset_location_on_penpal)
.unwrap();

// Encoded `create_asset` call to be executed in AssetHub
let call = AssetHubKusama::create_foreign_asset_call(
foreign_asset_at_asset_hub,
foreign_asset_at_asset_hub.clone(),
ASSET_MIN_BALANCE,
para_sovereign_account.clone(),
);
Expand Down Expand Up @@ -97,7 +97,7 @@ fn send_xcm_from_para_to_asset_hub_paying_fee_with_system_asset() {
},
// Foreign Asset created
RuntimeEvent::ForeignAssets(pallet_assets::Event::Created { asset_id, creator, owner }) => {
asset_id: *asset_id == foreign_asset_at_asset_hub,
asset_id: *asset_id == foreign_asset_at_asset_hub.clone(),
creator: *creator == para_sovereign_account.clone(),
owner: *owner == para_sovereign_account,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ fn relay_sets_system_para_xcm_supported_version() {
assert_ok!(<Kusama as KusamaPallet>::XcmPallet::force_xcm_version(
sudo_origin,
bx!(system_para_destination.clone()),
XCM_V3
XCM_V4
));

type RuntimeEvent = <Kusama as Chain>::RuntimeEvent;
Expand All @@ -36,7 +36,7 @@ fn relay_sets_system_para_xcm_supported_version() {
vec![
RuntimeEvent::XcmPallet(pallet_xcm::Event::SupportedVersionChanged {
location,
version: XCM_V3
version: XCM_V4
}) => { location: *location == system_para_destination, },
]
);
Expand All @@ -52,7 +52,7 @@ fn system_para_sets_relay_xcm_supported_version() {
<AssetHubKusama as Chain>::Runtime,
>::force_xcm_version {
location: bx!(parent_location.clone()),
version: XCM_V3,
version: XCM_V4,
})
.encode()
.into();
Expand All @@ -74,7 +74,7 @@ fn system_para_sets_relay_xcm_supported_version() {
vec![
RuntimeEvent::PolkadotXcm(pallet_xcm::Event::SupportedVersionChanged {
location,
version: XCM_V3
version: XCM_V4
}) => { location: *location == parent_location, },
]
);
Expand Down
Loading
Loading