Skip to content

docs(rs-platform-wallet/e2e): token TK-NNN spec entries + Wave G harness roadmap#3580

Closed
lklimek wants to merge 11 commits intofeat/rs-platform-wallet-e2efrom
docs/token-test-spec
Closed

docs(rs-platform-wallet/e2e): token TK-NNN spec entries + Wave G harness roadmap#3580
lklimek wants to merge 11 commits intofeat/rs-platform-wallet-e2efrom
docs/token-test-spec

Conversation

@lklimek
Copy link
Copy Markdown
Contributor

@lklimek lklimek commented May 4, 2026

Issue being fixed or feature implemented

Stacks on top of #3549.

This is a SPEC-ONLY PR for review. No test code, no framework code, no wallet API changes. The actual token-test implementation will be a follow-up PR after this spec is approved.

Source: token-feature investigation by the UX team (catalog of operations, mapping to wallet API surfaces, identification of API gaps).

What was done?

TEST_SPEC.md changes

  • 14 new TK-NNN entries added (TK-005..TK-016 + TK-001c, TK-003b variants), covering token operations: transfer, mint, burn, freeze, unfreeze, destroy_frozen_funds, pause, resume, claim, set_price, purchase, update_config.
  • Existing TK-001..TK-004 reframed: TK-003 / TK-004 superseded by new TK-007 / TK-008; TK-001 / TK-001b / TK-002 updated to use the in-test contract pattern.
  • All new TK entries land as Status: BLOCKED until two prerequisites land: (1) Wave A Signer<IdentityPublicKey> (already on PR feat(rs-platform-wallet/e2e): identity-credit sweep + ID-001/002/003/005 tests #3578), (2) a token-contract bootstrap helper (Wave G).
  • New Wave G subsection in §4 documenting:
    • 13 harness helpers needed for token tests.
    • 6 wallet API gaps (Gap-T1..T6) with file:line landing sites for follow-up.

What's NOT in this PR

  • Test code — implementation comes after spec approval.
  • Framework helpers — same.
  • Wallet API additions — Gap-T1..T6 will be filed/implemented separately.

How Has This Been Tested?

cargo check --tests --all-features and cargo fmt --check both green; spec-only edit doesn't affect compilation.

Breaking Changes

None.

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests (this is the SPEC; tests come in follow-up)
  • I have added "!" to the title and described breaking changes
  • I have made corresponding changes to the documentation if needed (this IS the documentation)

🤖 Co-authored by Claudius the Magnificent AI Agent

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 4, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7e3d8f23-5b6c-4c44-a3a9-864135d0c7ee

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/token-test-spec

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

lklimek and others added 2 commits May 5, 2026 09:11
… G harness roadmap

Source: token-feature investigation by Diziet (UX) covering 14 new TK-NNN cases
(TK-005..TK-016 plus TK-001c, TK-003b suffix variants). All entries land as
Status: BLOCKED until Wave A (Signer<IdentityPublicKey> harness, on PR #3578)
and Wave G (token-contract bootstrap) ship.

Reframing of existing TK-001..TK-004:
- TK-003 SUPERSEDED by TK-007 (in-test deployment + supply assertions +
  unauthorised-mint negative as sub-case).
- TK-004 SUPERSEDED by TK-008 (in-test deployment + supply round-trip +
  unauthorised-burn sub-case).
- TK-001 / TK-001b reframed off operator-pre-funded contract onto in-test
  deploy (TK-005 helper + in-test mint via TK-007).
- TK-002 demoted to nightly-only "live perpetual distribution"; the
  synchronous tier covers the same surface via TK-015's
  pre-programmed-distribution variant.

New TK-005..TK-016 cover: register contract, transfer-with-fee-accounting,
mint+supply, burn+supply, freeze, unfreeze, destroy frozen funds, pause/resume,
set-price + direct purchase, update config, claim from pre-programmed
distribution, and the group-action gateway happy path.

Harness work documented as Wave G in §4 with 13 helpers (setup_with_token_*,
mint_to, token_*_of accessors, wait_for_token_balance, JSON template,
register_extra_identity) plus 6 wallet-API gaps (Gap-T1..T6) for follow-up.
Wave D is marked SUPERSEDED by Wave G — operator-pre-funded contracts
dropped because the wallet already accepts tokens_schema_json on
create_data_contract_with_signer (wallet/identity/network/contract.rs:124).

Quick index updated with 14 new TK rows + 2 SUPERSEDED placeholders;
counts line recomputed (P0: 8 -> 10, P1: 17 -> 24, P2: 53 -> 56,
total 79 -> 93 with 2 superseded).

No test code, no framework code, no wallet API changes. Spec-only edit
for review before implementation begins.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… TK-NNN

User confirmed renumbering is safe — token tests haven't started
implementation yet, no external references to disturb.

- Remove TK-003 and TK-004 (superseded by TK-007 / TK-008 per
  Diziet's investigation).
- Renumber TK-005..TK-016 → TK-003..TK-014 contiguously.
- Renumber TK-003b → TK-005b (it is a P2 variant of the mint case
  which is now TK-005, not of the deleted old TK-003).
- Update Quick index, counts, cross-references, and §5 / §6 wording
  that referred to the old TK-003/TK-004 / Wave D model.

TK-001 / TK-001b / TK-001c retain their numbers (they cover the
operator-pre-funded → in-test-contract reframing, not superseded).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lklimek lklimek force-pushed the docs/token-test-spec branch from 7a313a4 to bcc5f64 Compare May 5, 2026 07:17
lklimek and others added 9 commits May 5, 2026 09:26
…elpers

Gap-T1..T6 were tracked as wallet-API surface gaps blocking token
test implementation. User decision: write framework-level helpers
that wrap SDK calls directly instead. The wallet's public API doesn't
need new methods to support tests.

- Each Gap-T* becomes a Wave G helper that calls SDK directly.
- TK-NNN BLOCKED reasons updated to drop Gap-T* references.
- Wave G helper count grows accordingly (13 + 6 = ~19 helpers).
- §4 / §5 / §6 cross-references cleaned up.

Test implementation can now proceed without waiting for any new
wallet API surface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds packages/rs-platform-wallet/tests/e2e/framework/tokens.rs with the
19-helper Wave G inventory documented in TEST_SPEC.md:

- 5 SDK-wrapper accessors (token_balance_of, token_supply_of,
  token_is_paused_of, token_pricing_of, token_frozen_balance_of)
  plus 5 raw-id variants.
- 4 bootstrap helpers (setup_with_token_contract,
  setup_with_token_and_{two,three}_identities,
  setup_with_token_pre_programmed_distribution).
- 4 utility helpers (register_token_contract_via_sdk, mint_to,
  wait_for_token_balance, permissive_owner_token_contract_json,
  register_extra_identity).

Module wired via framework/mod.rs. cargo check / clippy / fmt clean.
Test cases consuming these helpers come in Wave 2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ip cases [Wave 2-β]

TK-003 exercises Wave G's `register_token_contract_via_sdk` end to end
and asserts the chain-derived contract id, ownerId, and the default
token slot are all observable via `DataContract::fetch` immediately
after the broadcast resolves. The Wave 1 MASTER-vs-CRITICAL signing
trigger is wired as a sharp `panic!` so Wave 4 (Marvin) sees the
exact `InvalidSignatureError` rollup in CI logs without spelunking.

TK-004 drives an A→B→A token round-trip through `setup_with_token_
and_two_identities` + Wave G's `mint_to` + an inlined
`Sdk::token_transfer` call. Asserts owner balance is conserved across
the round-trip (token transfers carry no token-side fee), peer sees
the intermediate balance, peer ends at zero, and total supply stays
flat across pure transfers (only mint moves it).

Both cases gated behind `#[ignore]` per harness convention; `cargo
check --tests --all-features --test e2e` and `cargo clippy --tests
--all-features -- -D warnings` are clean, and `cargo fmt --check`
passes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… [Wave 2-γ]

Implements three TK-NNN cases on top of Wave G's framework helpers:

- TK-005: owner mints to self (two consecutive mints), pinning that
  total supply and owner balance both equal MINT_AMOUNT_A + MINT_AMOUNT_B
  and that pre-mint supply equals DEFAULT_BASE_SUPPLY (= 0).
- TK-005b: owner mints to a separate identity via
  setup_with_token_and_two_identities; pins that the recipient gains
  the balance, the owner balance stays 0, and supply equals the mint
  amount — exercising the cross-identity destination branch
  (mintingAllowChoosingDestination = true).
- TK-006: seeds a 1_000-token mint, then burns 100 via the SDK
  TokenBurnTransitionBuilder (the framework has no burn shortcut yet).
  Pins post-burn supply and owner balance both equal
  MINT_AMOUNT - BURN_AMOUNT (900) and asserts BurnResult resolves to
  HistoricalDocument because the permissive contract sets
  keepsBurningHistory = true.

All three carry #[ignore] (live testnet + bank-mnemonic gated) and
share the tracing-subscriber init pattern from id_001 / transfer.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… [Wave 2-δ]

Adds three #[ignore]'d e2e cases for the freeze admin chain:
TK-007 freeze + reject-while-frozen, TK-008 freeze→unfreeze
round-trip, TK-009 destroy-frozen-funds. Each test is
self-contained and stages its own freeze precondition via
setup_with_token_and_two_identities + mint + transfer; the
spec's BLOCKED-on-TK-007 chain is editorial only. Drives the
wallet-level token_(un)freeze/destroy_frozen_funds_with_signer
helpers and asserts frozen-balance / supply / fee-debited
invariants. FreezeResult/UnfreezeResult/DestroyFrozenFundsResult
do not expose actual_fee, so the fee>0 assertion is observed
against IdentityBalance pre/post.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… cases [Wave 2-ε]

Wire up three Wave 2 epsilon TK-NNN test cases against the Wave G
token-harness helpers in `tests/e2e/framework/tokens.rs`:

- TK-010: pause/resume round-trip — owner mints, pauses, asserts
  `token_is_paused_of` flips, attempts a transfer (must fail with a
  "token is paused" typed error), resumes, retries successfully.
- TK-011: set price + direct purchase — owner mints + sets a
  `SinglePrice(1_000)` schedule via `token_set_price_for_direct_purchase`,
  buyer purchases 10 tokens at total_agreed_price=10_000. Pins
  buyer/owner token deltas and credit-balance deltas (the bare SDK
  result enums don't surface `actual_fee`, so we read fees from
  credit-balance deltas).
- TK-012: single-ChangeItem update — owner mutates `MaxSupply` from
  the default `1e15` to `2e15` and re-fetches the contract to
  confirm the new value plus a contract-version bump.

All three cases are `#[ignore]`d behind PLATFORM_WALLET_E2E_BANK_MNEMONIC
+ live testnet, mirroring the existing transfer case. Each TODO-tags
the actual_fee assertion drift so Wave 4 can fold it back in once the
SDK result types expose fee fields.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…laim cases [Wave 2-α]

TK-001: full happy-path transfer between two identities; pins exact
sender/peer token balance deltas and a non-zero credit fee.

TK-001b: pins the zero-amount **(a) Reject** contract — calls
`token_transfer_with_signer(amount=0)` and asserts the typed
`InvalidTokenAmount` validator rejects pre-broadcast with both
balances unchanged.

TK-001c: depends on ID-004 (key add/disable) helper — body covers
setup + mint, then panics with a TODO at the rotation step pending a
`derive_identity_key`-driven signer-cache injection.

TK-002: live perpetual distribution — the spec requires
`setup_with_token_contract` to be extended with a
`distribution_rules` override which is not on the Wave 1 baseline.
Sub-team α is constrained from editing `framework/tokens.rs`, so
the test sets up the baseline fixture and panics with a TODO
citing the missing helper.

All four ignored by default; verified by `cargo check`,
`cargo clippy --tests --all-features -- -D warnings`, and
`cargo fmt --check`. Wave 4 runs them against live testnet.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ases [Wave 2-ζ]

Pin TK-013 (token claim from a past-timestamp pre-programmed
distribution) and TK-014 (group-action gateway: queue mint, list
pending, co-sign) end-to-end against a live testnet bank wallet.

TK-013 registers the owner first (so the recipient identifier is
known before the schedule is baked) then deploys a fresh contract
whose preProgrammedDistribution lands one hour in the past — the
claim is immediately eligible, dodging the live-time wait that
gates TK-002 (perpetual). Asserts owner balance == pre + payout.

TK-014 deploys a custom V1 contract with a 2-of-3 group at position
0 and `manualMintingRules` routed to it. Owner proposes a mint to
peer A (`GroupStateTransitionInfoProposer`), the test asserts the
pending list surfaces the proposal at `ActionActive` with the
recipient/amount untouched, peer A co-signs
(`GroupStateTransitionInfoOtherSigner`), then the test asserts
balance + supply advance, the action moves to `ActionClosed`, and
the active list no longer carries it.

Both cases drive `Sdk::token_*` builders directly — the wallet's
`token_claim_with_signer` / `token_mint_with_signer` are thin
forwards to the SDK, and the framework's `mint_to` already takes
this shape. TK-014 also ships an inline V1-envelope assembler with
a `groups` field, since `register_token_contract_via_sdk` (Wave 1)
doesn't surface a groups injection point yet.

Both gated behind `#[ignore]` for operator env (mnemonic + DAPI
access).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… Wave 2

Wave 2 implementation landed all 17 test cases (TK-001..TK-014 + variants).
Tests are #[ignore]-tagged and runnable on demand against testnet.

Some entries flag known limitations (panic-with-todo) for follow-up work:
- TK-001c: needs ID-004 signer-cache injection helper.
- TK-002: needs perpetual-distribution helper override in tokens.rs.
- TK-003: may need CRITICAL signing key class upgrade for DataContractCreate.

These do not block test execution — they document Wave 4's expected
discovery surface.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@lklimek
Copy link
Copy Markdown
Contributor Author

lklimek commented May 5, 2026

Merged into feature branch test/platform-wallet-e2e

@lklimek lklimek closed this May 5, 2026
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.

1 participant