@aztec/prover-client 5.0.0-private.20260319 → 5.0.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dest/config.d.ts +1 -1
  2. package/dest/config.d.ts.map +1 -1
  3. package/dest/config.js +16 -2
  4. package/dest/light/lightweight_checkpoint_builder.d.ts +1 -1
  5. package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
  6. package/dest/light/lightweight_checkpoint_builder.js +15 -5
  7. package/dest/mocks/test_context.d.ts +11 -11
  8. package/dest/mocks/test_context.d.ts.map +1 -1
  9. package/dest/mocks/test_context.js +25 -28
  10. package/dest/orchestrator/block-building-helpers.d.ts +1 -1
  11. package/dest/orchestrator/checkpoint-proving-state.d.ts +20 -36
  12. package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
  13. package/dest/orchestrator/checkpoint-proving-state.js +22 -120
  14. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +161 -0
  15. package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
  16. package/dest/orchestrator/{orchestrator.js → checkpoint-sub-tree-orchestrator.js} +267 -451
  17. package/dest/orchestrator/chonk-cache.d.ts +39 -0
  18. package/dest/orchestrator/chonk-cache.d.ts.map +1 -0
  19. package/dest/orchestrator/chonk-cache.js +80 -0
  20. package/dest/orchestrator/index.d.ts +4 -2
  21. package/dest/orchestrator/index.d.ts.map +1 -1
  22. package/dest/orchestrator/index.js +3 -1
  23. package/dest/orchestrator/proving-scheduler.d.ts +81 -0
  24. package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
  25. package/dest/orchestrator/proving-scheduler.js +120 -0
  26. package/dest/orchestrator/top-tree-orchestrator.d.ts +88 -0
  27. package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
  28. package/dest/orchestrator/top-tree-orchestrator.js +232 -0
  29. package/dest/orchestrator/top-tree-proving-state.d.ts +61 -0
  30. package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -0
  31. package/dest/orchestrator/top-tree-proving-state.js +185 -0
  32. package/dest/prover-client/prover-client.d.ts +61 -4
  33. package/dest/prover-client/prover-client.d.ts.map +1 -1
  34. package/dest/prover-client/prover-client.js +54 -7
  35. package/dest/proving_broker/broker_prover_facade.d.ts +1 -1
  36. package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
  37. package/dest/proving_broker/broker_prover_facade.js +10 -16
  38. package/dest/proving_broker/config.d.ts +8 -72
  39. package/dest/proving_broker/config.d.ts.map +1 -1
  40. package/dest/proving_broker/config.js +2 -2
  41. package/dest/proving_broker/index.d.ts +2 -1
  42. package/dest/proving_broker/index.d.ts.map +1 -1
  43. package/dest/proving_broker/index.js +1 -0
  44. package/dest/proving_broker/proving_broker.d.ts +2 -2
  45. package/dest/proving_broker/proving_broker.d.ts.map +1 -1
  46. package/dest/proving_broker/proving_broker.js +32 -7
  47. package/dest/proving_broker/proving_broker_database/persisted.js +2 -2
  48. package/dest/proving_broker/rpc.d.ts +3 -1
  49. package/dest/proving_broker/rpc.d.ts.map +1 -1
  50. package/dest/proving_broker/rpc.js +80 -24
  51. package/dest/test/epoch_settlement.d.ts +36 -0
  52. package/dest/test/epoch_settlement.d.ts.map +1 -0
  53. package/dest/test/epoch_settlement.js +52 -0
  54. package/dest/test/index.d.ts +2 -0
  55. package/dest/test/index.d.ts.map +1 -0
  56. package/dest/test/index.js +1 -0
  57. package/dest/test/mock_prover.d.ts +3 -3
  58. package/package.json +19 -18
  59. package/src/config.ts +18 -2
  60. package/src/light/lightweight_checkpoint_builder.ts +16 -6
  61. package/src/mocks/test_context.ts +24 -41
  62. package/src/orchestrator/checkpoint-proving-state.ts +21 -162
  63. package/src/orchestrator/{orchestrator.ts → checkpoint-sub-tree-orchestrator.ts} +415 -661
  64. package/src/orchestrator/chonk-cache.ts +99 -0
  65. package/src/orchestrator/index.ts +8 -1
  66. package/src/orchestrator/proving-scheduler.ts +160 -0
  67. package/src/orchestrator/top-tree-orchestrator.ts +384 -0
  68. package/src/orchestrator/top-tree-proving-state.ts +219 -0
  69. package/src/prover-client/prover-client.ts +128 -18
  70. package/src/proving_broker/broker_prover_facade.ts +8 -16
  71. package/src/proving_broker/config.ts +2 -1
  72. package/src/proving_broker/index.ts +1 -0
  73. package/src/proving_broker/proving_broker.ts +27 -5
  74. package/src/proving_broker/proving_broker_database/persisted.ts +2 -2
  75. package/src/proving_broker/rpc.ts +36 -24
  76. package/src/test/epoch_settlement.ts +82 -0
  77. package/src/test/index.ts +1 -0
  78. package/dest/orchestrator/epoch-proving-state.d.ts +0 -75
  79. package/dest/orchestrator/epoch-proving-state.d.ts.map +0 -1
  80. package/dest/orchestrator/epoch-proving-state.js +0 -269
  81. package/dest/orchestrator/orchestrator.d.ts +0 -130
  82. package/dest/orchestrator/orchestrator.d.ts.map +0 -1
  83. package/dest/prover-client/server-epoch-prover.d.ts +0 -32
  84. package/dest/prover-client/server-epoch-prover.d.ts.map +0 -1
  85. package/dest/prover-client/server-epoch-prover.js +0 -40
  86. package/src/orchestrator/epoch-proving-state.ts +0 -380
  87. package/src/prover-client/server-epoch-prover.ts +0 -69
