-
Notifications
You must be signed in to change notification settings - Fork 771
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
Improve Penpal runtime/emulated tests + AssetHub TokenLocationAsNative
#3339
base: master
Are you sure you want to change the base?
Conversation
The CI pipeline was cancelled due to failure one of the required jobs. |
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.
I am supportive of the penpal changes and all the emulated tests cleanup and improvements, but don't agree with the AssetHub config change without going through an RFC. That change needs to happen at the ecosystem level, it is not just an AH-local change (see in-line comments bellow).
@@ -114,18 +110,20 @@ fn para_dest_assertions(t: RelayToSystemParaTest) { | |||
|
|||
fn penpal_to_ah_foreign_assets_sender_assertions(t: ParaToSystemParaTest) { | |||
type RuntimeEvent = <PenpalA as Chain>::RuntimeEvent; | |||
PenpalA::assert_xcm_pallet_attempted_complete(None); |
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.
why remove this assertion?
let sender = PenpalASender::get(); | ||
let amount_to_send: Balance = ASSET_HUB_ROCOCO_ED * 10000; | ||
let asset_owner = penpal_asset_owner(); | ||
let assets: Assets = ((Parent, Parachain(ASSETHUB_PARA_ID)), amount_to_send).into(); |
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.
What is this asset?
IIUC this PR makes this sort of a "symlink" to RelayNative
. Aka you propose that all parachains be able to interchangeably say (1, Parachain(ASSETHUB_PARA_ID))
and (1, Here)
while still referring to DOT/KSM.
I don't see anything wrong with this on the surface, but it is a big conceptual change that the whole ecosystem needs to be aware of (and align to). In my opinion this definitely needs a Polkadot RFC before implementing/merging.
@@ -117,7 +120,7 @@ pub type FungibleTransactor = FungibleAdapter< | |||
// Use this currency: | |||
Balances, | |||
// Use this currency when it is a fungible asset matching the given location or name: | |||
IsConcrete<TokenLocation>, | |||
(IsConcrete<TokenLocation>, IsConcrete<TokenLocationAsNative>), |
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.
Every parachain in the ecosystem needs to do an equivalent change to their runtime, If we make this equivalence in AssetHub where RelayLocation
and AssetHubLocation
are both describing DOT/KSM asset.
Otherwise one parachain could align early with our change, then send DOT to another parachain, and send it through AH by referring to the DOT as (1, Parachain(AssetHubId))
. AH will happily handle the reserve transfer and send it to the final/destination parachain, but that chain doesn't (yet) recognize (1, Parachain(AssetHubId))
as being the same asset as (1, Here)
.
That's why this equivalence needs to be done at the protocol/ecosystem level through https://github.com/polkadot-fellows/RFCs
I would split this PR in two:
|
I was going to do this but I actually can not. The reason is that if the system asset in AssetHub is recognised as |
@acatangiu Opened a new PR without the controversial changes in: #3543 |
Issues addressed in this PR: - Improve *Penpal* runtime: - Properly handled received assets. Previously, it treated `(1, Here)` as the local native currency, whereas it should be treated as a `ForeignAsset`. This wasn't a great example of standard Parachain behaviour, as no Parachain treats the system asset as the local currency. - Remove `AllowExplicitUnpaidExecutionFrom` the system. Again, this wasn't a great example of standard Parachain behaviour. - Move duplicated `ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger` to `assets_common` crate. - Improve emulated tests: - Update *Penpal* tests to new runtime. - To simplify tests, register the reserve transferred, teleported, and system assets in *Penpal* and *AssetHub* genesis. This saves us from having to create the assets repeatedly for each test - Add missing test case: `reserve_transfer_assets_from_para_to_system_para`. - Cleanup. - Prevent integration tests crates imports from being re-exported, as they were polluting the `polkadot-sdk` docs. There is still a test case missing for reserve transfers: - Reserve transfer of system asset from *Parachain* to *Parachain* trough *AssetHub*. - This is not yet possible with `pallet-xcm` due to the reasons explained in #3339 --------- Co-authored-by: command-bot <>
Issues addressed in this PR: - Improve *Penpal* runtime: - Properly handled received assets. Previously, it treated `(1, Here)` as the local native currency, whereas it should be treated as a `ForeignAsset`. This wasn't a great example of standard Parachain behaviour, as no Parachain treats the system asset as the local currency. - Remove `AllowExplicitUnpaidExecutionFrom` the system. Again, this wasn't a great example of standard Parachain behaviour. - Move duplicated `ForeignAssetFeeAsExistentialDepositMultiplierFeeCharger` to `assets_common` crate. - Improve emulated tests: - Update *Penpal* tests to new runtime. - To simplify tests, register the reserve transferred, teleported, and system assets in *Penpal* and *AssetHub* genesis. This saves us from having to create the assets repeatedly for each test - Add missing test case: `reserve_transfer_assets_from_para_to_system_para`. - Cleanup. - Prevent integration tests crates imports from being re-exported, as they were polluting the `polkadot-sdk` docs. There is still a test case missing for reserve transfers: - Reserve transfer of system asset from *Parachain* to *Parachain* trough *AssetHub*. - This is not yet possible with `pallet-xcm` due to the reasons explained in paritytech#3339 --------- Co-authored-by: command-bot <>
Before I continue working on this PR (apply changes to
AssetHubWestend
too), I would appreciate some feedback @acatangiu @joepetrowski @KiChjang @bkontur to see if what I am proposing is acceptable.I am adding
TokenLocationAsNative = (0, Here)
in the AssetHub runtime to be recognised as local currency too, being in practice(0, Here)
&(1, Here)
equivalents. I need this change to makereserve_transfer_asset()
/transfer_asset()
work for a reserve transfer between Parachains through AssetHub. The reason is how thesepallet_xcm
methods determine the Remote Reserve Location, where the location is extracted from the asset location to be sent.If I try to send from a Parachain the asset
(1, Here)
, the Remote Reserve Location would be the Relay Chain, whereas if I try to send(1, Parachain(1000))
, the Remote Reserve Location would be AsseHub, which is correct, but the received asset has been reanchored giving as result(0, Here)
which is not recognised by AssetHub.I know that in principle a runtime shouldn't be changed to make a pallet work, but I do not see anything wrong about accepting
(0, Here)
as local currency too (which actually is the local currency), but I might be overlooking something. The pallet is well designed, but it is not working for this special case where the local currency is recognised as(1, Here)
instead of(0, Here)
.In addition to the previous change, there are other modifications in the PR that remain valid regardless:
(1, Here)
as local currency, updating its native currency balances, while it should be treated as aForeignAsset
. That wasn't a great example of a standard Parachain's behaviour, since none treats the System asset as local currency.ForeignAssets
were registered in genesis:(1, Here)
- Relay Chain native asset(1, Parachain(1000))
- AssetHub native assetinclude_penpal_create_foreign_asset_on_asset_hub
macro.polkadot-sdk
docs.DepositReserveAsset
fees payment #3340