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

enable TEER on Asset Hub and KSM on self #271

Merged
merged 14 commits into from
Feb 16, 2024

Conversation

brenzi
Copy link
Collaborator

@brenzi brenzi commented Feb 13, 2024

closes #268
closes #272

this enables

  • reserve transfer of ROC from relay to Integritee and back to relay
  • teleport of TEER to AssetHub and back

strategy:

regression testing:

  • chopsticks xcm with Karura

testing

zombienet

zombienet-linux-x64 spawn --provider native zombienet/rococo-local-with-integritee-and-asset-hub.toml
./scripts/hrmp-helper.sh 

send ROC between Relay <> Integritee

note preimage to register ROC as an asset on Integritee, set metadata and register its multilocation

execution should result in Events:

  • assets.forceCreated
  • assets.MetadataSet
  • assetRegistry.ReserveAssetRegistered

if testing with polkadot >= 1.7 binaries, need to downgrade safeXcmVersion to V3 on relaychain

  1. transfer 10.0 ROC from relay to itee
  2. send 2.0 ROC form Alice to Bob on itee
  3. send 0.1 ROC from Bob on itee to Bob_stash on relay

send TEER to Asset Hub

send 1 ROC to sovereign account 2015 on AH

note preimage to register TEER as foreign asset on Asset Hub

you should see these events on AH

  • foreignAssets.Created
  • foreignAssets.MetadataSet

teleport 1 TEER from Alice@Integritee to Alice@AH (and attach 1mROC to pay fees on AH)

this should result in events

  • assets.Burnedon Integritee
  • foreignAssets.Issued on Asset Hub

what also works:

transfer 100mROC from Alice on Integritee to Alice on AH

send TEER back

send 10 TEER to AH sibling account on integritee to pay XCM fees

teleport 200mTEER from alice on AH to Charlie on Integritee

you should see balances.Endowedevent or, if the recipient exists, balances.Deposit (hidden in system events. check block!)

fees

Fees are quite complex to understand with XCM.

use ./scripts/dump-essential-balances.sh to compare pre/post balances

XCM 10 ROC from Alice on Rococo to Alice on Integritee

Alice ROC@Rococo: -10.000261339136 ROC
Alice ROC@Integritee + 9.999650000000 ROC
Parachain2015 ROC@Rococo + 10.0 ROC
TotalIssuanceROC@Integritee + 9.999650000000 ROC
fees: Alice pays

  • 350uROC@Integritee (weight.refTime=5'000'000, proofSize=5120, NativePerSecond=70TEER)
  • 261uROC@Rococo

XCM 1 ROC from Alice on Integritee back to Alice on Rococo

TotalIssuanceTEER@Integritee: -165.755830 uTEER (burned fees 99%)
TotalIssuanceROC@Integritee: -1.000000000000 ROC
Treasury@Integritee: +1.674301 uTEER (fees 1% share)
Alice ROC@Rococo: + 0.999989698944 ROC
Alice TEER@Integritee: -167.430131 uTEER
Alice ROC@Integritee: -1.0 ROC
Parachain2015@Rococo: -1.0 ROC

fees: Alice pays:

  • 167 uTEER@Integritee
  • 10.3 uROC@Rococo

Teleport 1 TEER from Alice on Integritee to Alice on Asset Hub

TotalIssuance@Integritee: -1.000176638369 TEER
TotalIssuanceROC@Integritee: -1.0 mROC
Treasury@Integritee: +1.784225 uTEER (which means ~1% of fee to treasury, 99% burned)
Alice TEER@Integritee: -1000178422594 TEER
Alice TEER@AssetHub: +1.0 TEER
Alice ROC@AssetHub: + 0.964070016 mROC (refunded reminders after paying fee)
Alice ROC@Integritee: -1.0 mROC
Alice ROC@Rococo: +-0.0
Parachain2015@AssetHub: -1.0mROC

fees: Alice pays 178uTEER (on Integritee) + 36uROC (on AH)

Integritee Sovereign plays the broker and must balance its SovereinAccount manually! Send 1mROC from Integritee to AssetHub.

Teleport 200 mTEER from Alice on Asset Hub to Alice on Integritee

TotalIssuance@Integritee: + 200.0 mTEER
Alice ROC@AssetHub: - 145.180672 uROC
Alice TEER@AssetHub: -200mTEER
Alice TEER@Integritee: +199.650000000mTEER
Treasury@Integritee: + 350.0uTEER (fee burning not (yet) applied for XCM. all to treasury)

fees: Alice pays: 145uROC + 350uTEER

@brenzi brenzi changed the title add pallets assets and asset-registry enable TEER on Asset Hub and KSM on self Feb 14, 2024
@brenzi brenzi requested a review from clangenb February 14, 2024 18:51
Copy link
Contributor

@clangenb clangenb left a comment

Choose a reason for hiding this comment

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

I can't say that I understand all details of the added code, but it seems ok to me.

@brenzi
Copy link
Collaborator Author

brenzi commented Feb 16, 2024

regression testing with chopsticks:

start chopsticks xcm
npx @acala-network/chopsticks@latest xcm --p=karura --p=../../chopsticks/configs/integritee-kusama.yml
where that yml file overrides wasm to local build

  1. send 10 TEER to Karura (verify spec version is 48)
  2. send 1 TEER back from Karura

👍

@brenzi brenzi merged commit e578170 into master Feb 16, 2024
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

implement proper XCM fee handling add pallet_assets and allow reserve transfer of KSM to our chain
2 participants