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