Skip to content

E2E tests for coldkey swap#2518

Open
l0r1s wants to merge 5 commits intodevnet-readyfrom
e2e-tests-ck-swap
Open

E2E tests for coldkey swap#2518
l0r1s wants to merge 5 commits intodevnet-readyfrom
e2e-tests-ck-swap

Conversation

@l0r1s
Copy link
Collaborator

@l0r1s l0r1s commented Mar 19, 2026

Summary

Add E2E tests for coldkey swap using polkadot-api (papi).

Changes

Moonwall config (moonwall.config.json)

  • Added zombienet_coldkey_swap environment with papi connection
  • Added generate-types.sh to runScripts so papi descriptors are generated before test run

Utility files

  • utils/coldkey_swap.ts — Helpers for coldkey swap operations: announceColdkeySwap, swapColdkeyAnnounced, disputeColdkeySwap, clearColdkeySwapAnnouncement, sudoResetColdkeySwap, sudoSwapColdkey, and storage query helpers. Uses coldkeyHashBinary() for papi FixedSizeBinary<32> hash params.
  • utils/transactions.tssendTransaction wrapper that returns success/failure instead of throwing, for negative tests.

Test files

  • 00-coldkey-swap.test.ts — User-initiated coldkey swap tests:
    • T01–T08: core coldkey swap (announce, swap, dispute, reannounce, hash mismatch, etc.)
    • T09–T12: clear_coldkey_swap_announcement (happy path, too early, no announcement, after dispute)
    • T13: CheckColdkeySwap dispatch guard — active announcement blocks add_stake and Balances.transfer_keep_alive; swap-related calls (announce_coldkey_swap, dispute_coldkey_swap) still allowed through
    • T14: CheckColdkeySwap dispatch guard — disputed swap blocks ALL calls including add_stake, Balances.transfer_keep_alive, and even swap-related calls (swap_coldkey_announced)
  • 01-coldkey-swap-sudo.test.ts — Sudo coldkey swap tests (reset, instant swap, clears pending announcement)

@l0r1s l0r1s changed the title WIP E2E tests for coldkey swap [WIP] E2E tests for coldkey swap Mar 19, 2026
@l0r1s l0r1s changed the title [WIP] E2E tests for coldkey swap E2E tests for coldkey swap Mar 20, 2026
@l0r1s l0r1s marked this pull request as ready for review March 20, 2026 21:18
@l0r1s l0r1s added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant