@aztec/prover-client 0.0.0-test.1 → 0.0.1-commit.b655e406

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 (121) hide show
  1. package/dest/block-factory/index.d.ts +2 -0
  2. package/dest/block-factory/index.d.ts.map +1 -0
  3. package/dest/block-factory/light.d.ts +38 -0
  4. package/dest/block-factory/light.d.ts.map +1 -0
  5. package/dest/block-factory/light.js +94 -0
  6. package/dest/config.d.ts +6 -6
  7. package/dest/config.d.ts.map +1 -1
  8. package/dest/config.js +11 -1
  9. package/dest/mocks/fixtures.d.ts +7 -4
  10. package/dest/mocks/fixtures.d.ts.map +1 -1
  11. package/dest/mocks/fixtures.js +32 -4
  12. package/dest/mocks/test_context.d.ts +43 -15
  13. package/dest/mocks/test_context.d.ts.map +1 -1
  14. package/dest/mocks/test_context.js +110 -48
  15. package/dest/orchestrator/block-building-helpers.d.ts +37 -28
  16. package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
  17. package/dest/orchestrator/block-building-helpers.js +156 -150
  18. package/dest/orchestrator/block-proving-state.d.ts +62 -46
  19. package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
  20. package/dest/orchestrator/block-proving-state.js +223 -179
  21. package/dest/orchestrator/checkpoint-proving-state.d.ts +63 -0
  22. package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -0
  23. package/dest/orchestrator/checkpoint-proving-state.js +211 -0
  24. package/dest/orchestrator/epoch-proving-state.d.ts +37 -24
  25. package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
  26. package/dest/orchestrator/epoch-proving-state.js +143 -73
  27. package/dest/orchestrator/orchestrator.d.ts +34 -31
  28. package/dest/orchestrator/orchestrator.d.ts.map +1 -1
  29. package/dest/orchestrator/orchestrator.js +392 -234
  30. package/dest/orchestrator/orchestrator_metrics.d.ts +2 -0
  31. package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
  32. package/dest/orchestrator/orchestrator_metrics.js +9 -0
  33. package/dest/orchestrator/tx-proving-state.d.ts +12 -10
  34. package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
  35. package/dest/orchestrator/tx-proving-state.js +30 -38
  36. package/dest/prover-client/prover-client.d.ts +3 -3
  37. package/dest/prover-client/prover-client.d.ts.map +1 -1
  38. package/dest/prover-client/prover-client.js +5 -4
  39. package/dest/prover-client/server-epoch-prover.d.ts +13 -10
  40. package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
  41. package/dest/prover-client/server-epoch-prover.js +11 -11
  42. package/dest/proving_broker/broker_prover_facade.d.ts +22 -15
  43. package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
  44. package/dest/proving_broker/broker_prover_facade.js +64 -39
  45. package/dest/proving_broker/config.d.ts +9 -4
  46. package/dest/proving_broker/config.d.ts.map +1 -1
  47. package/dest/proving_broker/config.js +15 -4
  48. package/dest/proving_broker/factory.d.ts +1 -1
  49. package/dest/proving_broker/factory.d.ts.map +1 -1
  50. package/dest/proving_broker/factory.js +5 -1
  51. package/dest/proving_broker/fixtures.js +1 -1
  52. package/dest/proving_broker/proof_store/factory.js +1 -1
  53. package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
  54. package/dest/proving_broker/proof_store/gcs_proof_store.js +1 -0
  55. package/dest/proving_broker/proof_store/index.d.ts +1 -0
  56. package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
  57. package/dest/proving_broker/proof_store/index.js +1 -0
  58. package/dest/proving_broker/proving_agent.d.ts +3 -3
  59. package/dest/proving_broker/proving_agent.d.ts.map +1 -1
  60. package/dest/proving_broker/proving_agent.js +83 -47
  61. package/dest/proving_broker/proving_broker.d.ts +11 -2
  62. package/dest/proving_broker/proving_broker.d.ts.map +1 -1
  63. package/dest/proving_broker/proving_broker.js +34 -22
  64. package/dest/proving_broker/proving_broker_database/memory.js +1 -1
  65. package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
  66. package/dest/proving_broker/proving_broker_database/persisted.js +9 -8
  67. package/dest/proving_broker/proving_job_controller.d.ts +7 -8
  68. package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
  69. package/dest/proving_broker/proving_job_controller.js +89 -61
  70. package/dest/proving_broker/rpc.d.ts +3 -5
  71. package/dest/proving_broker/rpc.d.ts.map +1 -1
  72. package/dest/proving_broker/rpc.js +1 -4
  73. package/dest/test/mock_proof_store.d.ts +9 -0
  74. package/dest/test/mock_proof_store.d.ts.map +1 -0
  75. package/dest/test/mock_proof_store.js +10 -0
  76. package/dest/test/mock_prover.d.ts +23 -16
  77. package/dest/test/mock_prover.d.ts.map +1 -1
  78. package/dest/test/mock_prover.js +38 -20
  79. package/package.json +29 -29
  80. package/src/block-factory/index.ts +1 -0
  81. package/src/block-factory/light.ts +140 -0
  82. package/src/config.ts +24 -8
  83. package/src/mocks/fixtures.ts +43 -15
  84. package/src/mocks/test_context.ts +201 -75
  85. package/src/orchestrator/block-building-helpers.ts +247 -243
  86. package/src/orchestrator/block-proving-state.ts +247 -231
  87. package/src/orchestrator/checkpoint-proving-state.ts +299 -0
  88. package/src/orchestrator/epoch-proving-state.ts +187 -111
  89. package/src/orchestrator/orchestrator.ts +590 -289
  90. package/src/orchestrator/orchestrator_metrics.ts +20 -1
  91. package/src/orchestrator/tx-proving-state.ts +60 -61
  92. package/src/prover-client/prover-client.ts +16 -14
  93. package/src/prover-client/server-epoch-prover.ts +40 -21
  94. package/src/proving_broker/broker_prover_facade.ts +200 -113
  95. package/src/proving_broker/config.ts +17 -6
  96. package/src/proving_broker/factory.ts +2 -1
  97. package/src/proving_broker/fixtures.ts +1 -1
  98. package/src/proving_broker/proof_store/factory.ts +1 -1
  99. package/src/proving_broker/proof_store/gcs_proof_store.ts +5 -1
  100. package/src/proving_broker/proof_store/index.ts +1 -0
  101. package/src/proving_broker/proof_store/inline_proof_store.ts +1 -1
  102. package/src/proving_broker/proving_agent.ts +89 -47
  103. package/src/proving_broker/proving_broker.ts +51 -32
  104. package/src/proving_broker/proving_broker_database/memory.ts +1 -1
  105. package/src/proving_broker/proving_broker_database/persisted.ts +9 -8
  106. package/src/proving_broker/proving_job_controller.ts +92 -81
  107. package/src/proving_broker/rpc.ts +1 -6
  108. package/src/test/mock_proof_store.ts +14 -0
  109. package/src/test/mock_prover.ts +164 -60
  110. package/dest/bin/get-proof-inputs.d.ts +0 -2
  111. package/dest/bin/get-proof-inputs.d.ts.map +0 -1
  112. package/dest/bin/get-proof-inputs.js +0 -51
  113. package/dest/block_builder/index.d.ts +0 -6
  114. package/dest/block_builder/index.d.ts.map +0 -1
  115. package/dest/block_builder/light.d.ts +0 -33
  116. package/dest/block_builder/light.d.ts.map +0 -1
  117. package/dest/block_builder/light.js +0 -82
  118. package/src/bin/get-proof-inputs.ts +0 -59
  119. package/src/block_builder/index.ts +0 -6
  120. package/src/block_builder/light.ts +0 -101
  121. /package/dest/{block_builder → block-factory}/index.js +0 -0