@@ -1,20 +1,17 @@
1
- import { SpongeBlob, encodeCheckpointBlobDataFromBlocks } from '@aztec/blob-lib';
2
- import { BLOBS_PER_CHECKPOINT, FIELDS_PER_BLOB, NUM_MSGS_PER_BASE_PARITY } from '@aztec/constants';
1
+ import { SpongeBlob } from '@aztec/blob-lib';
2
+ import { NUM_MSGS_PER_BASE_PARITY } from '@aztec/constants';
3
3
  import { BlockNumber } from '@aztec/foundation/branded-types';
4
4
  import { padArrayEnd } from '@aztec/foundation/collection';
5
- import { BLS12Point } from '@aztec/foundation/curves/bls12';
6
5
  import { Fr } from '@aztec/foundation/curves/bn254';
7
6
  import { UnbalancedTreeStore } from '@aztec/foundation/trees';
8
- import { computeCheckpointOutHash } from '@aztec/stdlib/messaging';
9
7
  import { ParityBasePrivateInputs } from '@aztec/stdlib/parity';
10
- import { BlockMergeRollupPrivateInputs, CheckpointRootRollupHints, CheckpointRootRollupPrivateInputs, CheckpointRootSingleBlockRollupPrivateInputs } from '@aztec/stdlib/rollup';
11
- import { accumulateBlobs, buildBlobHints, toProofData } from './block-building-helpers.js';
8
+ import { BlockMergeRollupPrivateInputs } from '@aztec/stdlib/rollup';
9
+ import { toProofData } from './block-building-helpers.js';
12
10
  import { BlockProvingState } from './block-proving-state.js';
