@aztec/prover-client 0.0.1-commit.f1df4d2 → 0.0.1-commit.f224bb98b
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/light/lightweight_checkpoint_builder.d.ts +10 -5
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -1
- package/dest/light/lightweight_checkpoint_builder.js +37 -18
- package/dest/mocks/test_context.js +6 -3
- package/dest/orchestrator/block-building-helpers.d.ts +4 -4
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +2 -2
- package/dest/orchestrator/block-proving-state.d.ts +4 -1
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +7 -0
- package/dest/orchestrator/checkpoint-proving-state.d.ts +3 -3
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +3 -3
- package/dest/orchestrator/epoch-proving-state.d.ts +2 -2
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +5 -3
- package/dest/orchestrator/orchestrator.d.ts +5 -3
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +61 -57
- package/dest/prover-client/prover-client.d.ts +2 -2
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +1 -1
- package/dest/proving_broker/broker_prover_facade.d.ts +1 -1
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +3 -3
- package/dest/proving_broker/config.d.ts +2 -2
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +1 -1
- package/dest/proving_broker/proving_broker.d.ts +1 -1
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +7 -3
- package/dest/proving_broker/proving_broker_instrumentation.d.ts +3 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.js +7 -0
- package/dest/test/mock_prover.d.ts +1 -1
- package/package.json +17 -18
- package/src/light/lightweight_checkpoint_builder.ts +35 -19
- package/src/mocks/test_context.ts +3 -3
- package/src/orchestrator/block-building-helpers.ts +2 -2
- package/src/orchestrator/block-proving-state.ts +9 -0
- package/src/orchestrator/checkpoint-proving-state.ts +4 -4
- package/src/orchestrator/epoch-proving-state.ts +6 -4
- package/src/orchestrator/orchestrator.ts +69 -63
- package/src/prover-client/prover-client.ts +2 -1
- package/src/proving_broker/broker_prover_facade.ts +9 -4
- package/src/proving_broker/config.ts +1 -1
- package/src/proving_broker/proving_broker.ts +7 -2
- package/src/proving_broker/proving_broker_instrumentation.ts +9 -0
|
@@ -5,6 +5,7 @@ export class ProvingBrokerInstrumentation {
|
|
|
5
5
|
activeJobs;
|
|
6
6
|
resolvedJobs;
|
|
7
7
|
rejectedJobs;
|
|
8
|
+
abortedJobs;
|
|
8
9
|
timedOutJobs;
|
|
9
10
|
cachedJobs;
|
|
10
11
|
totalJobs;
|
|
@@ -21,6 +22,7 @@ export class ProvingBrokerInstrumentation {
|
|
|
21
22
|
};
|
|
22
23
|
this.resolvedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RESOLVED_JOBS, provingJobAttrs);
|
|
23
24
|
this.rejectedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_REJECTED_JOBS, provingJobAttrs);
|
|
25
|
+
this.abortedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_ABORTED_JOBS, provingJobAttrs);
|
|
24
26
|
this.retriedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_RETRIED_JOBS, provingJobAttrs);
|
|
25
27
|
this.timedOutJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_TIMED_OUT_JOBS, provingJobAttrs);
|
|
26
28
|
this.cachedJobs = createUpDownCounterWithDefault(meter, Metrics.PROVING_QUEUE_CACHED_JOBS, provingJobAttrs);
|
|
@@ -44,6 +46,11 @@ export class ProvingBrokerInstrumentation {
|
|
|
44
46
|
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType]
|
|
45
47
|
});
|
|
46
48
|
}
|
|
49
|
+
incAbortedJobs(proofType) {
|
|
50
|
+
this.abortedJobs.add(1, {
|
|
51
|
+
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType]
|
|
52
|
+
});
|
|
53
|
+
}
|
|
47
54
|
incRetriedJobs(proofType) {
|
|
48
55
|
this.retriedJobs.add(1, {
|
|
49
56
|
[Attributes.PROVING_JOB_TYPE]: ProvingRequestType[proofType]
|
|
@@ -19,7 +19,7 @@ export declare class TestBroker implements ProvingJobProducer {
|
|
|
19
19
|
}
|
|
20
20
|
export declare class MockProver implements ServerCircuitProver {
|
|
21
21
|
constructor();
|
|
22
|
-
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<
|
|
22
|
+
getAvmProof(_inputs: AvmCircuitInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<import("@aztec/stdlib/proofs").RecursiveProof<16400>>;
|
|
23
23
|
getBaseParityProof(_inputs: ParityBasePrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 449>>;
|
|
24
24
|
getRootParityProof(_inputs: ParityRootPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<import("@aztec/stdlib/parity").ParityPublicInputs, 449>>;
|
|
25
25
|
getPublicChonkVerifierProof(_inputs: PublicChonkVerifierPrivateInputs, _signal?: AbortSignal, _epochNumber?: number): Promise<PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.f224bb98b",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -27,8 +27,8 @@
|
|
|
27
27
|
"build:dev": "../scripts/tsc.sh --watch",
|
|
28
28
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
29
29
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
30
|
-
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000
|
|
31
|
-
"test:debug": "LOG_LEVEL=debug NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --
|
|
30
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=3500000",
|
|
31
|
+
"test:debug": "LOG_LEVEL=debug NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --testTimeout=1500000 --testNamePattern prover/bb_prover/parity"
|
|
32
32
|
},
|
|
33
33
|
"jest": {
|
|
34
34
|
"moduleNameMapper": {
|
|
@@ -68,20 +68,19 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
72
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
73
|
-
"@aztec/constants": "0.0.1-commit.
|
|
74
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
75
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
76
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
77
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
78
|
-
"@aztec/noir-types": "0.0.1-commit.
|
|
79
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
80
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
81
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
82
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
83
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
84
|
-
"@google-cloud/storage": "^7.15.0",
|
|
71
|
+
"@aztec/bb-prover": "0.0.1-commit.f224bb98b",
|
|
72
|
+
"@aztec/blob-lib": "0.0.1-commit.f224bb98b",
|
|
73
|
+
"@aztec/constants": "0.0.1-commit.f224bb98b",
|
|
74
|
+
"@aztec/ethereum": "0.0.1-commit.f224bb98b",
|
|
75
|
+
"@aztec/foundation": "0.0.1-commit.f224bb98b",
|
|
76
|
+
"@aztec/kv-store": "0.0.1-commit.f224bb98b",
|
|
77
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f224bb98b",
|
|
78
|
+
"@aztec/noir-types": "0.0.1-commit.f224bb98b",
|
|
79
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f224bb98b",
|
|
80
|
+
"@aztec/simulator": "0.0.1-commit.f224bb98b",
|
|
81
|
+
"@aztec/stdlib": "0.0.1-commit.f224bb98b",
|
|
82
|
+
"@aztec/telemetry-client": "0.0.1-commit.f224bb98b",
|
|
83
|
+
"@aztec/world-state": "0.0.1-commit.f224bb98b",
|
|
85
84
|
"@iarna/toml": "^2.2.5",
|
|
86
85
|
"commander": "^12.1.0",
|
|
87
86
|
"lodash.chunk": "^4.2.0",
|
|
@@ -90,7 +89,7 @@
|
|
|
90
89
|
"zod": "^3.23.8"
|
|
91
90
|
},
|
|
92
91
|
"devDependencies": {
|
|
93
|
-
"@aztec/noir-contracts.js": "0.0.1-commit.
|
|
92
|
+
"@aztec/noir-contracts.js": "0.0.1-commit.f224bb98b",
|
|
94
93
|
"@jest/globals": "^30.0.0",
|
|
95
94
|
"@types/jest": "^30.0.0",
|
|
96
95
|
"@types/node": "^22.15.17",
|
|
@@ -4,6 +4,7 @@ import { type CheckpointNumber, IndexWithinCheckpoint } from '@aztec/foundation/
|
|
|
4
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
6
|
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
7
|
+
import { elapsed } from '@aztec/foundation/timer';
|
|
7
8
|
import { L2Block } from '@aztec/stdlib/block';
|
|
8
9
|
import { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
9
10
|
import type { MerkleTreeWriteOperations } from '@aztec/stdlib/interfaces/server';
|
|
@@ -44,6 +45,7 @@ export class LightweightCheckpointBuilder {
|
|
|
44
45
|
constructor(
|
|
45
46
|
public readonly checkpointNumber: CheckpointNumber,
|
|
46
47
|
public readonly constants: CheckpointGlobalVariables,
|
|
48
|
+
public feeAssetPriceModifier: bigint,
|
|
47
49
|
public readonly l1ToL2Messages: Fr[],
|
|
48
50
|
private readonly previousCheckpointOutHashes: Fr[],
|
|
49
51
|
public readonly db: MerkleTreeWriteOperations,
|
|
@@ -54,7 +56,7 @@ export class LightweightCheckpointBuilder {
|
|
|
54
56
|
instanceId: `checkpoint-${checkpointNumber}`,
|
|
55
57
|
});
|
|
56
58
|
this.spongeBlob = SpongeBlob.init();
|
|
57
|
-
this.logger.debug('Starting new checkpoint', { constants, l1ToL2Messages });
|
|
59
|
+
this.logger.debug('Starting new checkpoint', { constants, l1ToL2Messages, feeAssetPriceModifier });
|
|
58
60
|
}
|
|
59
61
|
|
|
60
62
|
static async startNewCheckpoint(
|
|
@@ -64,6 +66,7 @@ export class LightweightCheckpointBuilder {
|
|
|
64
66
|
previousCheckpointOutHashes: Fr[],
|
|
65
67
|
db: MerkleTreeWriteOperations,
|
|
66
68
|
bindings?: LoggerBindings,
|
|
69
|
+
feeAssetPriceModifier: bigint = 0n,
|
|
67
70
|
): Promise<LightweightCheckpointBuilder> {
|
|
68
71
|
// Insert l1-to-l2 messages into the tree.
|
|
69
72
|
await db.appendLeaves(
|
|
@@ -74,6 +77,7 @@ export class LightweightCheckpointBuilder {
|
|
|
74
77
|
return new LightweightCheckpointBuilder(
|
|
75
78
|
checkpointNumber,
|
|
76
79
|
constants,
|
|
80
|
+
feeAssetPriceModifier,
|
|
77
81
|
l1ToL2Messages,
|
|
78
82
|
previousCheckpointOutHashes,
|
|
79
83
|
db,
|
|
@@ -90,6 +94,7 @@ export class LightweightCheckpointBuilder {
|
|
|
90
94
|
static async resumeCheckpoint(
|
|
91
95
|
checkpointNumber: CheckpointNumber,
|
|
92
96
|
constants: CheckpointGlobalVariables,
|
|
97
|
+
feeAssetPriceModifier: bigint,
|
|
93
98
|
l1ToL2Messages: Fr[],
|
|
94
99
|
previousCheckpointOutHashes: Fr[],
|
|
95
100
|
db: MerkleTreeWriteOperations,
|
|
@@ -99,6 +104,7 @@ export class LightweightCheckpointBuilder {
|
|
|
99
104
|
const builder = new LightweightCheckpointBuilder(
|
|
100
105
|
checkpointNumber,
|
|
101
106
|
constants,
|
|
107
|
+
feeAssetPriceModifier,
|
|
102
108
|
l1ToL2Messages,
|
|
103
109
|
previousCheckpointOutHashes,
|
|
104
110
|
db,
|
|
@@ -148,6 +154,10 @@ export class LightweightCheckpointBuilder {
|
|
|
148
154
|
return this.blocks.length;
|
|
149
155
|
}
|
|
150
156
|
|
|
157
|
+
public getBlocks() {
|
|
158
|
+
return this.blocks;
|
|
159
|
+
}
|
|
160
|
+
|
|
151
161
|
/**
|
|
152
162
|
* Adds a new block to the checkpoint. The tx effects must have already been inserted into the db if
|
|
153
163
|
* this is called after tx processing, if that's not the case, then set `insertTxsEffects` to true.
|
|
@@ -156,7 +166,8 @@ export class LightweightCheckpointBuilder {
|
|
|
156
166
|
globalVariables: GlobalVariables,
|
|
157
167
|
txs: ProcessedTx[],
|
|
158
168
|
opts: { insertTxsEffects?: boolean; expectedEndState?: StateReference } = {},
|
|
159
|
-
): Promise<L2Block> {
|
|
169
|
+
): Promise<{ block: L2Block; timings: Record<string, number> }> {
|
|
170
|
+
const timings: Record<string, number> = {};
|
|
160
171
|
const isFirstBlock = this.blocks.length === 0;
|
|
161
172
|
|
|
162
173
|
// Empty blocks are only allowed as the first block in a checkpoint
|
|
@@ -165,7 +176,9 @@ export class LightweightCheckpointBuilder {
|
|
|
165
176
|
}
|
|
166
177
|
|
|
167
178
|
if (isFirstBlock) {
|
|
168
|
-
|
|
179
|
+
const [msGetInitialArchive, initialArchive] = await elapsed(() => getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db));
|
|
180
|
+
this.lastArchives.push(initialArchive);
|
|
181
|
+
timings.getInitialArchive = msGetInitialArchive;
|
|
169
182
|
}
|
|
170
183
|
|
|
171
184
|
const lastArchive = this.lastArchives.at(-1)!;
|
|
@@ -175,12 +188,17 @@ export class LightweightCheckpointBuilder {
|
|
|
175
188
|
`Inserting side effects for ${txs.length} txs for block ${globalVariables.blockNumber} into db`,
|
|
176
189
|
{ txs: txs.map(tx => tx.hash.toString()) },
|
|
177
190
|
);
|
|
191
|
+
let msInsertSideEffects = 0;
|
|
178
192
|
for (const tx of txs) {
|
|
179
|
-
await insertSideEffects(tx, this.db);
|
|
193
|
+
const [ms] = await elapsed(() => insertSideEffects(tx, this.db));
|
|
194
|
+
msInsertSideEffects += ms;
|
|
180
195
|
}
|
|
196
|
+
timings.insertSideEffects = msInsertSideEffects;
|
|
181
197
|
}
|
|
182
198
|
|
|
183
|
-
const endState = await this.db.getStateReference();
|
|
199
|
+
const [msGetEndState, endState] = await elapsed(() => this.db.getStateReference());
|
|
200
|
+
timings.getEndState = msGetEndState;
|
|
201
|
+
|
|
184
202
|
if (opts.expectedEndState && !endState.equals(opts.expectedEndState)) {
|
|
185
203
|
this.logger.error('End state after processing txs does not match expected end state', {
|
|
186
204
|
globalVariables: globalVariables.toInspect(),
|
|
@@ -190,26 +208,24 @@ export class LightweightCheckpointBuilder {
|
|
|
190
208
|
throw new Error(`End state does not match expected end state when building block ${globalVariables.blockNumber}`);
|
|
191
209
|
}
|
|
192
210
|
|
|
193
|
-
const { header, body, blockBlobFields } = await
|
|
194
|
-
txs,
|
|
195
|
-
lastArchive,
|
|
196
|
-
endState,
|
|
197
|
-
globalVariables,
|
|
198
|
-
this.spongeBlob,
|
|
199
|
-
isFirstBlock,
|
|
211
|
+
const [msBuildHeaderAndBody, { header, body, blockBlobFields }] = await elapsed(() =>
|
|
212
|
+
buildHeaderAndBodyFromTxs(txs, lastArchive, endState, globalVariables, this.spongeBlob, isFirstBlock),
|
|
200
213
|
);
|
|
214
|
+
timings.buildHeaderAndBody = msBuildHeaderAndBody;
|
|
201
215
|
|
|
202
216
|
header.state.validate();
|
|
203
217
|
|
|
204
218
|
await this.db.updateArchive(header);
|
|
205
|
-
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
219
|
+
const [msUpdateArchive, newArchive] = await elapsed(() => getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db));
|
|
220
|
+
timings.updateArchive = msUpdateArchive;
|
|
206
221
|
this.lastArchives.push(newArchive);
|
|
207
222
|
|
|
208
223
|
const indexWithinCheckpoint = IndexWithinCheckpoint(this.blocks.length);
|
|
209
224
|
const block = new L2Block(newArchive, header, body, this.checkpointNumber, indexWithinCheckpoint);
|
|
210
225
|
this.blocks.push(block);
|
|
211
226
|
|
|
212
|
-
await this.spongeBlob.absorb(blockBlobFields);
|
|
227
|
+
const [msSpongeAbsorb] = await elapsed(() => this.spongeBlob.absorb(blockBlobFields));
|
|
228
|
+
timings.spongeAbsorb = msSpongeAbsorb;
|
|
213
229
|
this.blobFields.push(...blockBlobFields);
|
|
214
230
|
|
|
215
231
|
this.logger.debug(`Built block ${header.getBlockNumber()}`, {
|
|
@@ -220,7 +236,7 @@ export class LightweightCheckpointBuilder {
|
|
|
220
236
|
txs: block.body.txEffects.map(tx => tx.txHash.toString()),
|
|
221
237
|
});
|
|
222
238
|
|
|
223
|
-
return block;
|
|
239
|
+
return { block, timings };
|
|
224
240
|
}
|
|
225
241
|
|
|
226
242
|
async completeCheckpoint(): Promise<Checkpoint> {
|
|
@@ -237,7 +253,7 @@ export class LightweightCheckpointBuilder {
|
|
|
237
253
|
|
|
238
254
|
const newArchive = this.lastArchives[this.lastArchives.length - 1];
|
|
239
255
|
|
|
240
|
-
const blobs = getBlobsPerL1Block(this.blobFields);
|
|
256
|
+
const blobs = await getBlobsPerL1Block(this.blobFields);
|
|
241
257
|
const blobsHash = computeBlobsHashFromBlobs(blobs);
|
|
242
258
|
|
|
243
259
|
const inHash = computeInHashFromL1ToL2Messages(this.l1ToL2Messages);
|
|
@@ -248,8 +264,7 @@ export class LightweightCheckpointBuilder {
|
|
|
248
264
|
);
|
|
249
265
|
const epochOutHash = accumulateCheckpointOutHashes([...this.previousCheckpointOutHashes, checkpointOutHash]);
|
|
250
266
|
|
|
251
|
-
//
|
|
252
|
-
// timestamp of a checkpoint is the timestamp of the last block in the checkpoint.
|
|
267
|
+
// All blocks in the checkpoint have the same timestamp
|
|
253
268
|
const timestamp = blocks[blocks.length - 1].timestamp;
|
|
254
269
|
|
|
255
270
|
const totalManaUsed = blocks.reduce((acc, block) => acc.add(block.header.totalManaUsed), Fr.ZERO);
|
|
@@ -268,13 +283,14 @@ export class LightweightCheckpointBuilder {
|
|
|
268
283
|
totalManaUsed,
|
|
269
284
|
});
|
|
270
285
|
|
|
271
|
-
return new Checkpoint(newArchive, header, blocks, this.checkpointNumber);
|
|
286
|
+
return new Checkpoint(newArchive, header, blocks, this.checkpointNumber, this.feeAssetPriceModifier);
|
|
272
287
|
}
|
|
273
288
|
|
|
274
289
|
clone() {
|
|
275
290
|
const clone = new LightweightCheckpointBuilder(
|
|
276
291
|
this.checkpointNumber,
|
|
277
292
|
this.constants,
|
|
293
|
+
this.feeAssetPriceModifier,
|
|
278
294
|
[...this.l1ToL2Messages],
|
|
279
295
|
[...this.previousCheckpointOutHashes],
|
|
280
296
|
this.db,
|
|
@@ -116,7 +116,7 @@ export class TestContext {
|
|
|
116
116
|
|
|
117
117
|
const broker = new TestBroker(proverCount, localProver);
|
|
118
118
|
const facade = new BrokerCircuitProverFacade(broker);
|
|
119
|
-
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO);
|
|
119
|
+
const orchestrator = new TestProvingOrchestrator(ws, facade, EthAddress.ZERO, false, 10);
|
|
120
120
|
|
|
121
121
|
await broker.start();
|
|
122
122
|
facade.start();
|
|
@@ -250,7 +250,7 @@ export class TestContext {
|
|
|
250
250
|
const previousCheckpointOutHashes = this.checkpointOutHashes;
|
|
251
251
|
const builder = await LightweightCheckpointBuilder.startNewCheckpoint(
|
|
252
252
|
checkpointNumber,
|
|
253
|
-
constants,
|
|
253
|
+
{ ...constants, timestamp },
|
|
254
254
|
l1ToL2Messages,
|
|
255
255
|
previousCheckpointOutHashes,
|
|
256
256
|
cleanFork,
|
|
@@ -262,7 +262,7 @@ export class TestContext {
|
|
|
262
262
|
const txs = blockTxs[i];
|
|
263
263
|
const state = blockEndStates[i];
|
|
264
264
|
|
|
265
|
-
const block = await builder.addBlock(blockGlobalVariables[i], txs, {
|
|
265
|
+
const { block } = await builder.addBlock(blockGlobalVariables[i], txs, {
|
|
266
266
|
expectedEndState: state,
|
|
267
267
|
insertTxsEffects: true,
|
|
268
268
|
});
|
|
@@ -253,8 +253,8 @@ export function getPublicChonkVerifierPrivateInputsFromTx(tx: Tx | ProcessedTx,
|
|
|
253
253
|
// Build "hints" as the private inputs for the checkpoint root rollup circuit.
|
|
254
254
|
// The `blobCommitments` will be accumulated and checked in the root rollup against the `finalBlobChallenges`.
|
|
255
255
|
// The `blobsHash` will be validated on L1 against the submitted blob data.
|
|
256
|
-
export const buildBlobHints = (blobFields: Fr[]) => {
|
|
257
|
-
const blobs = getBlobsPerL1Block(blobFields);
|
|
256
|
+
export const buildBlobHints = async (blobFields: Fr[]) => {
|
|
257
|
+
const blobs = await getBlobsPerL1Block(blobFields);
|
|
258
258
|
const blobCommitments = getBlobCommitmentsFromBlobs(blobs);
|
|
259
259
|
const blobsHash = computeBlobsHashFromBlobs(blobs);
|
|
260
260
|
return { blobCommitments, blobs, blobsHash };
|
|
@@ -55,6 +55,7 @@ export class BlockProvingState {
|
|
|
55
55
|
| ProofState<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
56
56
|
| undefined;
|
|
57
57
|
private builtBlockHeader: BlockHeader | undefined;
|
|
58
|
+
private builtArchive: AppendOnlyTreeSnapshot | undefined;
|
|
58
59
|
private endState: StateReference | undefined;
|
|
59
60
|
private endSpongeBlob: SpongeBlob | undefined;
|
|
60
61
|
private txs: TxProvingState[] = [];
|
|
@@ -232,6 +233,14 @@ export class BlockProvingState {
|
|
|
232
233
|
return this.builtBlockHeader;
|
|
233
234
|
}
|
|
234
235
|
|
|
236
|
+
public setBuiltArchive(archive: AppendOnlyTreeSnapshot) {
|
|
237
|
+
this.builtArchive = archive;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
public getBuiltArchive() {
|
|
241
|
+
return this.builtArchive;
|
|
242
|
+
}
|
|
243
|
+
|
|
235
244
|
public getStartSpongeBlob() {
|
|
236
245
|
return this.startSpongeBlob;
|
|
237
246
|
}
|
|
@@ -85,7 +85,7 @@ export class CheckpointProvingState {
|
|
|
85
85
|
typeof L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH
|
|
86
86
|
>,
|
|
87
87
|
public parentEpoch: EpochProvingState,
|
|
88
|
-
private onBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void
|
|
88
|
+
private onBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => Promise<void>,
|
|
89
89
|
) {
|
|
90
90
|
this.blockProofs = new UnbalancedTreeStore(totalNumBlocks);
|
|
91
91
|
this.firstBlockNumber = BlockNumber(headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber + 1);
|
|
@@ -245,7 +245,7 @@ export class CheckpointProvingState {
|
|
|
245
245
|
this.endBlobAccumulator = await accumulateBlobs(this.blobFields!, startBlobAccumulator);
|
|
246
246
|
this.startBlobAccumulator = startBlobAccumulator;
|
|
247
247
|
|
|
248
|
-
this.onBlobAccumulatorSet(this);
|
|
248
|
+
await this.onBlobAccumulatorSet(this);
|
|
249
249
|
|
|
250
250
|
return this.endBlobAccumulator;
|
|
251
251
|
}
|
|
@@ -271,7 +271,7 @@ export class CheckpointProvingState {
|
|
|
271
271
|
return this.totalNumBlocks === 1 ? 'rollup-checkpoint-root-single-block' : 'rollup-checkpoint-root';
|
|
272
272
|
}
|
|
273
273
|
|
|
274
|
-
public getCheckpointRootRollupInputs() {
|
|
274
|
+
public async getCheckpointRootRollupInputs() {
|
|
275
275
|
const proofs = this.#getChildProofsForRoot();
|
|
276
276
|
const nonEmptyProofs = proofs.filter(p => !!p);
|
|
277
277
|
if (proofs.length !== nonEmptyProofs.length) {
|
|
@@ -287,7 +287,7 @@ export class CheckpointProvingState {
|
|
|
287
287
|
// `blobFields` must've been set if `startBlobAccumulator` is set (in `accumulateBlobs`).
|
|
288
288
|
const blobFields = this.blobFields!;
|
|
289
289
|
|
|
290
|
-
const { blobCommitments, blobsHash } = buildBlobHints(blobFields);
|
|
290
|
+
const { blobCommitments, blobsHash } = await buildBlobHints(blobFields);
|
|
291
291
|
|
|
292
292
|
const hints = CheckpointRootRollupHints.from({
|
|
293
293
|
previousBlockHeader: this.headerOfLastBlockInPreviousCheckpoint,
|
|
@@ -76,7 +76,7 @@ export class EpochProvingState {
|
|
|
76
76
|
public readonly epochNumber: EpochNumber,
|
|
77
77
|
public readonly totalNumCheckpoints: number,
|
|
78
78
|
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
79
|
-
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void
|
|
79
|
+
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => Promise<void>,
|
|
80
80
|
private completionCallback: (result: ProvingResult) => void,
|
|
81
81
|
private rejectionCallback: (reason: string) => void,
|
|
82
82
|
) {
|
|
@@ -254,9 +254,11 @@ export class EpochProvingState {
|
|
|
254
254
|
}
|
|
255
255
|
outHashes.push(outHash);
|
|
256
256
|
|
|
257
|
-
//
|
|
258
|
-
|
|
259
|
-
|
|
257
|
+
// If this is NOT the last checkpoint, get or create the hint for the next checkpoint.
|
|
258
|
+
if (i !== this.totalNumCheckpoints - 1) {
|
|
259
|
+
hint = checkpoint.getOutHashHintForNextCheckpoint() ?? (await computeOutHashHint(outHashes));
|
|
260
|
+
checkpoint.setOutHashHintForNextCheckpoint(hint);
|
|
261
|
+
}
|
|
260
262
|
}
|
|
261
263
|
}
|
|
262
264
|
|