Skip to content

fix: init bb.js sync singleton before subsystems start in createAndSync#24147

Merged
PhilWindle merged 2 commits into
merge-train/spartan-v5from
phil/a-1243-init-bb-singleton-in-createandsync
Jun 17, 2026
Merged

fix: init bb.js sync singleton before subsystems start in createAndSync#24147
PhilWindle merged 2 commits into
merge-train/spartan-v5from
phil/a-1243-init-bb-singleton-in-createandsync

Conversation

@PhilWindle

Copy link
Copy Markdown
Collaborator

Problem

A prover node in production crashed an epoch proving job:

Error in EpochSession 9598f7a8-...: Error: Sub-tree for checkpoint 1 failed: Error: First call BarretenbergSync.initSingleton() on @aztec/bb.js module.
    at TopTreeProvingState.rejectionCallback (.../prover-client/dest/orchestrator/top-tree-orchestrator.js:68:210)

The error comes from BarretenbergSync.getSingleton() throwing when the WASM singleton has not been initialised. Epoch proving deserializes compressed Chonk proofs via ChonkProof.fromBufferChonkProof.fromCompressedBytesgetSingleton().

The prover node starts monitoring epochs as soon as it is created inside AztecNodeService.createAndSync. The only init on the start path (aztec_start_action.ts) runs later and is guarded on services.aztec, so an EpochSession can reach the decompress path before the singleton is initialised — the race that crashed the job in production.

Fix

Initialise the singleton at the top of createAndSync, before any subsystem runs. This covers the prover node, validator, sequencer, and every other createAndSync caller (including e2e tests).

The existing initSingleton() call in aztec_start_action is left in place — initSingleton is idempotent (the singleton promise is cached), so it remains a harmless guard for the RPC schema-parsing path.

Fixes A-1243.

The prover node begins monitoring epochs as soon as it is created in
createAndSync, and epoch proving deserializes compressed Chonk proofs via
ChonkProof.fromBuffer -> BarretenbergSync.getSingleton(), which throws
"First call BarretenbergSync.initSingleton()" if the singleton has not yet
been initialised. The existing init in aztec_start_action runs later and is
guarded on services.aztec, leaving a race that crashed EpochSession jobs in
production. Initialise the singleton at the top of createAndSync so every
subsystem (and every createAndSync caller) is covered.
@PhilWindle PhilWindle marked this pull request as ready for review June 17, 2026 09:56
createAndSync now imports @aztec/bb.js to initialise the sync singleton, so
declare it as a dependency. Fixes the import-x/no-extraneous-dependencies lint
error.
@PhilWindle PhilWindle merged commit b7230ad into merge-train/spartan-v5 Jun 17, 2026
12 checks passed
@PhilWindle PhilWindle deleted the phil/a-1243-init-bb-singleton-in-createandsync branch June 17, 2026 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants