Closed hqwangningbo closed 2 months ago
This is an xtokens issue: https://bifrost.subscan.io/extrinsic/5038923-2, please open an issue there.
I see the transfer worked fine with pallet_xcm
: https://bifrost.subscan.io/extrinsic/5039021-2
@acatangiu Please check the problem carefully. Success depends on receiving DOT on AssetHub. Xcm message(bifrost->polkadot->assethub)
pallet_xcm.transferAssets success
: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fbifrost-polkadot.api.onfinality.io%2Fpublic-ws#/explorer/query/0x5cc0640d7b77643411ead78d8c29fe029fbcb9e5707340084df4f5a1860528b8relaychain success
: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Frockx-dot.w3node.com%2Fpolka-public-dot%2Fws#/explorer/query/0x6aa42a02f944456319286e7e77fdfe3461855cfb0328dcc93bd16fc642428068assetHub fail
: https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fdot-rpc.stakeworld.io%2Fassethub#/explorer/query/0xcb48926bbc51c3d5099847dffde80400281e196c2cfd5c9eeaff3478b14e5a0fah, yes, the issue is that Bifrost does not recognize AssetHub as a trusted reserve location for DOT - so it decides to go through the Relay chain as the reserve location, but between Relay and AH DOT has to be teleported, not reserve-transferred.
Bifrost should trust AH as a reserve for DOT and make their life and their users' lives easy. (This transfer would have then been simple point-to-point).
As long as Bifrost does not support AH as DOT reserve, DOT transfers to AH will have to go through the Relay chain (as attempted above).
The XCM program is being fully constructed on the origin chain (Bifrost), and parachains (Bifrost included) don't hold an on-chain map/registry of which assets can be teleported where.
So neither xtokens
nor pallet-xcm
can know to build the XCM program with a teleport for the second leg of the journey, so they build the wrong program in this particular case.
There is no pallet/on-chain solution for this (other than trusting AH as reserve for DOT as described above).
The transfer would still be possible by using pallet_xcm::transfer_assets_using_type_and_then() which allows the caller to define which transfer types to use and what should happen on subsequent hops. Unlike the on-chain logic, the (off-chain) caller can get the asset-reserves/teleports between various chains information from off-chain registries.
For this particular transfer, this could work (but also needs https://github.com/paritytech/polkadot-sdk/pull/4834): https://github.com/paritytech/polkadot-sdk/blob/0bc841ce4c20ae96d8b1299878103f7d31c7b4df/cumulus/parachains/integration-tests/emulated/tests/assets/asset-hub-westend/src/tests/hybrid_transfers.rs#L904C3-L914C4 (with Relay and AH reversed in your case).
But as you can see, things become complicated when you can't simply transfer DOT straight to AH (trust AH as reserve of DOT).
I get it,thank you for explaining it to me in detail.
xtokens.transfer: https://bifrost.subscan.io/xcm_message/polkadot-4e0a1ecd85156b054492a41ea087d48bb82b5466 polkadotXcm.transferAssets: https://bifrost.subscan.io/extrinsic/5039021-2
Both transactions although executed successfully, but fail on AssetHub