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

Integrate orml-xtokens into Shibuya #929

Merged
merged 11 commits into from
May 10, 2023
Merged

Integrate orml-xtokens into Shibuya #929

merged 11 commits into from
May 10, 2023

Conversation

shaunxw
Copy link
Member

@shaunxw shaunxw commented May 8, 2023

Pull Request Summary

Integrate orml-xtokens into Shibuya.

Note that for XCM unit tests, I kept the original tests that using pallet-xcm fork extra calls, to make sure that they still got covered before the fork is removed. These tests are renamed to x_via_pallet_xcm. The newly added tests are basically the same except for replacing fork extra calls with orml-xtokens calls.

Check list

  • added or updated unit tests
  • updated Astar official documentation
  • added OnRuntimeUpgrade hook for precompile revert code registration
  • updated spec version
  • updated semver

Comment on lines +338 to +339
// Default impl. Refer to `orml-xtokens` docs for more details.
type MinXcmFee = DisabledParachainFee;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly, this will disable double XCM support (not sure how it's properly called 🙂 ), e.g. Astar -> Polkadot -> Acala?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you mean sending assets from one chain to another with a hop through the reserve chain, like sending DOT from Astar to Acala, or sending ASTR from Moonbeam to Acala, this default impl actually works.😸

The non-default MinXcmFee is for an edge case that sends assets to its reserve chain which only accepts relay chain assets as fees. In this case two XCM message needs to be sent, one to relay chain and the other to the dest reserve chain. And the MinXcmFee serves as an indicator of how to break fees for these two messages. The only real-life case I know was a while ago when Statemine only accepts KSM as XCM fees, and Acala try to support sending RMRK to it. You may find more details here, open-web3-stack/open-runtime-module-library#698 . (P.S. now statemine/t support other assets as fees with paritytech/cumulus#1278)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks for the explanation! 🙏

for AbsoluteAndRelativeReserveProvider<AbsoluteLocation>
{
fn reserve(asset: &MultiAsset) -> Option<MultiLocation> {
RelativeReserveProvider::reserve(asset).map(|reserve_location| {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had to check what this does, but it seems it's functionally (almost?) same as: https://github.com/AstarNetwork/astar-frame/blob/polkadot-v0.9.39/primitives/xcm/src/lib.rs#L205

Not for this PR, but let's get rid of our custom implementation, if we can use the ORML one which does the exact same thing.

Copy link
Member Author

@shaunxw shaunxw May 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree! They are pretty similar. The ReserveAssetFilter in XCM primitives can be refactored to be leveraged on AbsoluteReserveProvider impl in ORML.

Btw I'm aware that some of the config (like this AbsoluteAndRelativeReserveProvider) could be moved to xcm-primitives and shared in different runtimes. I'm thinking of doing it after Shibuya integration finished and tested, so there would be less back and forth with astar-frame PRs, in case anything didn't work as expected. Hope it makes sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Of course! 🙂

I also saw your comment about merging Astar and astar-frame, so that's something we can discuss soon too!

@shaunxw shaunxw requested a review from shunsukew May 8, 2023 23:50
Copy link
Member

@Dinonard Dinonard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ashutoshvarma
Copy link
Member

LGTM
Just need a rebase to resolve conflicts.

@shaunxw
Copy link
Member Author

shaunxw commented May 9, 2023

I just noticed all commits are required to be signed. Let me try to rebuild the commit history and sign them. Probably will need force push.

@shaunxw shaunxw added runtime This PR/Issue is related to the topic “runtime”. shibuya related to shibuya labels May 10, 2023
@shaunxw shaunxw merged commit 4a9755a into master May 10, 2023
6 checks passed
@shaunxw shaunxw deleted the feat/xtokens branch May 10, 2023 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
runtime This PR/Issue is related to the topic “runtime”. shibuya related to shibuya
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants