Skip to content

feat: exported in-process testing network - #24629

Merged
Thunkar merged 8 commits into
merge-train/fairies-v5from
gj/upstream_testing_utils
Jul 14, 2026
Merged

feat: exported in-process testing network#24629
Thunkar merged 8 commits into
merge-train/fairies-v5from
gj/upstream_testing_utils

Conversation

@Thunkar

@Thunkar Thunkar commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Upstreaming the utilities build for aztec-kit so external projects can benefit from our e2e scaffolding. Essentially the same thing we already use, but pure ts rather than the unpublishable .sh script. Verified with ci-full-no-test-cache

@Thunkar Thunkar self-assigned this Jul 9, 2026
@Thunkar Thunkar added ci-full Run all master checks. ci-draft Run CI on draft PRs. labels Jul 9, 2026
@Thunkar Thunkar changed the title wip feat: in-process testing network Jul 9, 2026
Thunkar added 2 commits July 9, 2026 12:32
The pure-Node signal/exit handlers in startAnvil only reap anvil when node runs
its own handlers (explicit stop, Ctrl+C, normal exit, uncaught exception). On a
parent hard-kill (SIGKILL/crash/OOM) they never run, and the detached anvil is
orphaned — verified empirically. That is the exact failure the removed
anvil_kill_wrapper.sh guarded against and a known source of CI flakiness.

Spawn anvil under a small inlined bash watchdog that polls its parent (this node
process) and reaps anvil via an EXIT/INT/TERM trap when the parent dies for any
reason. Inlined (not a shipped .sh) so it works from the published npm tarball,
with the resolved anvil binary passed via $ANVIL_BIN so it works without anvil
on PATH.
The watchdog trapped cleanup on EXIT/INT/TERM, but a trapped TERM does not
terminate bash — it ran cleanup and then resumed the parent-poll loop, so the
supervisor never exited on stop() until killChild's 5s SIGKILL escalation. That
5s collided with jest's 5s hook timeout and hung afterEach teardown
(forwarder_l1_tx_utils.test.ts). Trap the kill on EXIT only and have INT/TERM
just exit (firing the EXIT trap); use 'sleep & wait' so the poll is
interruptible. stop() now returns in ~1s; orphan-on-parent-death still holds.
@Thunkar Thunkar added ci-full-no-test-cache and removed ci-full Run all master checks. labels Jul 9, 2026
@Thunkar Thunkar changed the title feat: in-process testing network feat: exported in-process testing network Jul 9, 2026
@Thunkar
Thunkar requested review from nchamo and spalladino July 9, 2026 13:41
@Thunkar
Thunkar marked this pull request as ready for review July 9, 2026 13:41

@nchamo nchamo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Some small comments

Comment on lines +75 to +76
await stopNode();
await stopAnvil();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we run them in parallel? So that if the first fails, the second one is also stopped?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done!

Comment on lines +81 to +84
const envBin = process.env.ANVIL_BIN;
if (envBin && existsSync(envBin)) {
return envBin;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I understand having defaults if $ANVIL_BIN is not set. But if it is set and it doesn't exist, then we should probably fail, instead of using default version

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

mmm, yeah reworked this part

() => {},
);

