Skip to content

chore: Accumulated ports to next - #25043

Merged
PhilWindle merged 1 commit into
nextfrom
port-to-next-staging
Jul 29, 2026
Merged

PhilWindle merged 1 commit into
nextfrom
port-to-next-staging

Conversation

@AztecBot

@AztecBot AztecBot commented Jul 29, 2026 •

Copy link
Copy Markdown
Collaborator

BEGIN_COMMIT_OVERRIDE
feat(prover-node): tear down checkpoint sub-tree once block proofs are ready (A-1213) (#24982)
END_COMMIT_OVERRIDE

…e ready (A-1213) (#24982)

## What

Reduces prover-node memory by tearing down each checkpoint's sub-tree
orchestrator as soon as its block proofs are captured, instead of
retaining it for the whole proof-submission window.

Each `CheckpointProver` held its `CheckpointSubTreeOrchestrator` — and
every `TxProvingState`, AVM circuit input, and base/merge/parity proof
it carried — alive until the prover was reaped at the end of the
submission window, long after the checkpoint's block proofs were
produced. Across every proven checkpoint this accumulates and dominates
prover-node memory under load.

Now, once the sub-tree's `SubTreeResult` is captured, the
`CheckpointProver` drops the sub-tree orchestrator. The block-proof
outputs survive via the resolved promise; post-completion consumers (the
top-tree job, a rebuilt `EpochSession`, failure upload) read only
`whenBlockProofsReady()` and the prover's own fields (`checkpoint`,
`txs`, headers, sibling paths), never the sub-tree. Teardown is tracked
so `whenDone()` awaits it and stays idempotent with the cancel/reap
path.

## Correctness

- Teardown of the sub-tree runs exactly once: `teardownSubTree()`
captures the orchestrator and nulls the field in a synchronous prefix
before any `await`, so the success-driven teardown and a concurrent
cancel/reap can't both call `stop()`.
- `whenDone()` awaits the block-proof settlement between `runPromise`
and the teardown check, so it can't report completion in the window
where block-level proving has finished enqueueing (`runPromise`
resolved) but the sub-tree proofs — and the teardown they trigger — are
still outstanding.

## Scope

This reclaims the *cross-checkpoint retention* of already-proven
sub-trees. It does **not** free the intermediates of checkpoints that
are *still proving* (the in-flight AVM inputs / base-rollup hints /
recursive proofs). Freeing those as they are consumed is a separate,
more invasive change and is deliberately left as a follow-up.

The broker remains a separate large consumer (A-1215), as does the
prover-node's `BrokerCircuitProverFacade` inline-inputs retention
(A-1517).

## Testing

- `yarn build`, full `@aztec/prover-node` `checkpoint-prover` suite.
- New tests: the sub-tree is released exactly once on completion while
the block-proof outputs still resolve; a subsequent reap cancel is a
no-op; and `whenDone()` stays pending until the sub-tree result lands
and teardown completes (asserted by calling it before the result
resolves).
@PhilWindle
PhilWindle added this pull request to the merge queue Jul 29, 2026
@AztecBot

Copy link
Copy Markdown
Collaborator Author

🤖 Auto-merge enabled after 8 hours of inactivity. This PR will be merged automatically once all checks pass.

Merged via the queue into next with commit bdf5597 Jul 29, 2026
33 of 37 checks passed
@PhilWindle
PhilWindle deleted the port-to-next-staging branch July 29, 2026 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants