open-runtime-module-library
open-runtime-module-library copied to clipboard
rework orml-unknown-tokens(BLOCKED)
with https://github.com/paritytech/polkadot/pull/3727 we may not need orml-unknown-tokens anymore. needs some evaluation
phase 0: Gavin's XCM Part III blog make a example of current execution chain didn't recognise asset to be deposit, as a result asset was left in the holding register. some times later, you can use ClaimAsset to reclaim asset in the holding register. of cause you can't reclaim asset not belong to you, so when content(asset) left in the holding register, the on-chain storage will record the origin register with some other info(the asset), and later on you can only reclaim your asset in the holding register, in this case the origin you relaim must match the origin in the on-chain storage.
There're also testcase in polkadot/pallet-xcm: https://github.com/paritytech/polkadot/blob/release-v0.9.12/xcm/pallet-xcm/src/tests.rs#L504
first thought and notes: the ClaimAsset is a top level Instruction just like DepositAsset/WithdrawAsset(more precisely, like WithdrawAsset, both do own logic then subsume asset to Holding Register). while current the logic of UnknownAsset is build-in inside DepostAsset/WithdrawAsset Instruction. the behavor of UnknownAsset is kind of inner operation.
the usercase of ClaimAsset can be used in xTokens for example, suppose there're two parachain A,B.
- paraB transfer tokenB to paraA, if tokenB is un-recognized by paraA, then the holing register lefted will record as hash of (origin, assets of tokenB). This is done by XCM executor automatically, as AssetTrap Hook will done this work when xcm finished.
Here, need to check what the origin is. if the beneficiary is Alice on paraA, then the origin is Alice or paraA sovereign account?
- paraA transfer tokenB to paraB/paraC. As the hash of (origin, assets of tokenB) exist in AssetTrap, paraA can move this asset to HoldingRegister(of cause here, the origin mush be matched), this is where ClaimAsset play role. After that, we can use DepositAsset to move asset from Holding Register to beneficiary. If the beneficiary is paraB then it's Ok, if the beneficiary is paraC, then we go to first case.
current XCM did't support brought back assets take from DepositAsset to holding register, so when deposit_asset throw error, then assets will lose. the discussion refer to issue: https://github.com/paritytech/polkadot/issues/4242