@aztec/prover-client 0.0.1-commit.b655e406 → 0.0.1-commit.d3ec352c
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/index.d.ts +1 -1
- package/dest/block-factory/light.d.ts +7 -7
- package/dest/block-factory/light.d.ts.map +1 -1
- package/dest/block-factory/light.js +36 -22
- package/dest/config.d.ts +1 -1
- package/dest/index.d.ts +1 -1
- package/dest/light/lightweight_checkpoint_builder.d.ts +29 -0
- package/dest/light/lightweight_checkpoint_builder.d.ts.map +1 -0
- package/dest/light/lightweight_checkpoint_builder.js +107 -0
- package/dest/mocks/fixtures.d.ts +1 -4
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +5 -15
- package/dest/mocks/test_context.d.ts +26 -45
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +99 -112
- package/dest/orchestrator/block-building-helpers.d.ts +15 -17
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +85 -110
- package/dest/orchestrator/block-proving-state.d.ts +16 -10
- package/dest/orchestrator/block-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/block-proving-state.js +81 -20
- package/dest/orchestrator/checkpoint-proving-state.d.ts +7 -7
- package/dest/orchestrator/checkpoint-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/checkpoint-proving-state.js +13 -15
- package/dest/orchestrator/epoch-proving-state.d.ts +8 -7
- package/dest/orchestrator/epoch-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/epoch-proving-state.js +3 -3
- package/dest/orchestrator/index.d.ts +1 -1
- package/dest/orchestrator/orchestrator.d.ts +7 -7
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +24 -30
- package/dest/orchestrator/orchestrator_metrics.d.ts +1 -1
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.d.ts +1 -1
- package/dest/orchestrator/tx-proving-state.d.ts.map +1 -1
- package/dest/orchestrator/tx-proving-state.js +2 -11
- package/dest/prover-client/factory.d.ts +1 -1
- package/dest/prover-client/index.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts +1 -1
- package/dest/prover-client/prover-client.d.ts.map +1 -1
- package/dest/prover-client/server-epoch-prover.d.ts +7 -6
- 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 +20 -20
- package/dest/proving_broker/broker_prover_facade.d.ts.map +1 -1
- package/dest/proving_broker/broker_prover_facade.js +3 -2
- package/dest/proving_broker/config.d.ts +11 -7
- package/dest/proving_broker/config.d.ts.map +1 -1
- package/dest/proving_broker/config.js +7 -1
- 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 +2 -1
- package/dest/proving_broker/index.d.ts +1 -1
- package/dest/proving_broker/proof_store/factory.d.ts +2 -2
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts +1 -1
- package/dest/proving_broker/proof_store/gcs_proof_store.d.ts.map +1 -1
- package/dest/proving_broker/proof_store/index.d.ts +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 +1 -1
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent_instrumentation.d.ts +1 -1
- package/dest/proving_broker/proving_agent_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.d.ts +2 -2
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +2 -1
- 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 +3 -2
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +3 -2
- 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 +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_job_controller.d.ts +3 -2
- package/dest/proving_broker/proving_job_controller.d.ts.map +1 -1
- package/dest/proving_broker/rpc.d.ts +4 -4
- package/dest/test/mock_proof_store.d.ts +3 -3
- package/dest/test/mock_proof_store.d.ts.map +1 -1
- package/dest/test/mock_prover.d.ts +3 -4
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/package.json +18 -17
- package/src/block-factory/light.ts +39 -42
- package/src/light/lightweight_checkpoint_builder.ts +143 -0
- package/src/mocks/fixtures.ts +5 -28
- package/src/mocks/test_context.ts +143 -174
- package/src/orchestrator/block-building-helpers.ts +124 -204
- package/src/orchestrator/block-proving-state.ts +102 -24
- package/src/orchestrator/checkpoint-proving-state.ts +22 -19
- package/src/orchestrator/epoch-proving-state.ts +8 -6
- package/src/orchestrator/orchestrator.ts +31 -38
- package/src/orchestrator/tx-proving-state.ts +3 -16
- package/src/prover-client/server-epoch-prover.ts +5 -6
- package/src/proving_broker/broker_prover_facade.ts +21 -20
- package/src/proving_broker/config.ts +7 -0
- package/src/proving_broker/fixtures.ts +7 -2
- package/src/proving_broker/proving_broker.ts +2 -1
- package/src/proving_broker/proving_broker_database/memory.ts +2 -1
- package/src/proving_broker/proving_broker_database/persisted.ts +5 -4
- package/src/proving_broker/proving_broker_database.ts +2 -1
- package/src/proving_broker/proving_job_controller.ts +2 -1
|
@@ -1,17 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
BatchedBlobAccumulator,
|
|
3
|
+
type FinalBlobBatchingChallenges,
|
|
4
|
+
SpongeBlob,
|
|
5
|
+
encodeCheckpointBlobDataFromBlocks,
|
|
6
|
+
} from '@aztec/blob-lib';
|
|
2
7
|
import {
|
|
3
8
|
type ARCHIVE_HEIGHT,
|
|
4
|
-
|
|
9
|
+
BLOBS_PER_CHECKPOINT,
|
|
5
10
|
FIELDS_PER_BLOB,
|
|
6
11
|
type L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
7
12
|
type NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
8
13
|
NUM_MSGS_PER_BASE_PARITY,
|
|
9
14
|
} from '@aztec/constants';
|
|
15
|
+
import { BlockNumber } from '@aztec/foundation/branded-types';
|
|
10
16
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
11
17
|
import { BLS12Point, Fr } from '@aztec/foundation/fields';
|
|
12
18
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
13
19
|
import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
14
|
-
import { getCheckpointBlobFields } from '@aztec/stdlib/checkpoint';
|
|
15
20
|
import type { PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
16
21
|
import { ParityBasePrivateInputs } from '@aztec/stdlib/parity';
|
|
17
22
|
import {
|
|
@@ -44,13 +49,12 @@ export class CheckpointProvingState {
|
|
|
44
49
|
private endBlobAccumulator: BatchedBlobAccumulator | undefined;
|
|
45
50
|
private blobFields: Fr[] | undefined;
|
|
46
51
|
private error: string | undefined;
|
|
47
|
-
public readonly firstBlockNumber:
|
|
52
|
+
public readonly firstBlockNumber: BlockNumber;
|
|
48
53
|
|
|
49
54
|
constructor(
|
|
50
55
|
public readonly index: number,
|
|
51
56
|
public readonly constants: CheckpointConstantData,
|
|
52
57
|
public readonly totalNumBlocks: number,
|
|
53
|
-
private readonly totalNumBlobFields: number,
|
|
54
58
|
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
55
59
|
private readonly headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
56
60
|
private readonly lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
@@ -71,21 +75,21 @@ export class CheckpointProvingState {
|
|
|
71
75
|
private onBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void,
|
|
72
76
|
) {
|
|
73
77
|
this.blockProofs = new UnbalancedTreeStore(totalNumBlocks);
|
|
74
|
-
this.firstBlockNumber = headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber + 1;
|
|
78
|
+
this.firstBlockNumber = BlockNumber(headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber + 1);
|
|
75
79
|
}
|
|
76
80
|
|
|
77
81
|
public get epochNumber(): number {
|
|
78
82
|
return this.parentEpoch.epochNumber;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
|
-
public
|
|
82
|
-
blockNumber:
|
|
85
|
+
public startNewBlock(
|
|
86
|
+
blockNumber: BlockNumber,
|
|
83
87
|
timestamp: UInt64,
|
|
84
88
|
totalNumTxs: number,
|
|
85
89
|
lastArchiveTreeSnapshot: AppendOnlyTreeSnapshot,
|
|
86
90
|
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
87
|
-
):
|
|
88
|
-
const index = blockNumber - this.firstBlockNumber;
|
|
91
|
+
): BlockProvingState {
|
|
92
|
+
const index = Number(blockNumber) - Number(this.firstBlockNumber);
|
|
89
93
|
if (index >= this.totalNumBlocks) {
|
|
90
94
|
throw new Error(`Unable to start a new block at index ${index}. Expected at most ${this.totalNumBlocks} blocks.`);
|
|
91
95
|
}
|
|
@@ -98,8 +102,7 @@ export class CheckpointProvingState {
|
|
|
98
102
|
const lastL1ToL2MessageSubtreeRootSiblingPath =
|
|
99
103
|
index === 0 ? this.lastL1ToL2MessageSubtreeRootSiblingPath : this.newL1ToL2MessageSubtreeRootSiblingPath;
|
|
100
104
|
|
|
101
|
-
const startSpongeBlob =
|
|
102
|
-
index === 0 ? await SpongeBlob.init(this.totalNumBlobFields) : this.blocks[index - 1]?.getEndSpongeBlob();
|
|
105
|
+
const startSpongeBlob = index === 0 ? SpongeBlob.init() : this.blocks[index - 1]?.getEndSpongeBlob();
|
|
103
106
|
if (!startSpongeBlob) {
|
|
104
107
|
throw new Error(
|
|
105
108
|
'Cannot start a new block before the trees have progressed from the tx effects in the previous block.',
|
|
@@ -192,12 +195,12 @@ export class CheckpointProvingState {
|
|
|
192
195
|
}
|
|
193
196
|
|
|
194
197
|
public async accumulateBlobs(startBlobAccumulator: BatchedBlobAccumulator) {
|
|
195
|
-
if (this.isAcceptingBlocks() || this.blocks.some(b => b
|
|
198
|
+
if (this.isAcceptingBlocks() || this.blocks.some(b => !b?.hasEndState())) {
|
|
196
199
|
return;
|
|
197
200
|
}
|
|
198
201
|
|
|
199
|
-
this.blobFields =
|
|
200
|
-
this.endBlobAccumulator = await accumulateBlobs(this.blobFields
|
|
202
|
+
this.blobFields = encodeCheckpointBlobDataFromBlocks(this.blocks.map(b => b!.getBlockBlobData()));
|
|
203
|
+
this.endBlobAccumulator = await accumulateBlobs(this.blobFields!, startBlobAccumulator);
|
|
201
204
|
this.startBlobAccumulator = startBlobAccumulator;
|
|
202
205
|
|
|
203
206
|
this.onBlobAccumulatorSet(this);
|
|
@@ -246,8 +249,8 @@ export class CheckpointProvingState {
|
|
|
246
249
|
previousArchiveSiblingPath: this.lastArchiveSiblingPath,
|
|
247
250
|
startBlobAccumulator: this.startBlobAccumulator.toBlobAccumulator(),
|
|
248
251
|
finalBlobChallenges: this.finalBlobBatchingChallenges,
|
|
249
|
-
blobFields: padArrayEnd(blobFields, Fr.ZERO, FIELDS_PER_BLOB *
|
|
250
|
-
blobCommitments: padArrayEnd(blobCommitments, BLS12Point.ZERO,
|
|
252
|
+
blobFields: padArrayEnd(blobFields, Fr.ZERO, FIELDS_PER_BLOB * BLOBS_PER_CHECKPOINT),
|
|
253
|
+
blobCommitments: padArrayEnd(blobCommitments, BLS12Point.ZERO, BLOBS_PER_CHECKPOINT),
|
|
251
254
|
blobsHash,
|
|
252
255
|
});
|
|
253
256
|
|
|
@@ -258,8 +261,8 @@ export class CheckpointProvingState {
|
|
|
258
261
|
: new CheckpointRootRollupPrivateInputs([left, right], hints);
|
|
259
262
|
}
|
|
260
263
|
|
|
261
|
-
public getBlockProvingStateByBlockNumber(blockNumber:
|
|
262
|
-
const index = blockNumber - this.firstBlockNumber;
|
|
264
|
+
public getBlockProvingStateByBlockNumber(blockNumber: BlockNumber) {
|
|
265
|
+
const index = Number(blockNumber) - Number(this.firstBlockNumber);
|
|
263
266
|
return this.blocks[index];
|
|
264
267
|
}
|
|
265
268
|
|
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
NESTED_RECURSIVE_PROOF_LENGTH,
|
|
6
6
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
7
7
|
} from '@aztec/constants';
|
|
8
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
8
9
|
import type { Fr } from '@aztec/foundation/fields';
|
|
9
10
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
10
11
|
import { type TreeNodeLocation, UnbalancedTreeStore } from '@aztec/foundation/trees';
|
|
@@ -66,7 +67,7 @@ export class EpochProvingState {
|
|
|
66
67
|
>();
|
|
67
68
|
|
|
68
69
|
constructor(
|
|
69
|
-
public readonly epochNumber:
|
|
70
|
+
public readonly epochNumber: EpochNumber,
|
|
70
71
|
public readonly totalNumCheckpoints: number,
|
|
71
72
|
private readonly finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
72
73
|
private onCheckpointBlobAccumulatorSet: (checkpoint: CheckpointProvingState) => void,
|
|
@@ -83,7 +84,6 @@ export class EpochProvingState {
|
|
|
83
84
|
checkpointIndex: number,
|
|
84
85
|
constants: CheckpointConstantData,
|
|
85
86
|
totalNumBlocks: number,
|
|
86
|
-
totalNumBlobFields: number,
|
|
87
87
|
previousBlockHeader: BlockHeader,
|
|
88
88
|
lastArchiveSiblingPath: Tuple<Fr, typeof ARCHIVE_HEIGHT>,
|
|
89
89
|
l1ToL2Messages: Fr[],
|
|
@@ -102,7 +102,6 @@ export class EpochProvingState {
|
|
|
102
102
|
checkpointIndex,
|
|
103
103
|
constants,
|
|
104
104
|
totalNumBlocks,
|
|
105
|
-
totalNumBlobFields,
|
|
106
105
|
this.finalBlobBatchingChallenges,
|
|
107
106
|
previousBlockHeader,
|
|
108
107
|
lastArchiveSiblingPath,
|
|
@@ -127,13 +126,16 @@ export class EpochProvingState {
|
|
|
127
126
|
return this.checkpoints[index];
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
public getCheckpointProvingStateByBlockNumber(blockNumber:
|
|
129
|
+
public getCheckpointProvingStateByBlockNumber(blockNumber: BlockNumber) {
|
|
131
130
|
return this.checkpoints.find(
|
|
132
|
-
c =>
|
|
131
|
+
c =>
|
|
132
|
+
c &&
|
|
133
|
+
Number(blockNumber) >= Number(c.firstBlockNumber) &&
|
|
134
|
+
Number(blockNumber) < Number(c.firstBlockNumber) + c.totalNumBlocks,
|
|
133
135
|
);
|
|
134
136
|
}
|
|
135
137
|
|
|
136
|
-
public getBlockProvingStateByBlockNumber(blockNumber:
|
|
138
|
+
public getBlockProvingStateByBlockNumber(blockNumber: BlockNumber) {
|
|
137
139
|
return this.getCheckpointProvingStateByBlockNumber(blockNumber)?.getBlockProvingStateByBlockNumber(blockNumber);
|
|
138
140
|
}
|
|
139
141
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BatchedBlob, FinalBlobBatchingChallenges, SpongeBlob } from '@aztec/blob-lib';
|
|
1
|
+
import { BatchedBlob, FinalBlobBatchingChallenges, SpongeBlob } from '@aztec/blob-lib/types';
|
|
2
2
|
import {
|
|
3
3
|
L1_TO_L2_MSG_SUBTREE_HEIGHT,
|
|
4
4
|
L1_TO_L2_MSG_SUBTREE_ROOT_SIBLING_PATH_LENGTH,
|
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
7
7
|
NUM_BASE_PARITY_PER_ROOT_PARITY,
|
|
8
8
|
} from '@aztec/constants';
|
|
9
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
9
10
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
10
11
|
import { AbortError } from '@aztec/foundation/error';
|
|
11
12
|
import { Fr } from '@aztec/foundation/fields';
|
|
@@ -16,7 +17,7 @@ import { pushTestData } from '@aztec/foundation/testing';
|
|
|
16
17
|
import { elapsed } from '@aztec/foundation/timer';
|
|
17
18
|
import type { TreeNodeLocation } from '@aztec/foundation/trees';
|
|
18
19
|
import { readAvmMinimalPublicTxInputsFromFile } from '@aztec/simulator/public/fixtures';
|
|
19
|
-
import { EthAddress
|
|
20
|
+
import { EthAddress } from '@aztec/stdlib/block';
|
|
20
21
|
import type {
|
|
21
22
|
EpochProver,
|
|
22
23
|
ForkMerkleTreeOperations,
|
|
@@ -54,7 +55,6 @@ import {
|
|
|
54
55
|
import { inspect } from 'util';
|
|
55
56
|
|
|
56
57
|
import {
|
|
57
|
-
buildBlockHeaderFromTxs,
|
|
58
58
|
buildHeaderFromCircuitOutputs,
|
|
59
59
|
getLastSiblingPath,
|
|
60
60
|
getPublicChonkVerifierPrivateInputsFromTx,
|
|
@@ -93,7 +93,8 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
93
93
|
|
|
94
94
|
private provingPromise: Promise<ProvingResult> | undefined = undefined;
|
|
95
95
|
private metrics: ProvingOrchestratorMetrics;
|
|
96
|
-
|
|
96
|
+
// eslint-disable-next-line aztec-custom/no-non-primitive-in-collections
|
|
97
|
+
private dbs: Map<BlockNumber, MerkleTreeWriteOperations> = new Map();
|
|
97
98
|
|
|
98
99
|
constructor(
|
|
99
100
|
private dbProvider: ForkMerkleTreeOperations,
|
|
@@ -118,7 +119,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
118
119
|
}
|
|
119
120
|
|
|
120
121
|
public startNewEpoch(
|
|
121
|
-
epochNumber:
|
|
122
|
+
epochNumber: EpochNumber,
|
|
122
123
|
totalNumCheckpoints: number,
|
|
123
124
|
finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
124
125
|
) {
|
|
@@ -147,7 +148,6 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
147
148
|
constants: CheckpointConstantData,
|
|
148
149
|
l1ToL2Messages: Fr[],
|
|
149
150
|
totalNumBlocks: number,
|
|
150
|
-
totalNumBlobFields: number,
|
|
151
151
|
headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
152
152
|
) {
|
|
153
153
|
if (!this.provingState) {
|
|
@@ -162,7 +162,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
162
162
|
const lastBlockNumber = headerOfLastBlockInPreviousCheckpoint.globalVariables.blockNumber;
|
|
163
163
|
const db = await this.dbProvider.fork(lastBlockNumber);
|
|
164
164
|
|
|
165
|
-
const firstBlockNumber = lastBlockNumber + 1;
|
|
165
|
+
const firstBlockNumber = BlockNumber(lastBlockNumber + 1);
|
|
166
166
|
this.dbs.set(firstBlockNumber, db);
|
|
167
167
|
|
|
168
168
|
// Get archive sibling path before any block in this checkpoint lands.
|
|
@@ -180,7 +180,6 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
180
180
|
checkpointIndex,
|
|
181
181
|
constants,
|
|
182
182
|
totalNumBlocks,
|
|
183
|
-
totalNumBlobFields,
|
|
184
183
|
headerOfLastBlockInPreviousCheckpoint,
|
|
185
184
|
lastArchiveSiblingPath,
|
|
186
185
|
l1ToL2Messages,
|
|
@@ -201,7 +200,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
201
200
|
@trackSpan('ProvingOrchestrator.startNewBlock', blockNumber => ({
|
|
202
201
|
[Attributes.BLOCK_NUMBER]: blockNumber,
|
|
203
202
|
}))
|
|
204
|
-
public async startNewBlock(blockNumber:
|
|
203
|
+
public async startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number) {
|
|
205
204
|
if (!this.provingState) {
|
|
206
205
|
throw new Error('Empty epoch proving state. Call startNewEpoch before starting a block.');
|
|
207
206
|
}
|
|
@@ -216,12 +215,12 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
216
215
|
}
|
|
217
216
|
|
|
218
217
|
const constants = checkpointProvingState.constants;
|
|
219
|
-
logger.info(`Starting block ${blockNumber} for slot ${constants.slotNumber
|
|
218
|
+
logger.info(`Starting block ${blockNumber} for slot ${constants.slotNumber}.`);
|
|
220
219
|
|
|
221
220
|
// Fork the db only when it's not already set. The db for the first block is set in `startNewCheckpoint`.
|
|
222
221
|
if (!this.dbs.has(blockNumber)) {
|
|
223
222
|
// Fork world state at the end of the immediately previous block
|
|
224
|
-
const db = await this.dbProvider.fork(blockNumber - 1);
|
|
223
|
+
const db = await this.dbProvider.fork(BlockNumber(blockNumber - 1));
|
|
225
224
|
this.dbs.set(blockNumber, db);
|
|
226
225
|
}
|
|
227
226
|
const db = this.dbs.get(blockNumber)!;
|
|
@@ -230,7 +229,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
230
229
|
const lastArchiveTreeSnapshot = await getTreeSnapshot(MerkleTreeId.ARCHIVE, db);
|
|
231
230
|
const lastArchiveSiblingPath = await getRootTreeSiblingPath(MerkleTreeId.ARCHIVE, db);
|
|
232
231
|
|
|
233
|
-
const blockProvingState =
|
|
232
|
+
const blockProvingState = checkpointProvingState.startNewBlock(
|
|
234
233
|
blockNumber,
|
|
235
234
|
timestamp,
|
|
236
235
|
totalNumTxs,
|
|
@@ -248,8 +247,12 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
248
247
|
// Because `addTxs` won't be called for a block without txs, and that's where the sponge blob state is computed.
|
|
249
248
|
// We need to set its end sponge blob here, which will become the start sponge blob for the next block.
|
|
250
249
|
if (totalNumTxs === 0) {
|
|
250
|
+
const endState = await db.getStateReference();
|
|
251
|
+
blockProvingState.setEndState(endState);
|
|
252
|
+
|
|
251
253
|
const endSpongeBlob = blockProvingState.getStartSpongeBlob().clone();
|
|
252
|
-
|
|
254
|
+
const blockEndBlobFields = blockProvingState.getBlockEndBlobFields();
|
|
255
|
+
await endSpongeBlob.absorb(blockEndBlobFields);
|
|
253
256
|
blockProvingState.setEndSpongeBlob(endSpongeBlob);
|
|
254
257
|
|
|
255
258
|
// And also try to accumulate the blobs as far as we can:
|
|
@@ -276,7 +279,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
276
279
|
return;
|
|
277
280
|
}
|
|
278
281
|
|
|
279
|
-
const blockNumber = txs[0].globalVariables.blockNumber;
|
|
282
|
+
const blockNumber = BlockNumber(txs[0].globalVariables.blockNumber);
|
|
280
283
|
const provingState = this.provingState.getBlockProvingStateByBlockNumber(blockNumber!);
|
|
281
284
|
if (!provingState) {
|
|
282
285
|
throw new Error(`Proving state for block ${blockNumber} not found. Call startNewBlock first.`);
|
|
@@ -341,7 +344,11 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
341
344
|
}
|
|
342
345
|
}
|
|
343
346
|
|
|
344
|
-
await
|
|
347
|
+
const endState = await db.getStateReference();
|
|
348
|
+
provingState.setEndState(endState);
|
|
349
|
+
|
|
350
|
+
const blockEndBlobFields = provingState.getBlockEndBlobFields();
|
|
351
|
+
await spongeBlobState.absorb(blockEndBlobFields);
|
|
345
352
|
|
|
346
353
|
provingState.setEndSpongeBlob(spongeBlobState);
|
|
347
354
|
|
|
@@ -382,10 +389,10 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
382
389
|
* Marks the block as completed.
|
|
383
390
|
* Computes the block header and updates the archive tree.
|
|
384
391
|
*/
|
|
385
|
-
@trackSpan('ProvingOrchestrator.setBlockCompleted', (blockNumber:
|
|
392
|
+
@trackSpan('ProvingOrchestrator.setBlockCompleted', (blockNumber: BlockNumber) => ({
|
|
386
393
|
[Attributes.BLOCK_NUMBER]: blockNumber,
|
|
387
394
|
}))
|
|
388
|
-
public async setBlockCompleted(blockNumber:
|
|
395
|
+
public async setBlockCompleted(blockNumber: BlockNumber, expectedHeader?: BlockHeader): Promise<BlockHeader> {
|
|
389
396
|
const provingState = this.provingState?.getBlockProvingStateByBlockNumber(blockNumber);
|
|
390
397
|
if (!provingState) {
|
|
391
398
|
throw new Error(`Block proving state for ${blockNumber} not found`);
|
|
@@ -408,39 +415,25 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
408
415
|
);
|
|
409
416
|
}
|
|
410
417
|
|
|
411
|
-
//
|
|
418
|
+
// Given we've applied every change from this block, now assemble the block header:
|
|
412
419
|
logger.verbose(`Block ${blockNumber} completed. Assembling header.`);
|
|
413
|
-
const header = await
|
|
414
|
-
|
|
415
|
-
await this.verifyBuiltBlockAgainstSyncedState(provingState);
|
|
416
|
-
|
|
417
|
-
return header;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
private async buildL2BlockHeader(provingState: BlockProvingState, expectedHeader?: BlockHeader) {
|
|
421
|
-
// Collect all txs in this block to build the header. The function calling this has made sure that all txs have been added.
|
|
422
|
-
const txs = provingState.getProcessedTxs();
|
|
423
|
-
|
|
424
|
-
const startSpongeBlob = provingState.getStartSpongeBlob();
|
|
425
|
-
|
|
426
|
-
// Get db for this block
|
|
427
|
-
const db = this.dbs.get(provingState.blockNumber)!;
|
|
428
|
-
|
|
429
|
-
// Given we've applied every change from this block, now assemble the block header
|
|
430
|
-
// and update the archive tree, so we're ready to start processing the next block
|
|
431
|
-
const header = await buildBlockHeaderFromTxs(txs, provingState.getGlobalVariables(), startSpongeBlob, db);
|
|
420
|
+
const header = await provingState.buildBlockHeader();
|
|
432
421
|
|
|
433
422
|
if (expectedHeader && !header.equals(expectedHeader)) {
|
|
434
423
|
logger.error(`Block header mismatch: header=${header} expectedHeader=${expectedHeader}`);
|
|
435
424
|
throw new Error('Block header mismatch');
|
|
436
425
|
}
|
|
437
426
|
|
|
427
|
+
// Get db for this block
|
|
428
|
+
const db = this.dbs.get(provingState.blockNumber)!;
|
|
429
|
+
|
|
430
|
+
// Update the archive tree, so we're ready to start processing the next block:
|
|
438
431
|
logger.verbose(
|
|
439
432
|
`Updating archive tree with block ${provingState.blockNumber} header ${(await header.hash()).toString()}`,
|
|
440
433
|
);
|
|
441
434
|
await db.updateArchive(header);
|
|
442
435
|
|
|
443
|
-
|
|
436
|
+
await this.verifyBuiltBlockAgainstSyncedState(provingState);
|
|
444
437
|
|
|
445
438
|
return header;
|
|
446
439
|
}
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED,
|
|
3
|
-
AVM_VK_INDEX,
|
|
4
|
-
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
|
-
} from '@aztec/constants';
|
|
1
|
+
import { AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED, NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH } from '@aztec/constants';
|
|
6
2
|
import type { Fr } from '@aztec/foundation/fields';
|
|
7
|
-
import { getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
8
|
-
import { getVKSiblingPath } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
3
|
+
import { getAvmVkData, getVkData } from '@aztec/noir-protocol-circuits-types/server/vks';
|
|
9
4
|
import type { AvmCircuitInputs } from '@aztec/stdlib/avm';
|
|
10
5
|
import type { ProofAndVerificationKey, PublicInputsAndRecursiveProof } from '@aztec/stdlib/interfaces/server';
|
|
11
6
|
import { ProofData } from '@aztec/stdlib/proofs';
|
|
@@ -20,7 +15,6 @@ import {
|
|
|
20
15
|
import type { CircuitName } from '@aztec/stdlib/stats';
|
|
21
16
|
import type { AppendOnlyTreeSnapshot, MerkleTreeId } from '@aztec/stdlib/trees';
|
|
22
17
|
import type { ProcessedTx } from '@aztec/stdlib/tx';
|
|
23
|
-
import { VerificationKeyData, VkData } from '@aztec/stdlib/vks';
|
|
24
18
|
|
|
25
19
|
import {
|
|
26
20
|
getChonkProofFromTx,
|
|
@@ -123,16 +117,9 @@ export class TxProvingState {
|
|
|
123
117
|
const avmProofData = new ProofData(
|
|
124
118
|
this.processedTx.avmProvingRequest.inputs.publicInputs,
|
|
125
119
|
this.avm.proof,
|
|
126
|
-
|
|
120
|
+
getAvmVkData(),
|
|
127
121
|
);
|
|
128
122
|
|
|
129
123
|
return new PublicTxBaseRollupPrivateInputs(publicChonkVerifierProofData, avmProofData, this.baseRollupHints);
|
|
130
124
|
}
|
|
131
|
-
|
|
132
|
-
#getVkData(verificationKey: VerificationKeyData, vkIndex: number) {
|
|
133
|
-
// TODO(#17162): Add avm vk hash to the tree and call `getVkData('AVM')` instead.
|
|
134
|
-
// Below will return a path to an empty leaf.
|
|
135
|
-
const vkPath = getVKSiblingPath(vkIndex);
|
|
136
|
-
return new VkData(verificationKey, vkIndex, vkPath);
|
|
137
|
-
}
|
|
138
125
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib';
|
|
1
|
+
import type { BatchedBlob, FinalBlobBatchingChallenges } from '@aztec/blob-lib/types';
|
|
2
|
+
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
2
3
|
import type { Fr } from '@aztec/foundation/fields';
|
|
3
4
|
import type { EthAddress } from '@aztec/stdlib/block';
|
|
4
5
|
import type { EpochProver } from '@aztec/stdlib/interfaces/server';
|
|
@@ -18,7 +19,7 @@ export class ServerEpochProver implements EpochProver {
|
|
|
18
19
|
) {}
|
|
19
20
|
|
|
20
21
|
startNewEpoch(
|
|
21
|
-
epochNumber:
|
|
22
|
+
epochNumber: EpochNumber,
|
|
22
23
|
totalNumCheckpoints: number,
|
|
23
24
|
finalBlobBatchingChallenges: FinalBlobBatchingChallenges,
|
|
24
25
|
): void {
|
|
@@ -30,7 +31,6 @@ export class ServerEpochProver implements EpochProver {
|
|
|
30
31
|
constants: CheckpointConstantData,
|
|
31
32
|
l1ToL2Messages: Fr[],
|
|
32
33
|
totalNumBlocks: number,
|
|
33
|
-
totalNumBlobFields: number,
|
|
34
34
|
headerOfLastBlockInPreviousCheckpoint: BlockHeader,
|
|
35
35
|
): Promise<void> {
|
|
36
36
|
return this.orchestrator.startNewCheckpoint(
|
|
@@ -38,14 +38,13 @@ export class ServerEpochProver implements EpochProver {
|
|
|
38
38
|
constants,
|
|
39
39
|
l1ToL2Messages,
|
|
40
40
|
totalNumBlocks,
|
|
41
|
-
totalNumBlobFields,
|
|
42
41
|
headerOfLastBlockInPreviousCheckpoint,
|
|
43
42
|
);
|
|
44
43
|
}
|
|
45
44
|
startChonkVerifierCircuits(txs: Tx[]): Promise<void> {
|
|
46
45
|
return this.orchestrator.startChonkVerifierCircuits(txs);
|
|
47
46
|
}
|
|
48
|
-
setBlockCompleted(blockNumber:
|
|
47
|
+
setBlockCompleted(blockNumber: BlockNumber, expectedBlockHeader?: BlockHeader): Promise<BlockHeader> {
|
|
49
48
|
return this.orchestrator.setBlockCompleted(blockNumber, expectedBlockHeader);
|
|
50
49
|
}
|
|
51
50
|
finalizeEpoch(): Promise<{ publicInputs: RootRollupPublicInputs; proof: Proof; batchedBlobInputs: BatchedBlob }> {
|
|
@@ -61,7 +60,7 @@ export class ServerEpochProver implements EpochProver {
|
|
|
61
60
|
await this.facade.stop();
|
|
62
61
|
await this.orchestrator.stop();
|
|
63
62
|
}
|
|
64
|
-
startNewBlock(blockNumber:
|
|
63
|
+
startNewBlock(blockNumber: BlockNumber, timestamp: UInt64, totalNumTxs: number): Promise<void> {
|
|
65
64
|
return this.orchestrator.startNewBlock(blockNumber, timestamp, totalNumTxs);
|
|
66
65
|
}
|
|
67
66
|
addTxs(txs: ProcessedTx[]): Promise<void> {
|
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH,
|
|
5
5
|
RECURSIVE_PROOF_LENGTH,
|
|
6
6
|
} from '@aztec/constants';
|
|
7
|
+
import { EpochNumber } from '@aztec/foundation/branded-types';
|
|
7
8
|
import { sha256 } from '@aztec/foundation/crypto';
|
|
8
9
|
import { Fr } from '@aztec/foundation/fields';
|
|
9
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
@@ -130,7 +131,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
130
131
|
id: ProvingJobId,
|
|
131
132
|
type: T,
|
|
132
133
|
inputs: ProvingJobInputsMap[T],
|
|
133
|
-
epochNumber =
|
|
134
|
+
epochNumber = EpochNumber.ZERO,
|
|
134
135
|
signal?: AbortSignal,
|
|
135
136
|
): Promise<ProvingJobResultsMap[T]> {
|
|
136
137
|
const { job: job, isEnqueued } = this.getOrCreateProvingJob(id, type, signal);
|
|
@@ -399,7 +400,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
399
400
|
inputs: AvmCircuitInputs,
|
|
400
401
|
skipPublicInputsValidation?: boolean, // TODO(#14234)[Unconditional PIs validation]: remove this argument
|
|
401
402
|
signal?: AbortSignal,
|
|
402
|
-
epochNumber?:
|
|
403
|
+
epochNumber?: EpochNumber,
|
|
403
404
|
): Promise<ProofAndVerificationKey<typeof AVM_V2_PROOF_LENGTH_IN_FIELDS_PADDED>> {
|
|
404
405
|
this.log.info(`getAvmProof() called with skipPublicInputsValidation: ${skipPublicInputsValidation}`);
|
|
405
406
|
|
|
@@ -420,7 +421,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
420
421
|
getBaseParityProof(
|
|
421
422
|
inputs: ParityBasePrivateInputs,
|
|
422
423
|
signal?: AbortSignal,
|
|
423
|
-
epochNumber?:
|
|
424
|
+
epochNumber?: EpochNumber,
|
|
424
425
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
425
426
|
return this.enqueueJob(
|
|
426
427
|
this.generateId(ProvingRequestType.PARITY_BASE, inputs, epochNumber),
|
|
@@ -434,7 +435,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
434
435
|
getTxMergeRollupProof(
|
|
435
436
|
input: TxMergeRollupPrivateInputs,
|
|
436
437
|
signal?: AbortSignal,
|
|
437
|
-
epochNumber?:
|
|
438
|
+
epochNumber?: EpochNumber,
|
|
438
439
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
439
440
|
return this.enqueueJob(
|
|
440
441
|
this.generateId(ProvingRequestType.TX_MERGE_ROLLUP, input, epochNumber),
|
|
@@ -448,7 +449,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
448
449
|
getPublicChonkVerifierProof(
|
|
449
450
|
inputs: PublicChonkVerifierPrivateInputs,
|
|
450
451
|
signal?: AbortSignal,
|
|
451
|
-
epochNumber?:
|
|
452
|
+
epochNumber?: EpochNumber,
|
|
452
453
|
): Promise<
|
|
453
454
|
PublicInputsAndRecursiveProof<PublicChonkVerifierPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
454
455
|
> {
|
|
@@ -464,7 +465,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
464
465
|
getPrivateTxBaseRollupProof(
|
|
465
466
|
baseRollupInput: PrivateTxBaseRollupPrivateInputs,
|
|
466
467
|
signal?: AbortSignal,
|
|
467
|
-
epochNumber?:
|
|
468
|
+
epochNumber?: EpochNumber,
|
|
468
469
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
469
470
|
return this.enqueueJob(
|
|
470
471
|
this.generateId(ProvingRequestType.PRIVATE_TX_BASE_ROLLUP, baseRollupInput, epochNumber),
|
|
@@ -478,7 +479,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
478
479
|
getPublicTxBaseRollupProof(
|
|
479
480
|
inputs: PublicTxBaseRollupPrivateInputs,
|
|
480
481
|
signal?: AbortSignal,
|
|
481
|
-
epochNumber?:
|
|
482
|
+
epochNumber?: EpochNumber,
|
|
482
483
|
): Promise<PublicInputsAndRecursiveProof<TxRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
483
484
|
return this.enqueueJob(
|
|
484
485
|
this.generateId(ProvingRequestType.PUBLIC_TX_BASE_ROLLUP, inputs, epochNumber),
|
|
@@ -492,7 +493,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
492
493
|
getRootParityProof(
|
|
493
494
|
inputs: ParityRootPrivateInputs,
|
|
494
495
|
signal?: AbortSignal,
|
|
495
|
-
epochNumber?:
|
|
496
|
+
epochNumber?: EpochNumber,
|
|
496
497
|
): Promise<PublicInputsAndRecursiveProof<ParityPublicInputs, typeof NESTED_RECURSIVE_PROOF_LENGTH>> {
|
|
497
498
|
return this.enqueueJob(
|
|
498
499
|
this.generateId(ProvingRequestType.PARITY_ROOT, inputs, epochNumber),
|
|
@@ -506,7 +507,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
506
507
|
getBlockRootFirstRollupProof(
|
|
507
508
|
input: BlockRootFirstRollupPrivateInputs,
|
|
508
509
|
signal?: AbortSignal,
|
|
509
|
-
epochNumber?:
|
|
510
|
+
epochNumber?: EpochNumber,
|
|
510
511
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
511
512
|
return this.enqueueJob(
|
|
512
513
|
this.generateId(ProvingRequestType.BLOCK_ROOT_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -520,7 +521,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
520
521
|
getBlockRootSingleTxFirstRollupProof(
|
|
521
522
|
input: BlockRootSingleTxFirstRollupPrivateInputs,
|
|
522
523
|
signal?: AbortSignal,
|
|
523
|
-
epochNumber?:
|
|
524
|
+
epochNumber?: EpochNumber,
|
|
524
525
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
525
526
|
return this.enqueueJob(
|
|
526
527
|
this.generateId(ProvingRequestType.BLOCK_ROOT_SINGLE_TX_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -534,7 +535,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
534
535
|
getBlockRootEmptyTxFirstRollupProof(
|
|
535
536
|
input: BlockRootEmptyTxFirstRollupPrivateInputs,
|
|
536
537
|
signal?: AbortSignal,
|
|
537
|
-
epochNumber?:
|
|
538
|
+
epochNumber?: EpochNumber,
|
|
538
539
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
539
540
|
return this.enqueueJob(
|
|
540
541
|
this.generateId(ProvingRequestType.BLOCK_ROOT_EMPTY_TX_FIRST_ROLLUP, input, epochNumber),
|
|
@@ -548,7 +549,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
548
549
|
getBlockRootRollupProof(
|
|
549
550
|
input: BlockRootRollupPrivateInputs,
|
|
550
551
|
signal?: AbortSignal,
|
|
551
|
-
epochNumber?:
|
|
552
|
+
epochNumber?: EpochNumber,
|
|
552
553
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
553
554
|
return this.enqueueJob(
|
|
554
555
|
this.generateId(ProvingRequestType.BLOCK_ROOT_ROLLUP, input, epochNumber),
|
|
@@ -562,7 +563,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
562
563
|
getBlockRootSingleTxRollupProof(
|
|
563
564
|
input: BlockRootSingleTxRollupPrivateInputs,
|
|
564
565
|
signal?: AbortSignal,
|
|
565
|
-
epochNumber?:
|
|
566
|
+
epochNumber?: EpochNumber,
|
|
566
567
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
567
568
|
return this.enqueueJob(
|
|
568
569
|
this.generateId(ProvingRequestType.BLOCK_ROOT_SINGLE_TX_ROLLUP, input, epochNumber),
|
|
@@ -576,7 +577,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
576
577
|
getBlockMergeRollupProof(
|
|
577
578
|
input: BlockMergeRollupPrivateInputs,
|
|
578
579
|
signal?: AbortSignal,
|
|
579
|
-
epochNumber?:
|
|
580
|
+
epochNumber?: EpochNumber,
|
|
580
581
|
): Promise<PublicInputsAndRecursiveProof<BlockRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>> {
|
|
581
582
|
return this.enqueueJob(
|
|
582
583
|
this.generateId(ProvingRequestType.BLOCK_MERGE_ROLLUP, input, epochNumber),
|
|
@@ -590,7 +591,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
590
591
|
getCheckpointRootRollupProof(
|
|
591
592
|
input: CheckpointRootRollupPrivateInputs,
|
|
592
593
|
signal?: AbortSignal,
|
|
593
|
-
epochNumber?:
|
|
594
|
+
epochNumber?: EpochNumber,
|
|
594
595
|
): Promise<
|
|
595
596
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
596
597
|
> {
|
|
@@ -606,7 +607,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
606
607
|
getCheckpointRootSingleBlockRollupProof(
|
|
607
608
|
input: CheckpointRootSingleBlockRollupPrivateInputs,
|
|
608
609
|
signal?: AbortSignal,
|
|
609
|
-
epochNumber?:
|
|
610
|
+
epochNumber?: EpochNumber,
|
|
610
611
|
): Promise<
|
|
611
612
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
612
613
|
> {
|
|
@@ -622,7 +623,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
622
623
|
getCheckpointPaddingRollupProof(
|
|
623
624
|
input: CheckpointPaddingRollupPrivateInputs,
|
|
624
625
|
signal?: AbortSignal,
|
|
625
|
-
epochNumber?:
|
|
626
|
+
epochNumber?: EpochNumber,
|
|
626
627
|
): Promise<
|
|
627
628
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
628
629
|
> {
|
|
@@ -638,7 +639,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
638
639
|
getCheckpointMergeRollupProof(
|
|
639
640
|
input: CheckpointMergeRollupPrivateInputs,
|
|
640
641
|
signal?: AbortSignal,
|
|
641
|
-
epochNumber?:
|
|
642
|
+
epochNumber?: EpochNumber,
|
|
642
643
|
): Promise<
|
|
643
644
|
PublicInputsAndRecursiveProof<CheckpointRollupPublicInputs, typeof NESTED_RECURSIVE_ROLLUP_HONK_PROOF_LENGTH>
|
|
644
645
|
> {
|
|
@@ -654,7 +655,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
654
655
|
getRootRollupProof(
|
|
655
656
|
input: RootRollupPrivateInputs,
|
|
656
657
|
signal?: AbortSignal,
|
|
657
|
-
epochNumber?:
|
|
658
|
+
epochNumber?: EpochNumber,
|
|
658
659
|
): Promise<PublicInputsAndRecursiveProof<RootRollupPublicInputs, typeof RECURSIVE_PROOF_LENGTH>> {
|
|
659
660
|
return this.enqueueJob(
|
|
660
661
|
this.generateId(ProvingRequestType.ROOT_ROLLUP, input, epochNumber),
|
|
@@ -665,7 +666,7 @@ export class BrokerCircuitProverFacade implements ServerCircuitProver {
|
|
|
665
666
|
);
|
|
666
667
|
}
|
|
667
668
|
|
|
668
|
-
private generateId(type: ProvingRequestType, inputs: { toBuffer(): Buffer }, epochNumber =
|
|
669
|
+
private generateId(type: ProvingRequestType, inputs: { toBuffer(): Buffer }, epochNumber = EpochNumber.ZERO) {
|
|
669
670
|
const inputsHash = sha256(inputs.toBuffer());
|
|
670
671
|
return makeProvingJobId(epochNumber, type, inputsHash.toString('hex'));
|
|
671
672
|
}
|
|
@@ -98,6 +98,8 @@ export const ProverAgentConfig = z.object({
|
|
|
98
98
|
proverTestDelayMs: z.number(),
|
|
99
99
|
/** If using realistic delays, what percentage of realistic times to apply. */
|
|
100
100
|
proverTestDelayFactor: z.number(),
|
|
101
|
+
/** The delay (ms) to inject during fake proof verification */
|
|
102
|
+
proverTestVerificationDelayMs: z.number().optional(),
|
|
101
103
|
});
|
|
102
104
|
|
|
103
105
|
export type ProverAgentConfig = z.infer<typeof ProverAgentConfig>;
|
|
@@ -146,4 +148,9 @@ export const proverAgentConfigMappings: ConfigMappingsType<ProverAgentConfig> =
|
|
|
146
148
|
description: 'If using realistic delays, what percentage of realistic times to apply.',
|
|
147
149
|
...numberConfigHelper(1),
|
|
148
150
|
},
|
|
151
|
+
proverTestVerificationDelayMs: {
|
|
152
|
+
env: 'PROVER_TEST_VERIFICATION_DELAY_MS',
|
|
153
|
+
description: 'The delay (ms) to inject during fake proof verification',
|
|
154
|
+
...numberConfigHelper(10),
|
|
155
|
+
},
|
|
149
156
|
};
|