@aztec/prover-client 3.0.0-canary.a9708bd → 3.0.0-manual.20251030
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/config.js +1 -1
- package/dest/mocks/fixtures.d.ts +4 -1
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +31 -3
- package/dest/mocks/test_context.d.ts +32 -9
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +78 -22
- package/dest/orchestrator/block-building-helpers.d.ts +33 -31
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +126 -137
- package/dest/orchestrator/block-proving-state.d.ts +60 -53
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +214 -187
- package/dest/orchestrator/checkpoint-proving-state.d.ts +63 -0
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-proving-state.js +211 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +34 -28
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +128 -84
- package/dest/orchestrator/orchestrator.d.ts +31 -30
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +368 -236
- package/dest/orchestrator/tx-proving-state.d.ts +11 -9
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +26 -23
- package/dest/prover-client/server-epoch-prover.d.ts +9 -8
- package/dest/prover-client/server-epoch-prover.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.js +9 -9
- package/dest/proving_broker/broker_prover_facade.d.ts +20 -15
- 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/config.d.ts +8 -8
- package/dest/proving_broker/config.js +5 -5
- package/dest/proving_broker/factory.js +1 -1
- 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 +29 -18
- package/dest/proving_broker/proving_broker_database/persisted.js +5 -5
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +38 -18
- package/dest/test/mock_prover.d.ts +22 -17
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +35 -20
- package/package.json +16 -17
- package/src/block-factory/light.ts +35 -9
- package/src/config.ts +1 -1
- package/src/mocks/fixtures.ts +39 -11
- package/src/mocks/test_context.ts +137 -31
- package/src/orchestrator/block-building-helpers.ts +211 -211
- package/src/orchestrator/block-proving-state.ts +235 -245
- package/src/orchestrator/checkpoint-proving-state.ts +299 -0
- package/src/orchestrator/epoch-proving-state.ts +172 -127
- package/src/orchestrator/orchestrator.ts +545 -303
- package/src/orchestrator/tx-proving-state.ts +49 -43
- package/src/prover-client/server-epoch-prover.ts +28 -18
- package/src/proving_broker/broker_prover_facade.ts +157 -86
- package/src/proving_broker/config.ts +7 -7
- package/src/proving_broker/factory.ts +1 -1
- 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 +36 -18
- package/src/proving_broker/proving_broker_database/persisted.ts +5 -5
- package/src/proving_broker/proving_job_controller.ts +38 -18
- package/src/test/mock_prover.ts +142 -60
- 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_ROOT_SIBLING_PATH_LENGTH,
|
|
5
|
+
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
5
6
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
6
|
-
TUBE_PROOF_LENGTH,
|
|
7
7
|
} from '@aztec/constants';
|
|
8
|
-
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
8
|
import type { Fr } from '@aztec/foundation/fields';
|
|
10
9
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
11
10
|
import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
12
|
-
import {
|
|
13
|
-
import type { ProofAndVerificationKey, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import type { PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
14
12
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
15
13
|
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
CheckpointConstantData,
|
|
15
|
+
CheckpointMergeRollupPrivateInputs,
|
|
16
|
+
CheckpointPaddingRollupPrivateInputs,
|
|
17
|
+
CheckpointRollupPublicInputs,
|
|
18
|
+
PublicChonkVerifierPublicInputs,
|
|
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,66 +44,97 @@ 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
|
|
|
56
|
-
// Map from tx hash to
|
|
57
|
-
public readonly
|
|
58
|
-
|
|
59
|
-
|
|
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
|
+
>();
|
|
60
67
|
|
|
61
68
|
constructor(
|
|
62
69
|
public readonly epochNumber: number,
|
|
63
|
-
public readonly
|
|
64
|
-
|
|
65
|
-
|
|
70
|
+
public readonly totalNumCheckpoints: number,
|
|
71
|
+
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
72
|
+
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void,
|
|
66
73
|
private completionCallback: (result: ProvingResult) => void,
|
|
67
74
|
private rejectionCallback: (reason: string) => void,
|
|
68
75
|
) {
|
|
69
|
-
this.
|
|
76
|
+
this.checkpointProofs = new UnbalancedTreeStore(totalNumCheckpoints);
|
|
77
|
+
this.startBlobAccumulator = BatchedBlobAccumulator.newWithChallenges(finalBlobBatchingChallenges);
|
|
70
78
|
}
|
|
71
79
|
|
|
72
80
|
// Adds a block to the proving state, returns its index
|
|
73
81
|
// Will update the proving life cycle if this is the last block
|
|
74
|
-
public
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
l1ToL2MessageTreeSnapshotAfterInsertion: AppendOnlyTreeSnapshot,
|
|
80
|
-
lastArchiveSnapshot: AppendOnlyTreeSnapshot,
|
|
81
|
-
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
82
|
-
newArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
82
|
+
public startNewCheckpoint(
|
|
83
|
+
checkpointIndex: number,
|
|
84
|
+
constants: CheckpointConstantData,
|
|
85
|
+
totalNumBlocks: number,
|
|
86
|
+
totalNumBlobFields: number,
|
|
83
87
|
previousBlockHeader: BlockHeader,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
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,
|
|
97
107
|
previousBlockHeader,
|
|
98
|
-
|
|
108
|
+
lastArchiveSiblingPath,
|
|
109
|
+
l1ToL2Messages,
|
|
110
|
+
lastL1ToL2MessageTreeSnapshot,
|
|
111
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
112
|
+
newL1ToL2MessageTreeSnapshot,
|
|
113
|
+
newL1ToL2MessageSubtreeRootSiblingPath,
|
|
99
114
|
this,
|
|
115
|
+
this.onCheckpointBlobAccumulatorSet,
|
|
100
116
|
);
|
|
101
|
-
this.
|
|
102
|
-
|
|
117
|
+
this.checkpoints[checkpointIndex] = checkpoint;
|
|
118
|
+
|
|
119
|
+
if (this.checkpoints.filter(c => !!c).length === this.totalNumCheckpoints) {
|
|
103
120
|
this.provingStateLifecycle = PROVING_STATE_LIFECYCLE.PROVING_STATE_FULL;
|
|
104
121
|
}
|
|
105
|
-
|
|
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);
|
|
106
138
|
}
|
|
107
139
|
|
|
108
140
|
// Returns true if this proving state is still valid, false otherwise
|
|
@@ -113,120 +145,146 @@ export class EpochProvingState {
|
|
|
113
145
|
);
|
|
114
146
|
}
|
|
115
147
|
|
|
116
|
-
// Returns true if we are still able to accept
|
|
117
|
-
public
|
|
118
|
-
return this.
|
|
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;
|
|
119
151
|
}
|
|
120
152
|
|
|
121
|
-
public
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
153
|
+
public setCheckpointRootRollupProof(
|
|
154
|
+
checkpointIndex: number,
|
|
155
|
+
provingOutput: PublicInputsAndRecursiveProof<
|
|
156
|
+
CheckpointRollupPublicInputs,
|
|
125
157
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
126
158
|
>,
|
|
127
159
|
): TreeNodeLocation {
|
|
128
|
-
return this.
|
|
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
|
+
}
|
|
129
170
|
}
|
|
130
171
|
|
|
131
|
-
public
|
|
172
|
+
public setCheckpointMergeRollupProof(
|
|
132
173
|
location: TreeNodeLocation,
|
|
133
|
-
|
|
134
|
-
|
|
174
|
+
provingOutput: PublicInputsAndRecursiveProof<
|
|
175
|
+
CheckpointRollupPublicInputs,
|
|
135
176
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
136
177
|
>,
|
|
137
178
|
) {
|
|
138
|
-
this.
|
|
179
|
+
this.checkpointProofs.setNode(location, { provingOutput });
|
|
139
180
|
}
|
|
140
181
|
|
|
141
|
-
public
|
|
142
|
-
this.
|
|
182
|
+
public tryStartProvingRootRollup() {
|
|
183
|
+
if (this.rootRollupProof?.isProving) {
|
|
184
|
+
return false;
|
|
185
|
+
} else {
|
|
186
|
+
this.rootRollupProof = { isProving: true };
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
public setRootRollupProof(provingOutput: PublicInputsAndRecursiveProof<RootRollupPublicInputs>) {
|
|
192
|
+
this.rootRollupProof = { provingOutput };
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
public tryStartProvingPaddingCheckpoint() {
|
|
196
|
+
if (this.checkpointPaddingProof?.isProving) {
|
|
197
|
+
return false;
|
|
198
|
+
} else {
|
|
199
|
+
this.checkpointPaddingProof = { isProving: true };
|
|
200
|
+
return true;
|
|
201
|
+
}
|
|
143
202
|
}
|
|
144
203
|
|
|
145
|
-
public
|
|
146
|
-
|
|
147
|
-
|
|
204
|
+
public setCheckpointPaddingProof(
|
|
205
|
+
provingOutput: PublicInputsAndRecursiveProof<
|
|
206
|
+
CheckpointRollupPublicInputs,
|
|
148
207
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
149
208
|
>,
|
|
150
209
|
) {
|
|
151
|
-
this.
|
|
210
|
+
this.checkpointPaddingProof = { provingOutput };
|
|
152
211
|
}
|
|
153
212
|
|
|
154
|
-
public
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
public async setBlobAccumulators(toBlock?: number) {
|
|
159
|
-
let previousAccumulator;
|
|
160
|
-
const end = toBlock ? toBlock - this.firstBlockNumber : this.blocks.length;
|
|
213
|
+
public async setBlobAccumulators() {
|
|
214
|
+
let previousAccumulator = this.startBlobAccumulator;
|
|
161
215
|
// Accumulate blobs as far as we can for this epoch.
|
|
162
|
-
for (let i = 0; i
|
|
163
|
-
const
|
|
164
|
-
if (!
|
|
165
|
-
// If the block proving state does not have a .block property, it may be awaiting more txs.
|
|
216
|
+
for (let i = 0; i < this.totalNumCheckpoints; i++) {
|
|
217
|
+
const checkpoint = this.checkpoints[i];
|
|
218
|
+
if (!checkpoint) {
|
|
166
219
|
break;
|
|
167
220
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
221
|
+
|
|
222
|
+
const endAccumulator =
|
|
223
|
+
checkpoint.getEndBlobAccumulator() || (await checkpoint.accumulateBlobs(previousAccumulator));
|
|
224
|
+
if (!endAccumulator) {
|
|
225
|
+
break;
|
|
171
226
|
}
|
|
172
|
-
|
|
173
|
-
|
|
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;
|
|
174
233
|
}
|
|
175
|
-
previousAccumulator = block.endBlobAccumulator;
|
|
176
234
|
}
|
|
177
235
|
}
|
|
178
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 */);
|
|
242
|
+
}
|
|
243
|
+
|
|
179
244
|
public getParentLocation(location: TreeNodeLocation) {
|
|
180
|
-
return this.
|
|
245
|
+
return this.checkpointProofs.getParentLocation(location);
|
|
181
246
|
}
|
|
182
247
|
|
|
183
|
-
public
|
|
184
|
-
const [left, right] = this.
|
|
248
|
+
public getCheckpointMergeRollupInputs(mergeLocation: TreeNodeLocation) {
|
|
249
|
+
const [left, right] = this.checkpointProofs.getChildren(mergeLocation).map(c => c?.provingOutput);
|
|
185
250
|
if (!left || !right) {
|
|
186
|
-
throw new Error('At
|
|
251
|
+
throw new Error('At least one child is not ready for the checkpoint merge rollup.');
|
|
187
252
|
}
|
|
188
253
|
|
|
189
|
-
return new
|
|
254
|
+
return new CheckpointMergeRollupPrivateInputs([toProofData(left), toProofData(right)]);
|
|
190
255
|
}
|
|
191
256
|
|
|
192
257
|
public getRootRollupInputs() {
|
|
193
258
|
const [left, right] = this.#getChildProofsForRoot();
|
|
194
259
|
if (!left || !right) {
|
|
195
|
-
throw new Error('At
|
|
260
|
+
throw new Error('At least one child is not ready for the root rollup.');
|
|
196
261
|
}
|
|
197
262
|
|
|
198
|
-
return
|
|
199
|
-
|
|
263
|
+
return RootRollupPrivateInputs.from({
|
|
264
|
+
previousRollups: [toProofData(left), toProofData(right)],
|
|
200
265
|
});
|
|
201
266
|
}
|
|
202
267
|
|
|
203
|
-
public
|
|
204
|
-
|
|
205
|
-
throw new Error('Epoch needs one completed block in order to be padded.');
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
return this.blocks[0].getPaddingBlockRootInputs();
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
// Returns a specific transaction proving state
|
|
212
|
-
public getBlockProvingStateByBlockNumber(blockNumber: number) {
|
|
213
|
-
return this.blocks.find(block => block?.blockNumber === blockNumber);
|
|
268
|
+
public getPaddingCheckpointInputs() {
|
|
269
|
+
return new CheckpointPaddingRollupPrivateInputs();
|
|
214
270
|
}
|
|
215
271
|
|
|
216
272
|
public getEpochProofResult(): { proof: Proof; publicInputs: RootRollupPublicInputs; batchedBlobInputs: BatchedBlob } {
|
|
217
|
-
|
|
273
|
+
const provingOutput = this.rootRollupProof?.provingOutput;
|
|
274
|
+
|
|
275
|
+
if (!provingOutput || !this.finalBatchedBlob) {
|
|
218
276
|
throw new Error('Unable to get epoch proof result. Root rollup is not ready.');
|
|
219
277
|
}
|
|
220
278
|
|
|
221
279
|
return {
|
|
222
|
-
proof:
|
|
223
|
-
publicInputs:
|
|
280
|
+
proof: provingOutput.proof.binaryProof,
|
|
281
|
+
publicInputs: provingOutput.inputs,
|
|
224
282
|
batchedBlobInputs: this.finalBatchedBlob,
|
|
225
283
|
};
|
|
226
284
|
}
|
|
227
285
|
|
|
228
|
-
public
|
|
229
|
-
return this.
|
|
286
|
+
public isReadyForCheckpointMerge(location: TreeNodeLocation) {
|
|
287
|
+
return !!this.checkpointProofs.getSibling(location)?.provingOutput;
|
|
230
288
|
}
|
|
231
289
|
|
|
232
290
|
// Returns true if we have sufficient inputs to execute the block root rollup
|
|
@@ -263,21 +321,8 @@ export class EpochProvingState {
|
|
|
263
321
|
#getChildProofsForRoot() {
|
|
264
322
|
const rootLocation = { level: 0, index: 0 };
|
|
265
323
|
// If there's only 1 block, its block root proof will be stored at the root.
|
|
266
|
-
return this.
|
|
267
|
-
? [this.
|
|
268
|
-
: this.
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
#getPreviousRollupData({
|
|
272
|
-
inputs,
|
|
273
|
-
proof,
|
|
274
|
-
verificationKey,
|
|
275
|
-
}: PublicInputsAndRecursiveProof<
|
|
276
|
-
BlockRootOrBlockMergePublicInputs,
|
|
277
|
-
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
278
|
-
>) {
|
|
279
|
-
const leafIndex = getVKIndex(verificationKey.keyAsFields);
|
|
280
|
-
const vkData = new VkData(verificationKey, leafIndex, getVKSiblingPath(leafIndex));
|
|
281
|
-
return new PreviousRollupBlockData(inputs, proof, vkData);
|
|
324
|
+
return this.totalNumCheckpoints === 1
|
|
325
|
+
? [this.checkpointProofs.getNode(rootLocation)?.provingOutput, this.checkpointPaddingProof?.provingOutput]
|
|
326
|
+
: this.checkpointProofs.getChildren(rootLocation).map(c => c?.provingOutput);
|
|
282
327
|
}
|
|
283
328
|
}
|