Skip to content

test(e2e): consolidate automine token suites - #24489

Merged
PhilWindle merged 2 commits into
merge-train/spartan-v5from
spl/e2e-r2-token
Jul 5, 2026
Merged

test(e2e): consolidate automine token suites#24489
PhilWindle merged 2 commits into
merge-train/spartan-v5from
spl/e2e-r2-token

Conversation

@spalladino

@spalladino spalladino commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Part of the e2e round-2 consolidation (PR 1 of 9). Merges the automine token/ suites into fewer, parameterized files, with no loss of asserted behavior. Failure cases are written as explicit per-case tests (no shared dispatch DSL), and the two token harnesses share member names so the merged suites can reuse code.

Merges (old files → new)

  • Transfer quintet → two files. transfer.test.ts (happy paths + the private Transfer event assertion, grouped by entrypoint) and new transfer_failures.test.ts (explicit per-case failure tests, grouped by entrypoint). Deletes transfer_in_private, transfer_in_public, transfer_to_private, transfer_to_public.
  • burn.test.ts + blacklist_burn.test.tsburn.test.ts via describe.each over the two harnesses. Each scenario's setup returns its harness directly; only the differing private-burn method (burn_private vs burn) is mapped per scenario (burn_public is identical on both). The blacklist-only "sender is blacklisted" cases are an extra block. Deletes blacklist_burn.test.ts.
  • blacklist_transfer_private.test.ts + blacklist_transfer_public.test.tsblacklist_transfer.test.ts, parameterized by authwit mechanism (private-proxy vs public) over a single shared harness (private transfers only touch private balances, public only public, so neither disturbs the other's mint). Failure cases are explicit per-case tests inside the mechanism loop. Deletes both.
  • minting.test.tsdescribe.each(['Public','Private']) for the mirrored role/overflow cases; the private-only ABI-encoding overflow case stays explicit.
  • reading_constants.parallel.test.tsreading_constants.test.ts: dropped the .parallel suffix, converted the 6 its to a single it.each, and deleted the empty no-op beforeEach.

Shared helpers (token_test_helpers.ts)

  • balanceOf / halfBalanceOf / amountAboveBalance — the "read balance, take half or balance±1, assert > 0" idiom.
  • assertPublicAuthwitReplayRejected / assertAuthwitProxyReplayRejected — the grant/consume-then-replay dances for public and private-proxy authwits.
  • deployAmmWithTokens — the AMM + 3-token + authwit-minter deployment boilerplate previously duplicated in token/amm.test.ts and simulation/kernelless_simulation.test.ts; both now call it.

Adopted the balance helpers (and the proxy-replay helper in unshielding) in blacklist_shielding.test.ts and blacklist_unshielding.test.ts.

Harness name unification

TokenContractTest and BlacklistTokenContractTest now share member names so the merged burn suite reads members off the harness directly:

  • Both expose a public applyMint() called after setup(); the Token harness's pre-setup applyMintSnapshot() flag is gone.
  • The Token harness's secondary account is renamed account1AddressotherAddress to match the blacklist harness's owner/other vocabulary. Consumers updated accordingly (transfer, minting, access_control.parallel, private_transfer_recursion.parallel).

Quick wins

  • Deleted the byte-identical duplicate it('transfer on behalf of other, wrong designated caller') in the old transfer_in_public.
  • Collapsed the triplicate it.skip('transfer into account to overflow') (GH Cheatcodes tracking issue #1259) to a single copy in transfer_failures.test.ts.
  • Resolved the new TokenContractTest('transfer_private') harness-name collision (the two files that shared it were merged; the survivors use distinct names).
  • Removed the redundant inline tokenSim.check() calls from the old transfer_to_private (the harness afterEach already checks).

Preserved-assertion mapping (summary)

Every asserted behavior survives: each failure mode × entrypoint pair is an explicit test; happy paths and event/balance/simulator assertions stay explicit. The CHECK_ALERTS/Grafana publishing_mana_per_second QoS guard from the old transfer_in_public moved to transfer.test.ts (which now owns the public-transfer execution).

Intentional changes (no assertion lost)

  • Balance-unchanged checks: where an original asserted only the owner's balance unchanged (private wrong-caller cases), the failure tests now assert both the owner's and other's balances unchanged — a strengthening, since simulate cannot move balances.
  • Dropped one redundant createAuthWit+authWitnesses in the old transfer_in_public over-balance-via-authwit case: the public authwit alone is the authorization mechanism (the private witness was inert on a public call); the U128-underflow revert + balances-unchanged assertions are unchanged.
  • For transfer_to_public over-balance / invalid-nonce, the recipient is now other rather than self; the asserted error (Balance too low / invalid nonce) is independent of the recipient.

Verification

yarn build, yarn format, yarn lint clean. CI is the oracle for the full matrix.

@spalladino spalladino added wip Work in progress and removed wip Work in progress labels Jul 3, 2026
Merge the automine token test files into fewer, parameterized files and
extract a shared token failure-case DSL, preserving every asserted behavior.

- Transfer quintet -> transfer.test.ts (happy) + transfer_failures.test.ts (table)
- burn + blacklist_burn -> burn.test.ts (describe.each over both harnesses)
- blacklist_transfer_{private,public} -> blacklist_transfer.test.ts (by authwit mechanism)
- minting.test.ts -> describe.each(['Public','Private'])
- reading_constants: drop .parallel, convert 6 its to it.each, delete empty beforeEach
- New token_test_helpers.ts: balance/authwit-replay helpers, runTokenFailureCases
  runner, and deployAmmWithTokens (used by amm.test.ts and kernelless_simulation)

Part of the e2e round-2 consolidation.
Roll back the runTokenFailureCases/runFailureMode failure-case DSL in favor
of explicit per-case tests, unify the mint method (applyMint) and the
secondary account name (otherAddress) between TokenContractTest and
BlacklistTokenContractTest, and dedupe the burn scenarios so each returns
its harness directly with only the differing private-burn method mapped.
@PhilWindle
PhilWindle merged commit 9f23247 into merge-train/spartan-v5 Jul 5, 2026
12 checks passed
@PhilWindle
PhilWindle deleted the spl/e2e-r2-token branch July 5, 2026 18:04
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
Clean forward-port of AztecProtocol#24524 (merge-train
spartan-v5, merge commit f397aa5, parents aba2a2e..7e7d8d0) onto
cb/private-port-next-7. Cherry-pick -m 1 applied with zero conflicts;
resulting tree touches exactly the 152 files of the source merge diff.

Pure TS/docs/CI (117 e2e-consolidation test files + sequencer-client,
archiver, stdlib TS, p2p, ethereum, validator-client, foundation, docs,
.test_patterns.yml). No noir/circuit/pinned-artifact surfaces → no
standard-contracts regen. Bundles sub-PRs AztecProtocol#24504 AztecProtocol#24506 AztecProtocol#24507 AztecProtocol#24509
AztecProtocol#24513 AztecProtocol#24515 AztecProtocol#24474 AztecProtocol#24489 AztecProtocol#24490 AztecProtocol#24491 AztecProtocol#24492 AztecProtocol#24494 AztecProtocol#24495 AztecProtocol#24498
AztecProtocol#24500 AztecProtocol#24503 AztecProtocol#24475.

Tracker: AztecProtocol/aztec-packages-private#570
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.

2 participants