-
Notifications
You must be signed in to change notification settings - Fork 709
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
Migrate foreign assets v3::Location to v4::Location #4129
Conversation
Can we migrate to |
We can. The only issue with that is we might have two versions of the same asset. We'd still need a migration to change values to the newest version. It's either that or migrating to change types to the newest version. I say fixing the version in this case doesn't sound like a bad idea. What do you think? |
I was thinking to keep assets with mixed versions in storage, but you're right that it won't work (or rather it could work but with many corner cases and ultimately more complexity). I agree we keep it simple and migrate assets to latest version. |
Rethinking this, it might be better to migrate them to VersionedAssets. The only way to create foreign assets is via XCM and the sender doesn't specify the asset id. We can just use V4 all the time and change it when we migrate. This means we'll have more leeway whenever a new XCM version comes out. What do you think? |
@xlc I remember seeing another thread on this topic where you had some input, but can't find it now. |
This is the original issue for this foreign asset id problem: #1130,
I was proposing there something like this - to use
which would solve
If we use
I don't know, it could lead maybe to other problems, at least we would need to use something like for |
I was initially convinced by the argument that if we use |
Yeah I made a comment somewhere but also can't find it anymore... It is possible to have runtime migration to keep the version is always at latest but we might as well use fixed version and do the migration at our own pace. i.e. we can upgrade from v3 to v4 anytime we want before v3 is removed but with Versioned type, we have to upgrade as soon as a new version is introduced or there will be unexpected things. In the end, there are little upside to use Versioned type but many downsides. |
cumulus/parachains/runtimes/assets/migrations/src/v1/benchmarks.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
cumulus/parachains/integration-tests/emulated/tests/bridges/bridge-hub-rococo/src/lib.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, modulo Adrian's comment related to pallet_collator_selection::migration::v1::MigrateToV1<Runtime>,
needs a review from @paritytech/frame-coders |
.appended_with(asset_location_on_penpal) | ||
.unwrap(); | ||
|
||
// Encoded `create_asset` call to be executed in AssetHub | ||
let call = AssetHubRococo::create_foreign_asset_call( | ||
foreign_asset_at_asset_hub, | ||
foreign_asset_at_asset_hub.clone(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franciscoaguirre just thinking, if we add xcm::v5
this won't compile again, I am not sure, but maybe:
foreign_asset_at_asset_hub.clone().try_into().unwrap()
would do the trick?
@@ -1781,64 +1784,3 @@ cumulus_pallet_parachain_system::register_validate_block! { | |||
Runtime = Runtime, | |||
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>, | |||
} | |||
|
|||
#[cfg(test)] | |||
mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@franciscoaguirre I'm not aware of any specific rule here. All other runtimes have tests in this file as well as in separate tests.rs files or in a separate tests directory. If that's the case, we should also clean up the other runtimes. Since these tests only check some basic constants, I think we could keep them here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even just a tests.rs
file, instead of tests/mod.rs
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess I ended up moving tests early in the PR for some reason. I'll put them back
@@ -1781,64 +1784,3 @@ cumulus_pallet_parachain_system::register_validate_block! { | |||
Runtime = Runtime, | |||
BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::<Runtime, Executive>, | |||
} | |||
|
|||
#[cfg(test)] | |||
mod tests { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even just a tests.rs
file, instead of tests/mod.rs
.
* master: (35 commits) Fix OurViewChange small race (#5356) Make ticket non-optional and add ensure_successful method to Consideration trait (#5359) [tests] dedup test code, add more tests, improve naming and docs (#5338) Stop running the wishlist workflow on forks (#5297) Migrate foreign assets v3::Location to v4::Location (#4129) Minor clean up (#5284) [Pools] Ensure members can always exit the pool gracefully (#4998) StorageWeightReclaim: set to node pov size if higher (#5281) [Bot] Add prdoc generation (#5331) Small nits found accidentally along the way (#5341) Create subsystem-benchmarks.yml (#5325) Bump libp2p-identity from 0.2.8 to 0.2.9 (#5232) Bump authoring duration for async backing to 2s. (#5195) Fix spelling issues (#5206) Bump the known_good_semver group across 1 directory with 3 updates (#5315) `polkadot-node-core-pvf-common`: Fix test compilation error (#5310) ci: Paused `cmd-action` commenter (#5287) Remove unnecessary mut (#5318) chain-spec: minor clarification on the genesis config patch (#5324) fix av-distribution Jaeger spans mem leak (#5321) ...
* master: (35 commits) Fix OurViewChange small race (#5356) Make ticket non-optional and add ensure_successful method to Consideration trait (#5359) [tests] dedup test code, add more tests, improve naming and docs (#5338) Stop running the wishlist workflow on forks (#5297) Migrate foreign assets v3::Location to v4::Location (#4129) Minor clean up (#5284) [Pools] Ensure members can always exit the pool gracefully (#4998) StorageWeightReclaim: set to node pov size if higher (#5281) [Bot] Add prdoc generation (#5331) Small nits found accidentally along the way (#5341) Create subsystem-benchmarks.yml (#5325) Bump libp2p-identity from 0.2.8 to 0.2.9 (#5232) Bump authoring duration for async backing to 2s. (#5195) Fix spelling issues (#5206) Bump the known_good_semver group across 1 directory with 3 updates (#5315) `polkadot-node-core-pvf-common`: Fix test compilation error (#5310) ci: Paused `cmd-action` commenter (#5287) Remove unnecessary mut (#5318) chain-spec: minor clarification on the genesis config patch (#5324) fix av-distribution Jaeger spans mem leak (#5321) ...
@franciscoaguirre I think this PR broke the Can you take a look please ? |
Sure, I'll take a look |
hmm, strange, https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6991678
probably this lines: https://github.com/paritytech/polkadot-sdk/blob/master/bridges/testing/framework/js-helpers/wrapped-assets-balance.js#L10-L11:
are not compatible with |
* master: (167 commits) Upgrade accidentally downgraded deps (#5365) [Pools] Fix issues with member migration to `DelegateStake` (#4822) Unify `no_genesis` check (#5360) [CI] Fix prdoc command (#5358) Beefy: add benchmarks for `report_fork_voting()` (#5188) Fix OurViewChange small race (#5356) Make ticket non-optional and add ensure_successful method to Consideration trait (#5359) [tests] dedup test code, add more tests, improve naming and docs (#5338) Stop running the wishlist workflow on forks (#5297) Migrate foreign assets v3::Location to v4::Location (#4129) Minor clean up (#5284) [Pools] Ensure members can always exit the pool gracefully (#4998) StorageWeightReclaim: set to node pov size if higher (#5281) [Bot] Add prdoc generation (#5331) Small nits found accidentally along the way (#5341) Create subsystem-benchmarks.yml (#5325) Bump libp2p-identity from 0.2.8 to 0.2.9 (#5232) Bump authoring duration for async backing to 2s. (#5195) Fix spelling issues (#5206) Bump the known_good_semver group across 1 directory with 3 updates (#5315) ...
Ahh indeed, that must be the issue. In v4, interior is now an array, so it should be: const foreignAssetAccount = await api.query.foreignAssets.account(
{ parents: 2, interior: { X1: [{ GlobalConsensus: bridgedNetworkName }] } }, I'll try it and see if that solves it |
After #4129, a zombienet bridge test was broken. This is because XCMv4 locations have an array in the `interior` field, which also has to appear in PJS. --------- Co-authored-by: Serban Iorga <serban@parity.io>
In the move from XCMv3 to XCMv4, the
AssetId
forForeignAssets
inasset-hub-rococo
andasset-hub-westend
was left asv3::Location
to be later migrated tov4::Location
.This is that migration PR.
Because the encoding of
v3::Location
andv4::Location
is the same, we don't need to do any data migration, the keys will still be decodable.The original idea by Jan was to make the v4 changes in v3 since the ABI (the encoding/decoding) didn't change.
Corroborated the ABI is the same iterating over all storage, the code is on another branch.
We will need a data migration when we want to update from
v4::Location
tov5::Location
because of the accepted RFC changing the NetworkId enum.I'll configure MBMs (Multi-Block Migrations) then and make the actual migration.
Fixes #4128