@aztec/prover-client 2.1.0-rc.9 → 3.0.0-devnet.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.
- 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 +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 +125 -81
- package/dest/orchestrator/orchestrator.d.ts +26 -25
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +350 -218
- 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 +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 +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 +4 -4
- 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/mocks/fixtures.ts +39 -11
- package/src/mocks/test_context.ts +137 -31
- package/src/orchestrator/block-building-helpers.ts +213 -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 +169 -126
- package/src/orchestrator/orchestrator.ts +519 -286
- package/src/orchestrator/tx-proving-state.ts +45 -43
- package/src/prover-client/server-epoch-prover.ts +26 -16
- package/src/proving_broker/broker_prover_facade.ts +157 -88
- package/src/proving_broker/config.ts +6 -6
- 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 -62
- 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
|
+
PublicTubePublicInputs,
|
|
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,95 @@ 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
60
|
// Map from tx hash to tube proof promise. Used when kickstarting tube proofs before tx processing.
|
|
57
|
-
public readonly cachedTubeProofs = new Map<
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
public readonly cachedTubeProofs = new Map<
|
|
62
|
+
string,
|
|
63
|
+
Promise<PublicInputsAndRecursiveProof<PublicTubePublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>
|
|
64
|
+
>();
|
|
60
65
|
|
|
61
66
|
constructor(
|
|
62
67
|
public readonly epochNumber: number,
|
|
63
|
-
public readonly
|
|
64
|
-
|
|
65
|
-
|
|
68
|
+
public readonly totalNumCheckpoints: number,
|
|
69
|
+
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
70
|
+
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void,
|
|
66
71
|
private completionCallback: (result: ProvingResult) => void,
|
|
67
72
|
private rejectionCallback: (reason: string) => void,
|
|
68
73
|
) {
|
|
69
|
-
this.
|
|
74
|
+
this.checkpointProofs = new UnbalancedTreeStore(totalNumCheckpoints);
|
|
75
|
+
this.startBlobAccumulator = BatchedBlobAccumulator.newWithChallenges(finalBlobBatchingChallenges);
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
// Adds a block to the proving state, returns its index
|
|
73
79
|
// 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>,
|
|
80
|
+
public startNewCheckpoint(
|
|
81
|
+
checkpointIndex: number,
|
|
82
|
+
constants: CheckpointConstantData,
|
|
83
|
+
totalNumBlocks: number,
|
|
84
|
+
totalNumBlobFields: number,
|
|
83
85
|
previousBlockHeader: BlockHeader,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
86
|
+
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
87
|
+
l1ToL2Messages: Fr[],
|
|
88
|
+
lastL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
89
|
+
lastL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>,
|
|
90
|
+
newL1ToL2MessageTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
91
|
+
newL1ToL2MessageSubtreeRootSiblingPath: Tuple<Fr, typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH>,
|
|
92
|
+
): CheckpointProvingState {
|
|
93
|
+
if (checkpointIndex >= this.totalNumCheckpoints) {
|
|
94
|
+
throw new Error(
|
|
95
|
+
`Unable to start a new checkpoint at index ${checkpointIndex}. Expected at most ${this.totalNumCheckpoints} checkpoints.`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const checkpoint = new CheckpointProvingState(
|
|
100
|
+
checkpointIndex,
|
|
101
|
+
constants,
|
|
102
|
+
totalNumBlocks,
|
|
103
|
+
totalNumBlobFields,
|
|
104
|
+
this.finalBlobBatchingChallenges,
|
|
97
105
|
previousBlockHeader,
|
|
98
|
-
|
|
106
|
+
lastArchiveSiblingPath,
|
|
107
|
+
l1ToL2Messages,
|
|
108
|
+
lastL1ToL2MessageTreeSnapshot,
|
|
109
|
+
lastL1ToL2MessageSubtreeRootSiblingPath,
|
|
110
|
+
newL1ToL2MessageTreeSnapshot,
|
|
111
|
+
newL1ToL2MessageSubtreeRootSiblingPath,
|
|
99
112
|
this,
|
|
113
|
+
this.onCheckpointBlobAccumulatorSet,
|
|
100
114
|
);
|
|
101
|
-
this.
|
|
102
|
-
|
|
115
|
+
this.checkpoints[checkpointIndex] = checkpoint;
|
|
116
|
+
|
|
117
|
+
if (this.checkpoints.filter(c => !!c).length === this.totalNumCheckpoints) {
|
|
103
118
|
this.provingStateLifecycle = PROVING_STATE_LIFECYCLE.PROVING_STATE_FULL;
|
|
104
119
|
}
|
|
105
|
-
|
|
120
|
+
|
|
121
|
+
return checkpoint;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
public getCheckpointProvingState(index: number) {
|
|
125
|
+
return this.checkpoints[index];
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
public getCheckpointProvingStateByBlockNumber(blockNumber: number) {
|
|
129
|
+
return this.checkpoints.find(
|
|
130
|
+
c => c && blockNumber >= c.firstBlockNumber && blockNumber < c.firstBlockNumber + c.totalNumBlocks,
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
public getBlockProvingStateByBlockNumber(blockNumber: number) {
|
|
135
|
+
return this.getCheckpointProvingStateByBlockNumber(blockNumber)?.getBlockProvingStateByBlockNumber(blockNumber);
|
|
106
136
|
}
|
|
107
137
|
|
|
108
138
|
// Returns true if this proving state is still valid, false otherwise
|
|
@@ -113,120 +143,146 @@ export class EpochProvingState {
|
|
|
113
143
|
);
|
|
114
144
|
}
|
|
115
145
|
|
|
116
|
-
// Returns true if we are still able to accept
|
|
117
|
-
public
|
|
118
|
-
return this.
|
|
146
|
+
// Returns true if we are still able to accept checkpoints, false otherwise.
|
|
147
|
+
public isAcceptingCheckpoints() {
|
|
148
|
+
return this.checkpoints.filter(c => !!c).length < this.totalNumCheckpoints;
|
|
119
149
|
}
|
|
120
150
|
|
|
121
|
-
public
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
151
|
+
public setCheckpointRootRollupProof(
|
|
152
|
+
checkpointIndex: number,
|
|
153
|
+
provingOutput: PublicInputsAndRecursiveProof<
|
|
154
|
+
CheckpointRollupPublicInputs,
|
|
125
155
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
126
156
|
>,
|
|
127
157
|
): TreeNodeLocation {
|
|
128
|
-
return this.
|
|
158
|
+
return this.checkpointProofs.setLeaf(checkpointIndex, { provingOutput });
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
public tryStartProvingCheckpointMerge(location: TreeNodeLocation) {
|
|
162
|
+
if (this.checkpointProofs.getNode(location)?.isProving) {
|
|
163
|
+
return false;
|
|
164
|
+
} else {
|
|
165
|
+
this.checkpointProofs.setNode(location, { isProving: true });
|
|
166
|
+
return true;
|
|
167
|
+
}
|
|
129
168
|
}
|
|
130
169
|
|
|
131
|
-
public
|
|
170
|
+
public setCheckpointMergeRollupProof(
|
|
132
171
|
location: TreeNodeLocation,
|
|
133
|
-
|
|
134
|
-
|
|
172
|
+
provingOutput: PublicInputsAndRecursiveProof<
|
|
173
|
+
CheckpointRollupPublicInputs,
|
|
135
174
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
136
175
|
>,
|
|
137
176
|
) {
|
|
138
|
-
this.
|
|
177
|
+
this.checkpointProofs.setNode(location, { provingOutput });
|
|
139
178
|
}
|
|
140
179
|
|
|
141
|
-
public
|
|
142
|
-
this.
|
|
180
|
+
public tryStartProvingRootRollup() {
|
|
181
|
+
if (this.rootRollupProof?.isProving) {
|
|
182
|
+
return false;
|
|
183
|
+
} else {
|
|
184
|
+
this.rootRollupProof = { isProving: true };
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
public setRootRollupProof(provingOutput: PublicInputsAndRecursiveProof<RootRollupPublicInputs>) {
|
|
190
|
+
this.rootRollupProof = { provingOutput };
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
public tryStartProvingPaddingCheckpoint() {
|
|
194
|
+
if (this.checkpointPaddingProof?.isProving) {
|
|
195
|
+
return false;
|
|
196
|
+
} else {
|
|
197
|
+
this.checkpointPaddingProof = { isProving: true };
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
143
200
|
}
|
|
144
201
|
|
|
145
|
-
public
|
|
146
|
-
|
|
147
|
-
|
|
202
|
+
public setCheckpointPaddingProof(
|
|
203
|
+
provingOutput: PublicInputsAndRecursiveProof<
|
|
204
|
+
CheckpointRollupPublicInputs,
|
|
148
205
|
typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH
|
|
149
206
|
>,
|
|
150
207
|
) {
|
|
151
|
-
this.
|
|
208
|
+
this.checkpointPaddingProof = { provingOutput };
|
|
152
209
|
}
|
|
153
210
|
|
|
154
|
-
public
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
public async setBlobAccumulators(toBlock?: number) {
|
|
159
|
-
let previousAccumulator;
|
|
160
|
-
const end = toBlock ? toBlock - this.firstBlockNumber : this.blocks.length;
|
|
211
|
+
public async setBlobAccumulators() {
|
|
212
|
+
let previousAccumulator = this.startBlobAccumulator;
|
|
161
213
|
// 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.
|
|
214
|
+
for (let i = 0; i < this.totalNumCheckpoints; i++) {
|
|
215
|
+
const checkpoint = this.checkpoints[i];
|
|
216
|
+
if (!checkpoint) {
|
|
166
217
|
break;
|
|
167
218
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
219
|
+
|
|
220
|
+
const endAccumulator =
|
|
221
|
+
checkpoint.getEndBlobAccumulator() || (await checkpoint.accumulateBlobs(previousAccumulator));
|
|
222
|
+
if (!endAccumulator) {
|
|
223
|
+
break;
|
|
171
224
|
}
|
|
172
|
-
|
|
173
|
-
|
|
225
|
+
|
|
226
|
+
previousAccumulator = endAccumulator;
|
|
227
|
+
|
|
228
|
+
// If this is the last checkpoint, set the end blob accumulator.
|
|
229
|
+
if (i === this.totalNumCheckpoints - 1) {
|
|
230
|
+
this.endBlobAccumulator = endAccumulator;
|
|
174
231
|
}
|
|
175
|
-
previousAccumulator = block.endBlobAccumulator;
|
|
176
232
|
}
|
|
177
233
|
}
|
|
178
234
|
|
|
235
|
+
public async finalizeBatchedBlob() {
|
|
236
|
+
if (!this.endBlobAccumulator) {
|
|
237
|
+
throw new Error('End blob accumulator not ready.');
|
|
238
|
+
}
|
|
239
|
+
this.finalBatchedBlob = await this.endBlobAccumulator.finalize(true /* verifyProof */);
|
|
240
|
+
}
|
|
241
|
+
|
|
179
242
|
public getParentLocation(location: TreeNodeLocation) {
|
|
180
|
-
return this.
|
|
243
|
+
return this.checkpointProofs.getParentLocation(location);
|
|
181
244
|
}
|
|
182
245
|
|
|
183
|
-
public
|
|
184
|
-
const [left, right] = this.
|
|
246
|
+
public getCheckpointMergeRollupInputs(mergeLocation: TreeNodeLocation) {
|
|
247
|
+
const [left, right] = this.checkpointProofs.getChildren(mergeLocation).map(c => c?.provingOutput);
|
|
185
248
|
if (!left || !right) {
|
|
186
|
-
throw new Error('At
|
|
249
|
+
throw new Error('At least one child is not ready for the checkpoint merge rollup.');
|
|
187
250
|
}
|
|
188
251
|
|
|
189
|
-
return new
|
|
252
|
+
return new CheckpointMergeRollupPrivateInputs([toProofData(left), toProofData(right)]);
|
|
190
253
|
}
|
|
191
254
|
|
|
192
255
|
public getRootRollupInputs() {
|
|
193
256
|
const [left, right] = this.#getChildProofsForRoot();
|
|
194
257
|
if (!left || !right) {
|
|
195
|
-
throw new Error('At
|
|
258
|
+
throw new Error('At least one child is not ready for the root rollup.');
|
|
196
259
|
}
|
|
197
260
|
|
|
198
|
-
return
|
|
199
|
-
|
|
261
|
+
return RootRollupPrivateInputs.from({
|
|
262
|
+
previousRollups: [toProofData(left), toProofData(right)],
|
|
200
263
|
});
|
|
201
264
|
}
|
|
202
265
|
|
|
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);
|
|
266
|
+
public getPaddingCheckpointInputs() {
|
|
267
|
+
return new CheckpointPaddingRollupPrivateInputs();
|
|
214
268
|
}
|
|
215
269
|
|
|
216
270
|
public getEpochProofResult(): { proof: Proof; publicInputs: RootRollupPublicInputs; batchedBlobInputs: BatchedBlob } {
|
|
217
|
-
|
|
271
|
+
const provingOutput = this.rootRollupProof?.provingOutput;
|
|
272
|
+
|
|
273
|
+
if (!provingOutput || !this.finalBatchedBlob) {
|
|
218
274
|
throw new Error('Unable to get epoch proof result. Root rollup is not ready.');
|
|
219
275
|
}
|
|
220
276
|
|
|
221
277
|
return {
|
|
222
|
-
proof:
|
|
223
|
-
publicInputs:
|
|
278
|
+
proof: provingOutput.proof.binaryProof,
|
|
279
|
+
publicInputs: provingOutput.inputs,
|
|
224
280
|
batchedBlobInputs: this.finalBatchedBlob,
|
|
225
281
|
};
|
|
226
282
|
}
|
|
227
283
|
|
|
228
|
-
public
|
|
229
|
-
return this.
|
|
284
|
+
public isReadyForCheckpointMerge(location: TreeNodeLocation) {
|
|
285
|
+
return !!this.checkpointProofs.getSibling(location)?.provingOutput;
|
|
230
286
|
}
|
|
231
287
|
|
|
232
288
|
// Returns true if we have sufficient inputs to execute the block root rollup
|
|
@@ -263,21 +319,8 @@ export class EpochProvingState {
|
|
|
263
319
|
#getChildProofsForRoot() {
|
|
264
320
|
const rootLocation = { level: 0, index: 0 };
|
|
265
321
|
// 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);
|
|
322
|
+
return this.totalNumCheckpoints === 1
|
|
323
|
+
? [this.checkpointProofs.getNode(rootLocation)?.provingOutput, this.checkpointPaddingProof?.provingOutput]
|
|
324
|
+
: this.checkpointProofs.getChildren(rootLocation).map(c => c?.provingOutput);
|
|
282
325
|
}
|
|
283
326
|
}
|