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

[Draft] Chopsticks tests with papi and local nodes #6572

Draft
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

x3c41a
Copy link
Contributor

@x3c41a x3c41a commented Nov 21, 2024

This PR contains XCM programs which we are going to translate into ecosystem-tests and add those programs to v5 docs.
Installation instructions are here

Comment on lines +236 to +242
const weight = await AHApi.apis.XcmPaymentApi.query_xcm_weight(msg);

const ahToWnd = AHApi.tx.PolkadotXcm.execute({
message: msg,
max_weight: { ref_time: weight.value.ref_time, proof_size: weight.value.proof_size },
},
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome use of the runtime API, I didn't think of it but it's much easier now for clients to call "execute". Did you need to add some extra weight as margin or did this work out of the box?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This worked out of the box. I thought that was the intention 😸


const WESTEND_NETWORK = Uint8Array.from([225, 67, 242, 56, 3, 172, 80, 232, 246, 248, 230, 38, 149, 209, 206, 158, 78, 29, 104, 170, 54, 193, 205, 44, 253, 21, 52, 2, 19, 243, 66, 62]);
// TODO: find a way to extract keys below from yaml config.
const BOB_KEY = "5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty";
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that from aliceSigner/bobSigner you can only get a Uint8Array public key; is it possible to use it in place of these addresses?

E.g. getFreeBalance(AHApi, BOB_KEY); becomes await getFreeBalance(AHApi, bobSigned.publicKey);

@x3c41a
Copy link
Contributor Author

x3c41a commented Nov 28, 2024

I've written a straightforward guide on how to set-up and run these scripts. Check it out - https://hackmd.io/uVBNwrS6Q1mLtXdcsDI-aQ?view

@paritytech-workflow-stopper
Copy link

All GitHub workflows were cancelled due to failure one of the required jobs.
Failed workflow url: https://github.com/paritytech/polkadot-sdk/actions/runs/12069771512
Failed job name: test-linux-stable-no-try-runtime

x3c41a and others added 7 commits December 16, 2024 18:07
Asset issuance config for test-tether. On Westend total issuance of this
token is equal to 0 (when in doubt check
https://polkadot.js.org/apps/?rpc=wss%3A%2F%2Fasset-hub-westend-rpc.dwellir.com#/assets
for Asset Hub). Even if you set yourself balance of 1 billion
test-tether tokens, the execution will fail during withdrawal thus
issuance config is needed.
)

Restructured config, added initial USDT deposit to penpal's SA. 
Preparation work for Reserve Asset Transfer
Added test scenario for local reserve asset transfer. 
Documented my work here -
https://hackmd.io/@RFUCsRRCSzKkumaXVxcCdg/B1pIuCGrJx
Added initiate reserve withdraw test scenario. 
Added penpal client to test set-up and updated Readme.

In order to verify USDT transfer from Asset Hub to Penpal
(ReserveAssetTransfer):
- go to Penpal's chain state
(https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Flocalhost%3A8001#/chainstate)
- select foreignAssets pallet and then select asset map
- within asset map specify relative path to USDT on Asset Hub (i.e.
parents: 1, Parachain(1000), PalletInstance(50), GeneralIndex(1984) and
hit "+" button
- within the response make sure that there is one account (`accounts:
1`) holding this foreign asset

In order to verify USDT transfer from Penpal to AssetHub
(InitiateReserveWithdraw):
- go to Asset Hub's chain state
(https://polkadot.js.org/apps/?rpc=ws%3A%2F%2Flocalhost%3A8000#/chainstate)
- select asset pallet and account map 
- below select Bob's account from the list (we use Bob for this test
scenario but you can also check if Alice's balance was decreased)
- and set id (u32) to 1984 (or USDT)
- then hit "+" button and make sure that Bob's balance is correct
@acatangiu
Copy link
Contributor

@x3c41a this still has "Draft" in its name, but it's status is open (not draft), is it ready for review or not?

@x3c41a x3c41a marked this pull request as draft January 22, 2025 18:06
@x3c41a
Copy link
Contributor Author

x3c41a commented Jan 22, 2025

@x3c41a this still has "Draft" in its name, but it's status is open (not draft), is it ready for review or not?

It's not ready for review just yet.
Even though the scenarios execute properly, the PR requires message style unification and more thorough post execution validation.

1. Discovered broken Set Asset Claimer. Replaced with nested SetHints +
AssetClaimer
2. Unified XCM v4 and v5 message creation, improved message weights,
small code refactors.
3. Removed `query_weight_to_asset_fee` call. It does not work as
intended; will be restored in the future iterations.
@x3c41a
Copy link
Contributor Author

x3c41a commented Jan 24, 2025

If it comes to post execution checks the plan is to add new block creation at destination chain and account balance validation after the execution.

PET checks are more extensive but there is no need to replicate its logic here.
Checking events, queue messages and system events is useful and more comprehensive but it's non-trivial and requires significant amount of time to make it work. only balances check for now.

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.

5 participants