13
11
  export class CheckpointProvingState {
14
12
  index;
15
13
  constants;
16
14
  totalNumBlocks;
17
- finalBlobBatchingChallenges;
18
15
  headerOfLastBlockInPreviousCheckpoint;
19
16
  lastArchiveSiblingPath;
20
17
  l1ToL2Messages;
@@ -22,28 +19,19 @@ export class CheckpointProvingState {
22
19
  lastL1ToL2MessageSubtreeRootSiblingPath;
23
20
  newL1ToL2MessageTreeSnapshot;
24
21
  newL1ToL2MessageSubtreeRootSiblingPath;
25
- parentEpoch;
26
- onBlobAccumulatorSet;
22
+ epochNumber;
23
+ isAlive;
24
+ onReject;
27
25
  blockProofs;
28
- checkpointRootProof;
29
26
  blocks;
30
- previousOutHashHint;
31
- outHash;
32
- // The snapshot and sibling path after the checkpoint's out hash is inserted.
33
- // Stored here to be retrieved for the next checkpoint when it's added.
34
- newOutHashHint;
35
- startBlobAccumulator;
36
- endBlobAccumulator;
37
- blobFields;
38
27
  error;
39
28
  firstBlockNumber;
40
- constructor(index, constants, totalNumBlocks, finalBlobBatchingChallenges, headerOfLastBlockInPreviousCheckpoint, lastArchiveSiblingPath, l1ToL2Messages, // The snapshot and sibling path before the new l1 to l2 message subtree is inserted.
29
+ constructor(index, constants, totalNumBlocks, headerOfLastBlockInPreviousCheckpoint, lastArchiveSiblingPath, l1ToL2Messages, // The snapshot and sibling path before the new l1 to l2 message subtree is inserted.
41
30
  lastL1ToL2MessageTreeSnapshot, lastL1ToL2MessageSubtreeRootSiblingPath, // The snapshot and sibling path after the new l1 to l2 message subtree is inserted.
42
- newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath, parentEpoch, onBlobAccumulatorSet){
31
+ newL1ToL2MessageTreeSnapshot, newL1ToL2MessageSubtreeRootSiblingPath, epochNumber, /** Owner's liveness check. `verifyState()` returns false once this returns false. */ isAlive, /** Owner's failure callback. Invoked from `reject` to surface the error upward. */ onReject){
43
32
  this.index = index;
44
33
  this.constants = constants;
45
34
  this.totalNumBlocks = totalNumBlocks;
46
- this.finalBlobBatchingChallenges = finalBlobBatchingChallenges;
47
35
  this.headerOfLastBlockInPreviousCheckpoint = headerOfLastBlockInPreviousCheckpoint;
48
36
  this.lastArchiveSiblingPath = lastArchiveSiblingPath;
49
37
  this.l1ToL2Messages = l1ToL2Messages;
@@ -51,15 +39,13 @@ export class CheckpointProvingState {
51
39
  this.lastL1ToL2MessageSubtreeRootSiblingPath = lastL1ToL2MessageSubtreeRootSiblingPath;
52
40
  this.newL1ToL2MessageTreeSnapshot = newL1ToL2MessageTreeSnapshot;
53
41
  this.newL1ToL2MessageSubtreeRootSiblingPath = newL1ToL2MessageSubtreeRootSiblingPath;
54
- this.parentEpoch = parentEpoch;
55
- this.onBlobAccumulatorSet = onBlobAccumulatorSet;
42
+ this.epochNumber = epochNumber;
43
+ this.isAlive = isAlive;
44
+ this.onReject = onReject;
56
45
  this.blocks = [];
57
46
  this.blockProofs = new UnbalancedTreeStore(totalNumBlocks);
58
47
  this.firstBlockNumber = BlockNumber(headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber + 1);
59
48
  }
60
- get epochNumber() {
61
- return this.parentEpoch.epochNumber;
62
- }
63
49
  startNewBlock(blockNumber, timestamp, totalNumTxs, lastArchiveTreeSnapshot, lastArchiveSiblingPath) {
64
50
  const index = Number(blockNumber) - Number(this.firstBlockNumber);
65
51
  if (index >= this.totalNumBlocks) {
@@ -102,60 +88,9 @@ export class CheckpointProvingState {
102
88
  provingOutput
103
89
  });
104
90
  }
105
- tryStartProvingCheckpointRoot() {
106
- if (this.checkpointRootProof?.isProving) {
107
- return false;
108
- } else {
109
- this.checkpointRootProof = {
110
- isProving: true
111
- };
112
- return true;
113
- }
114
- }
115
- setCheckpointRootRollupProof(provingOutput) {
116
- this.checkpointRootProof = {
117
- provingOutput
118
- };
119
- return this.parentEpoch.setCheckpointRootRollupProof(this.index, provingOutput);
120
- }
121
91
  getBaseParityInputs(baseParityIndex) {
122
92
  const messages = padArrayEnd(this.l1ToL2Messages.slice(baseParityIndex * NUM_MSGS_PER_BASE_PARITY, (baseParityIndex + 1) * NUM_MSGS_PER_BASE_PARITY), Fr.ZERO, NUM_MSGS_PER_BASE_PARITY);
123
- return new ParityBasePrivateInputs(messages, this.constants.vkTreeRoot);
124
- }
125
- setOutHashHint(hint) {
126
- this.previousOutHashHint = hint;
127
- }
128
- getOutHashHint() {
129
- return this.previousOutHashHint;
130
- }
131
- accumulateBlockOutHashes() {
132
- if (this.isAcceptingBlocks() || this.blocks.some((b)=>!b?.hasEndState())) {
133
- return;
134
- }
135
- if (!this.outHash) {
136
- const messagesPerBlock = this.blocks.map((b)=>b.getTxEffects().map((tx)=>tx.l2ToL1Msgs));
137
- this.outHash = computeCheckpointOutHash(messagesPerBlock);
138
- }
139
- return this.outHash;
140
- }
141
- setOutHashHintForNextCheckpoint(hint) {
142
- this.newOutHashHint = hint;
143
- }
144
- getOutHashHintForNextCheckpoint() {
145
- return this.newOutHashHint;
146
- }
147
- async accumulateBlobs(startBlobAccumulator) {
148
- if (this.isAcceptingBlocks() || this.blocks.some((b)=>!b?.hasEndState())) {
149
- return;
150
- }
151
- this.blobFields = encodeCheckpointBlobDataFromBlocks(this.blocks.map((b)=>b.getBlockBlobData()));
152
- this.endBlobAccumulator = await accumulateBlobs(this.blobFields, startBlobAccumulator);
153
- this.startBlobAccumulator = startBlobAccumulator;
154
- await this.onBlobAccumulatorSet(this);
155
- return this.endBlobAccumulator;
156
- }
157
- getEndBlobAccumulator() {
158
- return this.endBlobAccumulator;
93
+ return new ParityBasePrivateInputs(messages, this.constants.vkTreeRoot, this.constants.proverId);
159
94
  }
160
95
  getParentLocation(location) {
161
96
  return this.blockProofs.getParentLocation(location);
@@ -170,41 +105,6 @@ export class CheckpointProvingState {
170
105
  toProofData(right)
171
106
  ]);
172
107
  }
173
- getCheckpointRootRollupType() {
174
- return this.totalNumBlocks === 1 ? 'rollup-checkpoint-root-single-block' : 'rollup-checkpoint-root';
175
- }
176
- async getCheckpointRootRollupInputs() {
177
- const proofs = this.#getChildProofsForRoot();
178
- const nonEmptyProofs = proofs.filter((p)=>!!p);
179
- if (proofs.length !== nonEmptyProofs.length) {
180
- throw new Error('At least one child is not ready for the checkpoint root rollup.');
181
- }
182
- if (!this.previousOutHashHint) {
183
- throw new Error('Out hash hint is not set.');
184
- }
185
- if (!this.startBlobAccumulator) {
186
- throw new Error('Start blob accumulator is not set.');
187
- }
188
- // `blobFields` must've been set if `startBlobAccumulator` is set (in `accumulateBlobs`).
189
- const blobFields = this.blobFields;
190
- const { blobCommitments, blobsHash } = await buildBlobHints(blobFields);
191
- const hints = CheckpointRootRollupHints.from({
192
- previousBlockHeader: this.headerOfLastBlockInPreviousCheckpoint,
193
- previousArchiveSiblingPath: this.lastArchiveSiblingPath,
194
- previousOutHash: this.previousOutHashHint.treeSnapshot,
195
- newOutHashSiblingPath: this.previousOutHashHint.siblingPath,
196
- startBlobAccumulator: this.startBlobAccumulator.toBlobAccumulator(),
197
- finalBlobChallenges: this.finalBlobBatchingChallenges,
198
- blobFields: padArrayEnd(blobFields, Fr.ZERO, FIELDS_PER_BLOB * BLOBS_PER_CHECKPOINT),
199
- blobCommitments: padArrayEnd(blobCommitments, BLS12Point.ZERO, BLOBS_PER_CHECKPOINT),
200
- blobsHash
201
- });
202
- const [left, right] = nonEmptyProofs.map((p)=>toProofData(p));
203
- return !right ? new CheckpointRootSingleBlockRollupPrivateInputs(left, hints) : new CheckpointRootRollupPrivateInputs([
204
- left,
205
- right
206
- ], hints);
207
- }
208
108
  getBlockProvingStateByBlockNumber(blockNumber) {
209
109
  const index = Number(blockNumber) - Number(this.firstBlockNumber);
210
110
  return this.blocks[index];
@@ -212,12 +112,8 @@ export class CheckpointProvingState {
212
112
  isReadyForBlockMerge(location) {
213
113
  return !!this.blockProofs.getSibling(location)?.provingOutput;
214
114
  }
215
- isReadyForCheckpointRoot() {
216
- const allChildProofsReady = this.#getChildProofsForRoot().every((p)=>!!p);
217
- return allChildProofsReady && !!this.previousOutHashHint && !!this.startBlobAccumulator;
218
- }
219
115
  verifyState() {
220
- return this.parentEpoch.verifyState();
116
+ return this.isAlive();
221
117
  }
222
118
  getError() {
223
119
  return this.error;
@@ -228,9 +124,12 @@ export class CheckpointProvingState {
228
124
  }
229
125
  reject(reason) {
230
126
  this.error = reason;
231
- this.parentEpoch.reject(reason);
127
+ this.onReject(reason);
232
128
  }
233
- #getChildProofsForRoot() {
129
+ /**
130
+ * Returns the block-level proof outputs that feed into the checkpoint root rollup.
131
+ * Used by `CheckpointSubTreeOrchestrator` to surface its sub-tree result.
132
+ */ getSubTreeOutputProofs() {
234
133
  const rootLocation = {
235
134
  level: 0,
236
135
  index: 0
@@ -240,4 +139,7 @@ export class CheckpointProvingState {
240
139
  ] // If there's only 1 block, its proof will be stored at the root.
241
140
  : this.blockProofs.getChildren(rootLocation).map((c)=>c?.provingOutput);
242
141
  }
142
+ /** Sibling path of the archive tree captured before any block in this checkpoint landed. */ getLastArchiveSiblingPath() {
143
+ return this.lastArchiveSiblingPath;
144
+ }
243
145
  }
@@ -0,0 +1,161 @@
1
+ import { type ARCHIVE_HEIGHT, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
2
+ import { BlockNumber, type EpochNumber } from '@aztec/foundation/branded-types';
3
+ import { Fr } from '@aztec/foundation/curves/bn254';
4
+ import type { LoggerBindings } from '@aztec/foundation/log';
5
+ import type { SerialQueue } from '@aztec/foundation/queue';
6
+ import { type Tuple } from '@aztec/foundation/serialize';
7
+ import { EthAddress } from '@aztec/stdlib/block';
8
+ import type { ForkMerkleTreeOperations, PublicInputsAndRecursiveProof, ReadonlyWorldStateAccess, ServerCircuitProver } from '@aztec/stdlib/interfaces/server';
9
+ import { type BlockRollupPublicInputs, CheckpointConstantData } from '@aztec/stdlib/rollup';
10
+ import type { BlockHeader, ProcessedTx, Tx } from '@aztec/stdlib/tx';
11
+ import type { UInt64 } from '@aztec/stdlib/types';
12
+ import { type TelemetryClient, type Tracer } from '@aztec/telemetry-client';
13
+ import type { BlockProvingState } from './block-proving-state.js';
14
+ import { CheckpointProvingState } from './checkpoint-proving-state.js';
15
+ import type { ChonkCache } from './chonk-cache.js';
16
+ import { ProvingScheduler } from './proving-scheduler.js';
17
+ /**
18
+ * Result of proving a single checkpoint's block-level sub-tree.
19
+ *
20
+ * Contains the final block-rollup proof outputs that feed the checkpoint root rollup,
21
+ * plus the archive sibling path captured before any block in the checkpoint landed
22
+ * (the top-tree needs this to assemble the checkpoint root rollup hints).
23
+ */
24
+ export type SubTreeResult = {
25
+ blockProofOutputs: PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>[];
26
+ previousArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>;
27
+ };
28
+ /**
29
+ * Orchestrates block-level proving for a single checkpoint, stopping at the boundary
30
+ * where checkpoint root rollup would otherwise begin. Used by the per-checkpoint
31
+ * `CheckpointProver` in production; the top-tree orchestrator then composes the
32
+ * sub-tree's block proofs into the epoch proof.
33
+ *
34
+ * Wiring: a single-checkpoint mini-proving session is owned by the constructor. The
35
+ * canonical way to obtain a fully-started sub-tree is the `start` static factory,
36
+ * which also drives the single internal `startCheckpoint` call. The sub-tree never
37
+ * escalates past the checkpoint root boundary; `getSubTreeResult()` resolves once
38
+ * every block-level proof in the checkpoint's tree is ready.
39
+ */
40
+ export declare class CheckpointSubTreeOrchestrator extends ProvingScheduler {
41
+ private readonly dbProvider;
42
+ protected readonly prover: ServerCircuitProver;
43
+ private readonly proverId;
44
+ /**
45
+ * Shared chonk-verifier proof cache. Every chonk-verifier proof started by this
46
+ * sub-tree lives on the cache and survives the sub-tree's cancellation, so a tx
47
+ * whose original checkpoint is reorged out and re-appears in a replacement
48
+ * checkpoint reuses the cached proof.
49
+ */
50
+ private readonly chonkCache;
51
+ /** The epoch this sub-tree proves into. */
52
+ private readonly epochNumber;
53
+ private readonly cancelJobsOnStop;
54
+ /** The single checkpoint proving state this sub-tree owns. Allocated in the `start` factory. */
55
+ protected provingState: CheckpointProvingState | undefined;
56
+ private readonly subTreeResult;
57
+ private readonly metrics;
58
+ private dbs;
59
+ constructor(dbProvider: ReadonlyWorldStateAccess & ForkMerkleTreeOperations, prover: ServerCircuitProver, proverId: EthAddress,
60
+ /**
61
+ * Shared chonk-verifier proof cache. Every chonk-verifier proof started by this
62
+ * sub-tree lives on the cache and survives the sub-tree's cancellation, so a tx
63
+ * whose original checkpoint is reorged out and re-appears in a replacement
64
+ * checkpoint reuses the cached proof.
65
+ */
66
+ chonkCache: ChonkCache,
67
+ /** The epoch this sub-tree proves into. */
68
+ epochNumber: EpochNumber, cancelJobsOnStop: boolean | undefined, deferredJobQueue: SerialQueue, telemetryClient?: TelemetryClient, bindings?: LoggerBindings);
69
+ /** Tracks whether `cancel()` has been called; flows into the checkpoint state's isAlive hook. */
70
+ private cancelled;
71
+ get tracer(): Tracer;
72
+ getProverId(): EthAddress;
73
+ getNumActiveForks(): number;
74
+ /** Returns a promise that resolves when block-level proving completes for the checkpoint. */
75
+ getSubTreeResult(): Promise<SubTreeResult>;
76
+ /**
77
+ * Returns the archive sibling path captured at the internal checkpoint start.
78
+ * Available synchronously once `start` has resolved, before block-level proving
79
+ * completes. The top-tree consumer uses this to assemble checkpoint root rollup hints
80
+ * up-front so checkpoint root proofs can pipeline against in-flight sub-tree proving.
81
+ */
82
+ getPreviousArchiveSiblingPath(): Tuple<Fr, typeof ARCHIVE_HEIGHT>;
83
+ /**
84
+ * Constructs and starts a sub-tree for a single checkpoint. The returned sub-tree
85
+ * has had its single internal checkpoint state allocated; callers proceed directly
86
+ * to per-block `startNewBlock` / `addTxs` / `setBlockCompleted`.
87
+ *
88
+ * If the internal start rejects, the partially-constructed sub-tree is stopped
89
+ * before the error propagates, so no broker resources leak.
90
+ */
91
+ static start(dbProvider: ReadonlyWorldStateAccess & ForkMerkleTreeOperations, prover: ServerCircuitProver, proverId: EthAddress, chonkCache: ChonkCache, epochNumber: EpochNumber, cancelJobsOnStop: boolean, deferredJobQueue: SerialQueue, checkpointConstants: CheckpointConstantData, l1ToL2Messages: Fr[], totalNumBlocks: number, headerOfLastBlockInPreviousCheckpoint: BlockHeader, telemetryClient?: TelemetryClient, bindings?: LoggerBindings): Promise<CheckpointSubTreeOrchestrator>;
92
+ /**
93
+ * Kickstart chonk-verifier circuits via the shared `ChonkCache`. The cache owns the
94
+ * broker job lifecycle, so the proof survives this sub-tree's `cancel()` — a tx that
95
+ * ends up in a replacement checkpoint after a reorg can pick the cached promise up
96
+ * and skip re-proving.
97
+ */
98
+ startChonkVerifierCircuits(txs: Tx[]): Promise<void>;
99
+ /**
100
+ * Starts off a new block.
101
+ * @param blockNumber - The block number
102
+ * @param timestamp - The timestamp of the block. Required for empty blocks to construct private inputs.
103
+ * @param totalNumTxs - The total number of txs in the block.
104
+ */
105
+ startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void>;
106
+ /**
107
+ * The interface to add simulated transactions to the scheduler. Called at most once per block.
108
+ * @param txs - The transactions to be proven
109
+ */
110
+ addTxs(txs: ProcessedTx[]): Promise<void>;
111
+ /**
112
+ * Marks the block as completed.
113
+ * Computes the block header and updates the archive tree.
114
+ */
115
+ setBlockCompleted(blockNumber: BlockNumber, expectedHeader?: BlockHeader): Promise<BlockHeader>;
116
+ /**
117
+ * Cancels any further proving. If `cancelJobsOnStop` was set, aborts all pending broker jobs
118
+ * (used on reorg). Otherwise jobs remain in the broker queue and can be reused on restart.
119
+ */
120
+ cancel(): void;
121
+ protected cancelInternal(): void;
122
+ private startCheckpoint;
123
+ private updateL1ToL2MessageTree;
124
+ private prepareBaseRollupInputs;
125
+ private enqueueBaseRollup;
126
+ /**
127
+ * Route the tx's chonk-verifier dependency through the per-epoch context: read the
128
+ * cached promise (or enqueue if missing), then `.then(handleResult)` to progress to
129
+ * the base rollup once the proof lands.
130
+ */
131
+ private getOrEnqueueChonkVerifier;
132
+ private enqueueMergeRollup;
133
+ private enqueueBlockRootRollup;
134
+ private enqueueBaseParityCircuit;
135
+ private checkAndEnqueueRootParityCircuit;
136
+ private enqueueRootParityCircuit;
137
+ private enqueueBlockMergeRollup;
138
+ private checkAndEnqueueNextMergeRollup;
139
+ private checkAndEnqueueBlockRootRollup;
140
+ private checkAndEnqueueNextBlockMergeRollup;
141
+ /**
142
+ * Sub-tree analogue of the orchestrator's `checkAndEnqueueCheckpointRootRollup`:
143
+ * resolves the sub-tree promise with the block-level proof outputs once they're all ready,
144
+ * instead of escalating to the checkpoint root rollup.
145
+ */
146
+ private checkAndEnqueueSubTreeResolution;
147
+ /**
148
+ * Executes the VM circuit for a public function. Enqueues the base rollup once the
149
+ * tx's chonk-verifier + VM proofs are both ready.
150
+ */
151
+ private enqueueVM;
152
+ private checkAndEnqueueBaseRollup;
153
+ protected verifyBuiltBlockAgainstSyncedState(provingState: BlockProvingState): Promise<void>;
154
+ private getDbForBlock;
155
+ /**
156
+ * Wraps a circuit call with a tracer span and circuit attributes. Replaces the
157
+ * `ProvingScheduler.wrapCircuitCall` indirection that used to live on the abstract base.
158
+ */
159
+ private wrapCircuitCall;
160
+ }
161
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2hlY2twb2ludC1zdWItdHJlZS1vcmNoZXN0cmF0b3IuZC50cyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9vcmNoZXN0cmF0b3IvY2hlY2twb2ludC1zdWItdHJlZS1vcmNoZ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