@@ -1,27 +1,30 @@
1
- import {
2
- type ARCHIVE_HEIGHT,
3
- type L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH,
4
- type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
5
- type TUBE_PROOF_LENGTH,
6
- VK_TREE_HEIGHT,
1
+ import { BatchedBlob, BatchedBlobAccumulator, type FinalBlobBatchingChallenges } from '@aztec/blob-lib';
2
+ import type {
3
+ ARCHIVE_HEIGHT,
4
+ L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
5
+ NESTED_RECURSIVE_PROOF_LENGTH,
6
+ NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
7
7
  } from '@aztec/constants';
8
8
  import type { Fr } from '@aztec/foundation/fields';
9
9
  import type { Tuple } from '@aztec/foundation/serialize';
10
- import { MembershipWitness, type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
11
- import { getVKIndex, getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
12
- import type { ProofAndVerificationKey, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
10
+ import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
11
+ import type { PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
13
12
  import type { Proof } from '@aztec/stdlib/proofs';
14
13
  import {
15
- BlockMergeRollupInputs,
16
- type BlockRootOrBlockMergePublicInputs,
17
- PreviousRollupBlockData,
18
- RootRollupInputs,
14
+ CheckpointConstantData,
15
+ CheckpointMergeRollupPrivateInputs,
16
+ CheckpointPaddingRollupPrivateInputs,
17
+ CheckpointRollupPublicInputs,
18
+ PublicChonkVerifierPublicInputs,
19
+ RootRollupPrivateInputs,
19
20
  type RootRollupPublicInputs,
20
21
  } from '@aztec/stdlib/rollup';
21
22
  import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
22
- import type { BlockHeader, GlobalVariables } from '@aztec/stdlib/tx';
23
+ import type { BlockHeader } from '@aztec/stdlib/tx';
23
24
 
24
- import { BlockProvingState } from './block-proving-state.js';
25
+ import { toProofData } from './block-building-helpers.js';
26
+ import type { ProofState } from './block-proving-state.js';
27
+ import { CheckpointProvingState } from './checkpoint-proving-state.js';
25
28
 
26
29
  export type TreeSnapshots = Map<MerkleTreeId, AppendOnlyTreeSnapshot>;
27
30
 
@@ -41,58 +44,97 @@ export type ProvingResult = { status: 'success' } | { status: 'failure'; reason:
41
44
  * Captures resolve and reject callbacks to provide a promise base interface to the consumer of our proving.
42
45
  */
43
46
  export class EpochProvingState {
44
- private blockRootOrMergeProvingOutputs: UnbalancedTreeStore<
45
- PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
47
+ private checkpointProofs: UnbalancedTreeStore<
48
+ ProofState<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
46
49
  >;
47
- private paddingBlockRootProvingOutput:
48
- | PublicInputsAndRecursiveProof<BlockRootOrBlockMergePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
50
+ private checkpointPaddingProof:
51
+ | ProofState<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
49
52
  | undefined;
50
- private rootRollupProvingOutput: PublicInputsAndRecursiveProof<RootRollupPublicInputs> | undefined;
53
+ private rootRollupProof: ProofState<RootRollupPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH> | undefined;
54
+ private checkpoints: (CheckpointProvingState | undefined)[] = [];
55
+ private startBlobAccumulator: BatchedBlobAccumulator;
56
+ private endBlobAccumulator: BatchedBlobAccumulator | undefined;
57
+ private finalBatchedBlob: BatchedBlob | undefined;
51
58
  private provingStateLifecycle = PROVING_STATE_LIFECYCLE.PROVING_STATE_CREATED;
52
59
 
53
- // Map from tx hash to tube proof promise. Used when kickstarting tube proofs before tx processing.
54
- public readonly cachedTubeProofs = new Map<string, Promise<ProofAndVerificationKey<typeof TUBE_PROOF_LENGTH>>>();
55
-
56
- public blocks: (BlockProvingState | undefined)[] = [];
60
+ // Map from tx hash to chonk verifier proof promise. Used when kickstarting chonk verifier proofs before tx processing.
61
+ public readonly cachedChonkVerifierProofs = new Map<
62
+ string,
63
+ Promise<
64
+ PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
65
+ >
66
+ >();
57
67
 
58
68
  constructor(
59
69
  public readonly epochNumber: number,
60
- public readonly firstBlockNumber: number,
61
- public readonly totalNumBlocks: number,
70
+ public readonly totalNumCheckpoints: number,
71
+ private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
72
+ private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void,
62
73
  private completionCallback: (result: ProvingResult) => void,
63
74
  private rejectionCallback: (reason: string) => void,
64
75
  ) {
65
- this.blockRootOrMergeProvingOutputs = new UnbalancedTreeStore(totalNumBlocks);
76
+ this.checkpointProofs = new UnbalancedTreeStore(totalNumCheckpoints);
77
+ this.startBlobAccumulator = BatchedBlobAccumulator.newWithChallenges(finalBlobBatchingChallenges);
66
78
  }
67
79
 
68
80
  // Adds a block to the proving state, returns its index
69
81
  // Will update the proving life cycle if this is the last block
70
- public startNewBlock(
71
- globalVariables: GlobalVariables,
72
- l1ToL2Messages: Fr[],
73
- l1ToL2MessageSubtreeSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH>,
74
- l1ToL2MessageTreeSnapshotAfterInsertion: AppendOnlyTreeSnapshot,
75
- lastArchiveSnapshot: AppendOnlyTreeSnapshot,
76
- newArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
82
+ public startNewCheckpoint(
83
+ checkpointIndex: number,
84
+ constants: CheckpointConstantData,
85
+ totalNumBlocks: number,
86
+ totalNumBlobFields: number,
77
87
  previousBlockHeader: BlockHeader,
78
- ): BlockProvingState {
79
- const index = globalVariables.blockNumber.toNumber() - this.firstBlockNumber;
80
- const block = new BlockProvingState(
81
- index,
82
- globalVariables,
83
- l1ToL2Messages,
84
- l1ToL2MessageSubtreeSiblingPath,
85
- l1ToL2MessageTreeSnapshotAfterInsertion,
86
- lastArchiveSnapshot,
87
- newArchiveSiblingPath,
88
+ lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
89
+ l1ToL2Messages: Fr[],
90
+ lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
91
+ lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>,
92
+ newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
93
+ newL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>,
94
+ ): CheckpointProvingState {
95
+ if (checkpointIndex >= this.totalNumCheckpoints) {
96
+ throw new Error(
97
+ `Unable to start a new checkpoint at index ${checkpointIndex}. Expected at most ${this.totalNumCheckpoints} checkpoints.`,
98
+ );
99
+ }
100
+
101
+ const checkpoint = new CheckpointProvingState(
102
+ checkpointIndex,
103
+ constants,
104
+ totalNumBlocks,
105
+ totalNumBlobFields,
106
+ this.finalBlobBatchingChallenges,
88
107
  previousBlockHeader,
108
+ lastArchiveSiblingPath,
109
+ l1ToL2Messages,
110
+ lastL1ToL2MessageTreeSnapshot,
111
+ lastL1ToL2MessageSubtreeRootSiblingPath,
112
+ newL1ToL2MessageTreeSnapshot,
113
+ newL1ToL2MessageSubtreeRootSiblingPath,
89
114
  this,
115
+ this.onCheckpointBlobAccumulatorSet,
90
116
  );
91
- this.blocks[index] = block;
92
- if (this.blocks.filter(b => !!b).length === this.totalNumBlocks) {
117
+ this.checkpoints[checkpointIndex] = checkpoint;
118
+
119
+ if (this.checkpoints.filter(c => !!c).length === this.totalNumCheckpoints) {
93
120
  this.provingStateLifecycle = PROVING_STATE_LIFECYCLE.PROVING_STATE_FULL;
94
121
  }
95
- return block;
122
+
123
+ return checkpoint;
124
+ }
125
+
126
+ public getCheckpointProvingState(index: number) {
127
+ return this.checkpoints[index];
128
+ }
129
+
130
+ public getCheckpointProvingStateByBlockNumber(blockNumber: number) {
131
+ return this.checkpoints.find(
132
+ c => c && blockNumber >= c.firstBlockNumber && blockNumber < c.firstBlockNumber + c.totalNumBlocks,
133
+ );
134
+ }
135
+
136
+ public getBlockProvingStateByBlockNumber(blockNumber: number) {
137
+ return this.getCheckpointProvingStateByBlockNumber(blockNumber)?.getBlockProvingStateByBlockNumber(blockNumber);
96
138
  }
97
139
 
98
140
  // Returns true if this proving state is still valid, false otherwise
@@ -103,95 +145,146 @@ export class EpochProvingState {
103
145
  );
104
146
  }
105
147
 
106
- // Returns true if we are still able to accept blocks, false otherwise
107
- public isAcceptingBlocks() {
108
- return this.provingStateLifecycle === PROVING_STATE_LIFECYCLE.PROVING_STATE_CREATED;
148
+ // Returns true if we are still able to accept checkpoints, false otherwise.
149
+ public isAcceptingCheckpoints() {
150
+ return this.checkpoints.filter(c => !!c).length < this.totalNumCheckpoints;
109
151
  }
110
152
 
111
- public setBlockRootRollupProof(
112
- blockIndex: number,
113
- proof: PublicInputsAndRecursiveProof<
114
- BlockRootOrBlockMergePublicInputs,
153
+ public setCheckpointRootRollupProof(
154
+ checkpointIndex: number,
155
+ provingOutput: PublicInputsAndRecursiveProof<
156
+ CheckpointRollupPublicInputs,
115
157
  typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
116
158
  >,
117
159
  ): TreeNodeLocation {
118
- return this.blockRootOrMergeProvingOutputs.setLeaf(blockIndex, proof);
160
+ return this.checkpointProofs.setLeaf(checkpointIndex, { provingOutput });
161
+ }
162
+
163
+ public tryStartProvingCheckpointMerge(location: TreeNodeLocation) {
164
+ if (this.checkpointProofs.getNode(location)?.isProving) {
165
+ return false;
166
+ } else {
167
+ this.checkpointProofs.setNode(location, { isProving: true });
168
+ return true;
169
+ }
119
170
  }
120
171
 
121
- public setBlockMergeRollupProof(
172
+ public setCheckpointMergeRollupProof(
122
173
  location: TreeNodeLocation,
123
- proof: PublicInputsAndRecursiveProof<
124
- BlockRootOrBlockMergePublicInputs,
174
+ provingOutput: PublicInputsAndRecursiveProof<
175
+ CheckpointRollupPublicInputs,
125
176
  typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
126
177
  >,
127
178
  ) {
128
- this.blockRootOrMergeProvingOutputs.setNode(location, proof);
179
+ this.checkpointProofs.setNode(location, { provingOutput });
180
+ }
181
+
182
+ public tryStartProvingRootRollup() {
183
+ if (this.rootRollupProof?.isProving) {
184
+ return false;
185
+ } else {
186
+ this.rootRollupProof = { isProving: true };
187
+ return true;
188
+ }
129
189
  }
130
190
 
131
- public setRootRollupProof(proof: PublicInputsAndRecursiveProof<RootRollupPublicInputs>) {
132
- this.rootRollupProvingOutput = proof;
191
+ public setRootRollupProof(provingOutput: PublicInputsAndRecursiveProof<RootRollupPublicInputs>) {
192
+ this.rootRollupProof = { provingOutput };
133
193
  }
134
194
 
135
- public setPaddingBlockRootProof(
136
- proof: PublicInputsAndRecursiveProof<
137
- BlockRootOrBlockMergePublicInputs,
195
+ public tryStartProvingPaddingCheckpoint() {
196
+ if (this.checkpointPaddingProof?.isProving) {
197
+ return false;
198
+ } else {
199
+ this.checkpointPaddingProof = { isProving: true };
200
+ return true;
201
+ }
202
+ }
203
+
204
+ public setCheckpointPaddingProof(
205
+ provingOutput: PublicInputsAndRecursiveProof<
206
+ CheckpointRollupPublicInputs,
138
207
  typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
139
208
  >,
140
209
  ) {
141
- this.paddingBlockRootProvingOutput = proof;
210
+ this.checkpointPaddingProof = { provingOutput };
211
+ }
212
+
213
+ public async setBlobAccumulators() {
214
+ let previousAccumulator = this.startBlobAccumulator;
215
+ // Accumulate blobs as far as we can for this epoch.
216
+ for (let i = 0; i < this.totalNumCheckpoints; i++) {
217
+ const checkpoint = this.checkpoints[i];
218
+ if (!checkpoint) {
219
+ break;
220
+ }
221
+
222
+ const endAccumulator =
223
+ checkpoint.getEndBlobAccumulator() || (await checkpoint.accumulateBlobs(previousAccumulator));
224
+ if (!endAccumulator) {
225
+ break;
226
+ }
227
+
228
+ previousAccumulator = endAccumulator;
229
+
230
+ // If this is the last checkpoint, set the end blob accumulator.
231
+ if (i === this.totalNumCheckpoints - 1) {
232
+ this.endBlobAccumulator = endAccumulator;
233
+ }
234
+ }
235
+ }
236
+
237
+ public async finalizeBatchedBlob() {
238
+ if (!this.endBlobAccumulator) {
239
+ throw new Error('End blob accumulator not ready.');
240
+ }
241
+ this.finalBatchedBlob = await this.endBlobAccumulator.finalize(true /* verifyProof */);
142
242
  }
143
243
 
144
244
  public getParentLocation(location: TreeNodeLocation) {
145
- return this.blockRootOrMergeProvingOutputs.getParentLocation(location);
245
+ return this.checkpointProofs.getParentLocation(location);
146
246
  }
147
247
 
148
- public getBlockMergeRollupInputs(mergeLocation: TreeNodeLocation) {
149
- const [left, right] = this.blockRootOrMergeProvingOutputs.getChildren(mergeLocation);
248
+ public getCheckpointMergeRollupInputs(mergeLocation: TreeNodeLocation) {
249
+ const [left, right] = this.checkpointProofs.getChildren(mergeLocation).map(c => c?.provingOutput);
150
250
  if (!left || !right) {
151
- throw new Error('At lease one child is not ready.');
251
+ throw new Error('At least one child is not ready for the checkpoint merge rollup.');
152
252
  }
153
253
 
154
- return new BlockMergeRollupInputs([this.#getPreviousRollupData(left), this.#getPreviousRollupData(right)]);
254
+ return new CheckpointMergeRollupPrivateInputs([toProofData(left), toProofData(right)]);
155
255
  }
156
256
 
157
- public getRootRollupInputs(proverId: Fr) {
257
+ public getRootRollupInputs() {
158
258
  const [left, right] = this.#getChildProofsForRoot();
159
259
  if (!left || !right) {
160
- throw new Error('At lease one child is not ready.');
260
+ throw new Error('At least one child is not ready for the root rollup.');
161
261
  }
162
262
 
163
- return RootRollupInputs.from({
164
- previousRollupData: [this.#getPreviousRollupData(left), this.#getPreviousRollupData(right)],
165
- proverId,
263
+ return RootRollupPrivateInputs.from({
264
+ previousRollups: [toProofData(left), toProofData(right)],
166
265
  });
167
266
  }
168
267
 
169
- public getPaddingBlockRootInputs(proverId: Fr) {
170
- if (!this.blocks[0]?.isComplete()) {
171
- throw new Error('Epoch needs one completed block in order to be padded.');
172
- }
173
-
174
- return this.blocks[0].getPaddingBlockRootInputs(proverId);
268
+ public getPaddingCheckpointInputs() {
269
+ return new CheckpointPaddingRollupPrivateInputs();
175
270
  }
176
271
 
177
- // Returns a specific transaction proving state
178
- public getBlockProvingStateByBlockNumber(blockNumber: number) {
179
- return this.blocks.find(block => block?.blockNumber === blockNumber);
180
- }
272
+ public getEpochProofResult(): { proof: Proof; publicInputs: RootRollupPublicInputs; batchedBlobInputs: BatchedBlob } {
273
+ const provingOutput = this.rootRollupProof?.provingOutput;
181
274
 
182
- public getEpochProofResult(): { proof: Proof; publicInputs: RootRollupPublicInputs } {
183
- if (!this.rootRollupProvingOutput) {
275
+ if (!provingOutput || !this.finalBatchedBlob) {
184
276
  throw new Error('Unable to get epoch proof result. Root rollup is not ready.');
185
277
  }
186
278
 
187
279
  return {
188
- proof: this.rootRollupProvingOutput.proof.binaryProof,
189
- publicInputs: this.rootRollupProvingOutput.inputs,
280
+ proof: provingOutput.proof.binaryProof,
281
+ publicInputs: provingOutput.inputs,
282
+ batchedBlobInputs: this.finalBatchedBlob,
190
283
  };
191
284
  }
192
285
 
193
- public isReadyForBlockMerge(location: TreeNodeLocation) {
194
- return this.blockRootOrMergeProvingOutputs.getSibling(location) !== undefined;
286
+ public isReadyForCheckpointMerge(location: TreeNodeLocation) {
287
+ return !!this.checkpointProofs.getSibling(location)?.provingOutput;
195
288
  }
196
289
 
197
290
  // Returns true if we have sufficient inputs to execute the block root rollup
@@ -228,25 +321,8 @@ export class EpochProvingState {
228
321
  #getChildProofsForRoot() {
229
322
  const rootLocation = { level: 0, index: 0 };
230
323
  // If there's only 1 block, its block root proof will be stored at the root.
231
- return this.totalNumBlocks === 1
232
- ? [this.blockRootOrMergeProvingOutputs.getNode(rootLocation), this.paddingBlockRootProvingOutput]
233
- : this.blockRootOrMergeProvingOutputs.getChildren(rootLocation);
234
- }
235
-
236
- #getPreviousRollupData({
237
- inputs,
238
- proof,
239
- verificationKey,
240
- }: PublicInputsAndRecursiveProof<
241
- BlockRootOrBlockMergePublicInputs,
242
- typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
243
- >) {
244
- const leafIndex = getVKIndex(verificationKey.keyAsFields);
245
- return new PreviousRollupBlockData(
246
- inputs,
247
- proof,
248
- verificationKey.keyAsFields,
249
- new MembershipWitness(VK_TREE_HEIGHT, BigInt(leafIndex), getVKSiblingPath(leafIndex)),
250
- );
324
+ return this.totalNumCheckpoints === 1
325
+ ? [this.checkpointProofs.getNode(rootLocation)?.provingOutput, this.checkpointPaddingProof?.provingOutput]
326
+ : this.checkpointProofs.getChildren(rootLocation).map(c => c?.provingOutput);
251
327
  }
252
328
  }