@aztec/prover-client 0.0.1-commit.b655e406 → 0.0.1-commit.b9865e97
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/config.d.ts +2 -2
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +17 -3
- package/dest/index.d.ts +1 -1
- package/dest/light/index.d.ts +2 -0
- package/dest/light/index.d.ts.map +1 -0
- package/dest/light/index.js +1 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts +52 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +231 -0
- package/dest/mocks/fixtures.d.ts +1 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +9 -18
- package/dest/mocks/test_context.d.ts +31 -46
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +133 -123
- package/dest/orchestrator/block-building-helpers.d.ts +18 -20
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +90 -115
- package/dest/orchestrator/block-proving-state.d.ts +20 -11
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +87 -19
- package/dest/orchestrator/checkpoint-proving-state.d.ts +29 -9
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +62 -21
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts +107 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/checkpoint-sub-tree-orchestrator.js +151 -0
- package/dest/orchestrator/epoch-proving-context.d.ts +51 -0
- package/dest/orchestrator/epoch-proving-context.d.ts.map +1 -0
- package/dest/orchestrator/epoch-proving-context.js +81 -0
- package/dest/orchestrator/epoch-proving-state.d.ts +12 -10
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +40 -4
- package/dest/orchestrator/index.d.ts +4 -1
- package/dest/orchestrator/index.d.ts.map +1 -1
- package/dest/orchestrator/index.js +3 -0
- package/dest/orchestrator/orchestrator.d.ts +37 -32
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +568 -303
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -3
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +2 -15
- package/dest/orchestrator/proving-scheduler.d.ts +72 -0
- package/dest/orchestrator/proving-scheduler.d.ts.map +1 -0
- package/dest/orchestrator/proving-scheduler.js +117 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts +83 -0
- package/dest/orchestrator/top-tree-orchestrator.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-orchestrator.js +182 -0
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts +62 -0
- package/dest/orchestrator/top-tree-proving-scheduler.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-proving-scheduler.js +73 -0
- package/dest/orchestrator/top-tree-proving-state.d.ts +61 -0
- package/dest/orchestrator/top-tree-proving-state.d.ts.map +1 -0
- package/dest/orchestrator/top-tree-proving-state.js +185 -0
- package/dest/orchestrator/tx-proving-state.d.ts +6 -5
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +7 -16
- package/dest/prover-client/factory.d.ts +3 -3
- package/dest/prover-client/factory.d.ts.map +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts +66 -7
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/prover-client.js +64 -11
- 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 +2 -2
- package/dest/proving_broker/broker_prover_facade.d.ts +25 -23
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +21 -33
- package/dest/proving_broker/config.d.ts +14 -62
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +29 -6
- package/dest/proving_broker/factory.d.ts +1 -1
- package/dest/proving_broker/fixtures.d.ts +3 -2
- package/dest/proving_broker/fixtures.d.ts.map +1 -1
- package/dest/proving_broker/fixtures.js +3 -2
- package/dest/proving_broker/index.d.ts +2 -1
- package/dest/proving_broker/index.d.ts.map +1 -1
- package/dest/proving_broker/index.js +1 -0
- package/dest/proving_broker/proof_store/factory.d.ts +2 -5
- package/dest/proving_broker/proof_store/factory.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/factory.js +7 -30
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts +18 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.d.ts.map +1 -0
- package/dest/proving_broker/proof_store/file_store_proof_store.js +60 -0
- package/dest/proving_broker/proof_store/index.d.ts +2 -2
- package/dest/proving_broker/proof_store/index.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.js +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/inline_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/proof_store.d.ts +1 -1
- package/dest/proving_broker/proving_agent.d.ts +5 -9
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +4 -19
- package/dest/proving_broker/proving_broker.d.ts +8 -5
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +74 -22
- package/dest/proving_broker/proving_broker_database/memory.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database/memory.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.d.ts +5 -3
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +394 -5
- package/dest/proving_broker/proving_broker_database.d.ts +3 -2
- package/dest/proving_broker/proving_broker_database.d.ts.map +1 -1
- 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 +22 -35
- package/dest/proving_broker/proving_job_controller.d.ts +5 -3
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.js +8 -6
- package/dest/proving_broker/rpc.d.ts +9 -5
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +87 -23
- package/dest/test/mock_proof_store.d.ts +1 -1
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +5 -6
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +4 -4
- package/package.json +23 -22
- package/src/config.ts +19 -3
- package/src/light/index.ts +1 -0
- package/src/light/lightweight_checkpoint_builder.ts +320 -0
- package/src/mocks/fixtures.ts +9 -31
- package/src/mocks/test_context.ts +170 -185
- package/src/orchestrator/block-building-helpers.ts +129 -209
- package/src/orchestrator/block-proving-state.ts +109 -22
- package/src/orchestrator/checkpoint-proving-state.ts +89 -26
- package/src/orchestrator/checkpoint-sub-tree-orchestrator.ts +271 -0
- package/src/orchestrator/epoch-proving-context.ts +101 -0
- package/src/orchestrator/epoch-proving-state.ts +67 -15
- package/src/orchestrator/index.ts +8 -0
- package/src/orchestrator/orchestrator.ts +193 -354
- package/src/orchestrator/orchestrator_metrics.ts +2 -25
- package/src/orchestrator/proving-scheduler.ts +156 -0
- package/src/orchestrator/top-tree-orchestrator.ts +314 -0
- package/src/orchestrator/top-tree-proving-scheduler.ts +154 -0
- package/src/orchestrator/top-tree-proving-state.ts +220 -0
- package/src/orchestrator/tx-proving-state.ts +10 -27
- package/src/prover-client/factory.ts +6 -2
- package/src/prover-client/prover-client.ts +157 -24
- package/src/prover-client/server-epoch-prover.ts +6 -7
- package/src/proving_broker/broker_prover_facade.ts +46 -55
- package/src/proving_broker/config.ts +33 -3
- package/src/proving_broker/fixtures.ts +8 -3
- package/src/proving_broker/index.ts +1 -0
- package/src/proving_broker/proof_store/factory.ts +10 -32
- package/src/proving_broker/proof_store/file_store_proof_store.ts +78 -0
- package/src/proving_broker/proof_store/index.ts +1 -1
- package/src/proving_broker/proving_agent.ts +6 -19
- package/src/proving_broker/proving_broker.ts +70 -17
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +22 -7
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_broker_instrumentation.ts +23 -35
- package/src/proving_broker/proving_job_controller.ts +13 -7
- package/src/proving_broker/rpc.ts +46 -20
- package/src/test/mock_prover.ts +2 -14
- package/dest/block-factory/index.d.ts +0 -2
- package/dest/block-factory/index.d.ts.map +0 -1
- package/dest/block-factory/index.js +0 -1
- package/dest/block-factory/light.d.ts +0 -38
- package/dest/block-factory/light.d.ts.map +0 -1
- package/dest/block-factory/light.js +0 -94
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +0 -14
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +0 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.js +0 -52
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +0 -8
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +0 -1
- package/dest/proving_broker/proving_agent_instrumentation.js +0 -16
- package/src/block-factory/index.ts +0 -1
- package/src/block-factory/light.ts +0 -140
- package/src/proving_broker/proof_store/gcs_proof_store.ts +0 -76
- package/src/proving_broker/proving_agent_instrumentation.ts +0 -21
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { BatchedBlob, BatchedBlobAccumulator, type FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
2
|
-
import
|
|
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,
|
|
2
|
+
import {
|
|
3
|
+
type ARCHIVE_HEIGHT,
|
|
4
|
+
type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
5
|
+
type NESTED_RECURSIVE_PROOF_LENGTH,
|
|
6
|
+
type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
7
|
+
OUT_HASH_TREE_HEIGHT,
|
|
7
8
|
} from '@aztec/constants';
|
|
8
|
-
import
|
|
9
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
10
|
+
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
11
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
10
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
MerkleTreeCalculator,
|
|
14
|
+
type TreeNodeLocation,
|
|
15
|
+
UnbalancedTreeStore,
|
|
16
|
+
shaMerkleHash,
|
|
17
|
+
} from '@aztec/foundation/trees';
|
|
11
18
|
import type { PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
12
19
|
import type { Proof } from '@aztec/stdlib/proofs';
|
|
13
20
|
import {
|
|
@@ -19,7 +26,7 @@ import {
|
|
|
19
26
|
RootRollupPrivateInputs,
|
|
20
27
|
type RootRollupPublicInputs,
|
|
21
28
|
} from '@aztec/stdlib/rollup';
|
|
22
|
-
import
|
|
29
|
+
import { AppendOnlyTreeSnapshot, type MerkleTreeId } from '@aztec/stdlib/trees';
|
|
23
30
|
import type { BlockHeader } from '@aztec/stdlib/tx';
|
|
24
31
|
|
|
25
32
|
import { toProofData } from './block-building-helpers.js';
|
|
@@ -66,10 +73,10 @@ export class EpochProvingState {
|
|
|
66
73
|
>();
|
|
67
74
|
|
|
68
75
|
constructor(
|
|
69
|
-
public readonly epochNumber:
|
|
76
|
+
public readonly epochNumber: EpochNumber,
|
|
70
77
|
public readonly totalNumCheckpoints: number,
|
|
71
78
|
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
72
|
-
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void
|
|
79
|
+
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => Promise<void>,
|
|
73
80
|
private completionCallback: (result: ProvingResult) => void,
|
|
74
81
|
private rejectionCallback: (reason: string) => void,
|
|
75
82
|
) {
|
|
@@ -83,7 +90,6 @@ export class EpochProvingState {
|
|
|
83
90
|
checkpointIndex: number,
|
|
84
91
|
constants: CheckpointConstantData,
|
|
85
92
|
totalNumBlocks: number,
|
|
86
|
-
totalNumBlobFields: number,
|
|
87
93
|
previousBlockHeader: BlockHeader,
|
|
88
94
|
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
89
95
|
l1ToL2Messages: Fr[],
|
|
@@ -102,7 +108,6 @@ export class EpochProvingState {
|
|
|
102
108
|
checkpointIndex,
|
|
103
109
|
constants,
|
|
104
110
|
totalNumBlocks,
|
|
105
|
-
totalNumBlobFields,
|
|
106
111
|
this.finalBlobBatchingChallenges,
|
|
107
112
|
previousBlockHeader,
|
|
108
113
|
lastArchiveSiblingPath,
|
|
@@ -127,13 +132,16 @@ export class EpochProvingState {
|
|
|
127
132
|
return this.checkpoints[index];
|
|
128
133
|
}
|
|
129
134
|
|
|
130
|
-
public getCheckpointProvingStateByBlockNumber(blockNumber:
|
|
135
|
+
public getCheckpointProvingStateByBlockNumber(blockNumber: BlockNumber) {
|
|
131
136
|
return this.checkpoints.find(
|
|
132
|
-
c =>
|
|
137
|
+
c =>
|
|
138
|
+
c &&
|
|
139
|
+
Number(blockNumber) >= Number(c.firstBlockNumber) &&
|
|
140
|
+
Number(blockNumber) < Number(c.firstBlockNumber) + c.totalNumBlocks,
|
|
133
141
|
);
|
|
134
142
|
}
|
|
135
143
|
|
|
136
|
-
public getBlockProvingStateByBlockNumber(blockNumber:
|
|
144
|
+
public getBlockProvingStateByBlockNumber(blockNumber: BlockNumber) {
|
|
137
145
|
return this.getCheckpointProvingStateByBlockNumber(blockNumber)?.getBlockProvingStateByBlockNumber(blockNumber);
|
|
138
146
|
}
|
|
139
147
|
|
|
@@ -210,6 +218,50 @@ export class EpochProvingState {
|
|
|
210
218
|
this.checkpointPaddingProof = { provingOutput };
|
|
211
219
|
}
|
|
212
220
|
|
|
221
|
+
public async accumulateCheckpointOutHashes() {
|
|
222
|
+
const treeCalculator = await MerkleTreeCalculator.create(OUT_HASH_TREE_HEIGHT, undefined, (left, right) =>
|
|
223
|
+
Promise.resolve(shaMerkleHash(left, right)),
|
|
224
|
+
);
|
|
225
|
+
|
|
226
|
+
const computeOutHashHint = async (leaves: Fr[]) => {
|
|
227
|
+
const tree = await treeCalculator.computeTree(leaves.map(l => l.toBuffer()));
|
|
228
|
+
const nextAvailableLeafIndex = leaves.length;
|
|
229
|
+
return {
|
|
230
|
+
treeSnapshot: new AppendOnlyTreeSnapshot(Fr.fromBuffer(tree.root), nextAvailableLeafIndex),
|
|
231
|
+
siblingPath: tree.getSiblingPath(nextAvailableLeafIndex).map(Fr.fromBuffer) as Tuple<
|
|
232
|
+
Fr,
|
|
233
|
+
typeof OUT_HASH_TREE_HEIGHT
|
|
234
|
+
>,
|
|
235
|
+
};
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
let hint = this.checkpoints[0]?.getOutHashHint();
|
|
239
|
+
const outHashes = [];
|
|
240
|
+
for (let i = 0; i < this.totalNumCheckpoints; i++) {
|
|
241
|
+
const checkpoint = this.checkpoints[i];
|
|
242
|
+
if (!checkpoint) {
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// If hints are not set yet, it must be the first checkpoint. Compute the hints with an empty tree.
|
|
247
|
+
hint ??= await computeOutHashHint([]);
|
|
248
|
+
checkpoint.setOutHashHint(hint);
|
|
249
|
+
|
|
250
|
+
// Get the out hash for this checkpoint.
|
|
251
|
+
const outHash = checkpoint.accumulateBlockOutHashes();
|
|
252
|
+
if (!outHash) {
|
|
253
|
+
break;
|
|
254
|
+
}
|
|
255
|
+
outHashes.push(outHash);
|
|
256
|
+
|
|
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
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
213
265
|
public async setBlobAccumulators() {
|
|
214
266
|
let previousAccumulator = this.startBlobAccumulator;
|
|
215
267
|
// Accumulate blobs as far as we can for this epoch.
|
|
@@ -1 +1,9 @@
|
|
|
1
1
|
export { ProvingOrchestrator } from './orchestrator.js';
|
|
2
|
+
export { CheckpointSubTreeOrchestrator, type SubTreeResult } from './checkpoint-sub-tree-orchestrator.js';
|
|
3
|
+
export { EpochProvingContext, type ChonkVerifierProofResult } from './epoch-proving-context.js';
|
|
4
|
+
export {
|
|
5
|
+
TopTreeOrchestrator,
|
|
6
|
+
TopTreeCancelledError,
|
|
7
|
+
type CheckpointTopTreeData,
|
|
8
|
+
type TopTreeResult,
|
|
9
|
+
} from './top-tree-orchestrator.js';
|