return {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Claude suggested we also implement asyncDispose

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I did and I don't know if I'm a fan of the syntax, but removing the finally is neat

* `maxFeesPerGas.feePerL2Gas must be >= gasFees.feePerL2Gas`. Apply via
* `wallet.setMinFeePadding(TEST_FEE_PADDING)` on every test wallet that sends txs.
*/
export const TEST_FEE_PADDING = 30;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this the same as PIPELINED_FEE_PADDING for the same reasons? Just checking if we could re-use it or if they are different things

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It is, but for dependency reasons made PIPELINED_FEE_PADDING an alias

Comment on lines +91 to +92
/** Override the default per-address fee juice granted at genesis to funded addresses. */
initialAccountFeeJuice: Fr;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should this be optional if it's a default override?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines +27 to +28
expect(await a.node.getBlockNumber()).toBeGreaterThanOrEqual(0);
expect(await b.node.getBlockNumber()).toBeGreaterThanOrEqual(0);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we test strictly greater, to make sure block production works?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment on lines +82 to +84
if (envBin && existsSync(envBin)) {
return envBin;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we also test it's executable?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Done

Comment thread yarn-project/ethereum/src/test/start_anvil.ts Outdated
Comment on lines +34 to +35
/** anvil block time in seconds. Omit for automine (the default). */
l1BlockTime?: number;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Heads up that createLocalNetwork sets useAutomineSequencer to true by default, which sets anvil to automine during startup (see sequencer-client/src/sequencer/automine/automine_sequencer.ts start()). So a user setting eg l1BlockTime=12 will see their anvil still set to automine. I'd remove this option altogether for now, or add proper support for it if we really have a need for it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Removed!

Comment on lines +46 to +48
* Necessary because `deployAztecL1Contracts` shells out to bare `forge`/`solc`, and those inherit
* PATH from us. Since the aztec-up change that stopped polluting the user's interactive PATH,
* `forge`/`cast`/`anvil`/`nargo` are only reachable via `~/.aztec/current/internal-bin/`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'd rather modify deployAztecL1Contracts than meddling with PATH

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Right, this is reworked now

@Thunkar
Thunkar requested a review from nventuro as a code owner July 14, 2026 12:21
@Thunkar
Thunkar requested review from nchamo and spalladino and removed request for nventuro July 14, 2026 12:24

@spalladino spalladino left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. One thing to look out for is whether the user has a local anvil version that works with Aztec. Problem is, I don't know what's the min version we need (I guess the one pinned in the docker image?).

@Thunkar

Thunkar commented Jul 14, 2026

Copy link
Copy Markdown
Collaborator Author

Looks good. One thing to look out for is whether the user has a local anvil version that works with Aztec. Problem is, I don't know what's the min version we need (I guess the one pinned in the docker image?).

We can refine this, but I think ATM we can assume that if they're deep enough to have an e2e test that uses this external network, they also have the toolchain installed

@Thunkar
Thunkar merged commit 7e09008 into merge-train/fairies-v5 Jul 14, 2026
12 checks passed
@Thunkar
Thunkar deleted the gj/upstream_testing_utils branch July 14, 2026 13:55
PhilWindle pushed a commit that referenced this pull request Jul 21, 2026
Upstreaming the utilities build for `aztec-kit` so external projects can
benefit from our e2e scaffolding. Essentially the same thing we already
use, but pure ts rather than the unpublishable .sh script. Verified with
`ci-full-no-test-cache`

(cherry picked from commit 7e09008)
PhilWindle pushed a commit that referenced this pull request Jul 21, 2026
Upstreaming the utilities build for `aztec-kit` so external projects can
benefit from our e2e scaffolding. Essentially the same thing we already
use, but pure ts rather than the unpublishable .sh script. Verified with
`ci-full-no-test-cache`

(cherry picked from commit 7e09008)
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
Upstreaming the utilities build for `aztec-kit` so external projects can
benefit from our e2e scaffolding. Essentially the same thing we already
use, but pure ts rather than the unpublishable .sh script. Verified with
`ci-full-no-test-cache`

(cherry picked from commit 7e09008)
rangozd pushed a commit to rangozd/aztec-packages that referenced this pull request Aug 5, 2026
…o next (AztecProtocol#24933)

Forward-ports the **prover** and **node / world-state / barretenberg**
slices of the v5-next → next backlog (work merged to `v5-next` after the
~2026-07-08 cut that reshaped `next`).

## Applied (clean cherry-picks, chronological)
- feat(prover): revive cancelled proving jobs from a persisted aborted
state (AztecProtocol#24578)
- fix(prover-node): rebuild pruned checkpoint provers and recover the
epoch (AztecProtocol#24436)
- feat: exported in-process testing network (AztecProtocol#24629)
- fix(validator): sync world state before forking in checkpoint proposal
validation (AztecProtocol#24694)

## ⚠️ Needs owner conflict-resolution (conflict against reshaped `next`;
not included here)
Cherry-pick onto this branch and resolve:
- [ ] `git cherry-pick -x a4e3a44` — feat(world-state): support
prefilled nullifiers in genesis state (AztecProtocol#24567) **[RESHAPE — v6 subsystem
rewritten; re-implement, do not merge]**
- [ ] `git cherry-pick -x c44e74e` — fix(prover-node): do not abort
in-flight proving jobs on a clean shutdown (AztecProtocol#24579)
- [ ] `git cherry-pick -x 1039d38` — feat: allow custom proof
submission target address (AztecProtocol#24270)

Part of the manual v5-next → next backlog sweep. Draft until conflicts
are resolved and CI is green.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants