From 5dd5659b8e591085bcec4482a939241c5b02e957 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 16:45:06 -0300 Subject: [PATCH 1/7] refactor(e2e): add AutomineTestContext base + helpers Add the automine category base context as a sibling of SingleNodeTestContext: it wraps fixtures/setup.ts:setup() with AUTOMINE_E2E_OPTS as the default, exposes the common test handles, and provides markProvenAndWarp, registerContract, and applyManualParentChild. Lands unused; the test moves follow in later commits. Adds the blanket automine flake group to .test_patterns.yml. --- .test_patterns.yml | 5 + .../end-to-end/src/automine/README.md | 59 +++++++ .../src/automine/automine_test_context.ts | 153 ++++++++++++++++++ 3 files changed, 217 insertions(+) create mode 100644 yarn-project/end-to-end/src/automine/README.md create mode 100644 yarn-project/end-to-end/src/automine/automine_test_context.ts diff --git a/.test_patterns.yml b/.test_patterns.yml index 156f528c2975..0f7a04594657 100644 --- a/.test_patterns.yml +++ b/.test_patterns.yml @@ -301,6 +301,11 @@ tests: owners: - *palla + - regex: "src/automine/.*\\.test\\.ts" + flake_group_id: e2e-p2p-epoch-flakes + owners: + - *palla + - regex: "p2p/src/client/test/.*\\.test\\.ts" flake_group_id: e2e-p2p-epoch-flakes owners: diff --git a/yarn-project/end-to-end/src/automine/README.md b/yarn-project/end-to-end/src/automine/README.md new file mode 100644 index 000000000000..059cf33e931c --- /dev/null +++ b/yarn-project/end-to-end/src/automine/README.md @@ -0,0 +1,59 @@ +# `automine` e2e test category + +Automine tests run a single Aztec node driving the deterministic `AutomineSequencer`: one block per +submitted transaction, synchronous L1 publish, no committee, no prover, and no validator client. The +node opts into this topology through the `AUTOMINE_E2E_OPTS` preset (`fixtures/fixtures.ts`), which the +base context applies by default. This is the fast, deterministic counterpart to the `single-node` +category, whose node runs the production sequencer with interval block production. A test belongs here +when it exercises contract or protocol behavior that does not depend on real block-building or consensus +(token transfers, nested calls, note discovery, tx semantics); it belongs in `single-node` when it +asserts on sequencer, proving, or reorg behavior. + +## Base class + +All tests use `AutomineTestContext` (`automine_test_context.ts`), which owns: + +- The environment: an in-process anvil in automine mode plus the L1 contract deploy, wrapping + `fixtures/setup.ts:setup()` with `AUTOMINE_E2E_OPTS` and `fundSponsoredFPC` as defaults. +- The common handles: `context`, `wallet`, `aztecNode`, `aztecNodeAdmin`, `cheatCodes`, `sequencer`, + `accounts`, `defaultAccountAddress`, `logger`. +- `markProvenAndWarp(seconds)`: marks pending checkpoints proven before warping the L2 clock, so a long + warp does not trip the rollup's pruning window (see the method's doc comment). +- `registerContract(...)`: computes and registers a contract instance without an on-chain deploy. +- `applyManualParentChild()`: deploys a Parent and Child contract for the nested-call tests. + +Tests call the static `AutomineTestContext.setup({ numberOfAccounts })` factory (or `new` plus `setup()` +for the harness subclasses), passing `numberOfAccounts` rather than spreading `AUTOMINE_E2E_OPTS`. + +## Harnesses + +Two domain harnesses extend `AutomineTestContext` and run their domain setup after `super.setup()`: + +- `token/token_contract_test.ts` — a `TokenSimulator` plus opt-in base/mint snapshots for the Token + contract tests. +- `token/blacklist_token_contract_test.ts` — a `TokenSimulator`, the `Role` helper, and the + role-change-delay warp (via `markProvenAndWarp`) for the TokenBlacklist tests. + +## Organizing principle + +The top level groups tests by node topology (automine); the second level names the primary behavior +under test rather than the shared setup. Each file has a single top-level `describe` named to match its +path. A `.parallel` suffix marks files with more than one top-level `it`; CI splits each `it` into its +own job. + +## Subfolders + +| Path | Contents | +|---|---| +| `smoke/` | AutomineSequencer mechanics themselves: sequential and parallel tx landing, time warps, `mineBlock`, and checkpoint revert. | +| `token/` | Token-economics tests on the two token harnesses plus the `TokenSimulator`/`LendingSimulator`-adjacent DeFi tests: token transfers/minting/burning/access-control, the blacklist token suite, AMM, lending, NFT, orderbook, crowdfunding, and escrow. | +| `contracts/` | Contract lifecycle and cross-contract behavior. `deploy/` (class registration, deploy method, legacy deploy, private initialization), `nested/` (importer and the manual private/public nested-call patterns), plus contract updates, storage proofs, static calls, and nested utility calls. | +| `accounts/` | Account and key behavior: account contracts, keys, multiple accounts sharing an encryption key, two-PXE interop, authwit, and scope isolation. | +| `notes/` | Note discovery, events, and offchain effects: note getters, pending note hashes, partial notes, event logs, event-only notes, offchain effects and payments, large public events, custom messages, and the tx-effect oracle. | +| `execution/` | Transaction semantics: ordering, double-spend rejection, phase checks, kernelless simulation, the AVM simulator, the circuit recorder, option params, ABI types, state variables, mempool limits, the card game, and private voting. | +| `lifecycle/` | Chain-tip, pruning, and timing behavior under automine: pruned blocks, the genesis timestamp, expiration timestamps, and PXE behavior. | +| `sync/` | Node snapshot upload/download and sync. `snapshot_sync` creates a snapshot and syncs fresh nodes from one or multiple URLs, including fallback past a corrupted snapshot. | + +Two genuine outliers: `lifecycle/genesis_timestamp` builds its environment with a custom chain and a +disabled `AnvilTestWatcher` rather than going through the base factory, and `execution/avm_simulator` +dumps AVM circuit inputs for the downstream `avm_check_circuit` CI job. diff --git a/yarn-project/end-to-end/src/automine/automine_test_context.ts b/yarn-project/end-to-end/src/automine/automine_test_context.ts new file mode 100644 index 000000000000..135b77220b65 --- /dev/null +++ b/yarn-project/end-to-end/src/automine/automine_test_context.ts @@ -0,0 +1,153 @@ +import type { ContractArtifact } from '@aztec/aztec.js/abi'; +import type { AztecAddress } from '@aztec/aztec.js/addresses'; +import { type ContractBase, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts'; +import { Fr } from '@aztec/aztec.js/fields'; +import type { PublicKeys } from '@aztec/aztec.js/keys'; +import type { Logger } from '@aztec/aztec.js/log'; +import type { AztecNode } from '@aztec/aztec.js/node'; +import type { Wallet } from '@aztec/aztec.js/wallet'; +import type { CheatCodes } from '@aztec/aztec/testing'; +import { ChildContract } from '@aztec/noir-test-contracts.js/Child'; +import { ParentContract } from '@aztec/noir-test-contracts.js/Parent'; +import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest'; +import type { PXEConfig } from '@aztec/pxe/config'; +import type { SequencerClient } from '@aztec/sequencer-client'; +import type { AztecNodeAdmin, AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; + +import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; +import { type EndToEndContext, type SetupOptions, setup, teardown } from '../fixtures/setup.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; + +export type AutomineTestOpts = Partial & { + /** Number of accounts to create and deploy during setup. */ + numberOfAccounts?: number; + /** Options forwarded to PXE creation. */ + pxeOpts?: Partial; +}; + +/** + * Base class for the automine-sequencer test topology: a single in-process node running the + * deterministic {@link AUTOMINE_E2E_OPTS} preset (one block per submitted tx, synchronous L1 publish, + * no committee, no prover, no validator client). Owns the environment (in-proc anvil in automine mode + * plus the L1 deploy) and exposes the handles every automine test uses (`wallet`, `aztecNode`, + * `cheatCodes`, `sequencer`, `accounts`, `logger`). + * + * The sibling of {@link SingleNodeTestContext}: both wrap the same underlying `fixtures/setup.ts:setup()` + * but fix opposite sequencer topologies. Making {@link AUTOMINE_E2E_OPTS} the base default removes the + * per-test-file spread every automine test would otherwise repeat. + * + * Domain harnesses (the token simulators) compose on top by extending this base and overriding + * {@link setup} to run their domain steps after `super.setup()`. + */ +export class AutomineTestContext { + public context!: EndToEndContext; + public logger!: Logger; + public wallet!: TestWallet; + public aztecNode!: AztecNode & AztecNodeDebug; + public aztecNodeAdmin!: AztecNodeAdmin; + public cheatCodes!: CheatCodes; + public sequencer!: SequencerClient; + public accounts!: AztecAddress[]; + public defaultAccountAddress!: AztecAddress; + + public parentContract!: ParentContract; + public childContract!: ChildContract; + + public static async setup(this: new () => T, opts: AutomineTestOpts = {}): Promise { + const test = new this(); + await test.setup(opts); + return test; + } + + public async setup(opts: AutomineTestOpts = {}): Promise { + const { numberOfAccounts = 1, pxeOpts, ...setupOpts } = opts; + const context = await setup( + numberOfAccounts, + { + ...AUTOMINE_E2E_OPTS, + fundSponsoredFPC: true, + ...setupOpts, + }, + pxeOpts, + ); + await this.hydrateFromContext(context); + } + + /** + * Populates the context-derived handles from an already-built {@link EndToEndContext}. Split out of + * {@link setup} so domain harnesses that build the environment with their own bespoke `setup(...)` + * opts can still reuse the shared handle wiring. + */ + protected hydrateFromContext(context: EndToEndContext): Promise { + this.context = context; + this.logger = context.logger; + this.wallet = context.wallet; + this.aztecNode = context.aztecNodeService; + this.aztecNodeAdmin = context.aztecNodeService; + this.cheatCodes = context.cheatCodes; + this.sequencer = context.sequencer!; + this.accounts = context.accounts; + this.defaultAccountAddress = context.accounts[0]; + return Promise.resolve(); + } + + public async teardown(): Promise { + await teardown(this.context); + } + + /** + * Marks the current pending checkpoints as proven, then warps the L2 clock forward by `seconds`. + * + * Under {@link AUTOMINE_E2E_OPTS} a long warp crosses many epochs with no proofs being submitted, so + * without a prior `markAsProven()` the rollup contract's pruning window resets the chain tip to genesis + * and the warp's own empty-checkpoint propose fails with `Rollup__InvalidArchive`. Marking proven before + * warping keeps the pending chain alive. Composes the existing `cheatCodes.rollup.markAsProven` and + * `warpL2TimeAtLeastBy` with that required ordering. + */ + public async markProvenAndWarp(seconds: number | bigint): Promise { + await this.cheatCodes.rollup.markAsProven(); + await this.cheatCodes.warpL2TimeAtLeastBy(this.aztecNode, seconds); + } + + /** Computes and registers a contract instance in the wallet without deploying it on-chain. */ + public async registerContract( + wallet: Wallet, + contractArtifact: ContractArtifactClass, + opts: { + salt?: Fr; + publicKeys?: PublicKeys; + initArgs?: any[]; + constructorName?: string; + deployer?: AztecAddress; + } = {}, + ): Promise { + const { salt, publicKeys, initArgs, constructorName, deployer } = opts; + const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, { + constructorArgs: initArgs ?? [], + constructorArtifact: constructorName, + salt: salt ?? Fr.random(), + publicKeys, + deployer, + }); + await wallet.registerContract(instance, contractArtifact.artifact); + return contractArtifact.at(instance.address, wallet); + } + + /** Deploys a Parent and a Child contract from the default account for the nested-call tests. */ + public async applyManualParentChild(): Promise { + this.logger.info('Deploying parent and child contracts'); + ({ contract: this.parentContract } = await ParentContract.deploy(this.wallet).send({ + from: this.defaultAccountAddress, + })); + ({ contract: this.childContract } = await ChildContract.deploy(this.wallet).send({ + from: this.defaultAccountAddress, + })); + } +} + +export type StatefulContractCtorArgs = Parameters; + +export type ContractArtifactClass = { + at(address: AztecAddress, wallet: Wallet): T; + artifact: ContractArtifact; +}; From 1dd8723ec2a662bbdc07308f612f13e8ebdb7fb2 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 16:54:55 -0300 Subject: [PATCH 2/7] refactor(e2e): fold deploy + nested contract tests into automine Fold DeployTest and NestedContractTest into AutomineTestContext: registerContract and the StatefulContractCtorArgs/ContractArtifactClass aliases move onto the base, and applyManual becomes applyManualParentChild. Move the deploy tests under automine/contracts/deploy/, the nested tests under automine/contracts/nested/, and e2e_storage_proof under automine/contracts/ (with its fixtures). Files with more than one top-level it gain the .parallel suffix. Adds the automine/contracts globs to both bootstrap.sh test-list arrays, extends the compat flatten branch to cover src/automine/*, repoints the storage_proof_fetcher eslint override, the snapshot-regen script, and the protocol-contracts fixture provenance comment. --- yarn-project/end-to-end/bootstrap.sh | 13 +++- yarn-project/end-to-end/eslint.config.js | 2 +- .../contract_class_registration.test.ts | 14 ++-- .../deploy/deploy_method.parallel.test.ts} | 17 ++--- .../contracts/deploy/legacy.parallel.test.ts} | 15 ++-- .../private_initialization.parallel.test.ts} | 15 ++-- .../contracts}/fixtures/storage_proof.json | 0 .../fixtures/storage_proof_fetcher.ts | 0 .../fixtures/storage_proof_fixture.ts | 0 .../nested/importer.parallel.test.ts} | 12 ++- .../nested}/manual_private_call.test.ts | 14 ++-- .../manual_private_enqueue.parallel.test.ts} | 12 ++- .../nested/manual_public.parallel.test.ts} | 14 ++-- .../contracts/storage_proof.test.ts} | 21 +++--- .../bench/client_flows/storage_proof.test.ts | 2 +- .../src/e2e_deploy_contract/deploy_test.ts | 73 ------------------- .../nested_contract_test.ts | 51 ------------- .../protocol-contracts/src/tests/fixtures.ts | 4 +- yarn-project/update-snapshots.sh | 2 +- 19 files changed, 76 insertions(+), 205 deletions(-) rename yarn-project/end-to-end/src/{e2e_deploy_contract => automine/contracts/deploy}/contract_class_registration.test.ts (96%) rename yarn-project/end-to-end/src/{e2e_deploy_contract/deploy_method.test.ts => automine/contracts/deploy/deploy_method.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_deploy_contract/legacy.test.ts => automine/contracts/deploy/legacy.parallel.test.ts} (91%) rename yarn-project/end-to-end/src/{e2e_deploy_contract/private_initialization.test.ts => automine/contracts/deploy/private_initialization.parallel.test.ts} (96%) rename yarn-project/end-to-end/src/{e2e_storage_proof => automine/contracts}/fixtures/storage_proof.json (100%) rename yarn-project/end-to-end/src/{e2e_storage_proof => automine/contracts}/fixtures/storage_proof_fetcher.ts (100%) rename yarn-project/end-to-end/src/{e2e_storage_proof => automine/contracts}/fixtures/storage_proof_fixture.ts (100%) rename yarn-project/end-to-end/src/{e2e_nested_contract/importer.test.ts => automine/contracts/nested/importer.parallel.test.ts} (78%) rename yarn-project/end-to-end/src/{e2e_nested_contract => automine/contracts/nested}/manual_private_call.test.ts (56%) rename yarn-project/end-to-end/src/{e2e_nested_contract/manual_private_enqueue.test.ts => automine/contracts/nested/manual_private_enqueue.parallel.test.ts} (85%) rename yarn-project/end-to-end/src/{e2e_nested_contract/manual_public.test.ts => automine/contracts/nested/manual_public.parallel.test.ts} (85%) rename yarn-project/end-to-end/src/{e2e_storage_proof/e2e_storage_proof.test.ts => automine/contracts/storage_proof.test.ts} (63%) delete mode 100644 yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts delete mode 100644 yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index a266ebac13fb..102e5c2f1509 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -37,6 +37,9 @@ function test_cmds { local tests=( # List all standalone and nested tests, except for the ones listed above. src/e2e_*/*.test.ts + src/automine/contracts/*.test.ts + src/automine/contracts/deploy/*.test.ts + src/automine/contracts/nested/*.test.ts src/single-node/block-building/*.test.ts src/single-node/proving/*.test.ts src/single-node/l1-reorgs/*.test.ts @@ -296,6 +299,9 @@ function compat_test_cmds { local tests=( src/e2e_*/*.test.ts + src/automine/contracts/*.test.ts + src/automine/contracts/deploy/*.test.ts + src/automine/contracts/nested/*.test.ts src/single-node/fees/*.test.ts src/single-node/cross-chain/*.test.ts src/single-node/bot/*.test.ts @@ -306,9 +312,10 @@ function compat_test_cmds { ) for test in "${tests[@]}"; do local name - if [[ "$test" == src/p2p/* ]]; then - # The p2p/ folder has no `e2e_` prefix to strip; flatten its path into an e2e_p2p_ name - # (matching the historical e2e_p2p/ names) by dropping "src/", ".test.ts", and slashes. + if [[ "$test" == src/p2p/* || "$test" == src/automine/* ]]; then + # The p2p/ and automine/ folders have no `e2e_` prefix to strip; flatten their path into an + # e2e_ name (matching the historical e2e_p2p/ names) by dropping "src/", ".test.ts", + # and slashes. name=${test#src/} name=e2e_${name%.test.ts} name=${name//\//_} diff --git a/yarn-project/end-to-end/eslint.config.js b/yarn-project/end-to-end/eslint.config.js index 44e11c1365c6..47c0640f3663 100644 --- a/yarn-project/end-to-end/eslint.config.js +++ b/yarn-project/end-to-end/eslint.config.js @@ -21,7 +21,7 @@ export default [ }, }, { - files: ['src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts'], + files: ['src/automine/contracts/fixtures/storage_proof_fetcher.ts'], rules: { camelcase: 'off', 'no-console': 'off', diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts b/yarn-project/end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts rename to yarn-project/end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts index b5d637a3219c..13b8e26c29a3 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts @@ -21,19 +21,18 @@ import { PublicKeys } from '@aztec/stdlib/keys'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR } from '../fixtures/fixtures.js'; -import { DeployTest, type StatefulContractCtorArgs } from './deploy_test.js'; +import { DUPLICATE_NULLIFIER_ERROR } from '../../../fixtures/fixtures.js'; +import { AutomineTestContext, type StatefulContractCtorArgs } from '../../automine_test_context.js'; // Tests low-level contract class and instance registration: publishing class bytecode, deploying -// instances via wallet or a contract deployer, and init-check enforcement. DeployTest wraps -// setup(0, { ...AUTOMINE_E2E_OPTS, fundSponsoredFPC, skipAccountDeployment }) with 1 account. +// instances via wallet or a contract deployer, and init-check enforcement. Runs on a single account. // jest.setTimeout is 900s because serial publish/deploy chains exceed the default 5 min hook budget. -describe('e2e_deploy_contract contract class registration', () => { +describe('automine/contracts/deploy/contract_class_registration', () => { // Pipelined cadence (~24s/dependent-tx) inflates the chained deploy/publish setup beyond the default 5 min // hook window. Many of the publishInstance helpers serially register multiple contracts/instances per case. jest.setTimeout(900_000); - const t = new DeployTest('contract class'); + const t = new AutomineTestContext(); let logger: Logger; let wallet: Wallet; @@ -45,7 +44,8 @@ describe('e2e_deploy_contract contract class registration', () => { let publicationTxReceipt: TxReceipt; beforeAll(async () => { - ({ logger, wallet, aztecNode, defaultAccountAddress } = await t.setup({ ...AUTOMINE_E2E_OPTS })); + await t.setup(); + ({ logger, wallet, aztecNode, defaultAccountAddress } = t); artifact = StatefulTestContract.artifact; publicationTxReceipt = await publishContractClass(wallet, artifact).then(c => c.send({ from: defaultAccountAddress }).then(({ receipt }) => receipt), diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts b/yarn-project/end-to-end/src/automine/contracts/deploy/deploy_method.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts rename to yarn-project/end-to-end/src/automine/contracts/deploy/deploy_method.parallel.test.ts index fb52792edfbd..8c109ec687ae 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_method.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/deploy/deploy_method.parallel.test.ts @@ -11,16 +11,14 @@ import { NoConstructorContract } from '@aztec/noir-test-contracts.js/NoConstruct import { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest'; import { GasFees } from '@aztec/stdlib/gas'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { TestWallet } from '../test-wallet/test_wallet.js'; -import { DeployTest } from './deploy_test.js'; +import { TestWallet } from '../../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; // Tests the high-level DeployMethod API: deploying contracts publicly, privately, with -// batching, and verifying deployment metadata. DeployTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, -// fundSponsoredFPC, skipAccountDeployment }) with 1 account. Includes a minTxsPerBlock=2 sub-test -// that verifies two txs land in the same block. -describe('e2e_deploy_contract deploy method', () => { - const t = new DeployTest('deploy method'); +// batching, and verifying deployment metadata. Runs on a single account. Includes a minTxsPerBlock=2 +// sub-test that verifies two txs land in the same block. +describe('automine/contracts/deploy/deploy_method', () => { + const t = new AutomineTestContext(); let logger: Logger; let wallet: Wallet; @@ -28,7 +26,8 @@ describe('e2e_deploy_contract deploy method', () => { let defaultAccountAddress: AztecAddress; beforeAll(async () => { - ({ logger, wallet, aztecNode, defaultAccountAddress } = await t.setup({ ...AUTOMINE_E2E_OPTS })); + await t.setup(); + ({ logger, wallet, aztecNode, defaultAccountAddress } = t); }); afterAll(() => t.teardown()); diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts b/yarn-project/end-to-end/src/automine/contracts/deploy/legacy.parallel.test.ts similarity index 91% rename from yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts rename to yarn-project/end-to-end/src/automine/contracts/deploy/legacy.parallel.test.ts index 19f5492bbbb3..97f0e4ce5e4c 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/legacy.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/deploy/legacy.parallel.test.ts @@ -9,22 +9,21 @@ import { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest import { TestContractArtifact } from '@aztec/noir-test-contracts.js/Test'; import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import type { TestWallet } from '../test-wallet/test_wallet.js'; -import { DeployTest } from './deploy_test.js'; +import type { TestWallet } from '../../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; // Tests legacy ContractDeployer API: basic deploy, consecutive rollups, duplicate-salt rejection, -// and failed public constructor handling. DeployTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, -// fundSponsoredFPC, skipAccountDeployment }) with 1 account. -describe('e2e_deploy_contract legacy', () => { - const t = new DeployTest('legacy'); +// and failed public constructor handling. Runs on a single account. +describe('automine/contracts/deploy/legacy', () => { + const t = new AutomineTestContext(); let logger: Logger; let wallet: TestWallet; let defaultAccountAddress: AztecAddress; beforeAll(async () => { - ({ logger, wallet, defaultAccountAddress } = await t.setup({ ...AUTOMINE_E2E_OPTS })); + await t.setup(); + ({ logger, wallet, defaultAccountAddress } = t); }); afterAll(() => t.teardown()); diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts b/yarn-project/end-to-end/src/automine/contracts/deploy/private_initialization.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts rename to yarn-project/end-to-end/src/automine/contracts/deploy/private_initialization.parallel.test.ts index ee96b42f6194..023356c12593 100644 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/private_initialization.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/deploy/private_initialization.parallel.test.ts @@ -11,18 +11,16 @@ import { PrivateInitTestContract } from '@aztec/noir-test-contracts.js/PrivateIn import { siloNullifier } from '@aztec/stdlib/hash'; import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import type { TestWallet } from '../test-wallet/test_wallet.js'; -import { DeployTest } from './deploy_test.js'; +import type { TestWallet } from '../../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; type InitTestCtorArgs = Parameters; // Tests private contract initialization flows: noinitcheck functions, contracts without constructors, // single/batch initialization, ordering constraints between private init and public calls, and -// ContractInitializationStatus reporting. DeployTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, -// fundSponsoredFPC, skipAccountDeployment }) with 1 account. -describe('e2e_deploy_contract private initialization', () => { - const t = new DeployTest('private initialization'); +// ContractInitializationStatus reporting. Runs on a single account. +describe('automine/contracts/deploy/private_initialization', () => { + const t = new AutomineTestContext(); let logger: Logger; let wallet: TestWallet; @@ -30,7 +28,8 @@ describe('e2e_deploy_contract private initialization', () => { let aztecNode: AztecNode; beforeAll(async () => { - ({ logger, wallet, aztecNode, defaultAccountAddress } = await t.setup({ ...AUTOMINE_E2E_OPTS })); + await t.setup(); + ({ logger, wallet, aztecNode, defaultAccountAddress } = t); await publishContractClass(wallet, InitTestContract.artifact).then(c => c.send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_storage_proof/fixtures/storage_proof.json b/yarn-project/end-to-end/src/automine/contracts/fixtures/storage_proof.json similarity index 100% rename from yarn-project/end-to-end/src/e2e_storage_proof/fixtures/storage_proof.json rename to yarn-project/end-to-end/src/automine/contracts/fixtures/storage_proof.json diff --git a/yarn-project/end-to-end/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts b/yarn-project/end-to-end/src/automine/contracts/fixtures/storage_proof_fetcher.ts similarity index 100% rename from yarn-project/end-to-end/src/e2e_storage_proof/fixtures/storage_proof_fetcher.ts rename to yarn-project/end-to-end/src/automine/contracts/fixtures/storage_proof_fetcher.ts diff --git a/yarn-project/end-to-end/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts b/yarn-project/end-to-end/src/automine/contracts/fixtures/storage_proof_fixture.ts similarity index 100% rename from yarn-project/end-to-end/src/e2e_storage_proof/fixtures/storage_proof_fixture.ts rename to yarn-project/end-to-end/src/automine/contracts/fixtures/storage_proof_fixture.ts diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts b/yarn-project/end-to-end/src/automine/contracts/nested/importer.parallel.test.ts similarity index 78% rename from yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts rename to yarn-project/end-to-end/src/automine/contracts/nested/importer.parallel.test.ts index c59493f5f156..eabb2b861f4b 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/importer.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/nested/importer.parallel.test.ts @@ -1,20 +1,18 @@ import { ImportTestContract } from '@aztec/noir-test-contracts.js/ImportTest'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { NestedContractTest } from './nested_contract_test.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; // Tests cross-contract calls through the ImportTest contract (which imports functions from Test). -// NestedContractTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, fundSponsoredFPC, skipAccountDeployment }) -// with 1 public-deployed account. ImportTest and Test contracts are deployed fresh per test in beforeEach. -describe('e2e_nested_contract manual', () => { - const t = new NestedContractTest('manual'); +// Runs on a single account. ImportTest and Test contracts are deployed fresh per test in beforeEach. +describe('automine/contracts/nested/importer', () => { + const t = new AutomineTestContext(); let testContract: TestContract; let importerContract: ImportTestContract; let { wallet, logger, defaultAccountAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); ({ wallet, logger, defaultAccountAddress } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_call.test.ts b/yarn-project/end-to-end/src/automine/contracts/nested/manual_private_call.test.ts similarity index 56% rename from yarn-project/end-to-end/src/e2e_nested_contract/manual_private_call.test.ts rename to yarn-project/end-to-end/src/automine/contracts/nested/manual_private_call.test.ts index e16c60a91bb9..618d3819d261 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_call.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/nested/manual_private_call.test.ts @@ -1,16 +1,14 @@ -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { NestedContractTest } from './nested_contract_test.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; // Tests a nested private call from ParentContract into ChildContract's value() function. -// NestedContractTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, fundSponsoredFPC, skipAccountDeployment }) -// with 1 public-deployed account. applyManual() deploys Parent and Child contracts in beforeAll. -describe('e2e_nested_contract manual', () => { - const t = new NestedContractTest('manual'); +// Runs on a single account. applyManualParentChild() deploys Parent and Child contracts in beforeAll. +describe('automine/contracts/nested/manual_private_call', () => { + const t = new AutomineTestContext(); let { parentContract, childContract, defaultAccountAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); - await t.applyManual(); + await t.setup(); + await t.applyManualParentChild(); ({ parentContract, childContract, defaultAccountAddress } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts b/yarn-project/end-to-end/src/automine/contracts/nested/manual_private_enqueue.parallel.test.ts similarity index 85% rename from yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts rename to yarn-project/end-to-end/src/automine/contracts/nested/manual_private_enqueue.parallel.test.ts index 1e7d8d6714ed..c243fc5ec51b 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/manual_private_enqueue.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/nested/manual_private_enqueue.parallel.test.ts @@ -3,14 +3,12 @@ import { Fr } from '@aztec/aztec.js/fields'; import { ChildContract } from '@aztec/noir-test-contracts.js/Child'; import { ParentContract } from '@aztec/noir-test-contracts.js/Parent'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { NestedContractTest } from './nested_contract_test.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; // Tests parent contracts enqueuing public calls on a child contract via various call patterns. -// NestedContractTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, fundSponsoredFPC, skipAccountDeployment }) -// with 1 public-deployed account. Parent and Child are deployed fresh per test in beforeEach. -describe('e2e_nested_contract manual_enqueue', () => { - const t = new NestedContractTest('manual_enqueue'); +// Runs on a single account. Parent and Child are deployed fresh per test in beforeEach. +describe('automine/contracts/nested/manual_private_enqueue', () => { + const t = new AutomineTestContext(); let { wallet, parentContract, childContract, defaultAccountAddress, aztecNode } = t; const getChildStoredValue = (child: { address: AztecAddress }) => @@ -18,7 +16,7 @@ describe('e2e_nested_contract manual_enqueue', () => { beforeAll(async () => { // We don't deploy contracts in beforeAll because every test requires a fresh setup - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); ({ wallet, defaultAccountAddress, aztecNode } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/manual_public.test.ts b/yarn-project/end-to-end/src/automine/contracts/nested/manual_public.parallel.test.ts similarity index 85% rename from yarn-project/end-to-end/src/e2e_nested_contract/manual_public.test.ts rename to yarn-project/end-to-end/src/automine/contracts/nested/manual_public.parallel.test.ts index 49e0714e01d4..bb163922df50 100644 --- a/yarn-project/end-to-end/src/e2e_nested_contract/manual_public.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/nested/manual_public.parallel.test.ts @@ -4,22 +4,20 @@ import { Fr } from '@aztec/aztec.js/fields'; import { toBigIntBE } from '@aztec/foundation/bigint-buffer'; import { serializeToBuffer } from '@aztec/foundation/serialize'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { NestedContractTest } from './nested_contract_test.js'; +import { AutomineTestContext } from '../../automine_test_context.js'; // Tests public-to-public nested calls and ordering guarantees (public before private enqueue). -// NestedContractTest wraps setup(0, { ...AUTOMINE_E2E_OPTS, fundSponsoredFPC, skipAccountDeployment }) -// with 1 public-deployed account. applyManual() deploys Parent and Child contracts in beforeAll. -describe('e2e_nested_contract manual', () => { - const t = new NestedContractTest('manual'); +// Runs on a single account. applyManualParentChild() deploys Parent and Child contracts in beforeAll. +describe('automine/contracts/nested/manual_public', () => { + const t = new AutomineTestContext(); let { wallet, parentContract, childContract, defaultAccountAddress, aztecNode } = t; const getChildStoredValue = (child: { address: AztecAddress }) => aztecNode.getPublicStorageAt('latest', child.address, new Fr(1)); beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); - await t.applyManual(); + await t.setup(); + await t.applyManualParentChild(); ({ wallet, parentContract, childContract, defaultAccountAddress, aztecNode } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_storage_proof/e2e_storage_proof.test.ts b/yarn-project/end-to-end/src/automine/contracts/storage_proof.test.ts similarity index 63% rename from yarn-project/end-to-end/src/e2e_storage_proof/e2e_storage_proof.test.ts rename to yarn-project/end-to-end/src/automine/contracts/storage_proof.test.ts index 399f5cee329b..70e20a283add 100644 --- a/yarn-project/end-to-end/src/e2e_storage_proof/e2e_storage_proof.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/storage_proof.test.ts @@ -2,26 +2,25 @@ import { StorageProofTestContract } from '@aztec/noir-test-contracts.js/StorageP import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { type EndToEndContext, setup, teardown } from '../fixtures/setup.js'; +import { AutomineTestContext } from '../automine_test_context.js'; import { buildStorageProofCapsules, loadStorageProofArgs } from './fixtures/storage_proof_fixture.js'; jest.setTimeout(300_000); // Tests that a Noir contract can verify an Ethereum storage proof (MPT proof) via oracle capsules. -// Plain setup(1, { ...AUTOMINE_E2E_OPTS }) with 1 account. Deploys StorageProofTestContract, then -// loads pre-computed proof args from fixtures/storage_proof.json and verifies on-chain. -describe('Storage proof', () => { - let ctx: EndToEndContext; +// Deploys StorageProofTestContract, then loads pre-computed proof args from fixtures/storage_proof.json +// and verifies on-chain. +describe('automine/contracts/storage_proof', () => { + const t = new AutomineTestContext(); let contract: StorageProofTestContract; beforeAll(async () => { - ctx = await setup(1, { ...AUTOMINE_E2E_OPTS }); - ({ contract } = await StorageProofTestContract.deploy(ctx.wallet).send({ from: ctx.accounts[0] })); + await t.setup({ numberOfAccounts: 1 }); + ({ contract } = await StorageProofTestContract.deploy(t.wallet).send({ from: t.defaultAccountAddress })); }); afterAll(async () => { - await teardown(ctx); + await t.teardown(); }); // Loads pre-computed ethAddress/slotKey/slotContents/root from storage_proof.json, builds oracle @@ -31,12 +30,12 @@ describe('Storage proof', () => { const { ethAddress, slotKey, slotContents, root } = loadStorageProofArgs(); const capsules = await buildStorageProofCapsules(contract.address); - ctx.logger.info('Sending storage proof TX...'); + t.logger.info('Sending storage proof TX...'); const { receipt } = await contract.methods .storage_proof(ethAddress, slotKey, slotContents, root) .with({ capsules }) - .send({ from: ctx.accounts[0] }); + .send({ from: t.defaultAccountAddress }); expect(receipt.hasExecutionSucceeded()).toBe(true); }); diff --git a/yarn-project/end-to-end/src/bench/client_flows/storage_proof.test.ts b/yarn-project/end-to-end/src/bench/client_flows/storage_proof.test.ts index 7dff13c7454c..f8530977e0be 100644 --- a/yarn-project/end-to-end/src/bench/client_flows/storage_proof.test.ts +++ b/yarn-project/end-to-end/src/bench/client_flows/storage_proof.test.ts @@ -10,7 +10,7 @@ import { jest } from '@jest/globals'; import { buildStorageProofCapsules, loadStorageProofArgs, -} from '../../e2e_storage_proof/fixtures/storage_proof_fixture.js'; +} from '../../automine/contracts/fixtures/storage_proof_fixture.js'; import type { TestWallet } from '../../test-wallet/test_wallet.js'; import { captureProfile, expectedExecutionSteps } from './benchmark.js'; import { type AccountType, type BenchmarkingFeePaymentMethod, ClientFlowsBenchmark } from './client_flows_benchmark.js'; diff --git a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts b/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts deleted file mode 100644 index abf70734c12d..000000000000 --- a/yarn-project/end-to-end/src/e2e_deploy_contract/deploy_test.ts +++ /dev/null @@ -1,73 +0,0 @@ -import type { ContractArtifact } from '@aztec/aztec.js/abi'; -import type { AztecAddress } from '@aztec/aztec.js/addresses'; -import { type ContractBase, getContractInstanceFromInstantiationParams } from '@aztec/aztec.js/contracts'; -import { Fr } from '@aztec/aztec.js/fields'; -import type { PublicKeys } from '@aztec/aztec.js/keys'; -import { type Logger, createLogger } from '@aztec/aztec.js/log'; -import type { AztecNode } from '@aztec/aztec.js/node'; -import type { Wallet } from '@aztec/aztec.js/wallet'; -import type { StatefulTestContract } from '@aztec/noir-test-contracts.js/StatefulTest'; -import type { AztecNodeAdmin } from '@aztec/stdlib/interfaces/client'; - -import { type EndToEndContext, type SetupOptions, setup, teardown } from '../fixtures/setup.js'; -import type { TestWallet } from '../test-wallet/test_wallet.js'; - -export class DeployTest { - public context!: EndToEndContext; - public logger: Logger; - public wallet!: TestWallet; - public defaultAccountAddress!: AztecAddress; - public aztecNode!: AztecNode; - public aztecNodeAdmin!: AztecNodeAdmin; - - constructor(testName: string) { - this.logger = createLogger(`e2e:e2e_deploy_contract:${testName}`); - } - - async setup(opts: Partial = {}) { - this.logger.info('Setting up test environment'); - this.context = await setup(1, { - ...opts, - fundSponsoredFPC: true, - }); - this.aztecNode = this.context.aztecNodeService; - this.wallet = this.context.wallet; - this.aztecNodeAdmin = this.context.aztecNodeService; - this.defaultAccountAddress = this.context.accounts[0]; - return this; - } - - async teardown() { - await teardown(this.context); - } - - async registerContract( - wallet: Wallet, - contractArtifact: ContractArtifactClass, - opts: { - salt?: Fr; - publicKeys?: PublicKeys; - initArgs?: any[]; - constructorName?: string; - deployer?: AztecAddress; - } = {}, - ): Promise { - const { salt, publicKeys, initArgs, constructorName, deployer } = opts; - const instance = await getContractInstanceFromInstantiationParams(contractArtifact.artifact, { - constructorArgs: initArgs ?? [], - constructorArtifact: constructorName, - salt: salt ?? Fr.random(), - publicKeys, - deployer, - }); - await wallet.registerContract(instance, contractArtifact.artifact); - return contractArtifact.at(instance.address, wallet); - } -} - -export type StatefulContractCtorArgs = Parameters; - -export type ContractArtifactClass = { - at(address: AztecAddress, wallet: Wallet): T; - artifact: ContractArtifact; -}; diff --git a/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts b/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts deleted file mode 100644 index fb586da297fe..000000000000 --- a/yarn-project/end-to-end/src/e2e_nested_contract/nested_contract_test.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { AztecAddress } from '@aztec/aztec.js/addresses'; -import { type Logger, createLogger } from '@aztec/aztec.js/log'; -import type { AztecNode } from '@aztec/aztec.js/node'; -import type { Wallet } from '@aztec/aztec.js/wallet'; -import { ChildContract } from '@aztec/noir-test-contracts.js/Child'; -import { ParentContract } from '@aztec/noir-test-contracts.js/Parent'; - -import { type EndToEndContext, type SetupOptions, setup, teardown as teardownSubsystems } from '../fixtures/setup.js'; - -export class NestedContractTest { - context!: EndToEndContext; - logger: Logger; - wallet!: Wallet; - defaultAccountAddress!: AztecAddress; - aztecNode!: AztecNode; - - parentContract!: ParentContract; - childContract!: ChildContract; - - constructor( - testName: string, - private numberOfAccounts = 1, - ) { - this.logger = createLogger(`e2e:e2e_nested_contract:${testName}`); - } - - async setup(opts: Partial = {}) { - this.logger.info('Setting up fresh subsystems'); - this.context = await setup(this.numberOfAccounts, { - ...opts, - fundSponsoredFPC: true, - }); - this.wallet = this.context.wallet; - this.defaultAccountAddress = this.context.accounts[0]; - this.aztecNode = this.context.aztecNodeService; - } - - async teardown() { - await teardownSubsystems(this.context); - } - - async applyManual() { - this.logger.info('Deploying parent and child contracts'); - ({ contract: this.parentContract } = await ParentContract.deploy(this.wallet).send({ - from: this.defaultAccountAddress, - })); - ({ contract: this.childContract } = await ChildContract.deploy(this.wallet).send({ - from: this.defaultAccountAddress, - })); - } -} diff --git a/yarn-project/protocol-contracts/src/tests/fixtures.ts b/yarn-project/protocol-contracts/src/tests/fixtures.ts index d71fc48ac162..670d3e76924f 100644 --- a/yarn-project/protocol-contracts/src/tests/fixtures.ts +++ b/yarn-project/protocol-contracts/src/tests/fixtures.ts @@ -2,13 +2,13 @@ import { readFileSync } from 'fs'; import { dirname, resolve } from 'path'; import { fileURLToPath } from 'url'; -// Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1 +// Generated from end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1 export function getSampleContractClassPublishedEventPayload(): Buffer { const path = getPathToFixture('ContractClassPublishedEventData.hex'); return Buffer.from(readFileSync(path).toString(), 'hex'); } -// Generated from end-to-end/src/e2e_deploy_contract/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1 +// Generated from end-to-end/src/automine/contracts/deploy/contract_class_registration.test.ts with AZTEC_GENERATE_TEST_DATA=1 export function getSampleContractInstancePublishedEventPayload(): Buffer { const path = getPathToFixture('ContractInstancePublishedEventData.hex'); return Buffer.from(readFileSync(path).toString(), 'hex'); diff --git a/yarn-project/update-snapshots.sh b/yarn-project/update-snapshots.sh index eb275769d2df..2acf915105a7 100755 --- a/yarn-project/update-snapshots.sh +++ b/yarn-project/update-snapshots.sh @@ -7,7 +7,7 @@ yarn build:fast export AZTEC_GENERATE_TEST_DATA=1 yarn workspace @aztec/end-to-end test integration_l1_publisher.test.ts -yarn workspace @aztec/end-to-end test e2e_nested_contract -t 'performs nested calls' +yarn workspace @aztec/end-to-end test automine/contracts/nested -t 'performs nested calls' # this test takes considerable resources to run since it fully proves blocks # only enable if needed From 13e5456a6a982187391a6f18422e86506dfd847e Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 17:30:01 -0300 Subject: [PATCH 3/7] refactor(e2e): convert token + blacklist tests to automine harnesses Make TokenContractTest and BlacklistTokenContractTest extend AutomineTestContext: they keep their TokenSimulator, opt-in base/mint snapshots, and the Role helper, and run their domain setup after super.setup(). crossTimestampOfChange now delegates to the base markProvenAndWarp, and the harness loggers move to the e2e:automine:token / e2e:automine:blacklist namespaces. Move the 17 token/blacklist test files plus the two harnesses under automine/token/ (blacklist files gain a blacklist_ prefix to avoid collisions), switching each from setup({ ...AUTOMINE_E2E_OPTS }) to the base default and naming each describe after its path. Files with more than one top-level it gain the .parallel suffix. Adds the automine/token glob to both bootstrap.sh arrays, repoints the access_control flake entry, and updates the e2e_persistence harness import. --- .test_patterns.yml | 2 +- yarn-project/end-to-end/bootstrap.sh | 2 + .../token/access_control.parallel.test.ts} | 5 +- ...blacklist_access_control.parallel.test.ts} | 5 +- .../token/blacklist_burn.test.ts} | 9 ++- .../token/blacklist_minting.test.ts} | 7 +-- .../blacklist_shielding.parallel.test.ts} | 7 +-- .../token}/blacklist_token_contract_test.ts | 58 ++++++------------- ...acklist_transfer_private.parallel.test.ts} | 8 +-- ...lacklist_transfer_public.parallel.test.ts} | 7 +-- .../blacklist_unshielding.parallel.test.ts} | 8 +-- .../token}/burn.test.ts | 8 +-- .../token}/minting.test.ts | 6 +- ...ivate_transfer_recursion.parallel.test.ts} | 7 +-- .../token/reading_constants.parallel.test.ts} | 5 +- .../token}/token_contract_test.ts | 45 ++++++-------- .../token/transfer.parallel.test.ts} | 5 +- .../token}/transfer_in_private.test.ts | 8 +-- .../transfer_in_public.parallel.test.ts} | 8 +-- .../transfer_to_private.parallel.test.ts} | 6 +- .../transfer_to_public.parallel.test.ts} | 8 +-- .../src/composed/e2e_persistence.test.ts | 2 +- 22 files changed, 96 insertions(+), 130 deletions(-) rename yarn-project/end-to-end/src/{e2e_token_contract/access_control.test.ts => automine/token/access_control.parallel.test.ts} (93%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/access_control.test.ts => automine/token/blacklist_access_control.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/burn.test.ts => automine/token/blacklist_burn.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/minting.test.ts => automine/token/blacklist_minting.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/shielding.test.ts => automine/token/blacklist_shielding.parallel.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract => automine/token}/blacklist_token_contract_test.ts (79%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/transfer_private.test.ts => automine/token/blacklist_transfer_private.parallel.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/transfer_public.test.ts => automine/token/blacklist_transfer_public.parallel.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_blacklist_token_contract/unshielding.test.ts => automine/token/blacklist_unshielding.parallel.test.ts} (96%) rename yarn-project/end-to-end/src/{e2e_token_contract => automine/token}/burn.test.ts (98%) rename yarn-project/end-to-end/src/{e2e_token_contract => automine/token}/minting.test.ts (96%) rename yarn-project/end-to-end/src/{e2e_token_contract/private_transfer_recursion.test.ts => automine/token/private_transfer_recursion.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_token_contract/reading_constants.test.ts => automine/token/reading_constants.parallel.test.ts} (94%) rename yarn-project/end-to-end/src/{e2e_token_contract => automine/token}/token_contract_test.ts (81%) rename yarn-project/end-to-end/src/{e2e_token_contract/transfer.test.ts => automine/token/transfer.parallel.test.ts} (96%) rename yarn-project/end-to-end/src/{e2e_token_contract => automine/token}/transfer_in_private.test.ts (97%) rename yarn-project/end-to-end/src/{e2e_token_contract/transfer_in_public.test.ts => automine/token/transfer_in_public.parallel.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_token_contract/transfer_to_private.test.ts => automine/token/transfer_to_private.parallel.test.ts} (93%) rename yarn-project/end-to-end/src/{e2e_token_contract/transfer_to_public.test.ts => automine/token/transfer_to_public.parallel.test.ts} (96%) diff --git a/.test_patterns.yml b/.test_patterns.yml index 0f7a04594657..6ae2f6f54850 100644 --- a/.test_patterns.yml +++ b/.test_patterns.yml @@ -111,7 +111,7 @@ tests: - regex: "src/single-node/fees/private_payments" owners: - *phil - - regex: "src/e2e_token_contract/access_control" + - regex: "src/automine/token/access_control" error_regex: "HttpRequestError: HTTP request failed." owners: - *charlie diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index 102e5c2f1509..a56e5dbb5757 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -40,6 +40,7 @@ function test_cmds { src/automine/contracts/*.test.ts src/automine/contracts/deploy/*.test.ts src/automine/contracts/nested/*.test.ts + src/automine/token/*.test.ts src/single-node/block-building/*.test.ts src/single-node/proving/*.test.ts src/single-node/l1-reorgs/*.test.ts @@ -302,6 +303,7 @@ function compat_test_cmds { src/automine/contracts/*.test.ts src/automine/contracts/deploy/*.test.ts src/automine/contracts/nested/*.test.ts + src/automine/token/*.test.ts src/single-node/fees/*.test.ts src/single-node/cross-chain/*.test.ts src/single-node/bot/*.test.ts diff --git a/yarn-project/end-to-end/src/e2e_token_contract/access_control.test.ts b/yarn-project/end-to-end/src/automine/token/access_control.parallel.test.ts similarity index 93% rename from yarn-project/end-to-end/src/e2e_token_contract/access_control.test.ts rename to yarn-project/end-to-end/src/automine/token/access_control.parallel.test.ts index 0c4553a044b7..d2c6a51c5269 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/access_control.test.ts +++ b/yarn-project/end-to-end/src/automine/token/access_control.parallel.test.ts @@ -1,15 +1,14 @@ -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers admin and minter role management on the Token contract: set_admin, set_minter, and failure cases // when called by a non-admin. Setup: single node with AutomineSequencer (AUTOMINE_E2E_OPTS), 3 accounts // deployed, Token contract deployed. No time-warp needed (Token has no role-change delay). -describe('e2e_token_contract access control', () => { +describe('automine/token/access_control', () => { const t = new TokenContractTest('access_control'); beforeAll(async () => { t.applyBaseSnapshots(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); }); afterAll(async () => { diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_access_control.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_access_control.parallel.test.ts index 8b2b11243474..5d2dca2197e1 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/access_control.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_access_control.parallel.test.ts @@ -1,17 +1,16 @@ import { AztecAddress } from '@aztec/aztec.js/addresses'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; import { BlacklistTokenContractTest, Role } from './blacklist_token_contract_test.js'; // Covers role management (admin grant/revoke, minter assignment, blacklisting) on the TokenBlacklist contract. // Setup: single node with AutomineSequencer (AUTOMINE_E2E_OPTS), 3 deployed accounts (admin/other/blacklisted), // TokenBlacklist contract deployed. Role changes require crossing a 86400s L2 time delay enforced by the // contract; crossTimestampOfChange() handles this via markAsProven + warpL2TimeAtLeastBy. -describe('e2e_blacklist_token_contract access control', () => { +describe('automine/token/blacklist_access_control', () => { const t = new BlacklistTokenContractTest('access_control'); beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); }); afterAll(async () => { diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_burn.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_burn.test.ts index aac62974e3a9..4ca9b5a0a314 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/burn.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_burn.test.ts @@ -1,21 +1,20 @@ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization'; import { Fr } from '@aztec/aztec.js/fields'; -import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { DUPLICATE_NULLIFIER_ERROR, U128_UNDERFLOW_ERROR } from '../fixtures/index.js'; +import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR, U128_UNDERFLOW_ERROR } from '../../fixtures/index.js'; import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js'; // Covers public and private burn operations on TokenBlacklist, including authwit-delegated burns and // blacklist enforcement. Setup: single node with AutomineSequencer, 3 accounts, TokenBlacklist deployed, // initial mint applied (admin has both public and private balances). Time-warp required to cross // role-change delay (86400s) during setup. -describe('e2e_blacklist_token_contract burn', () => { +describe('automine/token/blacklist_burn', () => { const t = new BlacklistTokenContractTest('burn'); let { asset, tokenSim, wallet, adminAddress, otherAddress, blacklistedAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Beware that we are adding the wallet as minter here, which is very slow because it needs multiple blocks. await t.applyMint(); // Have to destructure again to ensure we have latest refs. diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_minting.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_minting.test.ts index ab1ed42868c6..c606a908799d 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/minting.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_minting.test.ts @@ -2,19 +2,18 @@ import { computeSecretHash } from '@aztec/aztec.js/crypto'; import { Fr } from '@aztec/aztec.js/fields'; import type { TxHash } from '@aztec/aztec.js/tx'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { U128_OVERFLOW_ERROR } from '../fixtures/index.js'; +import { U128_OVERFLOW_ERROR } from '../../fixtures/index.js'; import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js'; // Covers public and private minting on TokenBlacklist, including minter role enforcement and blacklist // restrictions on recipients. Setup: single node with AutomineSequencer, 3 accounts, TokenBlacklist // deployed with initial balances (applyMint). Role-change delay requires time-warp during setup. -describe('e2e_blacklist_token_contract mint', () => { +describe('automine/token/blacklist_minting', () => { const t = new BlacklistTokenContractTest('mint'); let { asset, tokenSim, adminAddress, otherAddress, blacklistedAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Beware that we are adding the admin as minter here, which is very slow because it needs multiple blocks. await t.applyMint(); // Have to destructure again to ensure we have latest refs. diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_shielding.parallel.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_shielding.parallel.test.ts index b4b3f84917e0..be9bda564c61 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/shielding.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_shielding.parallel.test.ts @@ -1,19 +1,18 @@ import { computeSecretHash } from '@aztec/aztec.js/crypto'; import { Fr } from '@aztec/aztec.js/fields'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { U128_UNDERFLOW_ERROR } from '../fixtures/index.js'; +import { U128_UNDERFLOW_ERROR } from '../../fixtures/index.js'; import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js'; // Covers the shield (public→private) and redeem_shield operations on TokenBlacklist, including // authwit-delegated shielding and blacklist enforcement. Setup: single node with AutomineSequencer, // 3 accounts, initial mint applied. Time-warp required during setup to cross role-change delay. -describe('e2e_blacklist_token_contract shield + redeem_shield', () => { +describe('automine/token/blacklist_shielding', () => { const t = new BlacklistTokenContractTest('shield'); let { asset, tokenSim, wallet, adminAddress, otherAddress, blacklistedAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); await t.applyMint(); // Beware that we are adding the admin as minter here // Have to destructure again to ensure we have latest refs. ({ asset, tokenSim, wallet, adminAddress, otherAddress, blacklistedAddress } = t); diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_token_contract_test.ts similarity index 79% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_token_contract_test.ts index 1639de4c38d3..79ec8a8f2f6a 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/blacklist_token_contract_test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_token_contract_test.ts @@ -1,28 +1,18 @@ import { AztecAddress } from '@aztec/aztec.js/addresses'; import { computeSecretHash } from '@aztec/aztec.js/crypto'; import { Fr } from '@aztec/aztec.js/fields'; -import { type Logger, createLogger } from '@aztec/aztec.js/log'; -import type { AztecNode } from '@aztec/aztec.js/node'; +import { createLogger } from '@aztec/aztec.js/log'; import type { TxHash } from '@aztec/aztec.js/tx'; -import type { CheatCodes } from '@aztec/aztec/testing'; import type { TokenContract } from '@aztec/noir-contracts.js/Token'; import { TokenBlacklistContract } from '@aztec/noir-contracts.js/TokenBlacklist'; import { GenericProxyContract } from '@aztec/noir-test-contracts.js/GenericProxy'; import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAccount'; -import type { SequencerClient } from '@aztec/sequencer-client'; -import type { AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; import { jest } from '@jest/globals'; -import { - type EndToEndContext, - type SetupOptions, - ensureAuthRegistryPublished, - setup, - teardown, -} from '../fixtures/setup.js'; -import { TokenSimulator } from '../simulators/token_simulator.js'; -import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { ensureAuthRegistryPublished } from '../../fixtures/setup.js'; +import { TokenSimulator } from '../../simulators/token_simulator.js'; +import { AutomineTestContext, type AutomineTestOpts } from '../automine_test_context.js'; export class Role { private isAdmin = false; @@ -51,37 +41,33 @@ export class Role { } } -export class BlacklistTokenContractTest { +/** + * TokenBlacklist-domain harness over the automine topology: extends {@link AutomineTestContext} with a + * {@link TokenSimulator}, the {@link Role} helper, the TokenBlacklist deploy plus a bad-account and + * authwit proxy, and the role-change-delay warp. Base setup and mint run in {@link setup}. + */ +export class BlacklistTokenContractTest extends AutomineTestContext { // This value MUST match the same value that we have in the contract static CHANGE_ROLES_DELAY = 86400; - context!: EndToEndContext; - logger: Logger; - wallet!: TestWallet; asset!: TokenBlacklistContract; tokenSim!: TokenSimulator; badAccount!: InvalidAccountContract; authwitProxy!: GenericProxyContract; - cheatCodes!: CheatCodes; - sequencer!: SequencerClient; - aztecNode!: AztecNode & AztecNodeDebug; adminAddress!: AztecAddress; otherAddress!: AztecAddress; blacklistedAddress!: AztecAddress; + private testName: string; + constructor(testName: string) { - this.logger = createLogger(`e2e:e2e_blacklist_token_contract:${testName}`); + super(); + this.testName = testName; } async crossTimestampOfChange() { - // Under AUTOMINE_E2E_OPTS, the 86400s warp crosses many epochs without any proofs being - // submitted. Mark current pending checkpoints as proven first so the rollup contract's - // pruning window doesn't reset the chain tip to genesis (which would make the warp's - // own empty-checkpoint propose fail with Rollup__InvalidArchive). See the AutomineSequencer - // README "Epoch proving caveat" and the equivalent pattern in lending_simulator.progressSlots. - await this.cheatCodes.rollup.markAsProven(); - await this.cheatCodes.warpL2TimeAtLeastBy(this.aztecNode, BlacklistTokenContractTest.CHANGE_ROLES_DELAY); + await this.markProvenAndWarp(BlacklistTokenContractTest.CHANGE_ROLES_DELAY); } /** @@ -139,19 +125,13 @@ export class BlacklistTokenContractTest { ).toEqual(new Role().withAdmin().toNoirStruct()); } - async setup(opts: Partial = {}) { - this.logger.info('Setting up fresh context'); - this.context = await setup(3, { - ...opts, - fundSponsoredFPC: true, - }); + override async setup(opts: AutomineTestOpts = {}) { + await super.setup({ numberOfAccounts: 3, ...opts }); + // hydrateFromContext repoints `this.logger` at the context logger; restore the harness-named one. + this.logger = createLogger(`e2e:automine:blacklist:${this.testName}`); await this.applyBaseSetup(); } - async teardown() { - await teardown(this.context); - } - async addPendingShieldNoteToPXE( contract: TokenBlacklistContract, recipient: AztecAddress, diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_transfer_private.parallel.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_transfer_private.parallel.test.ts index 1231e8c2df2f..38b70529cdc8 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_private.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_transfer_private.parallel.test.ts @@ -1,19 +1,19 @@ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization'; import { Fr } from '@aztec/aztec.js/fields'; -import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR } from '../fixtures/fixtures.js'; +import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR } from '../../fixtures/fixtures.js'; import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js'; // Covers private token transfers on TokenBlacklist: direct, self-transfer, authwit-delegated, and // blacklist enforcement. Setup: single node with AutomineSequencer, 3 accounts, initial mint applied. // Time-warp required during setup to cross role-change delay. -describe('e2e_blacklist_token_contract transfer private', () => { +describe('automine/token/blacklist_transfer_private', () => { const t = new BlacklistTokenContractTest('transfer_private'); let { asset, tokenSim, wallet, adminAddress, otherAddress, blacklistedAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Beware that we are adding the admin as minter here, which is very slow because it needs multiple blocks. await t.applyMint(); // Have to destructure again to ensure we have latest refs. diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_transfer_public.parallel.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_transfer_public.parallel.test.ts index 65577ab71af5..3717a08239dd 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/transfer_public.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_transfer_public.parallel.test.ts @@ -1,18 +1,17 @@ import { Fr } from '@aztec/aztec.js/fields'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { U128_UNDERFLOW_ERROR } from '../fixtures/index.js'; +import { U128_UNDERFLOW_ERROR } from '../../fixtures/index.js'; import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js'; // Covers public token transfers on TokenBlacklist: direct, self, authwit-delegated, and blacklist // enforcement. Setup: single node with AutomineSequencer, 3 accounts, initial mint applied. // Time-warp required during setup to cross role-change delay. -describe('e2e_blacklist_token_contract transfer public', () => { +describe('automine/token/blacklist_transfer_public', () => { const t = new BlacklistTokenContractTest('transfer_public'); let { asset, tokenSim, wallet, adminAddress, otherAddress, blacklistedAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Beware that we are adding the admin as minter here, which is very slow because it needs multiple blocks. await t.applyMint(); // Have to destructure again to ensure we have latest refs. diff --git a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts b/yarn-project/end-to-end/src/automine/token/blacklist_unshielding.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts rename to yarn-project/end-to-end/src/automine/token/blacklist_unshielding.parallel.test.ts index 2feca0c06cc9..f1355426843e 100644 --- a/yarn-project/end-to-end/src/e2e_blacklist_token_contract/unshielding.test.ts +++ b/yarn-project/end-to-end/src/automine/token/blacklist_unshielding.parallel.test.ts @@ -1,19 +1,19 @@ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization'; import { Fr } from '@aztec/aztec.js/fields'; -import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR } from '../fixtures/fixtures.js'; +import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR } from '../../fixtures/fixtures.js'; import { BlacklistTokenContractTest } from './blacklist_token_contract_test.js'; // Covers the unshield (private→public) operation on TokenBlacklist, including authwit-delegated unshielding // and blacklist enforcement on sender and recipient. Setup: single node with AutomineSequencer, 3 accounts, // initial mint applied. Time-warp required during setup to cross role-change delay. -describe('e2e_blacklist_token_contract unshielding', () => { +describe('automine/token/blacklist_unshielding', () => { const t = new BlacklistTokenContractTest('unshielding'); let { asset, tokenSim, wallet, adminAddress, otherAddress, blacklistedAddress } = t; beforeAll(async () => { - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Beware that we are adding the admin as minter here, which is very slow because it needs multiple blocks. await t.applyMint(); // Have to destructure again to ensure we have latest refs. diff --git a/yarn-project/end-to-end/src/e2e_token_contract/burn.test.ts b/yarn-project/end-to-end/src/automine/token/burn.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_token_contract/burn.test.ts rename to yarn-project/end-to-end/src/automine/token/burn.test.ts index 0540453ab413..b317cb9b41e0 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/burn.test.ts +++ b/yarn-project/end-to-end/src/automine/token/burn.test.ts @@ -1,20 +1,20 @@ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization'; import { Fr } from '@aztec/aztec.js/fields'; -import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR, U128_UNDERFLOW_ERROR } from '../fixtures/index.js'; +import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR, U128_UNDERFLOW_ERROR } from '../../fixtures/index.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers public and private burn on Token contract: direct, authwit-delegated via proxy, and error paths. // Setup: single node with AutomineSequencer, 3 accounts, Token deployed with initial public and private mint. -describe('e2e_token_contract burn', () => { +describe('automine/token/burn', () => { const t = new TokenContractTest('burn'); let { asset, tokenSim, wallet, adminAddress, account1Address } = t; beforeAll(async () => { t.applyBaseSnapshots(); t.applyMintSnapshot(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Have to destructure again to ensure we have latest refs. ({ asset, wallet, adminAddress, tokenSim, adminAddress, account1Address } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/minting.test.ts b/yarn-project/end-to-end/src/automine/token/minting.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_token_contract/minting.test.ts rename to yarn-project/end-to-end/src/automine/token/minting.test.ts index 43449b6a1abd..7e128d6bd899 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/minting.test.ts +++ b/yarn-project/end-to-end/src/automine/token/minting.test.ts @@ -1,15 +1,15 @@ -import { AUTOMINE_E2E_OPTS, U128_OVERFLOW_ERROR } from '../fixtures/fixtures.js'; +import { U128_OVERFLOW_ERROR } from '../../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers public and private minting on Token contract, including minter role enforcement and overflow checks. // Setup: single node with AutomineSequencer, 3 accounts deployed, Token contract deployed (no initial mint). -describe('e2e_token_contract minting', () => { +describe('automine/token/minting', () => { const t = new TokenContractTest('minting'); let { asset, tokenSim, adminAddress, account1Address } = t; beforeAll(async () => { t.applyBaseSnapshots(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); ({ asset, tokenSim, adminAddress, account1Address } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts b/yarn-project/end-to-end/src/automine/token/private_transfer_recursion.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts rename to yarn-project/end-to-end/src/automine/token/private_transfer_recursion.parallel.test.ts index 5143ea0f93e3..53123d182b7f 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/private_transfer_recursion.test.ts +++ b/yarn-project/end-to-end/src/automine/token/private_transfer_recursion.parallel.test.ts @@ -1,20 +1,19 @@ import { BlockNumber } from '@aztec/foundation/branded-types'; import { TokenContract, type Transfer } from '@aztec/noir-contracts.js/Token'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; -import { mintNotes } from '../fixtures/token_utils.js'; +import { mintNotes } from '../../fixtures/token_utils.js'; import { TokenContractTest } from './token_contract_test.js'; // Verifies that the Token contract's private transfer function correctly handles note consolidation across // recursive calls (consuming many notes via two levels of recursion). Also checks that private Transfer // events are emitted and readable. Setup: single node with AutomineSequencer, 3 accounts, Token deployed. -describe('e2e_token_contract private transfer recursion', () => { +describe('automine/token/private_transfer_recursion', () => { const t = new TokenContractTest('odd_transfer_private'); let { asset, wallet, adminAddress, account1Address, node } = t; beforeAll(async () => { t.applyBaseSnapshots(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); ({ asset, wallet, adminAddress, account1Address, node } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/reading_constants.test.ts b/yarn-project/end-to-end/src/automine/token/reading_constants.parallel.test.ts similarity index 94% rename from yarn-project/end-to-end/src/e2e_token_contract/reading_constants.test.ts rename to yarn-project/end-to-end/src/automine/token/reading_constants.parallel.test.ts index a74a28ca8d40..48cedf500158 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/reading_constants.test.ts +++ b/yarn-project/end-to-end/src/automine/token/reading_constants.parallel.test.ts @@ -1,18 +1,17 @@ import { readFieldCompressedString } from '@aztec/aztec.js/utils'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Verifies that Token contract constants (name, symbol, decimals) are readable from both private and public // entry points and match the values supplied at deploy time. Setup: single node with AutomineSequencer, // Token contract deployed with TOKEN_NAME/SYMBOL/DECIMALS. -describe('e2e_token_contract reading constants', () => { +describe('automine/token/reading_constants', () => { const t = new TokenContractTest('reading_constants'); const { TOKEN_DECIMALS, TOKEN_NAME, TOKEN_SYMBOL } = TokenContractTest; beforeAll(async () => { t.applyBaseSnapshots(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); }); afterAll(async () => { diff --git a/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts b/yarn-project/end-to-end/src/automine/token/token_contract_test.ts similarity index 81% rename from yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts rename to yarn-project/end-to-end/src/automine/token/token_contract_test.ts index 7fe1047e2cff..dcd4043b3d31 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/token_contract_test.ts +++ b/yarn-project/end-to-end/src/automine/token/token_contract_test.ts @@ -1,5 +1,5 @@ import { AztecAddress } from '@aztec/aztec.js/addresses'; -import { type Logger, createLogger } from '@aztec/aztec.js/log'; +import { createLogger } from '@aztec/aztec.js/log'; import type { AztecNode } from '@aztec/aztec.js/node'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { GenericProxyContract } from '@aztec/noir-test-contracts.js/GenericProxy'; @@ -7,25 +7,23 @@ import { InvalidAccountContract } from '@aztec/noir-test-contracts.js/InvalidAcc import { jest } from '@jest/globals'; -import { - type EndToEndContext, - type SetupOptions, - ensureAuthRegistryPublished, - setup, - teardown, -} from '../fixtures/setup.js'; -import { mintTokensToPrivate } from '../fixtures/token_utils.js'; -import { TokenSimulator } from '../simulators/token_simulator.js'; -import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { ensureAuthRegistryPublished } from '../../fixtures/setup.js'; +import { mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import { TokenSimulator } from '../../simulators/token_simulator.js'; +import { AutomineTestContext, type AutomineTestOpts } from '../automine_test_context.js'; const { METRICS_PORT: metricsPort } = process.env; -export class TokenContractTest { +/** + * Token-domain harness over the automine topology: extends {@link AutomineTestContext} with a + * {@link TokenSimulator}, the USDC Token deploy plus a bad-account and authwit proxy, and an optional + * mint. The base/mint steps are opt-in via {@link applyBaseSnapshots}/{@link applyMintSnapshot}, run + * after `super.setup()`. + */ +export class TokenContractTest extends AutomineTestContext { static TOKEN_NAME = 'USDC'; static TOKEN_SYMBOL = 'USD'; static TOKEN_DECIMALS = 18n; - context!: EndToEndContext; - logger: Logger; metricsPort?: number; asset!: TokenContract; tokenSim!: TokenSimulator; @@ -33,16 +31,17 @@ export class TokenContractTest { badAccount!: InvalidAccountContract; authwitProxy!: GenericProxyContract; - wallet!: TestWallet; adminAddress!: AztecAddress; account1Address!: AztecAddress; account2Address!: AztecAddress; private shouldApplyBaseSetup = false; private shouldApplyMint = false; + private testName: string; constructor(testName: string) { - this.logger = createLogger(`e2e:e2e_token_contract:${testName}`); + super(); + this.testName = testName; this.metricsPort = metricsPort ? parseInt(metricsPort) : undefined; } @@ -111,12 +110,10 @@ export class TokenContractTest { ); } - async setup(opts: Partial = {}) { - this.context = await setup(3, { - ...opts, - metricsPort: this.metricsPort, - fundSponsoredFPC: true, - }); + override async setup(opts: AutomineTestOpts = {}) { + await super.setup({ numberOfAccounts: 3, metricsPort: this.metricsPort, ...opts }); + // hydrateFromContext repoints `this.logger` at the context logger; restore the harness-named one. + this.logger = createLogger(`e2e:automine:token:${this.testName}`); if (this.shouldApplyBaseSetup) { await this.applyBaseSetup(); @@ -127,10 +124,6 @@ export class TokenContractTest { } } - async teardown() { - await teardown(this.context); - } - private async applyMint() { this.logger.info('Applying mint setup'); const { asset, adminAddress, tokenSim } = this; diff --git a/yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts b/yarn-project/end-to-end/src/automine/token/transfer.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts rename to yarn-project/end-to-end/src/automine/token/transfer.parallel.test.ts index bca964bc8762..6c00f1d9fc15 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/transfer.test.ts +++ b/yarn-project/end-to-end/src/automine/token/transfer.parallel.test.ts @@ -2,21 +2,20 @@ import { AztecAddress, CompleteAddress } from '@aztec/aztec.js/addresses'; import { BlockNumber } from '@aztec/foundation/branded-types'; import { TokenContract, type Transfer } from '@aztec/noir-contracts.js/Token'; -import { AUTOMINE_E2E_OPTS } from '../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers the top-level transfer() entry point on Token contract (private-to-private), including transfer to // non-deployed accounts and private Transfer event emission. Note: the describe title collides with // transfer_in_private.test.ts — the tested contract methods differ (transfer vs transfer_in_private). // Setup: single node with AutomineSequencer, 3 accounts, Token deployed with initial mint. -describe('e2e_token_contract transfer private', () => { +describe('automine/token/transfer', () => { const t = new TokenContractTest('transfer_private'); let { asset, adminAddress, wallet, account1Address, tokenSim } = t; beforeAll(async () => { t.applyBaseSnapshots(); t.applyMintSnapshot(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); ({ asset, adminAddress, wallet, account1Address, tokenSim } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/transfer_in_private.test.ts b/yarn-project/end-to-end/src/automine/token/transfer_in_private.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_token_contract/transfer_in_private.test.ts rename to yarn-project/end-to-end/src/automine/token/transfer_in_private.test.ts index 2c2773a46126..5a093f4306e6 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/transfer_in_private.test.ts +++ b/yarn-project/end-to-end/src/automine/token/transfer_in_private.test.ts @@ -1,21 +1,21 @@ import { computeAuthWitMessageHash, computeInnerAuthWitHashFromAction } from '@aztec/aztec.js/authorization'; import { Fr } from '@aztec/aztec.js/fields'; -import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR } from '../fixtures/fixtures.js'; +import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR } from '../../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers the transfer_in_private entry point on Token contract: authwit-delegated transfers via proxy, // authwit cancellation, and error paths including bad-account validation. Setup: single node with // AutomineSequencer, 3 accounts + InvalidAccount, Token deployed with initial mint. -describe('e2e_token_contract transfer private', () => { +describe('automine/token/transfer_in_private', () => { const t = new TokenContractTest('transfer_private'); let { asset, tokenSim, wallet, adminAddress, account1Address, badAccount } = t; beforeAll(async () => { t.applyBaseSnapshots(); t.applyMintSnapshot(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); ({ asset, tokenSim, wallet, adminAddress, account1Address, badAccount } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/transfer_in_public.test.ts b/yarn-project/end-to-end/src/automine/token/transfer_in_public.parallel.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_token_contract/transfer_in_public.test.ts rename to yarn-project/end-to-end/src/automine/token/transfer_in_public.parallel.test.ts index 689736e3facf..a5a55aa13623 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/transfer_in_public.test.ts +++ b/yarn-project/end-to-end/src/automine/token/transfer_in_public.parallel.test.ts @@ -1,7 +1,7 @@ import { Fr } from '@aztec/aztec.js/fields'; -import { AUTOMINE_E2E_OPTS, U128_UNDERFLOW_ERROR } from '../fixtures/fixtures.js'; -import { type AlertConfig, GrafanaClient } from '../quality_of_service/grafana_client.js'; +import { U128_UNDERFLOW_ERROR } from '../../fixtures/fixtures.js'; +import { type AlertConfig, GrafanaClient } from '../../quality_of_service/grafana_client.js'; import { TokenContractTest } from './token_contract_test.js'; const CHECK_ALERTS = process.env.CHECK_ALERTS === 'true'; @@ -21,14 +21,14 @@ const qosAlerts: AlertConfig[] = [ // Covers the transfer_in_public entry point on Token contract: direct, self, authwit-delegated, authwit // cancellation (two flows), and bad-account validation. Also conditionally checks Grafana QoS alerts when // CHECK_ALERTS=true. Setup: single node with AutomineSequencer, Token deployed with initial mint. -describe('e2e_token_contract transfer public', () => { +describe('automine/token/transfer_in_public', () => { const t = new TokenContractTest('transfer_in_public'); let { asset, tokenSim, wallet, adminAddress, account1Address, badAccount } = t; beforeAll(async () => { t.applyBaseSnapshots(); t.applyMintSnapshot(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Have to destructure again to ensure we have latest refs. ({ asset, tokenSim, wallet, adminAddress, account1Address, badAccount } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/transfer_to_private.test.ts b/yarn-project/end-to-end/src/automine/token/transfer_to_private.parallel.test.ts similarity index 93% rename from yarn-project/end-to-end/src/e2e_token_contract/transfer_to_private.test.ts rename to yarn-project/end-to-end/src/automine/token/transfer_to_private.parallel.test.ts index e9de4064a1f9..7cca9f3ec34a 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/transfer_to_private.test.ts +++ b/yarn-project/end-to-end/src/automine/token/transfer_to_private.parallel.test.ts @@ -1,17 +1,17 @@ -import { AUTOMINE_E2E_OPTS, U128_UNDERFLOW_ERROR } from '../fixtures/fixtures.js'; +import { U128_UNDERFLOW_ERROR } from '../../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers the transfer_to_private entry point on Token contract (public→private), including self and // cross-account transfers. Setup: single node with AutomineSequencer, 3 accounts, Token deployed with // initial mint. -describe('e2e_token_contract transfer_to_private', () => { +describe('automine/token/transfer_to_private', () => { const t = new TokenContractTest('transfer_to_private'); let { asset, adminAddress, account1Address, tokenSim } = t; beforeAll(async () => { t.applyBaseSnapshots(); t.applyMintSnapshot(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Have to destructure again to ensure we have latest refs. ({ asset, adminAddress, account1Address, tokenSim } = t); }); diff --git a/yarn-project/end-to-end/src/e2e_token_contract/transfer_to_public.test.ts b/yarn-project/end-to-end/src/automine/token/transfer_to_public.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_token_contract/transfer_to_public.test.ts rename to yarn-project/end-to-end/src/automine/token/transfer_to_public.parallel.test.ts index 362666dd76ec..db3df48724b4 100644 --- a/yarn-project/end-to-end/src/e2e_token_contract/transfer_to_public.test.ts +++ b/yarn-project/end-to-end/src/automine/token/transfer_to_public.parallel.test.ts @@ -1,21 +1,21 @@ import { computeAuthWitMessageHash } from '@aztec/aztec.js/authorization'; import { Fr } from '@aztec/aztec.js/fields'; -import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR } from '../fixtures/fixtures.js'; +import { sendThroughAuthwitProxy, simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR } from '../../fixtures/fixtures.js'; import { TokenContractTest } from './token_contract_test.js'; // Covers the transfer_to_public entry point on Token contract (private→public): direct, authwit-delegated // via proxy, and error paths. Setup: single node with AutomineSequencer, 3 accounts, Token deployed with // initial mint. -describe('e2e_token_contract transfer_to_public', () => { +describe('automine/token/transfer_to_public', () => { const t = new TokenContractTest('transfer_to_public'); let { asset, wallet, adminAddress, account1Address, tokenSim } = t; beforeAll(async () => { t.applyBaseSnapshots(); t.applyMintSnapshot(); - await t.setup({ ...AUTOMINE_E2E_OPTS }); + await t.setup(); // Have to destructure again to ensure we have latest refs. ({ asset, wallet, adminAddress, account1Address, tokenSim } = t); }); diff --git a/yarn-project/end-to-end/src/composed/e2e_persistence.test.ts b/yarn-project/end-to-end/src/composed/e2e_persistence.test.ts index 2073a2b6b710..fe48d6a45c65 100644 --- a/yarn-project/end-to-end/src/composed/e2e_persistence.test.ts +++ b/yarn-project/end-to-end/src/composed/e2e_persistence.test.ts @@ -15,7 +15,7 @@ import { mkdtemp } from 'fs/promises'; import { tmpdir } from 'os'; import { join } from 'path'; -import { BlacklistTokenContractTest, Role } from '../e2e_blacklist_token_contract/blacklist_token_contract_test.js'; +import { BlacklistTokenContractTest, Role } from '../automine/token/blacklist_token_contract_test.js'; import { PIPELINING_SETUP_OPTS } from '../fixtures/fixtures.js'; import { type EndToEndContext, setup } from '../fixtures/utils.js'; import type { TestWallet } from '../test-wallet/test_wallet.js'; From a36f490de4e742e40891726f1af68fb11130dc94 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 17:42:04 -0300 Subject: [PATCH 4/7] refactor(e2e): move automine root tests + recategorize snapshot_sync Move the 42 root AUTOMINE_E2E_OPTS tests under automine/ bucketed by behavior (smoke, token, contracts, accounts, notes, execution, lifecycle), switching each from setup(N, { ...AUTOMINE_E2E_OPTS }) to AutomineTestContext.setup({ numberOfAccounts: N }) and naming each describe after its path. Files with more than one top-level it gain the .parallel suffix. Preserve the e2e_avm_simulator AVM-dump bespoke CI line (re-pointed at src/automine/execution/avm_simulator.test.ts, dump name kept) with the file excluded from the generic execution glob, and keep kernelless_simulation excluded from the compat glob against its new path. Add the new automine subfolder globs to both bootstrap.sh arrays and repoint the lending / offchain_payment flake entries. Recategorize e2e_snapshot_sync: its checkpoint-history and corrupted-snapshot-fallback assertions rely on interval block production that the AutomineSequencer does not provide without injected txs, so per the plan's fallback it stays on the production sequencer and moves to single-node/sync/ alongside synching rather than forcing a flaky automine conversion. --- .test_patterns.yml | 6 ++--- yarn-project/end-to-end/bootstrap.sh | 12 ++++++++- .../end-to-end/src/automine/README.md | 6 ++--- .../accounts/2_pxes.parallel.test.ts} | 20 +++++++------- .../accounts/account_contracts.test.ts} | 19 ++++++------- .../accounts/authwit.test.ts} | 13 ++++----- .../accounts/keys.test.ts} | 11 ++++---- .../multiple_accounts_1_enc_key.test.ts} | 19 ++++++------- .../accounts/scope_isolation.test.ts} | 7 +++-- .../contract_updates.parallel.test.ts} | 19 ++++++------- .../nested_utility_calls.parallel.test.ts} | 27 ++++++++++--------- .../contracts/static_calls.test.ts} | 12 +++------ .../execution/abi_types.parallel.test.ts} | 7 +++-- .../execution/avm_simulator.test.ts} | 7 +++-- .../execution/card_game.test.ts} | 10 +++---- .../execution/circuit_recorder.test.ts} | 7 +++-- .../execution/double_spend.test.ts} | 7 +++-- .../execution/kernelless_simulation.test.ts} | 13 +++++---- .../execution/mempool_limit.test.ts} | 20 +++++++------- .../execution/option_params.parallel.test.ts} | 7 +++-- .../execution/ordering.test.ts} | 11 ++++---- .../execution/phase_check.parallel.test.ts} | 9 +++---- .../execution/private_voting.test.ts} | 7 +++-- .../execution/state_vars.test.ts} | 11 ++++---- .../lifecycle/expiration_timestamp.test.ts} | 11 ++++---- .../genesis_timestamp.parallel.test.ts} | 21 +++++++-------- .../lifecycle/pruned_blocks.test.ts} | 21 ++++++++------- .../lifecycle/pxe.test.ts} | 9 +++---- .../notes/custom_message.parallel.test.ts} | 7 +++-- .../notes/event_logs.test.ts} | 7 +++-- .../notes/event_only.test.ts} | 7 +++-- .../notes/large_public_event.test.ts} | 7 +++-- .../notes/note_getter.test.ts} | 7 +++-- .../notes/offchain_effect.parallel.test.ts} | 11 ++++---- .../notes/offchain_payment.parallel.test.ts} | 20 +++++++------- .../notes/partial_notes.test.ts} | 9 +++---- .../pending_note_hashes.parallel.test.ts} | 9 +++---- .../notes/tx_effect_oracle.parallel.test.ts} | 7 +++-- .../smoke/smoke.parallel.test.ts} | 7 +++-- .../token/amm.test.ts} | 11 ++++---- .../crowdfunding_and_claim.parallel.test.ts} | 12 ++++----- .../token/escrow.parallel.test.ts} | 11 ++++---- .../token/lending.parallel.test.ts} | 16 +++++------ .../token/nft.parallel.test.ts} | 7 +++-- .../token/orderbook.test.ts} | 11 ++++---- .../sync/snapshot_sync.test.ts} | 4 +-- 46 files changed, 254 insertions(+), 265 deletions(-) rename yarn-project/end-to-end/src/{e2e_2_pxes.test.ts => automine/accounts/2_pxes.parallel.test.ts} (96%) rename yarn-project/end-to-end/src/{e2e_account_contracts.test.ts => automine/accounts/account_contracts.test.ts} (92%) rename yarn-project/end-to-end/src/{e2e_authwit.test.ts => automine/accounts/authwit.test.ts} (93%) rename yarn-project/end-to-end/src/{e2e_keys.test.ts => automine/accounts/keys.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_multiple_accounts_1_enc_key.test.ts => automine/accounts/multiple_accounts_1_enc_key.test.ts} (90%) rename yarn-project/end-to-end/src/{e2e_scope_isolation.test.ts => automine/accounts/scope_isolation.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_contract_updates.test.ts => automine/contracts/contract_updates.parallel.test.ts} (96%) rename yarn-project/end-to-end/src/{e2e_nested_utility_calls.test.ts => automine/contracts/nested_utility_calls.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_static_calls.test.ts => automine/contracts/static_calls.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_abi_types.test.ts => automine/execution/abi_types.parallel.test.ts} (96%) rename yarn-project/end-to-end/src/{e2e_avm_simulator.test.ts => automine/execution/avm_simulator.test.ts} (99%) rename yarn-project/end-to-end/src/{e2e_card_game.test.ts => automine/execution/card_game.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_circuit_recorder.test.ts => automine/execution/circuit_recorder.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_double_spend.test.ts => automine/execution/double_spend.test.ts} (91%) rename yarn-project/end-to-end/src/{e2e_kernelless_simulation.test.ts => automine/execution/kernelless_simulation.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_mempool_limit.test.ts => automine/execution/mempool_limit.test.ts} (86%) rename yarn-project/end-to-end/src/{e2e_option_params.test.ts => automine/execution/option_params.parallel.test.ts} (94%) rename yarn-project/end-to-end/src/{e2e_ordering.test.ts => automine/execution/ordering.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_phase_check.test.ts => automine/execution/phase_check.parallel.test.ts} (92%) rename yarn-project/end-to-end/src/{e2e_private_voting_contract.test.ts => automine/execution/private_voting.test.ts} (92%) rename yarn-project/end-to-end/src/{e2e_state_vars.test.ts => automine/execution/state_vars.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_expiration_timestamp.test.ts => automine/lifecycle/expiration_timestamp.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_genesis_timestamp.test.ts => automine/lifecycle/genesis_timestamp.parallel.test.ts} (94%) rename yarn-project/end-to-end/src/{e2e_pruned_blocks.test.ts => automine/lifecycle/pruned_blocks.test.ts} (92%) rename yarn-project/end-to-end/src/{e2e_pxe.test.ts => automine/lifecycle/pxe.test.ts} (84%) rename yarn-project/end-to-end/src/{e2e_custom_message.test.ts => automine/notes/custom_message.parallel.test.ts} (94%) rename yarn-project/end-to-end/src/{e2e_event_logs.test.ts => automine/notes/event_logs.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_event_only.test.ts => automine/notes/event_only.test.ts} (90%) rename yarn-project/end-to-end/src/{e2e_large_public_event.test.ts => automine/notes/large_public_event.test.ts} (90%) rename yarn-project/end-to-end/src/{e2e_note_getter.test.ts => automine/notes/note_getter.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_offchain_effect.test.ts => automine/notes/offchain_effect.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_offchain_payment.test.ts => automine/notes/offchain_payment.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_partial_notes.test.ts => automine/notes/partial_notes.test.ts} (84%) rename yarn-project/end-to-end/src/{e2e_pending_note_hashes_contract.test.ts => automine/notes/pending_note_hashes.parallel.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_tx_effect_oracle.test.ts => automine/notes/tx_effect_oracle.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_automine_smoke.test.ts => automine/smoke/smoke.parallel.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_amm.test.ts => automine/token/amm.test.ts} (98%) rename yarn-project/end-to-end/src/{e2e_crowdfunding_and_claim.test.ts => automine/token/crowdfunding_and_claim.parallel.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_escrow_contract.test.ts => automine/token/escrow.parallel.test.ts} (93%) rename yarn-project/end-to-end/src/{e2e_lending_contract.test.ts => automine/token/lending.parallel.test.ts} (97%) rename yarn-project/end-to-end/src/{e2e_nft.test.ts => automine/token/nft.parallel.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_orderbook.test.ts => automine/token/orderbook.test.ts} (95%) rename yarn-project/end-to-end/src/{e2e_snapshot_sync.test.ts => single-node/sync/snapshot_sync.test.ts} (98%) diff --git a/.test_patterns.yml b/.test_patterns.yml index 6ae2f6f54850..96055b8f2470 100644 --- a/.test_patterns.yml +++ b/.test_patterns.yml @@ -115,11 +115,11 @@ tests: error_regex: "HttpRequestError: HTTP request failed." owners: - *charlie - - regex: "src/e2e_lending_contract" + - regex: "src/automine/token/lending" error_regex: "✕ Depositing" owners: - *lasse - - regex: "src/e2e_lending_contract" + - regex: "src/automine/token/lending" error_regex: "✕ Repay" owners: - *lasse @@ -401,7 +401,7 @@ tests: - *palla # http://ci.aztec-labs.com/153f5dcbb0f3799c - - regex: "src/e2e_offchain_payment.test.ts" + - regex: "src/automine/notes/offchain_payment.parallel.test.ts" error_regex: "✕ reprocesses an offchain-delivered payment after an L1 reorg" owners: - *martin diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index a56e5dbb5757..0a64ba209be1 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -32,7 +32,7 @@ function test_cmds { else echo "$prefix:NAME=e2e_prover_full_fake FAKE_PROOFS=1 $run_test_script simple single-node/prover/full" fi - echo "$prefix:TIMEOUT=30m:NAME=e2e_avm_simulator $(set_dump_avm e2e_avm_simulator) $run_test_script simple src/e2e_avm_simulator.test.ts" + echo "$prefix:TIMEOUT=30m:NAME=automine/execution/avm_simulator $(set_dump_avm e2e_avm_simulator) $run_test_script simple src/automine/execution/avm_simulator.test.ts" local tests=( # List all standalone and nested tests, except for the ones listed above. @@ -41,6 +41,11 @@ function test_cmds { src/automine/contracts/deploy/*.test.ts src/automine/contracts/nested/*.test.ts src/automine/token/*.test.ts + src/automine/smoke/*.test.ts + src/automine/accounts/*.test.ts + src/automine/notes/*.test.ts + src/automine/execution/!(avm_simulator).test.ts + src/automine/lifecycle/*.test.ts src/single-node/block-building/*.test.ts src/single-node/proving/*.test.ts src/single-node/l1-reorgs/*.test.ts @@ -304,6 +309,11 @@ function compat_test_cmds { src/automine/contracts/deploy/*.test.ts src/automine/contracts/nested/*.test.ts src/automine/token/*.test.ts + src/automine/smoke/*.test.ts + src/automine/accounts/*.test.ts + src/automine/notes/*.test.ts + src/automine/execution/!(kernelless_simulation).test.ts + src/automine/lifecycle/*.test.ts src/single-node/fees/*.test.ts src/single-node/cross-chain/*.test.ts src/single-node/bot/*.test.ts diff --git a/yarn-project/end-to-end/src/automine/README.md b/yarn-project/end-to-end/src/automine/README.md index 059cf33e931c..e0a01f97cdfa 100644 --- a/yarn-project/end-to-end/src/automine/README.md +++ b/yarn-project/end-to-end/src/automine/README.md @@ -52,8 +52,6 @@ own job. | `notes/` | Note discovery, events, and offchain effects: note getters, pending note hashes, partial notes, event logs, event-only notes, offchain effects and payments, large public events, custom messages, and the tx-effect oracle. | | `execution/` | Transaction semantics: ordering, double-spend rejection, phase checks, kernelless simulation, the AVM simulator, the circuit recorder, option params, ABI types, state variables, mempool limits, the card game, and private voting. | | `lifecycle/` | Chain-tip, pruning, and timing behavior under automine: pruned blocks, the genesis timestamp, expiration timestamps, and PXE behavior. | -| `sync/` | Node snapshot upload/download and sync. `snapshot_sync` creates a snapshot and syncs fresh nodes from one or multiple URLs, including fallback past a corrupted snapshot. | -Two genuine outliers: `lifecycle/genesis_timestamp` builds its environment with a custom chain and a -disabled `AnvilTestWatcher` rather than going through the base factory, and `execution/avm_simulator` -dumps AVM circuit inputs for the downstream `avm_check_circuit` CI job. +The `execution/avm_simulator` file is a genuine outlier: it dumps AVM circuit inputs for the downstream +`avm_check_circuit` CI job, so it has a bespoke CI line and is excluded from the generic `execution/` glob. diff --git a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts b/yarn-project/end-to-end/src/automine/accounts/2_pxes.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_2_pxes.test.ts rename to yarn-project/end-to-end/src/automine/accounts/2_pxes.parallel.test.ts index 08a5bd43db6d..9b996233a02b 100644 --- a/yarn-project/end-to-end/src/e2e_2_pxes.test.ts +++ b/yarn-project/end-to-end/src/automine/accounts/2_pxes.parallel.test.ts @@ -10,10 +10,10 @@ import type { AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; import { expect, jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { deployToken, expectTokenBalance, mintTokensToPrivate } from './fixtures/token_utils.js'; -import { setup, setupPXEAndGetWallet } from './fixtures/utils.js'; -import { TestWallet } from './test-wallet/test_wallet.js'; +import { deployToken, expectTokenBalance, mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import { setupPXEAndGetWallet } from '../../fixtures/utils.js'; +import { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -21,7 +21,7 @@ const TIMEOUT = 300_000; // account keys. Exercises note decryption scoping, contract registration ordering, and deferred-note // reprocessing when a contract is registered late. setup(1, AUTOMINE_E2E_OPTS) provides one node with // automine sequencer; a second PXE is attached via setupPXEAndGetWallet. -describe('e2e_2_pxes', () => { +describe('automine/accounts/2_pxes', () => { jest.setTimeout(TIMEOUT); let aztecNode: AztecNode & AztecNodeDebug; @@ -59,10 +59,12 @@ describe('e2e_2_pxes', () => { logger, teardown: teardownA, // accountA is the default initializerless account; accountB/C are created+deployed from these. - } = await setup(1, { - ...AUTOMINE_E2E_OPTS, - additionallyFundedAccounts: await generateSchnorrAccounts(3, 'schnorr'), - })); + } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 1, + additionallyFundedAccounts: await generateSchnorrAccounts(3, 'schnorr'), + }) + ).context); ({ wallet: walletB, diff --git a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts b/yarn-project/end-to-end/src/automine/accounts/account_contracts.test.ts similarity index 92% rename from yarn-project/end-to-end/src/e2e_account_contracts.test.ts rename to yarn-project/end-to-end/src/automine/accounts/account_contracts.test.ts index a082d3dfb8da..2395232b287c 100644 --- a/yarn-project/end-to-end/src/e2e_account_contracts.test.ts +++ b/yarn-project/end-to-end/src/automine/accounts/account_contracts.test.ts @@ -17,10 +17,9 @@ import { ChildContract } from '@aztec/noir-test-contracts.js/Child'; import { createPXE, getPXEConfig } from '@aztec/pxe/server'; import { deriveSigningKey } from '@aztec/stdlib/keys'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import { TestWallet } from './test-wallet/test_wallet.js'; -import { AztecNodeProxy } from './test-wallet/utils.js'; +import { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AztecNodeProxy } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; export class TestWalletInternals extends TestWallet { static override async create(node: AztecNode): Promise { @@ -64,10 +63,12 @@ const itShouldBehaveLikeAnAccountContract = ( address, }; - ({ logger, teardown, aztecNode } = await setup(0, { - ...AUTOMINE_E2E_OPTS, - additionallyFundedAccounts: [accountData], - })); + ({ logger, teardown, aztecNode } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 0, + additionallyFundedAccounts: [accountData], + }) + ).context); wallet = await TestWalletInternals.create(aztecNode); const accountManager = await wallet.createAccount({ secret, contract, salt }); @@ -120,7 +121,7 @@ const itShouldBehaveLikeAnAccountContract = ( // setup(0, AUTOMINE_E2E_OPTS) with an additionallyFundedAccounts override, one node, automine sequencer, // no extra nodes. (v5: added the initializerless variant and renamed initialFundedAccounts → // additionallyFundedAccounts.) -describe('e2e_account_contracts', () => { +describe('automine/accounts/account_contracts', () => { describe('schnorr account', () => { itShouldBehaveLikeAnAccountContract(() => new SchnorrAccountContract(GrumpkinScalar.random())); }); diff --git a/yarn-project/end-to-end/src/e2e_authwit.test.ts b/yarn-project/end-to-end/src/automine/accounts/authwit.test.ts similarity index 93% rename from yarn-project/end-to-end/src/e2e_authwit.test.ts rename to yarn-project/end-to-end/src/automine/accounts/authwit.test.ts index fadf558e9b19..cf3f624d972e 100644 --- a/yarn-project/end-to-end/src/e2e_authwit.test.ts +++ b/yarn-project/end-to-end/src/automine/accounts/authwit.test.ts @@ -8,17 +8,18 @@ import { STANDARD_AUTH_REGISTRY_ADDRESS } from '@aztec/standard-contracts/auth-r import { jest } from '@jest/globals'; -import { sendThroughAuthwitProxy } from './fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS, DUPLICATE_NULLIFIER_ERROR } from './fixtures/fixtures.js'; -import { type EndToEndContext, ensureAuthRegistryPublished, setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { sendThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { DUPLICATE_NULLIFIER_ERROR } from '../../fixtures/fixtures.js'; +import { type EndToEndContext, ensureAuthRegistryPublished } from '../../fixtures/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // Tests the authorization witness (authwit) system in both private and public contexts. // Uses setup(2, AUTOMINE_E2E_OPTS) providing one node with automine sequencer and two accounts. // Accounts are publicly deployed and the AuthRegistry is published before any test runs. -describe('e2e_authwit_tests', () => { +describe('automine/accounts/authwit', () => { jest.setTimeout(TIMEOUT); let wallet: TestWallet; @@ -34,7 +35,7 @@ describe('e2e_authwit_tests', () => { teardown, wallet, accounts: [account1Address, account2Address], - } = await setup(2, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 2 })).context); await ensureAuthRegistryPublished(wallet, account1Address); ({ contract: auth } = await AuthWitTestContract.deploy(wallet).send({ from: account1Address })); diff --git a/yarn-project/end-to-end/src/e2e_keys.test.ts b/yarn-project/end-to-end/src/automine/accounts/keys.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_keys.test.ts rename to yarn-project/end-to-end/src/automine/accounts/keys.test.ts index 249c3e8a283b..84741d202d5f 100644 --- a/yarn-project/end-to-end/src/e2e_keys.test.ts +++ b/yarn-project/end-to-end/src/automine/accounts/keys.test.ts @@ -18,16 +18,15 @@ import { import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // Covers cryptographic key derivation and usage: nhk_app-based nullification detection and // ovsk_app retrieval via the TestContract. Single automine node, one funded Schnorr account, // TestContract deployed in beforeAll. -describe('Keys', () => { +describe('automine/accounts/keys', () => { jest.setTimeout(TIMEOUT); let aztecNode: AztecNode; @@ -42,7 +41,9 @@ describe('Keys', () => { beforeAll(async () => { // This test needs the account's secret, so we provide and create the account ourselves. const [account] = await generateSchnorrAccounts(1); - ({ aztecNode, teardown, wallet } = await setup(0, { ...AUTOMINE_E2E_OPTS, additionallyFundedAccounts: [account] })); + ({ aztecNode, teardown, wallet } = ( + await AutomineTestContext.setup({ numberOfAccounts: 0, additionallyFundedAccounts: [account] }) + ).context); await wallet.createSchnorrInitializerlessAccount(account.secret, account.salt, account.signingKey); defaultAccountAddress = account.address; secret = account.secret; diff --git a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts b/yarn-project/end-to-end/src/automine/accounts/multiple_accounts_1_enc_key.test.ts similarity index 90% rename from yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts rename to yarn-project/end-to-end/src/automine/accounts/multiple_accounts_1_enc_key.test.ts index d5467db40532..e882ca1ed254 100644 --- a/yarn-project/end-to-end/src/e2e_multiple_accounts_1_enc_key.test.ts +++ b/yarn-project/end-to-end/src/automine/accounts/multiple_accounts_1_enc_key.test.ts @@ -4,15 +4,14 @@ import { Fr, GrumpkinScalar } from '@aztec/aztec.js/fields'; import type { Logger } from '@aztec/aztec.js/log'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { deployToken, expectTokenBalance } from './fixtures/token_utils.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { deployToken, expectTokenBalance } from '../../fixtures/token_utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies that the PXE correctly handles multiple Schnorr accounts sharing the same encryption // key (different signing keys). Checks that note discovery and balance tracking remain accurate // across three accounts. Uses AUTOMINE_E2E_OPTS with 3 custom accounts sharing one secret. -describe('e2e_multiple_accounts_1_enc_key', () => { +describe('automine/accounts/multiple_accounts_1_enc_key', () => { let wallet: TestWallet; let accounts: AztecAddress[] = []; let logger: Logger; @@ -45,10 +44,12 @@ describe('e2e_multiple_accounts_1_enc_key', () => { }), ); - ({ teardown, logger, wallet } = await setup(0, { - ...AUTOMINE_E2E_OPTS, - additionallyFundedAccounts: accountsData, - })); + ({ teardown, logger, wallet } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 0, + additionallyFundedAccounts: accountsData, + }) + ).context); for (const a of accountsData) { await wallet.createSchnorrInitializerlessAccount(a.secret, a.salt, a.signingKey); } diff --git a/yarn-project/end-to-end/src/e2e_scope_isolation.test.ts b/yarn-project/end-to-end/src/automine/accounts/scope_isolation.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_scope_isolation.test.ts rename to yarn-project/end-to-end/src/automine/accounts/scope_isolation.test.ts index 3fe04430785a..67bc78be7aa5 100644 --- a/yarn-project/end-to-end/src/e2e_scope_isolation.test.ts +++ b/yarn-project/end-to-end/src/automine/accounts/scope_isolation.test.ts @@ -2,13 +2,12 @@ import type { AztecAddress } from '@aztec/aztec.js/addresses'; import type { Wallet } from '@aztec/aztec.js/wallet'; import { ScopeTestContract } from '@aztec/noir-test-contracts.js/ScopeTest'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies that PXE note access and key-derivation are scoped per account: a different account // cannot read another's notes or derive their nullifier hiding key. Uses a single node with // AutomineSequencer and three accounts (alice, bob, charlie). -describe('e2e scope isolation', () => { +describe('automine/accounts/scope_isolation', () => { let wallet: Wallet; let accounts: AztecAddress[]; let teardown: () => Promise; @@ -22,7 +21,7 @@ describe('e2e scope isolation', () => { const BOB_NOTE_VALUE = 100n; beforeAll(async () => { - ({ teardown, wallet, accounts } = await setup(3, { ...AUTOMINE_E2E_OPTS })); + ({ teardown, wallet, accounts } = (await AutomineTestContext.setup({ numberOfAccounts: 3 })).context); [alice, bob, charlie] = accounts; ({ contract } = await ScopeTestContract.deploy(wallet).send({ from: alice })); diff --git a/yarn-project/end-to-end/src/e2e_contract_updates.test.ts b/yarn-project/end-to-end/src/automine/contracts/contract_updates.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_contract_updates.test.ts rename to yarn-project/end-to-end/src/automine/contracts/contract_updates.parallel.test.ts index 4092c1fce247..527a695c3366 100644 --- a/yarn-project/end-to-end/src/e2e_contract_updates.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/contract_updates.parallel.test.ts @@ -20,9 +20,8 @@ import type { AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; import { deriveSigningKey } from '@aztec/stdlib/keys'; import { PublicDataTreeLeaf } from '@aztec/stdlib/trees'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Set the update delay in genesis data so it's feasible to test in an e2e test. // The protocol enforces `MINIMUM_UPDATE_DELAY` (600 seconds, see constants.gen.ts), so we use that @@ -40,7 +39,7 @@ const UPDATED_CONTRACT_PUBLIC_VALUE = 27n; // in additionallyFundedAccounts (whose address is known before setup so the delay can be seeded in // genesis for it). (v5: was setup(1, …) with initialFundedAccounts; the renamed option and // initializerless account are setup-mechanics changes, not category changes.) -describe('e2e_contract_updates', () => { +describe('automine/contracts/contract_updates', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let teardown: () => Promise; @@ -100,11 +99,13 @@ describe('e2e_contract_updates', () => { const constructorArgs = [INITIAL_UPDATABLE_CONTRACT_VALUE]; const genesisPublicData = await setupScheduledDelay(constructorArgs, salt, account.address); - ({ aztecNode, teardown, wallet, cheatCodes } = await setup(0, { - ...AUTOMINE_E2E_OPTS, - genesisPublicData, - additionallyFundedAccounts: [account], - })); + ({ aztecNode, teardown, wallet, cheatCodes } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 0, + genesisPublicData, + additionallyFundedAccounts: [account], + }) + ).context); await wallet.createSchnorrInitializerlessAccount(account.secret, account.salt, account.signingKey); ({ contract, instance } = await UpdatableContract.deploy(wallet, constructorArgs[0], { salt }).send({ diff --git a/yarn-project/end-to-end/src/e2e_nested_utility_calls.test.ts b/yarn-project/end-to-end/src/automine/contracts/nested_utility_calls.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_nested_utility_calls.test.ts rename to yarn-project/end-to-end/src/automine/contracts/nested_utility_calls.parallel.test.ts index bba5474aff81..c033207604e7 100644 --- a/yarn-project/end-to-end/src/e2e_nested_utility_calls.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/nested_utility_calls.parallel.test.ts @@ -8,15 +8,14 @@ import { getContractClassFromArtifact } from '@aztec/stdlib/contract'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // Verifies nested utility calls via pow_utility(x, n) = x^n (recursive utility→utility), // calling it from a private function via pow_private, and the default hook behavior. // Single automine node, one funded account, two NestedUtilityContract instances. -describe('Nested utility calls', () => { +describe('automine/contracts/nested_utility_calls', () => { let contractA: NestedUtilityContract; let contractB: NestedUtilityContract; jest.setTimeout(TIMEOUT); @@ -30,7 +29,7 @@ describe('Nested utility calls', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract: contractA } = await NestedUtilityContract.deploy(wallet).send({ from: defaultAccountAddress })); ({ contract: contractB } = await NestedUtilityContract.deploy(wallet).send({ from: defaultAccountAddress })); }); @@ -103,17 +102,19 @@ describe('authorizeUtilityCall hook', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { - ...AUTOMINE_E2E_OPTS, - pxeCreationOptions: { - hooks: { - authorizeUtilityCall: (req: UtilityCallAuthorizationRequest) => { - lastRequest = req; - return Promise.resolve({ authorized: hookAllows }); + } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 1, + pxeCreationOptions: { + hooks: { + authorizeUtilityCall: (req: UtilityCallAuthorizationRequest) => { + lastRequest = req; + return Promise.resolve({ authorized: hookAllows }); + }, }, }, - }, - })); + }) + ).context); ({ contract: contractA } = await NestedUtilityContract.deploy(wallet).send({ from: defaultAccountAddress })); ({ contract: contractB } = await NestedUtilityContract.deploy(wallet).send({ from: defaultAccountAddress })); diff --git a/yarn-project/end-to-end/src/e2e_static_calls.test.ts b/yarn-project/end-to-end/src/automine/contracts/static_calls.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_static_calls.test.ts rename to yarn-project/end-to-end/src/automine/contracts/static_calls.test.ts index ea1d6087c4de..d8298d186d0b 100644 --- a/yarn-project/end-to-end/src/e2e_static_calls.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/static_calls.test.ts @@ -3,17 +3,13 @@ import type { Wallet } from '@aztec/aztec.js/wallet'; import { StaticChildContract } from '@aztec/noir-test-contracts.js/StaticChild'; import { StaticParentContract } from '@aztec/noir-test-contracts.js/StaticParent'; -import { - AUTOMINE_E2E_OPTS, - STATIC_CALL_STATE_MODIFICATION_ERROR, - STATIC_CONTEXT_ASSERTION_ERROR, -} from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { STATIC_CALL_STATE_MODIFICATION_ERROR, STATIC_CONTEXT_ASSERTION_ERROR } from '../../fixtures/fixtures.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies that static call enforcement prevents state modifications in private and public contexts, // and that non-static calls to functions marked with static-call assertions are rejected. Uses a single // node with AutomineSequencer and two contracts (StaticParent, StaticChild). -describe('e2e_static_calls', () => { +describe('automine/contracts/static_calls', () => { let wallet: Wallet; let parentContract: StaticParentContract; let childContract: StaticChildContract; @@ -26,7 +22,7 @@ describe('e2e_static_calls', () => { teardown, wallet, accounts: [owner], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); sender = owner; ({ contract: parentContract } = await StaticParentContract.deploy(wallet).send({ from: owner })); ({ contract: childContract } = await StaticChildContract.deploy(wallet).send({ from: owner })); diff --git a/yarn-project/end-to-end/src/e2e_abi_types.test.ts b/yarn-project/end-to-end/src/automine/execution/abi_types.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/e2e_abi_types.test.ts rename to yarn-project/end-to-end/src/automine/execution/abi_types.parallel.test.ts index dc2b700811d8..8a0a6eee2176 100644 --- a/yarn-project/end-to-end/src/e2e_abi_types.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/abi_types.parallel.test.ts @@ -7,8 +7,7 @@ import { AbiTypesContract } from '@aztec/noir-test-contracts.js/AbiTypes'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -19,7 +18,7 @@ const I64_MIN = -(2n ** 63n); // Tests that different ABI types are correctly encoded when passed to contract functions and decoded from // return values in TypeScript. Mirrors Noir-side AbiTypes unit tests. Uses setup(1, AUTOMINE_E2E_OPTS) // providing one node, automine sequencer, and one deployed account. -describe('AbiTypes', () => { +describe('automine/execution/abi_types', () => { let abiTypesContract: AbiTypesContract; jest.setTimeout(TIMEOUT); @@ -32,7 +31,7 @@ describe('AbiTypes', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract: abiTypesContract } = await AbiTypesContract.deploy(wallet).send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts b/yarn-project/end-to-end/src/automine/execution/avm_simulator.test.ts similarity index 99% rename from yarn-project/end-to-end/src/e2e_avm_simulator.test.ts rename to yarn-project/end-to-end/src/automine/execution/avm_simulator.test.ts index 8da1fbee15a0..d7afe94a87bd 100644 --- a/yarn-project/end-to-end/src/e2e_avm_simulator.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/avm_simulator.test.ts @@ -9,8 +9,7 @@ import { AvmTestContract } from '@aztec/noir-test-contracts.js/AvmTest'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 600_000; @@ -18,7 +17,7 @@ const TIMEOUT = 600_000; // nested calls, gas metering, contract instances, L2→L1 messages, and public-storage overrides. // Uses setup(1, AUTOMINE_E2E_OPTS) providing one node, automine sequencer, one funded account. // CI runs this as a separate job with TIMEOUT=30m and optionally dumps AVM circuit inputs. -describe('e2e_avm_simulator', () => { +describe('automine/execution/avm_simulator', () => { jest.setTimeout(TIMEOUT); let wallet: Wallet; @@ -32,7 +31,7 @@ describe('e2e_avm_simulator', () => { wallet, aztecNode, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); }); afterAll(() => teardown()); diff --git a/yarn-project/end-to-end/src/e2e_card_game.test.ts b/yarn-project/end-to-end/src/automine/execution/card_game.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_card_game.test.ts rename to yarn-project/end-to-end/src/automine/execution/card_game.test.ts index c24c74a07988..e6885632fc06 100644 --- a/yarn-project/end-to-end/src/e2e_card_game.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/card_game.test.ts @@ -10,9 +10,8 @@ import { CardGameContract } from '@aztec/noir-contracts.js/CardGame'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; /* eslint-disable camelcase */ @@ -62,7 +61,7 @@ const TIMEOUT = 600_000; // initializerless accounts — it derives nullifier-hiding keys from the players' secrets, so it owns the // keys. (v5: was setup(3, …); the explicit account provisioning is a setup-mechanics change, not a // category change.) jest.setTimeout(600s). -describe('e2e_card_game', () => { +describe('automine/execution/card_game', () => { jest.setTimeout(TIMEOUT); let logger: Logger; @@ -98,7 +97,8 @@ describe('e2e_card_game', () => { // This test derives nullifier-hiding keys from the players' secrets, so we provide and create the // accounts ourselves. const players = await generateSchnorrAccounts(3); - const context = await setup(0, { ...AUTOMINE_E2E_OPTS, additionallyFundedAccounts: players }); + const context = (await AutomineTestContext.setup({ numberOfAccounts: 0, additionallyFundedAccounts: players })) + .context; ({ logger, teardown, wallet } = context); for (const player of players) { diff --git a/yarn-project/end-to-end/src/e2e_circuit_recorder.test.ts b/yarn-project/end-to-end/src/automine/execution/circuit_recorder.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_circuit_recorder.test.ts rename to yarn-project/end-to-end/src/automine/execution/circuit_recorder.test.ts index d5b79f23eb35..c14ef3c1af96 100644 --- a/yarn-project/end-to-end/src/e2e_circuit_recorder.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/circuit_recorder.test.ts @@ -4,8 +4,7 @@ import { ChildContract } from '@aztec/noir-test-contracts.js/Child'; import fs from 'fs/promises'; import path from 'path'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; /** * Tests the circuit recorder is working as expected. To read more about it, check JSDoc of CircuitRecorder class. @@ -15,7 +14,7 @@ import { setup } from './fixtures/utils.js'; // ChildContract) and protocol circuits (PrivateKernelInit variant). (v5: the default account is now // initializerless, so the user circuit recorded is the entrypoint, not a SchnorrAccount constructor.) // Uses setup(1, AUTOMINE_E2E_OPTS) with one node, automine sequencer, one account. -describe('Circuit Recorder', () => { +describe('automine/execution/circuit_recorder', () => { const RECORD_DIR = './circuit_recordings'; // Sets CIRCUIT_RECORD_DIR env var, runs setup + a ChildContract deploy to trigger circuit execution, @@ -31,7 +30,7 @@ describe('Circuit Recorder', () => { teardown, wallet, accounts: [accountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS }); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context; await ChildContract.deploy(wallet).send({ from: accountAddress }); // Check recording directory exists diff --git a/yarn-project/end-to-end/src/e2e_double_spend.test.ts b/yarn-project/end-to-end/src/automine/execution/double_spend.test.ts similarity index 91% rename from yarn-project/end-to-end/src/e2e_double_spend.test.ts rename to yarn-project/end-to-end/src/automine/execution/double_spend.test.ts index ae02243d2c10..2d18a574d773 100644 --- a/yarn-project/end-to-end/src/e2e_double_spend.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/double_spend.test.ts @@ -5,12 +5,11 @@ import { TxExecutionResult } from '@aztec/aztec.js/tx'; import type { Wallet } from '@aztec/aztec.js/wallet'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Tests that a public nullifier emitted in one tx cannot be emitted again in a subsequent tx. // Uses setup(1, AUTOMINE_E2E_OPTS) with one node, automine sequencer, one funded account. -describe('e2e_double_spend', () => { +describe('automine/execution/double_spend', () => { let wallet: Wallet; let defaultAccountAddress: AztecAddress; @@ -26,7 +25,7 @@ describe('e2e_double_spend', () => { wallet, accounts: [defaultAccountAddress], logger, - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await TestContract.deploy(wallet).send({ from: defaultAccountAddress })); diff --git a/yarn-project/end-to-end/src/e2e_kernelless_simulation.test.ts b/yarn-project/end-to-end/src/automine/execution/kernelless_simulation.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_kernelless_simulation.test.ts rename to yarn-project/end-to-end/src/automine/execution/kernelless_simulation.test.ts index 1ebc44b62c01..8c871ec0d08a 100644 --- a/yarn-project/end-to-end/src/e2e_kernelless_simulation.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/kernelless_simulation.test.ts @@ -19,11 +19,10 @@ import { MerkleTreeId } from '@aztec/stdlib/trees'; import { jest } from '@jest/globals'; -import { simulateThroughAuthwitProxy } from './fixtures/authwit_proxy.js'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { deployToken, mintTokensToPrivate } from './fixtures/token_utils.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { simulateThroughAuthwitProxy } from '../../fixtures/authwit_proxy.js'; +import { deployToken, mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; /* * Demonstrates the capability of simulating a transaction without executing the kernels, allowing @@ -33,7 +32,7 @@ import type { TestWallet } from './test-wallet/test_wallet.js'; * Uses a single automine node with three funded accounts (admin, liquidityProvider, swapper), * an AMM with two token pairs, and various test contracts deployed in beforeAll. */ -describe('Kernelless simulation', () => { +describe('automine/execution/kernelless_simulation', () => { let teardown: () => Promise; let logger: Logger; @@ -60,7 +59,7 @@ describe('Kernelless simulation', () => { wallet, accounts: [adminAddress, liquidityProviderAddress, swapperAddress], logger, - } = await setup(3, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 3 })).context); ({ contract: token0 } = await deployToken(wallet, adminAddress, 0n, logger)); ({ contract: token1 } = await deployToken(wallet, adminAddress, 0n, logger)); diff --git a/yarn-project/end-to-end/src/e2e_mempool_limit.test.ts b/yarn-project/end-to-end/src/automine/execution/mempool_limit.test.ts similarity index 86% rename from yarn-project/end-to-end/src/e2e_mempool_limit.test.ts rename to yarn-project/end-to-end/src/automine/execution/mempool_limit.test.ts index 5015a2ec076d..b01a72362f04 100644 --- a/yarn-project/end-to-end/src/e2e_mempool_limit.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/mempool_limit.test.ts @@ -4,14 +4,14 @@ import { TxStatus } from '@aztec/aztec.js/tx'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { type EndToEndContext, setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import type { EndToEndContext } from '../../fixtures/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies that the node rejects incoming transactions when the mempool is at capacity. Uses a // single automine node with aztecNodeAdmin access; sequencer is paused to let txs accumulate. -describe('e2e_mempool_limit', () => { +describe('automine/execution/mempool_limit', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let aztecNode: AztecNode; @@ -26,10 +26,12 @@ describe('e2e_mempool_limit', () => { aztecNodeAdmin, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { - ...AUTOMINE_E2E_OPTS, - proverTestVerificationDelayMs: undefined, - })); + } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 1, + proverTestVerificationDelayMs: undefined, + }) + ).context); if (!aztecNodeAdmin) { throw new Error('Aztec node admin API must be available for this test'); diff --git a/yarn-project/end-to-end/src/e2e_option_params.test.ts b/yarn-project/end-to-end/src/automine/execution/option_params.parallel.test.ts similarity index 94% rename from yarn-project/end-to-end/src/e2e_option_params.test.ts rename to yarn-project/end-to-end/src/automine/execution/option_params.parallel.test.ts index 2678e7acdbf7..ba1116ebc113 100644 --- a/yarn-project/end-to-end/src/e2e_option_params.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/option_params.parallel.test.ts @@ -5,8 +5,7 @@ import { OptionParamContract } from '@aztec/noir-test-contracts.js/OptionParam'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -16,7 +15,7 @@ const I64_MIN = -(2n ** 63n); // Verifies that the Aztec.js ABI layer correctly serialises/deserialises Noir Option parameters // for public, utility, and private functions. Single node with AutomineSequencer; all calls are // simulate()-only (no on-chain state changes). -describe('Option params', () => { +describe('automine/execution/option_params', () => { let contract: OptionParamContract; let wallet: Wallet; let defaultAccountAddress: AztecAddress; @@ -36,7 +35,7 @@ describe('Option params', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); contract = (await OptionParamContract.deploy(wallet).send({ from: defaultAccountAddress })).contract; }); diff --git a/yarn-project/end-to-end/src/e2e_ordering.test.ts b/yarn-project/end-to-end/src/automine/execution/ordering.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_ordering.test.ts rename to yarn-project/end-to-end/src/automine/execution/ordering.test.ts index eb9f0e214cdf..f3cf951386cd 100644 --- a/yarn-project/end-to-end/src/e2e_ordering.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/ordering.test.ts @@ -13,17 +13,16 @@ import { computeCalldataHash } from '@aztec/stdlib/hash'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // See https://github.com/AztecProtocol/aztec-packages/issues/1601 // Verifies deterministic execution ordering for enqueued public calls and public state updates. // Uses a single node with AutomineSequencer; each test mines one block per call via beforeEach setup. -describe('e2e_ordering', () => { +describe('automine/execution/ordering', () => { jest.setTimeout(TIMEOUT); let wallet: TestWallet; @@ -50,7 +49,7 @@ describe('e2e_ordering', () => { wallet, aztecNode, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); }, TIMEOUT); afterEach(() => teardown()); diff --git a/yarn-project/end-to-end/src/e2e_phase_check.test.ts b/yarn-project/end-to-end/src/automine/execution/phase_check.parallel.test.ts similarity index 92% rename from yarn-project/end-to-end/src/e2e_phase_check.test.ts rename to yarn-project/end-to-end/src/automine/execution/phase_check.parallel.test.ts index 5dcb027a5e1a..23b0b7deb573 100644 --- a/yarn-project/end-to-end/src/e2e_phase_check.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/phase_check.parallel.test.ts @@ -9,16 +9,15 @@ import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contra import { PublicDataTreeLeaf } from '@aztec/stdlib/trees'; import { defaultInitialAccountFeeJuice } from '@aztec/world-state/testing'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Private functions should receive automatically a phase check that avoids any nested call changing the phase. // Functions that opt out of this phase check can be marked with #[allow_phase_change]. // // Uses a single node with AutomineSequencer. The setup pre-funds a custom SponsoredFPC via genesisPublicData // so that fee payment can be crafted without ending the setup phase, which is needed to trigger the phase-change error. -describe('Phase check', () => { +describe('automine/execution/phase_check', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let teardown: () => Promise; @@ -37,7 +36,7 @@ describe('Phase check', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS, genesisPublicData: [genesisBalanceEntry] })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1, genesisPublicData: [genesisBalanceEntry] })).context); ({ contract } = await TestContract.deploy(wallet).send({ from: defaultAccountAddress })); sponsoredFPC = await SponsoredFPCNoEndSetupContract.deploy(wallet, { diff --git a/yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts b/yarn-project/end-to-end/src/automine/execution/private_voting.test.ts similarity index 92% rename from yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts rename to yarn-project/end-to-end/src/automine/execution/private_voting.test.ts index 3dcbd0157746..74a103240c34 100644 --- a/yarn-project/end-to-end/src/e2e_private_voting_contract.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/private_voting.test.ts @@ -5,12 +5,11 @@ import type { Wallet } from '@aztec/aztec.js/wallet'; import { PrivateVotingContract } from '@aztec/noir-contracts.js/PrivateVoting'; import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies the PrivateVoting contract's nullifier-based double-vote prevention. Uses a single node // with AutomineSequencer and one account. -describe('e2e_voting_contract', () => { +describe('automine/execution/private_voting', () => { let wallet: Wallet; let logger: Logger; @@ -26,7 +25,7 @@ describe('e2e_voting_contract', () => { wallet, logger, accounts: [owner], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract: votingContract } = await PrivateVotingContract.deploy(wallet, owner).send({ from: owner })); diff --git a/yarn-project/end-to-end/src/e2e_state_vars.test.ts b/yarn-project/end-to-end/src/automine/execution/state_vars.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_state_vars.test.ts rename to yarn-project/end-to-end/src/automine/execution/state_vars.test.ts index 91b22307ca83..b4cf40c2c88c 100644 --- a/yarn-project/end-to-end/src/e2e_state_vars.test.ts +++ b/yarn-project/end-to-end/src/automine/execution/state_vars.test.ts @@ -7,10 +7,9 @@ import { StateVarsContract } from '@aztec/noir-test-contracts.js/StateVars'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -18,7 +17,7 @@ const TIMEOUT = 300_000; // via the StateVars and Auth contracts. Single node with AutomineSequencer. The DelayedPublicMutable sub-suite // reads DefaultL1ContractsConfig.aztecSlotDuration as a static constant (72) for delay arithmetic and asserts // it has not changed; the runtime slot set by AUTOMINE_E2E_OPTS (12s) is irrelevant to that assertion. -describe('e2e_state_vars', () => { +describe('automine/execution/state_vars', () => { jest.setTimeout(TIMEOUT); let aztecNode: AztecNode; @@ -37,7 +36,7 @@ describe('e2e_state_vars', () => { aztecNode, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await StateVarsContract.deploy(wallet).send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_expiration_timestamp.test.ts b/yarn-project/end-to-end/src/automine/lifecycle/expiration_timestamp.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_expiration_timestamp.test.ts rename to yarn-project/end-to-end/src/automine/lifecycle/expiration_timestamp.test.ts index a42b04e229dc..3bffa060ed0f 100644 --- a/yarn-project/end-to-end/src/e2e_expiration_timestamp.test.ts +++ b/yarn-project/end-to-end/src/automine/lifecycle/expiration_timestamp.test.ts @@ -5,16 +5,15 @@ import { TestContract } from '@aztec/noir-test-contracts.js/Test'; import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; import { TX_ERROR_INVALID_EXPIRATION_TIMESTAMP } from '@aztec/stdlib/tx'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Covers transaction expiration-timestamp enforcement: setting a valid expiration succeeds, setting // one below the mined block timestamp fails at prove time, and setting one that is then warped past // by L1 time causes rejection at submission. Uses a single automine node; L1 time is warped via // cheatCodes.eth.warp in the invalidation tests. -describe('e2e_expiration_timestamp', () => { +describe('automine/lifecycle/expiration_timestamp', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let aztecNode: AztecNode & AztecNodeDebug; @@ -32,7 +31,7 @@ describe('e2e_expiration_timestamp', () => { aztecNode, cheatCodes, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await TestContract.deploy(wallet).send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_genesis_timestamp.test.ts b/yarn-project/end-to-end/src/automine/lifecycle/genesis_timestamp.parallel.test.ts similarity index 94% rename from yarn-project/end-to-end/src/e2e_genesis_timestamp.test.ts rename to yarn-project/end-to-end/src/automine/lifecycle/genesis_timestamp.parallel.test.ts index 26f17f834832..a2477b4a3004 100644 --- a/yarn-project/end-to-end/src/e2e_genesis_timestamp.test.ts +++ b/yarn-project/end-to-end/src/automine/lifecycle/genesis_timestamp.parallel.test.ts @@ -3,9 +3,9 @@ import { NO_FROM } from '@aztec/aztec.js/account'; import { createLogger } from '@aztec/aztec.js/log'; import { retryUntil } from '@aztec/foundation/retry'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { type EndToEndContext, setup } from './fixtures/utils.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import type { EndToEndContext } from '../../fixtures/utils.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies that genesis-anchored transactions (proved while PXE is pinned to block 0) can be // included in blocks after block 1, and that PXE can prove transactions anchored to genesis even @@ -14,7 +14,7 @@ import { proveInteraction } from './test-wallet/utils.js'; // syncChainTip='proven' so the anchor stays at genesis until a real proof lands, which never happens // in these tests (no prover node running). (v5: replaced skipAccountDeployment with // advancePastGenesis=false + explicit additionallyFundedAccounts.) -describe('e2e_genesis_timestamp', () => { +describe('automine/lifecycle/genesis_timestamp', () => { let context: EndToEndContext; const logger = createLogger('e2e:genesis_timestamp'); @@ -24,10 +24,9 @@ describe('e2e_genesis_timestamp', () => { // anchor lags behind proposed blocks. Under AUTOMINE_E2E_OPTS the AnvilTestWatcher is disabled // and the AutomineSequencer never marks blocks as proven on its own, so without a prover node // the proven tip stays at genesis for the duration of the test. - context = await setup( - 0, - { - ...AUTOMINE_E2E_OPTS, + context = ( + await AutomineTestContext.setup({ + numberOfAccounts: 0, // This suite pins the proven tip at genesis (no prover node, syncChainTip:'proven', // advancePastGenesis:false) and asserts on genesis-anchored txs. Mining the L1 setup txs // instantly shifts how far L1 time advances past the rollup genesis during deployment, which @@ -36,9 +35,9 @@ describe('e2e_genesis_timestamp', () => { advancePastGenesis: false, // This test proves genesis-anchored account deployment txs, so it needs deployable accounts additionallyFundedAccounts: await generateSchnorrAccounts(2, 'schnorr'), - }, - { syncChainTip: 'proven' }, - ); + pxeOpts: { syncChainTip: 'proven' }, + }) + ).context; }); afterEach(() => context.teardown()); diff --git a/yarn-project/end-to-end/src/e2e_pruned_blocks.test.ts b/yarn-project/end-to-end/src/automine/lifecycle/pruned_blocks.test.ts similarity index 92% rename from yarn-project/end-to-end/src/e2e_pruned_blocks.test.ts rename to yarn-project/end-to-end/src/automine/lifecycle/pruned_blocks.test.ts index 7918378715b5..401781af00ac 100644 --- a/yarn-project/end-to-end/src/e2e_pruned_blocks.test.ts +++ b/yarn-project/end-to-end/src/automine/lifecycle/pruned_blocks.test.ts @@ -9,8 +9,7 @@ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client' import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Tests PXE interacting with a node that has pruned relevant blocks, preventing usage of the archive API (which PXE // should not rely on). @@ -18,7 +17,7 @@ import { setup } from './fixtures/utils.js'; // Uses a single node with AutomineSequencer, worldStateCheckpointHistory=2, and // aztecProofSubmissionEpochs=1024 (effectively no reorg). markAsProven + extra L1 blocks cause world-state // to prune old block data; the test then verifies that PXE can still discover notes from pruned blocks. -describe('e2e_pruned_blocks', () => { +describe('automine/lifecycle/pruned_blocks', () => { jest.setTimeout(5 * 60 * 1000); let logger: Logger; @@ -50,13 +49,15 @@ describe('e2e_pruned_blocks', () => { teardown, wallet, accounts: [admin, sender, recipient], - } = await setup(3, { - ...AUTOMINE_E2E_OPTS, - worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY, - worldStateBlockCheckIntervalMS: WORLD_STATE_CHECK_INTERVAL_MS, - archiverPollingIntervalMS: ARCHIVER_POLLING_INTERVAL_MS, - aztecProofSubmissionEpochs: 1024, // effectively do not reorg - })); + } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 3, + worldStateCheckpointHistory: WORLD_STATE_CHECKPOINT_HISTORY, + worldStateBlockCheckIntervalMS: WORLD_STATE_CHECK_INTERVAL_MS, + archiverPollingIntervalMS: ARCHIVER_POLLING_INTERVAL_MS, + aztecProofSubmissionEpochs: 1024, // effectively do not reorg + }) + ).context); ({ contract: token } = await TokenContract.deploy(wallet, admin, 'TEST', '$TST', 18).send({ from: admin })); logger.info(`L2 token contract deployed at ${token.address}`); diff --git a/yarn-project/end-to-end/src/e2e_pxe.test.ts b/yarn-project/end-to-end/src/automine/lifecycle/pxe.test.ts similarity index 84% rename from yarn-project/end-to-end/src/e2e_pxe.test.ts rename to yarn-project/end-to-end/src/automine/lifecycle/pxe.test.ts index ce0092793338..5fa7df339b9c 100644 --- a/yarn-project/end-to-end/src/e2e_pxe.test.ts +++ b/yarn-project/end-to-end/src/automine/lifecycle/pxe.test.ts @@ -3,15 +3,14 @@ import { Fr } from '@aztec/aztec.js/fields'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // TODO: Ideally these would be unit tests for PXE, but some functions like simulateTx, proveTx, etc require // more complex setup // // Exercises PXE simulation error paths that require a running node. Single node with AutomineSequencer. -describe('e2e_pxe', () => { +describe('automine/lifecycle/pxe', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let teardown: () => Promise; @@ -23,7 +22,7 @@ describe('e2e_pxe', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await TestContract.deploy(wallet).send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_custom_message.test.ts b/yarn-project/end-to-end/src/automine/notes/custom_message.parallel.test.ts similarity index 94% rename from yarn-project/end-to-end/src/e2e_custom_message.test.ts rename to yarn-project/end-to-end/src/automine/notes/custom_message.parallel.test.ts index 19b982f08856..abbd6bc28eae 100644 --- a/yarn-project/end-to-end/src/e2e_custom_message.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/custom_message.parallel.test.ts @@ -7,15 +7,14 @@ import { CustomMessageContract, type MultiLogEvent } from '@aztec/noir-test-cont import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // Tests the CustomMessage contract's multi-log event pattern: emitting a single event split across // multiple private logs and reassembling it via wallet.getPrivateEvents. // Uses setup(1, AUTOMINE_E2E_OPTS) with one node, automine sequencer, one account. -describe('CustomMessage - Multi-Log Pattern', () => { +describe('automine/notes/custom_message', () => { let contract: CustomMessageContract; jest.setTimeout(TIMEOUT); @@ -28,7 +27,7 @@ describe('CustomMessage - Multi-Log Pattern', () => { teardown, wallet, accounts: [account], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await CustomMessageContract.deploy(wallet).send({ from: account })); }); diff --git a/yarn-project/end-to-end/src/e2e_event_logs.test.ts b/yarn-project/end-to-end/src/automine/notes/event_logs.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_event_logs.test.ts rename to yarn-project/end-to-end/src/automine/notes/event_logs.test.ts index c563539f0ba8..37103ab7fed2 100644 --- a/yarn-project/end-to-end/src/e2e_event_logs.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/event_logs.test.ts @@ -17,8 +17,7 @@ import { import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -26,7 +25,7 @@ const TIMEOUT = 300_000; // public-log event emission and retrieval (unencrypted events via getPublicEvents), including nested // events with struct fields and tagging-cache reconciliation against kernel squashing. Uses a single // automine node with two genesis-funded Schnorr accounts and a deployed TestLogContract. -describe('Logs', () => { +describe('automine/notes/event_logs', () => { let testLogContract: TestLogContract; jest.setTimeout(TIMEOUT); @@ -46,7 +45,7 @@ describe('Logs', () => { accounts: [account1Address, account2Address], aztecNode, logger: log, - } = await setup(2, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 2 })).context); log.warn(`Deploying test contract`); ({ contract: testLogContract } = await TestLogContract.deploy(wallet).send({ from: account1Address })); diff --git a/yarn-project/end-to-end/src/e2e_event_only.test.ts b/yarn-project/end-to-end/src/automine/notes/event_only.test.ts similarity index 90% rename from yarn-project/end-to-end/src/e2e_event_only.test.ts rename to yarn-project/end-to-end/src/automine/notes/event_only.test.ts index 845f1c82d839..801b4191626a 100644 --- a/yarn-project/end-to-end/src/e2e_event_only.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/event_only.test.ts @@ -6,14 +6,13 @@ import { EventOnlyContract, type TestEvent } from '@aztec/noir-test-contracts.js import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; /// Tests that a private event can be obtained for a contract that does not work with notes. // Single automine node, one genesis-funded account, EventOnlyContract deployed in beforeAll. -describe('EventOnly', () => { +describe('automine/notes/event_only', () => { let eventOnlyContract: EventOnlyContract; jest.setTimeout(TIMEOUT); @@ -26,7 +25,7 @@ describe('EventOnly', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract: eventOnlyContract } = await EventOnlyContract.deploy(wallet).send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_large_public_event.test.ts b/yarn-project/end-to-end/src/automine/notes/large_public_event.test.ts similarity index 90% rename from yarn-project/end-to-end/src/e2e_large_public_event.test.ts rename to yarn-project/end-to-end/src/automine/notes/large_public_event.test.ts index eb29962fabc9..dbc855562eee 100644 --- a/yarn-project/end-to-end/src/e2e_large_public_event.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/large_public_event.test.ts @@ -8,14 +8,13 @@ import type { AztecAddress } from '@aztec/stdlib/aztec-address'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; /// Tests that events exceeding MAX_EVENT_SERIALIZED_LEN can be emitted publicly. // Single automine node, one funded account, LargePublicEventContract deployed in beforeAll. -describe('LargePublicEvent', () => { +describe('automine/notes/large_public_event', () => { let contract: LargePublicEventContract; jest.setTimeout(TIMEOUT); @@ -30,7 +29,7 @@ describe('LargePublicEvent', () => { wallet, aztecNode, accounts: [accountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await LargePublicEventContract.deploy(wallet).send({ from: accountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_note_getter.test.ts b/yarn-project/end-to-end/src/automine/notes/note_getter.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_note_getter.test.ts rename to yarn-project/end-to-end/src/automine/notes/note_getter.test.ts index c05f07f35560..96572616d4e1 100644 --- a/yarn-project/end-to-end/src/e2e_note_getter.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/note_getter.test.ts @@ -4,8 +4,7 @@ import type { Wallet } from '@aztec/aztec.js/wallet'; import { NoteGetterContract } from '@aztec/noir-test-contracts.js/NoteGetter'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; interface NoirBoundedVec { storage: T[]; @@ -19,7 +18,7 @@ function boundedVecToArray(boundedVec: NoirBoundedVec): T[] { // Covers the NoteGetter contract's filtering capabilities (EQ, NEQ, LT, GT, LTE, GTE comparators // and sub-field property selectors) and the TestContract's note status filter (active vs nullified). // Single automine node, one funded account, contracts deployed per describe block. -describe('e2e_note_getter', () => { +describe('automine/notes/note_getter', () => { let wallet: Wallet; let defaultAddress: AztecAddress; let teardown: () => Promise; @@ -29,7 +28,7 @@ describe('e2e_note_getter', () => { teardown, wallet, accounts: [defaultAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); }); afterAll(() => teardown()); diff --git a/yarn-project/end-to-end/src/e2e_offchain_effect.test.ts b/yarn-project/end-to-end/src/automine/notes/offchain_effect.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_offchain_effect.test.ts rename to yarn-project/end-to-end/src/automine/notes/offchain_effect.parallel.test.ts index 1fbaee2d6ae2..d4e582e284c4 100644 --- a/yarn-project/end-to-end/src/e2e_offchain_effect.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/offchain_effect.parallel.test.ts @@ -5,10 +5,9 @@ import { OffchainEffectContract, type TestEvent } from '@aztec/noir-test-contrac import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -16,7 +15,7 @@ const TIMEOUT = 300_000; // proveInteraction, and the offchain-message delivery flow (emitting an event or note as an // offchain message, then delivering it via offchain_receive and retrieving via getPrivateEvents). // Single automine node, one funded account, two OffchainEffectContract instances. -describe('e2e_offchain_effect', () => { +describe('automine/notes/offchain_effect', () => { let contract1: OffchainEffectContract; let contract2: OffchainEffectContract; @@ -30,7 +29,7 @@ describe('e2e_offchain_effect', () => { teardown, wallet, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract: contract1 } = await OffchainEffectContract.deploy(wallet).send({ from: defaultAccountAddress })); ({ contract: contract2 } = await OffchainEffectContract.deploy(wallet).send({ from: defaultAccountAddress })); }); diff --git a/yarn-project/end-to-end/src/e2e_offchain_payment.test.ts b/yarn-project/end-to-end/src/automine/notes/offchain_payment.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_offchain_payment.test.ts rename to yarn-project/end-to-end/src/automine/notes/offchain_payment.parallel.test.ts index b39311aa079a..05088cc76208 100644 --- a/yarn-project/end-to-end/src/e2e_offchain_payment.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/offchain_payment.parallel.test.ts @@ -8,17 +8,17 @@ import { OffchainPaymentContract } from '@aztec/noir-test-contracts.js/OffchainP import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { getLogger, setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; -import { proveInteraction } from './test-wallet/utils.js'; +import { getLogger } from '../../fixtures/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { proveInteraction } from '../../test-wallet/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // Tests the OffchainPayment contract's offchain message delivery mechanism. Uses a single node with the // AutomineSequencer so each tx mines a block immediately. Also exercises the AutomineSequencer's // revertToCheckpoint to simulate a reorg and verify that offchain-delivered notes are reprocessed correctly. -describe('e2e_offchain_payment', () => { +describe('automine/notes/offchain_payment', () => { let contract: OffchainPaymentContract; let aztecNode: AztecNode; let aztecNodeService: AztecNodeService; @@ -30,10 +30,12 @@ describe('e2e_offchain_payment', () => { jest.setTimeout(TIMEOUT); beforeAll(async () => { - ({ teardown, wallet, accounts, aztecNode, aztecNodeService } = await setup(2, { - ...AUTOMINE_E2E_OPTS, - anvilSlotsInAnEpoch: 32, - })); + ({ teardown, wallet, accounts, aztecNode, aztecNodeService } = ( + await AutomineTestContext.setup({ + numberOfAccounts: 2, + anvilSlotsInAnEpoch: 32, + }) + ).context); }); afterAll(() => teardown()); diff --git a/yarn-project/end-to-end/src/e2e_partial_notes.test.ts b/yarn-project/end-to-end/src/automine/notes/partial_notes.test.ts similarity index 84% rename from yarn-project/end-to-end/src/e2e_partial_notes.test.ts rename to yarn-project/end-to-end/src/automine/notes/partial_notes.test.ts index 405d056a181e..c19631d41d7a 100644 --- a/yarn-project/end-to-end/src/e2e_partial_notes.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/partial_notes.test.ts @@ -5,15 +5,14 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { deployToken, mintTokensToPrivate } from './fixtures/token_utils.js'; -import { setup } from './fixtures/utils.js'; +import { deployToken, mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; // Smoke test for the partial-note pattern: minting tokens into a private note via the // Token contract's mint_to_private path. Single node with AutomineSequencer. -describe('partial notes', () => { +describe('automine/notes/partial_notes', () => { jest.setTimeout(TIMEOUT); let teardown: () => Promise; @@ -35,7 +34,7 @@ describe('partial notes', () => { wallet, accounts: [adminAddress, liquidityProviderAddress], logger, - } = await setup(2, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 2 })).context); const { contract } = await deployToken(wallet, adminAddress, 0n, logger); token0 = contract; diff --git a/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts b/yarn-project/end-to-end/src/automine/notes/pending_note_hashes.parallel.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts rename to yarn-project/end-to-end/src/automine/notes/pending_note_hashes.parallel.test.ts index 0604823ed985..e1d3a2b6d6a7 100644 --- a/yarn-project/end-to-end/src/e2e_pending_note_hashes_contract.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/pending_note_hashes.parallel.test.ts @@ -10,14 +10,13 @@ import { } from '@aztec/constants'; import { PendingNoteHashesContract } from '@aztec/noir-test-contracts.js/PendingNoteHashes'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Verifies the kernel's pending-note-hash squashing logic: notes created and nullified in the same tx // are not persisted to the tree. Uses a single node with AutomineSequencer; contracts are deployed // per-test via deployContract(). -describe('e2e_pending_note_hashes_contract', () => { +describe('automine/notes/pending_note_hashes', () => { let aztecNode: AztecNode; let wallet: TestWallet; let owner: AztecAddress; @@ -32,7 +31,7 @@ describe('e2e_pending_note_hashes_contract', () => { wallet, logger, accounts: [owner], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); }); afterAll(() => teardown()); diff --git a/yarn-project/end-to-end/src/e2e_tx_effect_oracle.test.ts b/yarn-project/end-to-end/src/automine/notes/tx_effect_oracle.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_tx_effect_oracle.test.ts rename to yarn-project/end-to-end/src/automine/notes/tx_effect_oracle.parallel.test.ts index 78764f52f1d1..0bb9ff64c32b 100644 --- a/yarn-project/end-to-end/src/e2e_tx_effect_oracle.test.ts +++ b/yarn-project/end-to-end/src/automine/notes/tx_effect_oracle.parallel.test.ts @@ -19,8 +19,7 @@ import type { TxEffect, TxHash } from '@aztec/stdlib/tx'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 120_000; @@ -34,7 +33,7 @@ const TIMEOUT = 120_000; // obtained tx effect from oracle with the one obtained directly in TS. // // Uses a single node with AutomineSequencer and one account. -describe('e2e tx effect oracle', () => { +describe('automine/notes/tx_effect_oracle', () => { let contract: TxEffectOracleTestContract; let deployTxHash: TxHash; jest.setTimeout(TIMEOUT); @@ -50,7 +49,7 @@ describe('e2e tx effect oracle', () => { wallet, aztecNode, accounts: [defaultAccountAddress], - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); const { contract: deployed, receipt } = await TxEffectOracleTestContract.deploy(wallet).send({ from: defaultAccountAddress, }); diff --git a/yarn-project/end-to-end/src/e2e_automine_smoke.test.ts b/yarn-project/end-to-end/src/automine/smoke/smoke.parallel.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_automine_smoke.test.ts rename to yarn-project/end-to-end/src/automine/smoke/smoke.parallel.test.ts index f85a6c7f666c..0f064e23c178 100644 --- a/yarn-project/end-to-end/src/e2e_automine_smoke.test.ts +++ b/yarn-project/end-to-end/src/automine/smoke/smoke.parallel.test.ts @@ -11,13 +11,12 @@ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client' import { jest } from '@jest/globals'; import 'jest-extended'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Smoke tests for the AutomineSequencer: verifies that sequential and parallel txs land correctly, // time warps work, mineBlock produces checkpoints, and revertToCheckpoint restores chain state. // Uses setup(1, AUTOMINE_E2E_OPTS) providing one node with AutomineSequencer. -describe('e2e_automine_smoke', () => { +describe('automine/smoke/smoke', () => { jest.setTimeout(10 * 60 * 1000); let teardown: () => Promise; @@ -36,7 +35,7 @@ describe('e2e_automine_smoke', () => { wallet, accounts: [owner], cheatCodes, - } = await setup(1, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context); ({ contract } = await TestContract.deploy(wallet).send({ from: owner })); }); diff --git a/yarn-project/end-to-end/src/e2e_amm.test.ts b/yarn-project/end-to-end/src/automine/token/amm.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_amm.test.ts rename to yarn-project/end-to-end/src/automine/token/amm.test.ts index cec42bc3ac71..b65beb77d206 100644 --- a/yarn-project/end-to-end/src/e2e_amm.test.ts +++ b/yarn-project/end-to-end/src/automine/token/amm.test.ts @@ -6,10 +6,9 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { deployToken, mintTokensToPrivate } from './fixtures/token_utils.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { deployToken, mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 900_000; @@ -18,7 +17,7 @@ const TIMEOUT = 900_000; // sequencer, four funded accounts (admin, two LPs, swapper), and three deployed Token contracts. // TODO(F-560): Consider whether it makes sense to drop this // https://linear.app/aztec-labs/issue/F-560/add-more-tests-to-forward-compatibility-testing -describe('AMM', () => { +describe('automine/token/amm', () => { jest.setTimeout(TIMEOUT); let teardown: () => Promise; @@ -54,7 +53,7 @@ describe('AMM', () => { wallet, accounts: [adminAddress, liquidityProviderAddress, otherLiquidityProviderAddress, swapperAddress], logger, - } = await setup(4, { ...AUTOMINE_E2E_OPTS }, { syncChainTip: 'checkpointed' })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 4, pxeOpts: { syncChainTip: 'checkpointed' } })).context); ({ contract: token0 } = await deployToken(wallet, adminAddress, 0n, logger)); ({ contract: token1 } = await deployToken(wallet, adminAddress, 0n, logger)); diff --git a/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts b/yarn-project/end-to-end/src/automine/token/crowdfunding_and_claim.parallel.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts rename to yarn-project/end-to-end/src/automine/token/crowdfunding_and_claim.parallel.test.ts index bed7cffbe82b..c5ed4e47108f 100644 --- a/yarn-project/end-to-end/src/e2e_crowdfunding_and_claim.test.ts +++ b/yarn-project/end-to-end/src/automine/token/crowdfunding_and_claim.parallel.test.ts @@ -10,17 +10,17 @@ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client' import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { mintTokensToPrivate } from './fixtures/token_utils.js'; -import { ensurePublicChecksPublished, setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import { ensurePublicChecksPublished } from '../../fixtures/utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; jest.setTimeout(400_000); // Tests crowdfunding via the Crowdfunding contract and claiming the reward token via the Claim contract. // Uses setup(3, AUTOMINE_E2E_OPTS) with one node, automine sequencer, three accounts (operator, 2 donors). // One test warps L1 time via cheatCodes.eth.warp to pass the deadline. jest.setTimeout(400s). -describe('e2e_crowdfunding_and_claim', () => { +describe('automine/token/crowdfunding_and_claim', () => { const donationTokenMetadata = { name: 'Donation Token', symbol: 'DNT', @@ -63,7 +63,7 @@ describe('e2e_crowdfunding_and_claim', () => { wallet, aztecNode: _aztecNode, accounts: [operatorAddress, donor1Address, donor2Address], - } = await setup(3, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 3 })).context); // Crowdfunding's `donate` calls `privately_check_timestamp`, which dispatches into the deployed // PublicChecks contract. Publish PublicChecks before the test runs anything that uses it. diff --git a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts b/yarn-project/end-to-end/src/automine/token/escrow.parallel.test.ts similarity index 93% rename from yarn-project/end-to-end/src/e2e_escrow_contract.test.ts rename to yarn-project/end-to-end/src/automine/token/escrow.parallel.test.ts index 330ddf9f5425..131dc68be0f2 100644 --- a/yarn-project/end-to-end/src/e2e_escrow_contract.test.ts +++ b/yarn-project/end-to-end/src/automine/token/escrow.parallel.test.ts @@ -7,15 +7,14 @@ import { EscrowContract } from '@aztec/noir-contracts.js/Escrow'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; import type { PublicKeys } from '@aztec/stdlib/keys'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { expectTokenBalance, mintTokensToPrivate } from './fixtures/token_utils.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { expectTokenBalance, mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Tests the Escrow contract: withdrawing to a recipient, access-control enforcement, and // multi-key batch operations. Uses setup(2, AUTOMINE_E2E_OPTS) with one node, automine sequencer, // and two funded accounts (owner, recipient). A fresh escrow and token are deployed in beforeEach. -describe('e2e_escrow_contract', () => { +describe('automine/token/escrow', () => { let wallet: TestWallet; let logger: Logger; @@ -36,7 +35,7 @@ describe('e2e_escrow_contract', () => { wallet, accounts: [owner, recipient], logger, - } = await setup(2, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 2 })).context); // Generate private key for escrow contract, register key in PXE, and deploy // Note that we need to register it first if we want to emit an encrypted note for it in the constructor diff --git a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts b/yarn-project/end-to-end/src/automine/token/lending.parallel.test.ts similarity index 97% rename from yarn-project/end-to-end/src/e2e_lending_contract.test.ts rename to yarn-project/end-to-end/src/automine/token/lending.parallel.test.ts index 56a044664ab4..ab781010f946 100644 --- a/yarn-project/end-to-end/src/e2e_lending_contract.test.ts +++ b/yarn-project/end-to-end/src/automine/token/lending.parallel.test.ts @@ -12,18 +12,18 @@ import { TokenContract } from '@aztec/noir-contracts.js/Token'; import { afterAll, jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import type { EndToEndContext } from './fixtures/setup.js'; -import { mintTokensToPrivate } from './fixtures/token_utils.js'; -import { ensureAuthRegistryPublished, setup } from './fixtures/utils.js'; -import { LendingAccount, LendingSimulator, TokenSimulator } from './simulators/index.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import type { EndToEndContext } from '../../fixtures/setup.js'; +import { mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import { ensureAuthRegistryPublished } from '../../fixtures/utils.js'; +import { LendingAccount, LendingSimulator, TokenSimulator } from '../../simulators/index.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; // Covers the full lifecycle of the Lending contract (deposit, borrow, repay, withdraw) in both // private (🥸) and public paths, with and without authorization witnesses. Uses a single automine // node; LendingSimulator tracks expected state and verifies after each test. Note that the // lendingSim.progressSlots calls advance slot time on the simulator (not L1 time directly). -describe('e2e_lending_contract', () => { +describe('automine/token/lending', () => { jest.setTimeout(100_000); let wallet: TestWallet; let defaultAccountAddress: AztecAddress; @@ -85,7 +85,7 @@ describe('e2e_lending_contract', () => { }; beforeAll(async () => { - const ctx = await setup(1, { ...AUTOMINE_E2E_OPTS }); + const ctx = (await AutomineTestContext.setup({ numberOfAccounts: 1 })).context; ({ teardown, logger, diff --git a/yarn-project/end-to-end/src/e2e_nft.test.ts b/yarn-project/end-to-end/src/automine/token/nft.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_nft.test.ts rename to yarn-project/end-to-end/src/automine/token/nft.parallel.test.ts index 04bd19842852..97768d4ee01e 100644 --- a/yarn-project/end-to-end/src/e2e_nft.test.ts +++ b/yarn-project/end-to-end/src/automine/token/nft.parallel.test.ts @@ -5,8 +5,7 @@ import { NFTContract } from '@aztec/noir-contracts.js/NFT'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { setup } from './fixtures/utils.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -14,7 +13,7 @@ const TIMEOUT = 300_000; // This test is only kept around to check that public data writes are squashed as expected. // Single automine node, four funded accounts (admin, minter, user1, user2), NFTContract deployed. // Tests are sequential: each depends on the state left by the previous. -describe('NFT', () => { +describe('automine/token/nft', () => { jest.setTimeout(TIMEOUT); let teardown: () => Promise; @@ -33,7 +32,7 @@ describe('NFT', () => { beforeAll(async () => { let accounts: AztecAddress[]; - ({ teardown, wallet, accounts } = await setup(4, { ...AUTOMINE_E2E_OPTS })); + ({ teardown, wallet, accounts } = (await AutomineTestContext.setup({ numberOfAccounts: 4 })).context); [adminAddress, minterAddress, user1Address, user2Address] = accounts; ({ contract: nftContract } = await NFTContract.deploy(wallet, adminAddress, 'FROG', 'FRG').send({ diff --git a/yarn-project/end-to-end/src/e2e_orderbook.test.ts b/yarn-project/end-to-end/src/automine/token/orderbook.test.ts similarity index 95% rename from yarn-project/end-to-end/src/e2e_orderbook.test.ts rename to yarn-project/end-to-end/src/automine/token/orderbook.test.ts index d9b6390ae178..00a03a253df7 100644 --- a/yarn-project/end-to-end/src/e2e_orderbook.test.ts +++ b/yarn-project/end-to-end/src/automine/token/orderbook.test.ts @@ -9,10 +9,9 @@ import type { TokenContract } from '@aztec/noir-contracts.js/Token'; import { jest } from '@jest/globals'; -import { AUTOMINE_E2E_OPTS } from './fixtures/fixtures.js'; -import { deployToken, mintTokensToPrivate } from './fixtures/token_utils.js'; -import { setup } from './fixtures/utils.js'; -import type { TestWallet } from './test-wallet/test_wallet.js'; +import { deployToken, mintTokensToPrivate } from '../../fixtures/token_utils.js'; +import type { TestWallet } from '../../test-wallet/test_wallet.js'; +import { AutomineTestContext } from '../automine_test_context.js'; const TIMEOUT = 300_000; @@ -24,7 +23,7 @@ const TIMEOUT = 300_000; // Exercises the Orderbook contract's create_order / fulfill_order flow. Uses a single node with AutomineSequencer // and three accounts (admin, maker, taker). Each step lands in its own block; the partial note opened by // create_order is completed in fulfill_order's block. -describe('Orderbook', () => { +describe('automine/token/orderbook', () => { jest.setTimeout(TIMEOUT); let teardown: () => Promise; @@ -52,7 +51,7 @@ describe('Orderbook', () => { accounts: [adminAddress, makerAddress, takerAddress], aztecNode, logger, - } = await setup(3, { ...AUTOMINE_E2E_OPTS })); + } = (await AutomineTestContext.setup({ numberOfAccounts: 3 })).context); ({ contract: token0 } = await deployToken(wallet, adminAddress, 0n, logger)); ({ contract: token1 } = await deployToken(wallet, adminAddress, 0n, logger)); diff --git a/yarn-project/end-to-end/src/e2e_snapshot_sync.test.ts b/yarn-project/end-to-end/src/single-node/sync/snapshot_sync.test.ts similarity index 98% rename from yarn-project/end-to-end/src/e2e_snapshot_sync.test.ts rename to yarn-project/end-to-end/src/single-node/sync/snapshot_sync.test.ts index c9dc8eb08464..1296d0c06bb8 100644 --- a/yarn-project/end-to-end/src/e2e_snapshot_sync.test.ts +++ b/yarn-project/end-to-end/src/single-node/sync/snapshot_sync.test.ts @@ -15,8 +15,8 @@ import { cp, mkdtemp, readFile, readdir, rm, writeFile } from 'fs/promises'; import { tmpdir } from 'os'; import { join } from 'path'; -import { PIPELINING_SETUP_OPTS } from './fixtures/fixtures.js'; -import { type EndToEndContext, setup } from './fixtures/utils.js'; +import { PIPELINING_SETUP_OPTS } from '../../fixtures/fixtures.js'; +import { type EndToEndContext, setup } from '../../fixtures/utils.js'; const L1_BLOCK_TIME_IN_S = process.env.L1_BLOCK_TIME ? parseInt(process.env.L1_BLOCK_TIME) : 8; const L2_TARGET_BLOCK_NUM = 3; From e2d72aee9850c801f2071aa009c3dc156aafbd3a Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 18:22:06 -0300 Subject: [PATCH 5/7] refactor(e2e): re-bucket automine second level The execution/ and lifecycle/ buckets had become grab-bags, so they are dissolved. notes/ is renamed to effects/ (note discovery, events, offchain effects) and gains pruned_blocks (note rediscovery after a prune). A new simulation/ folder holds avm_simulator, kernelless_simulation, and the circuit recorder. The ABI/storage-surface tests (abi_types, option_params, state_vars) move into contracts/. The genuine miscellany (smoke, ordering, double_spend, phase_check, mempool_limit, card_game, private_voting, expiration_timestamp, genesis_timestamp, pxe) is flattened to the automine/ root: a second-level folder is created only when it earns its keep. CI test discovery in bootstrap.sh and the .test_patterns.yml path entry are updated to match; per-file describe titles are repointed to their new paths. --- .test_patterns.yml | 2 +- yarn-project/end-to-end/bootstrap.sh | 16 +++++++--------- yarn-project/end-to-end/src/automine/README.md | 17 ++++++++++------- .../automine/{execution => }/card_game.test.ts | 6 +++--- .../abi_types.parallel.test.ts | 2 +- .../option_params.parallel.test.ts | 2 +- .../{execution => contracts}/state_vars.test.ts | 2 +- .../{execution => }/double_spend.test.ts | 4 ++-- .../custom_message.parallel.test.ts | 2 +- .../{notes => effects}/event_logs.test.ts | 2 +- .../{notes => effects}/event_only.test.ts | 2 +- .../large_public_event.test.ts | 2 +- .../{notes => effects}/note_getter.test.ts | 2 +- .../offchain_effect.parallel.test.ts | 2 +- .../offchain_payment.parallel.test.ts | 2 +- .../{notes => effects}/partial_notes.test.ts | 2 +- .../pending_note_hashes.parallel.test.ts | 2 +- .../pruned_blocks.test.ts | 2 +- .../tx_effect_oracle.parallel.test.ts | 2 +- .../expiration_timestamp.test.ts | 8 ++++---- .../genesis_timestamp.parallel.test.ts | 8 ++++---- .../{execution => }/mempool_limit.test.ts | 10 +++++----- .../automine/{execution => }/ordering.test.ts | 8 ++++---- .../phase_check.parallel.test.ts | 6 +++--- .../{execution => }/private_voting.test.ts | 4 ++-- .../src/automine/{lifecycle => }/pxe.test.ts | 6 +++--- .../avm_simulator.test.ts | 2 +- .../circuit_recorder.test.ts | 2 +- .../kernelless_simulation.test.ts | 2 +- .../automine/{smoke => }/smoke.parallel.test.ts | 4 ++-- 30 files changed, 67 insertions(+), 66 deletions(-) rename yarn-project/end-to-end/src/automine/{execution => }/card_game.test.ts (98%) rename yarn-project/end-to-end/src/automine/{execution => contracts}/abi_types.parallel.test.ts (99%) rename yarn-project/end-to-end/src/automine/{execution => contracts}/option_params.parallel.test.ts (98%) rename yarn-project/end-to-end/src/automine/{execution => contracts}/state_vars.test.ts (99%) rename yarn-project/end-to-end/src/automine/{execution => }/double_spend.test.ts (95%) rename yarn-project/end-to-end/src/automine/{notes => effects}/custom_message.parallel.test.ts (98%) rename yarn-project/end-to-end/src/automine/{notes => effects}/event_logs.test.ts (99%) rename yarn-project/end-to-end/src/automine/{notes => effects}/event_only.test.ts (97%) rename yarn-project/end-to-end/src/automine/{notes => effects}/large_public_event.test.ts (97%) rename yarn-project/end-to-end/src/automine/{notes => effects}/note_getter.test.ts (99%) rename yarn-project/end-to-end/src/automine/{notes => effects}/offchain_effect.parallel.test.ts (99%) rename yarn-project/end-to-end/src/automine/{notes => effects}/offchain_payment.parallel.test.ts (99%) rename yarn-project/end-to-end/src/automine/{notes => effects}/partial_notes.test.ts (97%) rename yarn-project/end-to-end/src/automine/{notes => effects}/pending_note_hashes.parallel.test.ts (99%) rename yarn-project/end-to-end/src/automine/{lifecycle => effects}/pruned_blocks.test.ts (99%) rename yarn-project/end-to-end/src/automine/{notes => effects}/tx_effect_oracle.parallel.test.ts (98%) rename yarn-project/end-to-end/src/automine/{lifecycle => }/expiration_timestamp.test.ts (97%) rename yarn-project/end-to-end/src/automine/{lifecycle => }/genesis_timestamp.parallel.test.ts (96%) rename yarn-project/end-to-end/src/automine/{execution => }/mempool_limit.test.ts (91%) rename yarn-project/end-to-end/src/automine/{execution => }/ordering.test.ts (96%) rename yarn-project/end-to-end/src/automine/{execution => }/phase_check.parallel.test.ts (95%) rename yarn-project/end-to-end/src/automine/{execution => }/private_voting.test.ts (95%) rename yarn-project/end-to-end/src/automine/{lifecycle => }/pxe.test.ts (89%) rename yarn-project/end-to-end/src/automine/{execution => simulation}/avm_simulator.test.ts (99%) rename yarn-project/end-to-end/src/automine/{execution => simulation}/circuit_recorder.test.ts (98%) rename yarn-project/end-to-end/src/automine/{execution => simulation}/kernelless_simulation.test.ts (99%) rename yarn-project/end-to-end/src/automine/{smoke => }/smoke.parallel.test.ts (98%) diff --git a/.test_patterns.yml b/.test_patterns.yml index 96055b8f2470..682557f971f1 100644 --- a/.test_patterns.yml +++ b/.test_patterns.yml @@ -401,7 +401,7 @@ tests: - *palla # http://ci.aztec-labs.com/153f5dcbb0f3799c - - regex: "src/automine/notes/offchain_payment.parallel.test.ts" + - regex: "src/automine/effects/offchain_payment.parallel.test.ts" error_regex: "✕ reprocesses an offchain-delivered payment after an L1 reorg" owners: - *martin diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index 0a64ba209be1..5b8a7025f9f7 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -32,20 +32,19 @@ function test_cmds { else echo "$prefix:NAME=e2e_prover_full_fake FAKE_PROOFS=1 $run_test_script simple single-node/prover/full" fi - echo "$prefix:TIMEOUT=30m:NAME=automine/execution/avm_simulator $(set_dump_avm e2e_avm_simulator) $run_test_script simple src/automine/execution/avm_simulator.test.ts" + echo "$prefix:TIMEOUT=30m:NAME=automine/simulation/avm_simulator $(set_dump_avm e2e_avm_simulator) $run_test_script simple src/automine/simulation/avm_simulator.test.ts" local tests=( # List all standalone and nested tests, except for the ones listed above. src/e2e_*/*.test.ts + src/automine/*.test.ts src/automine/contracts/*.test.ts src/automine/contracts/deploy/*.test.ts src/automine/contracts/nested/*.test.ts src/automine/token/*.test.ts - src/automine/smoke/*.test.ts src/automine/accounts/*.test.ts - src/automine/notes/*.test.ts - src/automine/execution/!(avm_simulator).test.ts - src/automine/lifecycle/*.test.ts + src/automine/effects/*.test.ts + src/automine/simulation/!(avm_simulator).test.ts src/single-node/block-building/*.test.ts src/single-node/proving/*.test.ts src/single-node/l1-reorgs/*.test.ts @@ -305,15 +304,14 @@ function compat_test_cmds { local tests=( src/e2e_*/*.test.ts + src/automine/*.test.ts src/automine/contracts/*.test.ts src/automine/contracts/deploy/*.test.ts src/automine/contracts/nested/*.test.ts src/automine/token/*.test.ts - src/automine/smoke/*.test.ts src/automine/accounts/*.test.ts - src/automine/notes/*.test.ts - src/automine/execution/!(kernelless_simulation).test.ts - src/automine/lifecycle/*.test.ts + src/automine/effects/*.test.ts + src/automine/simulation/!(avm_simulator|kernelless_simulation).test.ts src/single-node/fees/*.test.ts src/single-node/cross-chain/*.test.ts src/single-node/bot/*.test.ts diff --git a/yarn-project/end-to-end/src/automine/README.md b/yarn-project/end-to-end/src/automine/README.md index e0a01f97cdfa..1a48533aba10 100644 --- a/yarn-project/end-to-end/src/automine/README.md +++ b/yarn-project/end-to-end/src/automine/README.md @@ -43,15 +43,18 @@ own job. ## Subfolders +A second-level folder is created only when it earns its keep: a shared harness, an existing sub-hierarchy, +or a coherent domain of several files. The remaining miscellaneous protocol/execution behaviors live as flat +files directly under `automine/` — smoke, tx ordering/double-spend/phase checks, mempool limits, the app demos +(card game, private voting), and the timestamp/PXE tests. + | Path | Contents | |---|---| -| `smoke/` | AutomineSequencer mechanics themselves: sequential and parallel tx landing, time warps, `mineBlock`, and checkpoint revert. | | `token/` | Token-economics tests on the two token harnesses plus the `TokenSimulator`/`LendingSimulator`-adjacent DeFi tests: token transfers/minting/burning/access-control, the blacklist token suite, AMM, lending, NFT, orderbook, crowdfunding, and escrow. | -| `contracts/` | Contract lifecycle and cross-contract behavior. `deploy/` (class registration, deploy method, legacy deploy, private initialization), `nested/` (importer and the manual private/public nested-call patterns), plus contract updates, storage proofs, static calls, and nested utility calls. | +| `contracts/` | Contract lifecycle and cross-contract behavior. `deploy/` (class registration, deploy method, legacy deploy, private initialization), `nested/` (importer and the manual private/public nested-call patterns), plus contract updates, storage proofs, static calls, nested utility calls, and the ABI/storage-surface tests (ABI types, option params, state variables). | | `accounts/` | Account and key behavior: account contracts, keys, multiple accounts sharing an encryption key, two-PXE interop, authwit, and scope isolation. | -| `notes/` | Note discovery, events, and offchain effects: note getters, pending note hashes, partial notes, event logs, event-only notes, offchain effects and payments, large public events, custom messages, and the tx-effect oracle. | -| `execution/` | Transaction semantics: ordering, double-spend rejection, phase checks, kernelless simulation, the AVM simulator, the circuit recorder, option params, ABI types, state variables, mempool limits, the card game, and private voting. | -| `lifecycle/` | Chain-tip, pruning, and timing behavior under automine: pruned blocks, the genesis timestamp, expiration timestamps, and PXE behavior. | +| `effects/` | Note discovery, events, and offchain effects: note getters, pending note hashes, partial notes, event logs, event-only notes, offchain effects and payments, large public events, custom messages, the tx-effect oracle, and note rediscovery after pruned blocks. | +| `simulation/` | Circuit simulation surface: the AVM simulator, kernelless simulation, and the circuit recorder. | -The `execution/avm_simulator` file is a genuine outlier: it dumps AVM circuit inputs for the downstream -`avm_check_circuit` CI job, so it has a bespoke CI line and is excluded from the generic `execution/` glob. +The `simulation/avm_simulator` file is a genuine outlier: it dumps AVM circuit inputs for the downstream +`avm_check_circuit` CI job, so it has a bespoke CI line and is excluded from the generic `simulation/` glob. diff --git a/yarn-project/end-to-end/src/automine/execution/card_game.test.ts b/yarn-project/end-to-end/src/automine/card_game.test.ts similarity index 98% rename from yarn-project/end-to-end/src/automine/execution/card_game.test.ts rename to yarn-project/end-to-end/src/automine/card_game.test.ts index e6885632fc06..59f1e0449cc8 100644 --- a/yarn-project/end-to-end/src/automine/execution/card_game.test.ts +++ b/yarn-project/end-to-end/src/automine/card_game.test.ts @@ -10,8 +10,8 @@ import { CardGameContract } from '@aztec/noir-contracts.js/CardGame'; import { jest } from '@jest/globals'; -import type { TestWallet } from '../../test-wallet/test_wallet.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { AutomineTestContext } from './automine_test_context.js'; /* eslint-disable camelcase */ @@ -61,7 +61,7 @@ const TIMEOUT = 600_000; // initializerless accounts — it derives nullifier-hiding keys from the players' secrets, so it owns the // keys. (v5: was setup(3, …); the explicit account provisioning is a setup-mechanics change, not a // category change.) jest.setTimeout(600s). -describe('automine/execution/card_game', () => { +describe('automine/card_game', () => { jest.setTimeout(TIMEOUT); let logger: Logger; diff --git a/yarn-project/end-to-end/src/automine/execution/abi_types.parallel.test.ts b/yarn-project/end-to-end/src/automine/contracts/abi_types.parallel.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/execution/abi_types.parallel.test.ts rename to yarn-project/end-to-end/src/automine/contracts/abi_types.parallel.test.ts index 8a0a6eee2176..f63cc1cb2b95 100644 --- a/yarn-project/end-to-end/src/automine/execution/abi_types.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/abi_types.parallel.test.ts @@ -18,7 +18,7 @@ const I64_MIN = -(2n ** 63n); // Tests that different ABI types are correctly encoded when passed to contract functions and decoded from // return values in TypeScript. Mirrors Noir-side AbiTypes unit tests. Uses setup(1, AUTOMINE_E2E_OPTS) // providing one node, automine sequencer, and one deployed account. -describe('automine/execution/abi_types', () => { +describe('automine/contracts/abi_types', () => { let abiTypesContract: AbiTypesContract; jest.setTimeout(TIMEOUT); diff --git a/yarn-project/end-to-end/src/automine/execution/option_params.parallel.test.ts b/yarn-project/end-to-end/src/automine/contracts/option_params.parallel.test.ts similarity index 98% rename from yarn-project/end-to-end/src/automine/execution/option_params.parallel.test.ts rename to yarn-project/end-to-end/src/automine/contracts/option_params.parallel.test.ts index ba1116ebc113..b73ce33dcf74 100644 --- a/yarn-project/end-to-end/src/automine/execution/option_params.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/option_params.parallel.test.ts @@ -15,7 +15,7 @@ const I64_MIN = -(2n ** 63n); // Verifies that the Aztec.js ABI layer correctly serialises/deserialises Noir Option parameters // for public, utility, and private functions. Single node with AutomineSequencer; all calls are // simulate()-only (no on-chain state changes). -describe('automine/execution/option_params', () => { +describe('automine/contracts/option_params', () => { let contract: OptionParamContract; let wallet: Wallet; let defaultAccountAddress: AztecAddress; diff --git a/yarn-project/end-to-end/src/automine/execution/state_vars.test.ts b/yarn-project/end-to-end/src/automine/contracts/state_vars.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/execution/state_vars.test.ts rename to yarn-project/end-to-end/src/automine/contracts/state_vars.test.ts index b4cf40c2c88c..b808114e2925 100644 --- a/yarn-project/end-to-end/src/automine/execution/state_vars.test.ts +++ b/yarn-project/end-to-end/src/automine/contracts/state_vars.test.ts @@ -17,7 +17,7 @@ const TIMEOUT = 300_000; // via the StateVars and Auth contracts. Single node with AutomineSequencer. The DelayedPublicMutable sub-suite // reads DefaultL1ContractsConfig.aztecSlotDuration as a static constant (72) for delay arithmetic and asserts // it has not changed; the runtime slot set by AUTOMINE_E2E_OPTS (12s) is irrelevant to that assertion. -describe('automine/execution/state_vars', () => { +describe('automine/contracts/state_vars', () => { jest.setTimeout(TIMEOUT); let aztecNode: AztecNode; diff --git a/yarn-project/end-to-end/src/automine/execution/double_spend.test.ts b/yarn-project/end-to-end/src/automine/double_spend.test.ts similarity index 95% rename from yarn-project/end-to-end/src/automine/execution/double_spend.test.ts rename to yarn-project/end-to-end/src/automine/double_spend.test.ts index 2d18a574d773..edf0d35e6b7f 100644 --- a/yarn-project/end-to-end/src/automine/execution/double_spend.test.ts +++ b/yarn-project/end-to-end/src/automine/double_spend.test.ts @@ -5,11 +5,11 @@ import { TxExecutionResult } from '@aztec/aztec.js/tx'; import type { Wallet } from '@aztec/aztec.js/wallet'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; -import { AutomineTestContext } from '../automine_test_context.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Tests that a public nullifier emitted in one tx cannot be emitted again in a subsequent tx. // Uses setup(1, AUTOMINE_E2E_OPTS) with one node, automine sequencer, one funded account. -describe('automine/execution/double_spend', () => { +describe('automine/double_spend', () => { let wallet: Wallet; let defaultAccountAddress: AztecAddress; diff --git a/yarn-project/end-to-end/src/automine/notes/custom_message.parallel.test.ts b/yarn-project/end-to-end/src/automine/effects/custom_message.parallel.test.ts similarity index 98% rename from yarn-project/end-to-end/src/automine/notes/custom_message.parallel.test.ts rename to yarn-project/end-to-end/src/automine/effects/custom_message.parallel.test.ts index abbd6bc28eae..8be39d89cfd2 100644 --- a/yarn-project/end-to-end/src/automine/notes/custom_message.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/custom_message.parallel.test.ts @@ -14,7 +14,7 @@ const TIMEOUT = 300_000; // Tests the CustomMessage contract's multi-log event pattern: emitting a single event split across // multiple private logs and reassembling it via wallet.getPrivateEvents. // Uses setup(1, AUTOMINE_E2E_OPTS) with one node, automine sequencer, one account. -describe('automine/notes/custom_message', () => { +describe('automine/effects/custom_message', () => { let contract: CustomMessageContract; jest.setTimeout(TIMEOUT); diff --git a/yarn-project/end-to-end/src/automine/notes/event_logs.test.ts b/yarn-project/end-to-end/src/automine/effects/event_logs.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/notes/event_logs.test.ts rename to yarn-project/end-to-end/src/automine/effects/event_logs.test.ts index 37103ab7fed2..97b8eaf0010b 100644 --- a/yarn-project/end-to-end/src/automine/notes/event_logs.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/event_logs.test.ts @@ -25,7 +25,7 @@ const TIMEOUT = 300_000; // public-log event emission and retrieval (unencrypted events via getPublicEvents), including nested // events with struct fields and tagging-cache reconciliation against kernel squashing. Uses a single // automine node with two genesis-funded Schnorr accounts and a deployed TestLogContract. -describe('automine/notes/event_logs', () => { +describe('automine/effects/event_logs', () => { let testLogContract: TestLogContract; jest.setTimeout(TIMEOUT); diff --git a/yarn-project/end-to-end/src/automine/notes/event_only.test.ts b/yarn-project/end-to-end/src/automine/effects/event_only.test.ts similarity index 97% rename from yarn-project/end-to-end/src/automine/notes/event_only.test.ts rename to yarn-project/end-to-end/src/automine/effects/event_only.test.ts index 801b4191626a..7ce0e5d05772 100644 --- a/yarn-project/end-to-end/src/automine/notes/event_only.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/event_only.test.ts @@ -12,7 +12,7 @@ const TIMEOUT = 300_000; /// Tests that a private event can be obtained for a contract that does not work with notes. // Single automine node, one genesis-funded account, EventOnlyContract deployed in beforeAll. -describe('automine/notes/event_only', () => { +describe('automine/effects/event_only', () => { let eventOnlyContract: EventOnlyContract; jest.setTimeout(TIMEOUT); diff --git a/yarn-project/end-to-end/src/automine/notes/large_public_event.test.ts b/yarn-project/end-to-end/src/automine/effects/large_public_event.test.ts similarity index 97% rename from yarn-project/end-to-end/src/automine/notes/large_public_event.test.ts rename to yarn-project/end-to-end/src/automine/effects/large_public_event.test.ts index dbc855562eee..a31ab8cd55d8 100644 --- a/yarn-project/end-to-end/src/automine/notes/large_public_event.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/large_public_event.test.ts @@ -14,7 +14,7 @@ const TIMEOUT = 300_000; /// Tests that events exceeding MAX_EVENT_SERIALIZED_LEN can be emitted publicly. // Single automine node, one funded account, LargePublicEventContract deployed in beforeAll. -describe('automine/notes/large_public_event', () => { +describe('automine/effects/large_public_event', () => { let contract: LargePublicEventContract; jest.setTimeout(TIMEOUT); diff --git a/yarn-project/end-to-end/src/automine/notes/note_getter.test.ts b/yarn-project/end-to-end/src/automine/effects/note_getter.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/notes/note_getter.test.ts rename to yarn-project/end-to-end/src/automine/effects/note_getter.test.ts index 96572616d4e1..433f13943142 100644 --- a/yarn-project/end-to-end/src/automine/notes/note_getter.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/note_getter.test.ts @@ -18,7 +18,7 @@ function boundedVecToArray(boundedVec: NoirBoundedVec): T[] { // Covers the NoteGetter contract's filtering capabilities (EQ, NEQ, LT, GT, LTE, GTE comparators // and sub-field property selectors) and the TestContract's note status filter (active vs nullified). // Single automine node, one funded account, contracts deployed per describe block. -describe('automine/notes/note_getter', () => { +describe('automine/effects/note_getter', () => { let wallet: Wallet; let defaultAddress: AztecAddress; let teardown: () => Promise; diff --git a/yarn-project/end-to-end/src/automine/notes/offchain_effect.parallel.test.ts b/yarn-project/end-to-end/src/automine/effects/offchain_effect.parallel.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/notes/offchain_effect.parallel.test.ts rename to yarn-project/end-to-end/src/automine/effects/offchain_effect.parallel.test.ts index d4e582e284c4..d8ba94b4474a 100644 --- a/yarn-project/end-to-end/src/automine/notes/offchain_effect.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/offchain_effect.parallel.test.ts @@ -15,7 +15,7 @@ const TIMEOUT = 300_000; // proveInteraction, and the offchain-message delivery flow (emitting an event or note as an // offchain message, then delivering it via offchain_receive and retrieving via getPrivateEvents). // Single automine node, one funded account, two OffchainEffectContract instances. -describe('automine/notes/offchain_effect', () => { +describe('automine/effects/offchain_effect', () => { let contract1: OffchainEffectContract; let contract2: OffchainEffectContract; diff --git a/yarn-project/end-to-end/src/automine/notes/offchain_payment.parallel.test.ts b/yarn-project/end-to-end/src/automine/effects/offchain_payment.parallel.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/notes/offchain_payment.parallel.test.ts rename to yarn-project/end-to-end/src/automine/effects/offchain_payment.parallel.test.ts index 05088cc76208..567d2749e780 100644 --- a/yarn-project/end-to-end/src/automine/notes/offchain_payment.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/offchain_payment.parallel.test.ts @@ -18,7 +18,7 @@ const TIMEOUT = 300_000; // Tests the OffchainPayment contract's offchain message delivery mechanism. Uses a single node with the // AutomineSequencer so each tx mines a block immediately. Also exercises the AutomineSequencer's // revertToCheckpoint to simulate a reorg and verify that offchain-delivered notes are reprocessed correctly. -describe('automine/notes/offchain_payment', () => { +describe('automine/effects/offchain_payment', () => { let contract: OffchainPaymentContract; let aztecNode: AztecNode; let aztecNodeService: AztecNodeService; diff --git a/yarn-project/end-to-end/src/automine/notes/partial_notes.test.ts b/yarn-project/end-to-end/src/automine/effects/partial_notes.test.ts similarity index 97% rename from yarn-project/end-to-end/src/automine/notes/partial_notes.test.ts rename to yarn-project/end-to-end/src/automine/effects/partial_notes.test.ts index c19631d41d7a..1eefb41f1d18 100644 --- a/yarn-project/end-to-end/src/automine/notes/partial_notes.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/partial_notes.test.ts @@ -12,7 +12,7 @@ const TIMEOUT = 300_000; // Smoke test for the partial-note pattern: minting tokens into a private note via the // Token contract's mint_to_private path. Single node with AutomineSequencer. -describe('automine/notes/partial_notes', () => { +describe('automine/effects/partial_notes', () => { jest.setTimeout(TIMEOUT); let teardown: () => Promise; diff --git a/yarn-project/end-to-end/src/automine/notes/pending_note_hashes.parallel.test.ts b/yarn-project/end-to-end/src/automine/effects/pending_note_hashes.parallel.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/notes/pending_note_hashes.parallel.test.ts rename to yarn-project/end-to-end/src/automine/effects/pending_note_hashes.parallel.test.ts index e1d3a2b6d6a7..b23ff1342b5f 100644 --- a/yarn-project/end-to-end/src/automine/notes/pending_note_hashes.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/pending_note_hashes.parallel.test.ts @@ -16,7 +16,7 @@ import { AutomineTestContext } from '../automine_test_context.js'; // Verifies the kernel's pending-note-hash squashing logic: notes created and nullified in the same tx // are not persisted to the tree. Uses a single node with AutomineSequencer; contracts are deployed // per-test via deployContract(). -describe('automine/notes/pending_note_hashes', () => { +describe('automine/effects/pending_note_hashes', () => { let aztecNode: AztecNode; let wallet: TestWallet; let owner: AztecAddress; diff --git a/yarn-project/end-to-end/src/automine/lifecycle/pruned_blocks.test.ts b/yarn-project/end-to-end/src/automine/effects/pruned_blocks.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/lifecycle/pruned_blocks.test.ts rename to yarn-project/end-to-end/src/automine/effects/pruned_blocks.test.ts index 401781af00ac..35c25090df7f 100644 --- a/yarn-project/end-to-end/src/automine/lifecycle/pruned_blocks.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/pruned_blocks.test.ts @@ -17,7 +17,7 @@ import { AutomineTestContext } from '../automine_test_context.js'; // Uses a single node with AutomineSequencer, worldStateCheckpointHistory=2, and // aztecProofSubmissionEpochs=1024 (effectively no reorg). markAsProven + extra L1 blocks cause world-state // to prune old block data; the test then verifies that PXE can still discover notes from pruned blocks. -describe('automine/lifecycle/pruned_blocks', () => { +describe('automine/effects/pruned_blocks', () => { jest.setTimeout(5 * 60 * 1000); let logger: Logger; diff --git a/yarn-project/end-to-end/src/automine/notes/tx_effect_oracle.parallel.test.ts b/yarn-project/end-to-end/src/automine/effects/tx_effect_oracle.parallel.test.ts similarity index 98% rename from yarn-project/end-to-end/src/automine/notes/tx_effect_oracle.parallel.test.ts rename to yarn-project/end-to-end/src/automine/effects/tx_effect_oracle.parallel.test.ts index 0bb9ff64c32b..880c2276b52c 100644 --- a/yarn-project/end-to-end/src/automine/notes/tx_effect_oracle.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/effects/tx_effect_oracle.parallel.test.ts @@ -33,7 +33,7 @@ const TIMEOUT = 120_000; // obtained tx effect from oracle with the one obtained directly in TS. // // Uses a single node with AutomineSequencer and one account. -describe('automine/notes/tx_effect_oracle', () => { +describe('automine/effects/tx_effect_oracle', () => { let contract: TxEffectOracleTestContract; let deployTxHash: TxHash; jest.setTimeout(TIMEOUT); diff --git a/yarn-project/end-to-end/src/automine/lifecycle/expiration_timestamp.test.ts b/yarn-project/end-to-end/src/automine/expiration_timestamp.test.ts similarity index 97% rename from yarn-project/end-to-end/src/automine/lifecycle/expiration_timestamp.test.ts rename to yarn-project/end-to-end/src/automine/expiration_timestamp.test.ts index 3bffa060ed0f..284a9895fafa 100644 --- a/yarn-project/end-to-end/src/automine/lifecycle/expiration_timestamp.test.ts +++ b/yarn-project/end-to-end/src/automine/expiration_timestamp.test.ts @@ -5,15 +5,15 @@ import { TestContract } from '@aztec/noir-test-contracts.js/Test'; import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client'; import { TX_ERROR_INVALID_EXPIRATION_TIMESTAMP } from '@aztec/stdlib/tx'; -import type { TestWallet } from '../../test-wallet/test_wallet.js'; -import { proveInteraction } from '../../test-wallet/utils.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { proveInteraction } from '../test-wallet/utils.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Covers transaction expiration-timestamp enforcement: setting a valid expiration succeeds, setting // one below the mined block timestamp fails at prove time, and setting one that is then warped past // by L1 time causes rejection at submission. Uses a single automine node; L1 time is warped via // cheatCodes.eth.warp in the invalidation tests. -describe('automine/lifecycle/expiration_timestamp', () => { +describe('automine/expiration_timestamp', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let aztecNode: AztecNode & AztecNodeDebug; diff --git a/yarn-project/end-to-end/src/automine/lifecycle/genesis_timestamp.parallel.test.ts b/yarn-project/end-to-end/src/automine/genesis_timestamp.parallel.test.ts similarity index 96% rename from yarn-project/end-to-end/src/automine/lifecycle/genesis_timestamp.parallel.test.ts rename to yarn-project/end-to-end/src/automine/genesis_timestamp.parallel.test.ts index a2477b4a3004..e48dffce310f 100644 --- a/yarn-project/end-to-end/src/automine/lifecycle/genesis_timestamp.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/genesis_timestamp.parallel.test.ts @@ -3,9 +3,9 @@ import { NO_FROM } from '@aztec/aztec.js/account'; import { createLogger } from '@aztec/aztec.js/log'; import { retryUntil } from '@aztec/foundation/retry'; -import type { EndToEndContext } from '../../fixtures/utils.js'; -import { proveInteraction } from '../../test-wallet/utils.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { EndToEndContext } from '../fixtures/utils.js'; +import { proveInteraction } from '../test-wallet/utils.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Verifies that genesis-anchored transactions (proved while PXE is pinned to block 0) can be // included in blocks after block 1, and that PXE can prove transactions anchored to genesis even @@ -14,7 +14,7 @@ import { AutomineTestContext } from '../automine_test_context.js'; // syncChainTip='proven' so the anchor stays at genesis until a real proof lands, which never happens // in these tests (no prover node running). (v5: replaced skipAccountDeployment with // advancePastGenesis=false + explicit additionallyFundedAccounts.) -describe('automine/lifecycle/genesis_timestamp', () => { +describe('automine/genesis_timestamp', () => { let context: EndToEndContext; const logger = createLogger('e2e:genesis_timestamp'); diff --git a/yarn-project/end-to-end/src/automine/execution/mempool_limit.test.ts b/yarn-project/end-to-end/src/automine/mempool_limit.test.ts similarity index 91% rename from yarn-project/end-to-end/src/automine/execution/mempool_limit.test.ts rename to yarn-project/end-to-end/src/automine/mempool_limit.test.ts index b01a72362f04..28f8a5dc3258 100644 --- a/yarn-project/end-to-end/src/automine/execution/mempool_limit.test.ts +++ b/yarn-project/end-to-end/src/automine/mempool_limit.test.ts @@ -4,14 +4,14 @@ import { TxStatus } from '@aztec/aztec.js/tx'; import { TokenContract } from '@aztec/noir-contracts.js/Token'; import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client'; -import type { EndToEndContext } from '../../fixtures/utils.js'; -import type { TestWallet } from '../../test-wallet/test_wallet.js'; -import { proveInteraction } from '../../test-wallet/utils.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { EndToEndContext } from '../fixtures/utils.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { proveInteraction } from '../test-wallet/utils.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Verifies that the node rejects incoming transactions when the mempool is at capacity. Uses a // single automine node with aztecNodeAdmin access; sequencer is paused to let txs accumulate. -describe('automine/execution/mempool_limit', () => { +describe('automine/mempool_limit', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let aztecNode: AztecNode; diff --git a/yarn-project/end-to-end/src/automine/execution/ordering.test.ts b/yarn-project/end-to-end/src/automine/ordering.test.ts similarity index 96% rename from yarn-project/end-to-end/src/automine/execution/ordering.test.ts rename to yarn-project/end-to-end/src/automine/ordering.test.ts index f3cf951386cd..5b49bb9d88cd 100644 --- a/yarn-project/end-to-end/src/automine/execution/ordering.test.ts +++ b/yarn-project/end-to-end/src/automine/ordering.test.ts @@ -13,16 +13,16 @@ import { computeCalldataHash } from '@aztec/stdlib/hash'; import { jest } from '@jest/globals'; -import type { TestWallet } from '../../test-wallet/test_wallet.js'; -import { proveInteraction } from '../../test-wallet/utils.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { proveInteraction } from '../test-wallet/utils.js'; +import { AutomineTestContext } from './automine_test_context.js'; const TIMEOUT = 300_000; // See https://github.com/AztecProtocol/aztec-packages/issues/1601 // Verifies deterministic execution ordering for enqueued public calls and public state updates. // Uses a single node with AutomineSequencer; each test mines one block per call via beforeEach setup. -describe('automine/execution/ordering', () => { +describe('automine/ordering', () => { jest.setTimeout(TIMEOUT); let wallet: TestWallet; diff --git a/yarn-project/end-to-end/src/automine/execution/phase_check.parallel.test.ts b/yarn-project/end-to-end/src/automine/phase_check.parallel.test.ts similarity index 95% rename from yarn-project/end-to-end/src/automine/execution/phase_check.parallel.test.ts rename to yarn-project/end-to-end/src/automine/phase_check.parallel.test.ts index 23b0b7deb573..7fcc078ea23b 100644 --- a/yarn-project/end-to-end/src/automine/execution/phase_check.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/phase_check.parallel.test.ts @@ -9,15 +9,15 @@ import { getContractInstanceFromInstantiationParams } from '@aztec/stdlib/contra import { PublicDataTreeLeaf } from '@aztec/stdlib/trees'; import { defaultInitialAccountFeeJuice } from '@aztec/world-state/testing'; -import type { TestWallet } from '../../test-wallet/test_wallet.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Private functions should receive automatically a phase check that avoids any nested call changing the phase. // Functions that opt out of this phase check can be marked with #[allow_phase_change]. // // Uses a single node with AutomineSequencer. The setup pre-funds a custom SponsoredFPC via genesisPublicData // so that fee payment can be crafted without ending the setup phase, which is needed to trigger the phase-change error. -describe('automine/execution/phase_check', () => { +describe('automine/phase_check', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let teardown: () => Promise; diff --git a/yarn-project/end-to-end/src/automine/execution/private_voting.test.ts b/yarn-project/end-to-end/src/automine/private_voting.test.ts similarity index 95% rename from yarn-project/end-to-end/src/automine/execution/private_voting.test.ts rename to yarn-project/end-to-end/src/automine/private_voting.test.ts index 74a103240c34..1f321c6c8d85 100644 --- a/yarn-project/end-to-end/src/automine/execution/private_voting.test.ts +++ b/yarn-project/end-to-end/src/automine/private_voting.test.ts @@ -5,11 +5,11 @@ import type { Wallet } from '@aztec/aztec.js/wallet'; import { PrivateVotingContract } from '@aztec/noir-contracts.js/PrivateVoting'; import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; -import { AutomineTestContext } from '../automine_test_context.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Verifies the PrivateVoting contract's nullifier-based double-vote prevention. Uses a single node // with AutomineSequencer and one account. -describe('automine/execution/private_voting', () => { +describe('automine/private_voting', () => { let wallet: Wallet; let logger: Logger; diff --git a/yarn-project/end-to-end/src/automine/lifecycle/pxe.test.ts b/yarn-project/end-to-end/src/automine/pxe.test.ts similarity index 89% rename from yarn-project/end-to-end/src/automine/lifecycle/pxe.test.ts rename to yarn-project/end-to-end/src/automine/pxe.test.ts index 5fa7df339b9c..3fdb95dbe14b 100644 --- a/yarn-project/end-to-end/src/automine/lifecycle/pxe.test.ts +++ b/yarn-project/end-to-end/src/automine/pxe.test.ts @@ -3,14 +3,14 @@ import { Fr } from '@aztec/aztec.js/fields'; import { TestContract } from '@aztec/noir-test-contracts.js/Test'; import { TX_ERROR_EXISTING_NULLIFIER } from '@aztec/stdlib/tx'; -import type { TestWallet } from '../../test-wallet/test_wallet.js'; -import { AutomineTestContext } from '../automine_test_context.js'; +import type { TestWallet } from '../test-wallet/test_wallet.js'; +import { AutomineTestContext } from './automine_test_context.js'; // TODO: Ideally these would be unit tests for PXE, but some functions like simulateTx, proveTx, etc require // more complex setup // // Exercises PXE simulation error paths that require a running node. Single node with AutomineSequencer. -describe('automine/lifecycle/pxe', () => { +describe('automine/pxe', () => { let wallet: TestWallet; let defaultAccountAddress: AztecAddress; let teardown: () => Promise; diff --git a/yarn-project/end-to-end/src/automine/execution/avm_simulator.test.ts b/yarn-project/end-to-end/src/automine/simulation/avm_simulator.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/execution/avm_simulator.test.ts rename to yarn-project/end-to-end/src/automine/simulation/avm_simulator.test.ts index d7afe94a87bd..04670932deda 100644 --- a/yarn-project/end-to-end/src/automine/execution/avm_simulator.test.ts +++ b/yarn-project/end-to-end/src/automine/simulation/avm_simulator.test.ts @@ -17,7 +17,7 @@ const TIMEOUT = 600_000; // nested calls, gas metering, contract instances, L2→L1 messages, and public-storage overrides. // Uses setup(1, AUTOMINE_E2E_OPTS) providing one node, automine sequencer, one funded account. // CI runs this as a separate job with TIMEOUT=30m and optionally dumps AVM circuit inputs. -describe('automine/execution/avm_simulator', () => { +describe('automine/simulation/avm_simulator', () => { jest.setTimeout(TIMEOUT); let wallet: Wallet; diff --git a/yarn-project/end-to-end/src/automine/execution/circuit_recorder.test.ts b/yarn-project/end-to-end/src/automine/simulation/circuit_recorder.test.ts similarity index 98% rename from yarn-project/end-to-end/src/automine/execution/circuit_recorder.test.ts rename to yarn-project/end-to-end/src/automine/simulation/circuit_recorder.test.ts index c14ef3c1af96..517ffeba2fe1 100644 --- a/yarn-project/end-to-end/src/automine/execution/circuit_recorder.test.ts +++ b/yarn-project/end-to-end/src/automine/simulation/circuit_recorder.test.ts @@ -14,7 +14,7 @@ import { AutomineTestContext } from '../automine_test_context.js'; // ChildContract) and protocol circuits (PrivateKernelInit variant). (v5: the default account is now // initializerless, so the user circuit recorded is the entrypoint, not a SchnorrAccount constructor.) // Uses setup(1, AUTOMINE_E2E_OPTS) with one node, automine sequencer, one account. -describe('automine/execution/circuit_recorder', () => { +describe('automine/simulation/circuit_recorder', () => { const RECORD_DIR = './circuit_recordings'; // Sets CIRCUIT_RECORD_DIR env var, runs setup + a ChildContract deploy to trigger circuit execution, diff --git a/yarn-project/end-to-end/src/automine/execution/kernelless_simulation.test.ts b/yarn-project/end-to-end/src/automine/simulation/kernelless_simulation.test.ts similarity index 99% rename from yarn-project/end-to-end/src/automine/execution/kernelless_simulation.test.ts rename to yarn-project/end-to-end/src/automine/simulation/kernelless_simulation.test.ts index 8c871ec0d08a..e1ba22b90a42 100644 --- a/yarn-project/end-to-end/src/automine/execution/kernelless_simulation.test.ts +++ b/yarn-project/end-to-end/src/automine/simulation/kernelless_simulation.test.ts @@ -32,7 +32,7 @@ import { AutomineTestContext } from '../automine_test_context.js'; * Uses a single automine node with three funded accounts (admin, liquidityProvider, swapper), * an AMM with two token pairs, and various test contracts deployed in beforeAll. */ -describe('automine/execution/kernelless_simulation', () => { +describe('automine/simulation/kernelless_simulation', () => { let teardown: () => Promise; let logger: Logger; diff --git a/yarn-project/end-to-end/src/automine/smoke/smoke.parallel.test.ts b/yarn-project/end-to-end/src/automine/smoke.parallel.test.ts similarity index 98% rename from yarn-project/end-to-end/src/automine/smoke/smoke.parallel.test.ts rename to yarn-project/end-to-end/src/automine/smoke.parallel.test.ts index 0f064e23c178..4b36c9440257 100644 --- a/yarn-project/end-to-end/src/automine/smoke/smoke.parallel.test.ts +++ b/yarn-project/end-to-end/src/automine/smoke.parallel.test.ts @@ -11,12 +11,12 @@ import type { AztecNode, AztecNodeDebug } from '@aztec/stdlib/interfaces/client' import { jest } from '@jest/globals'; import 'jest-extended'; -import { AutomineTestContext } from '../automine_test_context.js'; +import { AutomineTestContext } from './automine_test_context.js'; // Smoke tests for the AutomineSequencer: verifies that sequential and parallel txs land correctly, // time warps work, mineBlock produces checkpoints, and revertToCheckpoint restores chain state. // Uses setup(1, AUTOMINE_E2E_OPTS) providing one node with AutomineSequencer. -describe('automine/smoke/smoke', () => { +describe('automine/smoke', () => { jest.setTimeout(10 * 60 * 1000); let teardown: () => Promise; From 49eda5aba1edc4c21e947bbfe6bdb522e9e63b3c Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 18:24:31 -0300 Subject: [PATCH 6/7] fix(e2e): keep avm_simulator in automine compat tests The compat_test_cmds simulation glob excluded both avm_simulator and kernelless_simulation, but the bespoke AVM-dump line that covers avm_simulator only exists in test_cmds. The previous execution/ compat glob excluded only kernelless, so avm_simulator ran in compat as a regular test; restore that by excluding only kernelless. --- yarn-project/end-to-end/bootstrap.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yarn-project/end-to-end/bootstrap.sh b/yarn-project/end-to-end/bootstrap.sh index 5b8a7025f9f7..66c67cbde687 100755 --- a/yarn-project/end-to-end/bootstrap.sh +++ b/yarn-project/end-to-end/bootstrap.sh @@ -311,7 +311,7 @@ function compat_test_cmds { src/automine/token/*.test.ts src/automine/accounts/*.test.ts src/automine/effects/*.test.ts - src/automine/simulation/!(avm_simulator|kernelless_simulation).test.ts + src/automine/simulation/!(kernelless_simulation).test.ts src/single-node/fees/*.test.ts src/single-node/cross-chain/*.test.ts src/single-node/bot/*.test.ts From dbbbf396afa342a10beabeeb34dadd5eded95ab5 Mon Sep 17 00:00:00 2001 From: Santiago Palladino Date: Fri, 26 Jun 2026 19:23:36 -0300 Subject: [PATCH 7/7] docs(e2e): document the test category structure in a top-level README Rewrites end-to-end/README.md to serve two audiences: a succinct human overview (the five topology categories, a where-does-my-test-go guide, quick-start commands) and a detailed agent reference tail (base-class hierarchy, the hydrateFromContext harness pattern, the .parallel rule, CI discovery via bootstrap.sh's two arrays incl. the avm/kernelless special-cases, .test_patterns.yml, compose/HA run modes, relocated no-node tests, and support dirs). Preserves the legacy-artifacts section. The relocated no-node tests it references land in the sibling no-node-relocations PR. --- yarn-project/end-to-end/README.md | 216 ++++++++++++++++++++++++++---- 1 file changed, 189 insertions(+), 27 deletions(-) diff --git a/yarn-project/end-to-end/README.md b/yarn-project/end-to-end/README.md index 26248361e2fd..0d8954321a9b 100644 --- a/yarn-project/end-to-end/README.md +++ b/yarn-project/end-to-end/README.md @@ -1,47 +1,209 @@ -# End to End +# End-to-end tests -This package includes end-to-end tests that cover Aztec's main milestones. -These can be run locally either by starting anvil on a different terminal. +This package holds Aztec's end-to-end (e2e) tests: full-stack scenarios that spin up an Aztec node (or +several), a PXE, and an L1 (anvil) and exercise the system the way a real deployment would. It is the +integration layer above the per-package unit tests. -``` -anvil -p 8545 --host 0.0.0.0 --chain-id 31337 -``` +> **Two audiences.** The top of this document is a quick orientation for humans. The +> [Reference for agents](#reference-for-agents) section at the bottom is the detailed, exhaustive +> version — read that when you are placing, moving, or wiring up a test. -and then running +## Quick start -``` -yarn test +Run a single test (spawns its own in-process anvil): + +```bash +yarn test:e2e src/automine/token/transfer.parallel.test.ts +yarn test:e2e src/single-node/block-building/block_building.test.ts -t 'rejects double spend' ``` -Or by running +Turn up logging with `LOG_LEVEL` (`verbose` is the useful default; `debug:sequencer,archiver` scopes it): +```bash +LOG_LEVEL=verbose yarn test:e2e src/single-node/proving/empty_blocks.test.ts ``` -yarn test:integration -``` -which will spawn the two processes. +Compose-based tests (those under `src/composed/`) need a running local network — see +[Compose / HA / web3signer tests](#compose--ha--web3signer-tests). + +## Test categories + +Tests are grouped by **node topology** — the shape of the network a test needs. The top-level folder is +the category; the second level names the behavior under test. Each category owns a base class that builds +its environment, so a test file only describes the scenario, not the wiring. + +| Category | Topology | A test belongs here when… | README | +|---|---|---|---| +| [`automine/`](src/automine/README.md) | One node, deterministic `AutomineSequencer` — one block per tx, no committee/prover/validator. Fast. | it exercises contract or protocol behavior that doesn't depend on real block-building or consensus (transfers, nested calls, note discovery, tx semantics). | yes | +| [`single-node/`](src/single-node/README.md) | One node, production sequencer (interval block production), optional prover. | it asserts on sequencer, proving, partial-proof, L1-reorg, recovery, fee, or cross-chain behavior on a single sequencer. | yes | +| [`multi-node/`](src/multi-node/README.md) | N validators on an in-memory mock-gossip bus. | it needs a committee: consensus, attestations, slashing, governance, or multi-validator block production. | yes | +| `p2p/` | Real libp2p transport between nodes. | the networking transport itself is under test (gossip, rediscovery, req/resp). | — | +| [`infra/`](src/infra/README.md) | Targets a deployed/external network (local anvil or a public testnet). | its concern is deployment or network targeting, not a specific protocol behavior. | yes | + +A handful of tests live **outside** this package, next to the code they test — see +[Tests that live elsewhere](#tests-that-live-elsewhere). Other non-category test groups (`composed/`, +`guides/`, `bench/`) are described in the reference section. + +## Where does my test go? + +1. **Does it need real networking transport?** → `p2p/`. +2. **Does it need a validator committee (consensus/slashing/governance)?** → `multi-node/`. +3. **Does it assert on the production sequencer, proving, reorgs, fees, or cross-chain flows?** → + `single-node/`. +4. **Is it pure contract/protocol behavior that's happy with one-block-per-tx?** → `automine/` (the + default home for most contract tests). +5. **Is it really a unit/integration test of one package with no Aztec node?** → it probably belongs in + that package, not here (see [Tests that live elsewhere](#tests-that-live-elsewhere)). + +When in doubt, prefer `automine/` for contract behavior and `single-node/` for anything that watches the +chain advance. + +--- + +## Reference for agents + +This section is the detailed contract for adding, moving, and wiring tests. It assumes you've read the +overview above. + +### Category base classes + +Each category centralizes its environment in a base class. The hierarchy: + +- `single-node/single_node_test_context.ts` → **`SingleNodeTestContext`**. Owns the environment + (in-process anvil + L1 deploy), node spawning (`createNonValidatorNode`, `createProverNode`), the + `ChainMonitor`, and the epoch/checkpoint/proof-window/reorg waiters. +- `multi-node/multi_node_test_context.ts` → **`MultiNodeTestContext extends SingleNodeTestContext`**. + Adds the N-validator topology over a mock-gossip bus, inheriting the base environment and waiters. +- `automine/automine_test_context.ts` → **`AutomineTestContext`**. A sibling of `SingleNodeTestContext` + (both wrap `fixtures/setup.ts:setup()`), but fixes the automine topology and makes `AUTOMINE_E2E_OPTS` + the default. Exposes `markProvenAndWarp`, `registerContract`, `applyManualParentChild`. +- `p2p/p2p_network.ts` → **`P2PNetworkTest`**. Real libp2p; node creation goes through + `setup_p2p_test.ts`. +- `infra/` has no shared base — its tests target a network selected by `L1_CHAIN_ID` (local anvil in CI, + a public testnet with credentials). + +All of the above ultimately wrap `fixtures/setup.ts:setup(numberOfAccounts, opts)`, the single entry point +that deploys L1 contracts, starts the node(s), and provisions a PXE and accounts. + +### Setup factories + +Categories expose thin factories over their base's static `setup`, named by what the test wants, so a test +calls the factory instead of spreading option presets: + +- `single-node/setup.ts`: `setupWithProver` (fake in-process prover — the single-node default) and + `setupBlockProducer` (no prover; raises `aztecProofSubmissionEpochs` to `1024` so unproven blocks + aren't pruned, and points the PXE at `syncChainTip: 'proposed'`). +- `automine` tests call `AutomineTestContext.setup({ numberOfAccounts })` directly. + +### The harness pattern (domain setup on top of a category) -You can also run this by `docker-compose up` which will spawn 2 different containers for Anvil and the test runner. +A test suite with bespoke domain setup does **not** fork `setup()`. It subclasses the category base and +overrides a `protected hydrateFromContext(context)` split out of `setup`, so it reuses the base's +rollup/epoch-cache/chain-monitor/waiter/teardown machinery while adding its own domain state. Examples: -You can run a single test by running `yarn test:compose `. +- `single-node/prover/` → `FullProverTest` (real Barretenberg env) extends `SingleNodeTestContext`. +- `single-node/fees/` → `FeesTest`; `single-node/cross-chain/` → `CrossChainMessagingTest`. +- `automine/token/` → `TokenContractTest` and `BlacklistTokenContractTest` extend `AutomineTestContext` + and run their `TokenSimulator`/snapshot setup after `super.setup()`. -## Running tests against legacy contract artifacts +When two suites share behavior: if their public APIs are nearly identical, use inheritance; if behavior +overlaps but APIs differ, compose. Don't duplicate a category's environment wiring. + +### The `.parallel` suffix + +CI splits each **top-level** `it` in a `.parallel.test.ts` file into its own docker job (via +`extract_test_names` in `bootstrap.sh`). Rules: + +- A file with more than one top-level `it` **must** carry the `.parallel.test.ts` suffix. +- A file with a single top-level `it` (even if it has many `it`s nested inside sub-`describe`s — those + don't count) is a plain `.test.ts`. +- Each file has exactly one top-level `describe`, named to match its path + (e.g. `describe('automine/token/transfer', …)`). + +### CI test discovery — `bootstrap.sh` + +`end-to-end/bootstrap.sh` enumerates tests in two arrays, and a test must appear in the relevant one or it +**won't run in CI**: + +- `test_cmds` (~line 37) — the standard run. +- `compat_test_cmds` (~line 290) — the forward/legacy-compat run (a subset). + +Each leaf folder needs its own single-level glob line (e.g. `src/automine/token/*.test.ts`) in each array; +globs are not recursive, so every sub-folder is listed explicitly. Folders that organize by behavior get +one line per leaf. Bespoke handling to be aware of: + +- **`avm_simulator`** (`automine/simulation/avm_simulator.test.ts`) has a dedicated line in `test_cmds` + that sets `DUMP_AVM_INPUTS_TO_DIR` (feeds the downstream `avm_check_circuit` job) and is therefore + excluded from the generic `simulation/` glob there (`!(avm_simulator)`). In `compat_test_cmds` it runs + as a regular test (no dump line), so it is **not** excluded there. +- **`kernelless_simulation`** is excluded from `compat_test_cmds` only. + +After editing the arrays, confirm every `*.test.ts` resolves through exactly one line (no duplicate, no +omission). Per-test bash `TIMEOUT` overrides live in the `case` block in `test_cmds` and must stay in sync +with the test's `jest.setTimeout`. + +### Flaky tests — `.test_patterns.yml` + +Flaky/owner entries live in `.test_patterns.yml` at the **git root** (not in this package), keyed on the +test path. A bare entry flags the test as flaky whenever it fails; add `error_regex` to flag only on a +matching message; `skip: true` disables it. Blanket regex entries (e.g. `src/automine/.*\.test\.ts`) are +depth-agnostic and survive folder renames; path-specific entries must be updated when a file moves. + +### Compose / HA / web3signer tests + +`src/composed/` tests run against a **running local network** rather than an in-process stack, via +`scripts/run_test.sh` in different modes: + +- `src/composed/*.test.ts` → `compose` mode (e.g. `e2e_persistence`, `uniswap_trade_on_l1_from_l2`, + `e2e_cheat_codes` — the compose variant, distinct from the relocated unit-style one). +- `src/composed/web3signer/*.test.ts` → `web3signer` mode (remote-signer scenarios). +- `src/composed/ha/*.test.ts` → `ha` mode (high-availability multi-process scenarios). +- `src/guides/*.test.ts` → tutorial/guide flows; `src/bench/` → benchmarks (see `bench_cmds`). + +Run one compose test locally with `yarn test:compose ` (anvil + the test runner are spawned for +you), or `docker-compose up` for separate containers. + +### Tests that live elsewhere + +Tests with **no Aztec node** that exercise one package belong in that package, not here: + +- L1 cheat-code behavior (`EthCheatCodes`/`RollupCheatCodes` against raw anvil) → `@aztec/ethereum` + (`ethereum/src/test/eth_cheat_codes.test.ts`). +- The `SequencerPublisher` integration test (anvil + L1 deploy, no node) → `@aztec/sequencer-client` + (`sequencer-client/src/publisher/`). + +These run in their own package's test lane (both packages already run anvil-backed integration tests). + +### Support directories (not test categories) + +- `fixtures/` — the shared `setup()`, option presets (`fixtures.ts`), `CrossChainTestHarness`, + `l1_to_l2_messaging`, and common utils. +- `shared/` — shared test bodies and `timing_env.mjs`, a **custom jest `testEnvironment`** referenced from + this package's `package.json`. `yarn prepare` / the package-json check will try to revert it to the + default — don't let it. +- `simulators/` — in-TS reference models (`TokenSimulator`, `LendingSimulator`) used to assert contract + behavior. +- `test-wallet/`, `bench/`, `spartan/`, `quality_of_service/`, `forward-compatibility/` — helpers, + benchmarks, and network/ops tests outside the topology categories. + +### Running tests against legacy contract artifacts To verify that contracts deployed from a previous release still work against the current stack, set -`CONTRACT_ARTIFACTS_VERSION` to a published version of `@aztec/noir-contracts.js` / `@aztec/noir-test-contracts.js`: +`CONTRACT_ARTIFACTS_VERSION` to a published version of `@aztec/noir-contracts.js` / +`@aztec/noir-test-contracts.js`: -``` -CONTRACT_ARTIFACTS_VERSION=4.1.3 yarn test:e2e src/e2e_amm.test.ts +```bash +CONTRACT_ARTIFACTS_VERSION=4.1.3 yarn test:e2e src/automine/token/transfer.parallel.test.ts ``` Only the JSON artifact files (`.../artifacts/*.json`) are redirected. The TypeScript wrapper classes -(e.g. `TokenContract`) continue to load from the current workspace and use the current `@aztec/aztec.js` — so this -exercises whether a deployed contract's ABI / bytecode / notes still work through the *new* client, not whether the -legacy wrapper code still imports cleanly. +(e.g. `TokenContract`) continue to load from the current workspace and use the current `@aztec/aztec.js` — +so this exercises whether a deployed contract's ABI / bytecode / notes still work through the *new* client, +not whether the legacy wrapper code still imports cleanly. -The first run downloads the pinned packages into `.legacy-contracts//node_modules/` (cached across runs). A -startup banner and a per-redirect line are printed to stderr so you can confirm the legacy artifacts were actually -loaded: +The first run downloads the pinned packages into `.legacy-contracts//node_modules/` (cached across +runs). A startup banner and a per-redirect line are printed to stderr so you can confirm the legacy +artifacts were actually loaded: ``` [legacy-contracts][jest] CONTRACT_ARTIFACTS_VERSION=4.1.3 @@ -49,5 +211,5 @@ loaded: [legacy-contracts][jest] redirected token_contract-Token.json -> /abs/.../.legacy-contracts/4.1.3/.../token_contract-Token.json ``` -When `CONTRACT_ARTIFACTS_VERSION` is unset the test run is byte-identical to the default behaviour. The cache is -populated automatically on first use. +When `CONTRACT_ARTIFACTS_VERSION` is unset the test run is byte-identical to the default behaviour. The +cache is populated automatically on first use.