@aztec/prover-client 0.66.0 → 0.67.0
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_builder/light.d.ts.map +1 -1
- package/dest/block_builder/light.js +12 -8
- package/dest/mocks/fixtures.d.ts +3 -3
- package/dest/mocks/fixtures.d.ts.map +1 -1
- package/dest/mocks/fixtures.js +2 -2
- package/dest/mocks/test_context.d.ts +7 -7
- package/dest/mocks/test_context.d.ts.map +1 -1
- package/dest/mocks/test_context.js +6 -6
- package/dest/orchestrator/block-building-helpers.d.ts +5 -5
- package/dest/orchestrator/block-building-helpers.d.ts.map +1 -1
- package/dest/orchestrator/block-building-helpers.js +10 -11
- package/dest/orchestrator/orchestrator.d.ts +2 -2
- package/dest/orchestrator/orchestrator.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator.js +3 -3
- package/dest/orchestrator/orchestrator_metrics.d.ts.map +1 -1
- package/dest/orchestrator/orchestrator_metrics.js +2 -5
- package/dest/prover-agent/memory-proving-queue.d.ts.map +1 -1
- package/dest/prover-agent/memory-proving-queue.js +5 -4
- package/dest/prover-agent/prover-agent.d.ts.map +1 -1
- package/dest/prover-agent/prover-agent.js +3 -3
- package/dest/prover-client/prover-client.js +3 -3
- package/dest/proving_broker/caching_broker_facade.d.ts +12 -12
- package/dest/proving_broker/caching_broker_facade.d.ts.map +1 -1
- package/dest/proving_broker/caching_broker_facade.js +32 -29
- package/dest/proving_broker/proving_agent.d.ts.map +1 -1
- package/dest/proving_broker/proving_agent.js +3 -3
- package/dest/proving_broker/proving_broker.d.ts +24 -5
- package/dest/proving_broker/proving_broker.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker.js +112 -44
- package/dest/proving_broker/proving_broker_database/persisted.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_database/persisted.js +4 -8
- package/dest/proving_broker/proving_broker_instrumentation.d.ts.map +1 -1
- package/dest/proving_broker/proving_broker_instrumentation.js +2 -8
- package/dest/proving_broker/rpc.d.ts.map +1 -1
- package/dest/proving_broker/rpc.js +3 -2
- package/dest/test/mock_prover.d.ts +3 -2
- package/dest/test/mock_prover.d.ts.map +1 -1
- package/dest/test/mock_prover.js +6 -3
- package/package.json +15 -11
- package/src/block_builder/light.ts +12 -9
- package/src/mocks/fixtures.ts +4 -4
- package/src/mocks/test_context.ts +11 -11
- package/src/orchestrator/block-building-helpers.ts +13 -14
- package/src/orchestrator/orchestrator.ts +5 -5
- package/src/orchestrator/orchestrator_metrics.ts +1 -11
- package/src/prover-agent/memory-proving-queue.ts +4 -3
- package/src/prover-agent/prover-agent.ts +2 -2
- package/src/prover-client/prover-client.ts +2 -2
- package/src/proving_broker/caching_broker_facade.ts +31 -15
- package/src/proving_broker/proving_agent.ts +2 -2
- package/src/proving_broker/proving_broker.ts +140 -51
- package/src/proving_broker/proving_broker_database/persisted.ts +2 -8
- package/src/proving_broker/proving_broker_instrumentation.ts +0 -7
- package/src/proving_broker/rpc.ts +2 -1
- package/src/test/mock_prover.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.67.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -63,19 +63,23 @@
|
|
|
63
63
|
"summaryThreshold": 9999
|
|
64
64
|
}
|
|
65
65
|
]
|
|
66
|
+
],
|
|
67
|
+
"testTimeout": 30000,
|
|
68
|
+
"setupFiles": [
|
|
69
|
+
"../../foundation/src/jest/setup.mjs"
|
|
66
70
|
]
|
|
67
71
|
},
|
|
68
72
|
"dependencies": {
|
|
69
|
-
"@aztec/bb-prover": "0.
|
|
70
|
-
"@aztec/circuit-types": "0.
|
|
71
|
-
"@aztec/circuits.js": "0.
|
|
72
|
-
"@aztec/foundation": "0.
|
|
73
|
-
"@aztec/kv-store": "0.
|
|
74
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
75
|
-
"@aztec/protocol-contracts": "0.
|
|
76
|
-
"@aztec/simulator": "0.
|
|
77
|
-
"@aztec/telemetry-client": "0.
|
|
78
|
-
"@aztec/world-state": "0.
|
|
73
|
+
"@aztec/bb-prover": "0.67.0",
|
|
74
|
+
"@aztec/circuit-types": "0.67.0",
|
|
75
|
+
"@aztec/circuits.js": "0.67.0",
|
|
76
|
+
"@aztec/foundation": "0.67.0",
|
|
77
|
+
"@aztec/kv-store": "0.67.0",
|
|
78
|
+
"@aztec/noir-protocol-circuits-types": "0.67.0",
|
|
79
|
+
"@aztec/protocol-contracts": "0.67.0",
|
|
80
|
+
"@aztec/simulator": "0.67.0",
|
|
81
|
+
"@aztec/telemetry-client": "0.67.0",
|
|
82
|
+
"@aztec/world-state": "0.67.0",
|
|
79
83
|
"@noir-lang/types": "portal:../../noir/packages/types",
|
|
80
84
|
"commander": "^12.1.0",
|
|
81
85
|
"lodash.chunk": "^4.2.0",
|
|
@@ -8,14 +8,12 @@ import {
|
|
|
8
8
|
} from '@aztec/circuit-types';
|
|
9
9
|
import { Fr, type GlobalVariables, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP } from '@aztec/circuits.js';
|
|
10
10
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
11
|
-
import {
|
|
11
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
12
12
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types';
|
|
13
13
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
14
14
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
15
15
|
import { NoopTelemetryClient } from '@aztec/telemetry-client/noop';
|
|
16
16
|
|
|
17
|
-
import { inspect } from 'util';
|
|
18
|
-
|
|
19
17
|
import {
|
|
20
18
|
buildBaseRollupHints,
|
|
21
19
|
buildHeaderAndBodyFromTxs,
|
|
@@ -32,12 +30,12 @@ export class LightweightBlockBuilder implements BlockBuilder {
|
|
|
32
30
|
|
|
33
31
|
private readonly txs: ProcessedTx[] = [];
|
|
34
32
|
|
|
35
|
-
private readonly logger =
|
|
33
|
+
private readonly logger = createLogger('prover-client:block_builder');
|
|
36
34
|
|
|
37
35
|
constructor(private db: MerkleTreeWriteOperations, private telemetry: TelemetryClient) {}
|
|
38
36
|
|
|
39
37
|
async startNewBlock(numTxs: number, globalVariables: GlobalVariables, l1ToL2Messages: Fr[]): Promise<void> {
|
|
40
|
-
this.logger.
|
|
38
|
+
this.logger.debug('Starting new block', { numTxs, globalVariables: globalVariables.toInspect(), l1ToL2Messages });
|
|
41
39
|
this.numTxs = numTxs;
|
|
42
40
|
this.globalVariables = globalVariables;
|
|
43
41
|
this.l1ToL2Messages = padArrayEnd(l1ToL2Messages, Fr.ZERO, NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP);
|
|
@@ -47,14 +45,15 @@ export class LightweightBlockBuilder implements BlockBuilder {
|
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
async addNewTx(tx: ProcessedTx): Promise<void> {
|
|
50
|
-
this.logger.
|
|
48
|
+
this.logger.debug(tx.hash.isZero() ? 'Adding padding tx to block' : 'Adding new tx to block', {
|
|
49
|
+
txHash: tx.hash.toString(),
|
|
50
|
+
});
|
|
51
51
|
this.txs.push(tx);
|
|
52
52
|
await buildBaseRollupHints(tx, this.globalVariables!, this.db);
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
async setBlockCompleted(): Promise<L2Block> {
|
|
56
56
|
const paddingTxCount = this.numTxs! - this.txs.length;
|
|
57
|
-
this.logger.verbose(`Setting block as completed and adding ${paddingTxCount} padding txs`);
|
|
58
57
|
for (let i = 0; i < paddingTxCount; i++) {
|
|
59
58
|
await this.addNewTx(
|
|
60
59
|
makeEmptyProcessedTx(
|
|
@@ -71,8 +70,6 @@ export class LightweightBlockBuilder implements BlockBuilder {
|
|
|
71
70
|
}
|
|
72
71
|
|
|
73
72
|
private async buildBlock(): Promise<L2Block> {
|
|
74
|
-
this.logger.verbose(`Finalising block`);
|
|
75
|
-
|
|
76
73
|
const { header, body } = await buildHeaderAndBodyFromTxs(
|
|
77
74
|
this.txs,
|
|
78
75
|
this.globalVariables!,
|
|
@@ -84,6 +81,12 @@ export class LightweightBlockBuilder implements BlockBuilder {
|
|
|
84
81
|
const newArchive = await getTreeSnapshot(MerkleTreeId.ARCHIVE, this.db);
|
|
85
82
|
|
|
86
83
|
const block = new L2Block(newArchive, header, body);
|
|
84
|
+
this.logger.debug(`Built block ${block.number}`, {
|
|
85
|
+
globalVariables: this.globalVariables?.toInspect(),
|
|
86
|
+
archiveRoot: newArchive.root.toString(),
|
|
87
|
+
blockHash: block.hash.toString(),
|
|
88
|
+
});
|
|
89
|
+
|
|
87
90
|
return block;
|
|
88
91
|
}
|
|
89
92
|
}
|
package/src/mocks/fixtures.ts
CHANGED
|
@@ -11,11 +11,11 @@ import {
|
|
|
11
11
|
} from '@aztec/circuits.js';
|
|
12
12
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
13
13
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
14
|
-
import { type
|
|
14
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
15
15
|
import { fileURLToPath } from '@aztec/foundation/url';
|
|
16
16
|
import { NativeACVMSimulator, type SimulationProvider, WASMSimulator } from '@aztec/simulator';
|
|
17
17
|
|
|
18
|
-
import
|
|
18
|
+
import { promises as fs } from 'fs';
|
|
19
19
|
import path from 'path';
|
|
20
20
|
|
|
21
21
|
const {
|
|
@@ -30,7 +30,7 @@ const {
|
|
|
30
30
|
} = process.env;
|
|
31
31
|
|
|
32
32
|
// Determines if we have access to the bb binary and a tmp folder for temp files
|
|
33
|
-
export const getEnvironmentConfig = async (logger:
|
|
33
|
+
export const getEnvironmentConfig = async (logger: Logger) => {
|
|
34
34
|
try {
|
|
35
35
|
const expectedBBPath = BB_BINARY_PATH
|
|
36
36
|
? BB_BINARY_PATH
|
|
@@ -68,7 +68,7 @@ export const getEnvironmentConfig = async (logger: DebugLogger) => {
|
|
|
68
68
|
|
|
69
69
|
export async function getSimulationProvider(
|
|
70
70
|
config: { acvmWorkingDirectory: string | undefined; acvmBinaryPath: string | undefined },
|
|
71
|
-
logger?:
|
|
71
|
+
logger?: Logger,
|
|
72
72
|
): Promise<SimulationProvider> {
|
|
73
73
|
if (config.acvmBinaryPath && config.acvmWorkingDirectory) {
|
|
74
74
|
try {
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
type TxValidator,
|
|
10
10
|
} from '@aztec/circuit-types';
|
|
11
11
|
import { makeBloatedProcessedTx } from '@aztec/circuit-types/test';
|
|
12
|
-
import { type AppendOnlyTreeSnapshot, type Gas, type GlobalVariables
|
|
12
|
+
import { type AppendOnlyTreeSnapshot, BlockHeader, type Gas, type GlobalVariables } from '@aztec/circuits.js';
|
|
13
13
|
import { times } from '@aztec/foundation/collection';
|
|
14
14
|
import { Fr } from '@aztec/foundation/fields';
|
|
15
|
-
import { type
|
|
15
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
16
16
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types';
|
|
17
17
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
18
18
|
import {
|
|
@@ -27,7 +27,7 @@ import { type MerkleTreeAdminDatabase } from '@aztec/world-state';
|
|
|
27
27
|
import { NativeWorldStateService } from '@aztec/world-state/native';
|
|
28
28
|
|
|
29
29
|
import { jest } from '@jest/globals';
|
|
30
|
-
import
|
|
30
|
+
import { promises as fs } from 'fs';
|
|
31
31
|
import { mock } from 'jest-mock-extended';
|
|
32
32
|
|
|
33
33
|
import { TestCircuitProver } from '../../../bb-prover/src/test/test_circuit_prover.js';
|
|
@@ -40,7 +40,7 @@ import { ProverAgent } from '../prover-agent/prover-agent.js';
|
|
|
40
40
|
import { getEnvironmentConfig, getSimulationProvider, makeGlobals } from './fixtures.js';
|
|
41
41
|
|
|
42
42
|
export class TestContext {
|
|
43
|
-
private headers: Map<number,
|
|
43
|
+
private headers: Map<number, BlockHeader> = new Map();
|
|
44
44
|
|
|
45
45
|
constructor(
|
|
46
46
|
public publicTxSimulator: PublicTxSimulator,
|
|
@@ -53,7 +53,7 @@ export class TestContext {
|
|
|
53
53
|
public orchestrator: TestProvingOrchestrator,
|
|
54
54
|
public blockNumber: number,
|
|
55
55
|
public directoriesToCleanup: string[],
|
|
56
|
-
public logger:
|
|
56
|
+
public logger: Logger,
|
|
57
57
|
) {}
|
|
58
58
|
|
|
59
59
|
public get epochProver() {
|
|
@@ -61,7 +61,7 @@ export class TestContext {
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
static async new(
|
|
64
|
-
logger:
|
|
64
|
+
logger: Logger,
|
|
65
65
|
proverCount = 4,
|
|
66
66
|
createProver: (bbConfig: BBProverConfig) => Promise<ServerCircuitProver> = _ =>
|
|
67
67
|
Promise.resolve(new TestCircuitProver(new NoopTelemetryClient(), new WASMSimulator())),
|
|
@@ -83,7 +83,7 @@ export class TestContext {
|
|
|
83
83
|
const processor = new PublicProcessor(
|
|
84
84
|
publicDb,
|
|
85
85
|
globalVariables,
|
|
86
|
-
|
|
86
|
+
BlockHeader.empty(),
|
|
87
87
|
worldStateDB,
|
|
88
88
|
publicTxSimulator,
|
|
89
89
|
telemetry,
|
|
@@ -138,9 +138,9 @@ export class TestContext {
|
|
|
138
138
|
return this.worldState.fork();
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
public
|
|
142
|
-
public
|
|
143
|
-
public
|
|
141
|
+
public getBlockHeader(blockNumber: 0): BlockHeader;
|
|
142
|
+
public getBlockHeader(blockNumber: number): BlockHeader | undefined;
|
|
143
|
+
public getBlockHeader(blockNumber = 0) {
|
|
144
144
|
return blockNumber === 0 ? this.worldState.getCommitted().getInitialHeader() : this.headers.get(blockNumber);
|
|
145
145
|
}
|
|
146
146
|
|
|
@@ -156,7 +156,7 @@ export class TestContext {
|
|
|
156
156
|
public makeProcessedTx(seedOrOpts?: Parameters<typeof makeBloatedProcessedTx>[0] | number): ProcessedTx {
|
|
157
157
|
const opts = typeof seedOrOpts === 'number' ? { seed: seedOrOpts } : seedOrOpts;
|
|
158
158
|
const blockNum = (opts?.globalVariables ?? this.globalVariables).blockNumber.toNumber();
|
|
159
|
-
const header = this.
|
|
159
|
+
const header = this.getBlockHeader(blockNum - 1);
|
|
160
160
|
return makeBloatedProcessedTx({
|
|
161
161
|
header,
|
|
162
162
|
vkTreeRoot: getVKTreeRoot(),
|
|
@@ -10,13 +10,13 @@ import {
|
|
|
10
10
|
ARCHIVE_HEIGHT,
|
|
11
11
|
AppendOnlyTreeSnapshot,
|
|
12
12
|
type BaseOrMergeRollupPublicInputs,
|
|
13
|
+
BlockHeader,
|
|
13
14
|
BlockMergeRollupInputs,
|
|
14
15
|
type BlockRootOrBlockMergePublicInputs,
|
|
15
16
|
ConstantRollupData,
|
|
16
17
|
ContentCommitment,
|
|
17
18
|
Fr,
|
|
18
19
|
type GlobalVariables,
|
|
19
|
-
Header,
|
|
20
20
|
MAX_NOTE_HASHES_PER_TX,
|
|
21
21
|
MAX_NULLIFIERS_PER_TX,
|
|
22
22
|
MAX_TOTAL_PUBLIC_DATA_UPDATE_REQUESTS_PER_TX,
|
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
import { makeTuple } from '@aztec/foundation/array';
|
|
53
53
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
54
54
|
import { sha256Trunc } from '@aztec/foundation/crypto';
|
|
55
|
-
import { type
|
|
55
|
+
import { type Logger } from '@aztec/foundation/log';
|
|
56
56
|
import { type Tuple, assertLength, toFriendlyJSON } from '@aztec/foundation/serialize';
|
|
57
57
|
import { computeUnbalancedMerkleRoot } from '@aztec/foundation/trees';
|
|
58
58
|
import { getVKIndex, getVKSiblingPath, getVKTreeRoot } from '@aztec/noir-protocol-circuits-types';
|
|
@@ -95,13 +95,6 @@ export async function buildBaseRollupHints(
|
|
|
95
95
|
i < noteHashSubtreeSiblingPathArray.length ? noteHashSubtreeSiblingPathArray[i] : Fr.ZERO,
|
|
96
96
|
);
|
|
97
97
|
|
|
98
|
-
// Create data hint for reading fee payer initial balance in Fee Juice
|
|
99
|
-
// If no fee payer is set, read hint should be empty
|
|
100
|
-
const leafSlot = computeFeePayerBalanceLeafSlot(tx.data.feePayer);
|
|
101
|
-
const feePayerFeeJuiceBalanceReadHint = tx.data.feePayer.isZero()
|
|
102
|
-
? PublicDataHint.empty()
|
|
103
|
-
: await getPublicDataHint(db, leafSlot.toBigInt());
|
|
104
|
-
|
|
105
98
|
// Update the note hash trees with the new items being inserted to get the new roots
|
|
106
99
|
// that will be used by the next iteration of the base rollup circuit, skipping the empty ones
|
|
107
100
|
const noteHashes = padArrayEnd(tx.txEffect.noteHashes, Fr.ZERO, MAX_NOTE_HASHES_PER_TX);
|
|
@@ -184,7 +177,6 @@ export async function buildBaseRollupHints(
|
|
|
184
177
|
return PublicBaseRollupHints.from({
|
|
185
178
|
start,
|
|
186
179
|
stateDiffHints,
|
|
187
|
-
feePayerFeeJuiceBalanceReadHint: feePayerFeeJuiceBalanceReadHint,
|
|
188
180
|
archiveRootMembershipWitness,
|
|
189
181
|
constants,
|
|
190
182
|
});
|
|
@@ -197,6 +189,13 @@ export async function buildBaseRollupHints(
|
|
|
197
189
|
throw new Error(`More than one public data write in a private only tx`);
|
|
198
190
|
}
|
|
199
191
|
|
|
192
|
+
// Create data hint for reading fee payer initial balance in Fee Juice
|
|
193
|
+
// If no fee payer is set, read hint should be empty
|
|
194
|
+
const leafSlot = computeFeePayerBalanceLeafSlot(tx.data.feePayer);
|
|
195
|
+
const feePayerFeeJuiceBalanceReadHint = tx.data.feePayer.isZero()
|
|
196
|
+
? PublicDataHint.empty()
|
|
197
|
+
: await getPublicDataHint(db, leafSlot.toBigInt());
|
|
198
|
+
|
|
200
199
|
const feeWriteLowLeafPreimage =
|
|
201
200
|
txPublicDataUpdateRequestInfo.lowPublicDataWritesPreimages[0] || PublicDataTreeLeafPreimage.empty();
|
|
202
201
|
const feeWriteLowLeafMembershipWitness =
|
|
@@ -299,7 +298,7 @@ export function buildHeaderFromCircuitOutputs(
|
|
|
299
298
|
parityPublicInputs: ParityPublicInputs,
|
|
300
299
|
rootRollupOutputs: BlockRootOrBlockMergePublicInputs,
|
|
301
300
|
updatedL1ToL2TreeSnapshot: AppendOnlyTreeSnapshot,
|
|
302
|
-
logger?:
|
|
301
|
+
logger?: Logger,
|
|
303
302
|
) {
|
|
304
303
|
const contentCommitment = new ContentCommitment(
|
|
305
304
|
new Fr(previousMergeData[0].numTxs + previousMergeData[1].numTxs),
|
|
@@ -310,7 +309,7 @@ export function buildHeaderFromCircuitOutputs(
|
|
|
310
309
|
sha256Trunc(Buffer.concat([previousMergeData[0].outHash.toBuffer(), previousMergeData[1].outHash.toBuffer()])),
|
|
311
310
|
);
|
|
312
311
|
const state = new StateReference(updatedL1ToL2TreeSnapshot, previousMergeData[1].end);
|
|
313
|
-
const header = new
|
|
312
|
+
const header = new BlockHeader(
|
|
314
313
|
rootRollupOutputs.previousArchive,
|
|
315
314
|
contentCommitment,
|
|
316
315
|
state,
|
|
@@ -371,7 +370,7 @@ export async function buildHeaderAndBodyFromTxs(
|
|
|
371
370
|
const fees = body.txEffects.reduce((acc, tx) => acc.add(tx.transactionFee), Fr.ZERO);
|
|
372
371
|
const manaUsed = txs.reduce((acc, tx) => acc.add(new Fr(tx.gasUsed.totalGas.l2Gas)), Fr.ZERO);
|
|
373
372
|
|
|
374
|
-
const header = new
|
|
373
|
+
const header = new BlockHeader(previousArchive, contentCommitment, stateReference, globalVariables, fees, manaUsed);
|
|
375
374
|
|
|
376
375
|
return { header, body };
|
|
377
376
|
}
|
|
@@ -379,7 +378,7 @@ export async function buildHeaderAndBodyFromTxs(
|
|
|
379
378
|
// Validate that the roots of all local trees match the output of the root circuit simulation
|
|
380
379
|
export async function validateBlockRootOutput(
|
|
381
380
|
blockRootOutput: BlockRootOrBlockMergePublicInputs,
|
|
382
|
-
blockHeader:
|
|
381
|
+
blockHeader: BlockHeader,
|
|
383
382
|
db: MerkleTreeReadOperations,
|
|
384
383
|
) {
|
|
385
384
|
await Promise.all([
|
|
@@ -19,12 +19,12 @@ import {
|
|
|
19
19
|
type BaseOrMergeRollupPublicInputs,
|
|
20
20
|
BaseParityInputs,
|
|
21
21
|
type BaseRollupHints,
|
|
22
|
+
type BlockHeader,
|
|
22
23
|
type BlockRootOrBlockMergePublicInputs,
|
|
23
24
|
BlockRootRollupInputs,
|
|
24
25
|
EmptyBlockRootRollupInputs,
|
|
25
26
|
Fr,
|
|
26
27
|
type GlobalVariables,
|
|
27
|
-
type Header,
|
|
28
28
|
L1_TO_L2_MSG_SUBTREE_HEIGHT,
|
|
29
29
|
L1_TO_L2_MSG_SUBTREE_SIBLING_PATH_LENGTH,
|
|
30
30
|
type NESTED_RECURSIVE_PROOF_LENGTH,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
import { makeTuple } from '@aztec/foundation/array';
|
|
43
43
|
import { maxBy, padArrayEnd } from '@aztec/foundation/collection';
|
|
44
44
|
import { AbortError } from '@aztec/foundation/error';
|
|
45
|
-
import {
|
|
45
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
46
46
|
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
47
47
|
import { type Tuple } from '@aztec/foundation/serialize';
|
|
48
48
|
import { pushTestData } from '@aztec/foundation/testing';
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
import { ProvingOrchestratorMetrics } from './orchestrator_metrics.js';
|
|
78
78
|
import { TxProvingState } from './tx-proving-state.js';
|
|
79
79
|
|
|
80
|
-
const logger =
|
|
80
|
+
const logger = createLogger('prover-client:orchestrator');
|
|
81
81
|
|
|
82
82
|
/**
|
|
83
83
|
* Implements an event driven proving scheduler to build the recursive proof tree. The idea being:
|
|
@@ -279,7 +279,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
279
279
|
@trackSpan('ProvingOrchestrator.setBlockCompleted', (blockNumber: number) => ({
|
|
280
280
|
[Attributes.BLOCK_NUMBER]: blockNumber,
|
|
281
281
|
}))
|
|
282
|
-
public async setBlockCompleted(blockNumber: number, expectedHeader?:
|
|
282
|
+
public async setBlockCompleted(blockNumber: number, expectedHeader?: BlockHeader): Promise<L2Block> {
|
|
283
283
|
const provingState = this.provingState?.getBlockProvingStateByBlockNumber(blockNumber);
|
|
284
284
|
if (!provingState) {
|
|
285
285
|
throw new Error(`Block proving state for ${blockNumber} not found`);
|
|
@@ -407,7 +407,7 @@ export class ProvingOrchestrator implements EpochProver {
|
|
|
407
407
|
return Promise.resolve();
|
|
408
408
|
}
|
|
409
409
|
|
|
410
|
-
private async buildBlock(provingState: BlockProvingState, expectedHeader?:
|
|
410
|
+
private async buildBlock(provingState: BlockProvingState, expectedHeader?: BlockHeader) {
|
|
411
411
|
// Collect all new nullifiers, commitments, and contracts from all txs in this block to build body
|
|
412
412
|
const txs = provingState!.allTxs.map(a => a.processedTx);
|
|
413
413
|
|
|
@@ -1,11 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type Histogram,
|
|
3
|
-
Metrics,
|
|
4
|
-
type TelemetryClient,
|
|
5
|
-
type Tracer,
|
|
6
|
-
ValueType,
|
|
7
|
-
millisecondBuckets,
|
|
8
|
-
} from '@aztec/telemetry-client';
|
|
1
|
+
import { type Histogram, Metrics, type TelemetryClient, type Tracer, ValueType } from '@aztec/telemetry-client';
|
|
9
2
|
|
|
10
3
|
export class ProvingOrchestratorMetrics {
|
|
11
4
|
public readonly tracer: Tracer;
|
|
@@ -20,9 +13,6 @@ export class ProvingOrchestratorMetrics {
|
|
|
20
13
|
unit: 'ms',
|
|
21
14
|
description: 'Duration to build base rollup inputs',
|
|
22
15
|
valueType: ValueType.INT,
|
|
23
|
-
advice: {
|
|
24
|
-
explicitBucketBoundaries: millisecondBuckets(1), // 10ms -> ~327s
|
|
25
|
-
},
|
|
26
16
|
});
|
|
27
17
|
}
|
|
28
18
|
|
|
@@ -32,7 +32,7 @@ import type {
|
|
|
32
32
|
} from '@aztec/circuits.js';
|
|
33
33
|
import { randomBytes } from '@aztec/foundation/crypto';
|
|
34
34
|
import { AbortError, TimeoutError } from '@aztec/foundation/error';
|
|
35
|
-
import {
|
|
35
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
36
36
|
import { type PromiseWithResolvers, RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
37
37
|
import { PriorityMemoryQueue } from '@aztec/foundation/queue';
|
|
38
38
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
@@ -57,7 +57,7 @@ const defaultTimeSource = () => Date.now();
|
|
|
57
57
|
* The queue accumulates jobs and provides them to agents prioritized by block number.
|
|
58
58
|
*/
|
|
59
59
|
export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource {
|
|
60
|
-
private log =
|
|
60
|
+
private log = createLogger('prover-client:prover-pool:queue');
|
|
61
61
|
private queue = new PriorityMemoryQueue<ProvingJobWithResolvers>(
|
|
62
62
|
(a, b) => (a.epochNumber ?? 0) - (b.epochNumber ?? 0),
|
|
63
63
|
);
|
|
@@ -120,6 +120,7 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
120
120
|
id: job.id,
|
|
121
121
|
type: job.type,
|
|
122
122
|
inputsUri: job.inputsUri,
|
|
123
|
+
epochNumber: job.epochNumber,
|
|
123
124
|
};
|
|
124
125
|
} catch (err) {
|
|
125
126
|
if (err instanceof TimeoutError) {
|
|
@@ -244,7 +245,7 @@ export class MemoryProvingQueue implements ServerCircuitProver, ProvingJobSource
|
|
|
244
245
|
reject,
|
|
245
246
|
attempts: 1,
|
|
246
247
|
heartbeat: 0,
|
|
247
|
-
epochNumber,
|
|
248
|
+
epochNumber: epochNumber ?? 0,
|
|
248
249
|
};
|
|
249
250
|
|
|
250
251
|
if (signal) {
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
type ServerCircuitProver,
|
|
9
9
|
makeProvingRequestResult,
|
|
10
10
|
} from '@aztec/circuit-types';
|
|
11
|
-
import {
|
|
11
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
12
12
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
13
13
|
import { elapsed } from '@aztec/foundation/timer';
|
|
14
14
|
|
|
@@ -38,7 +38,7 @@ export class ProverAgent implements ProverAgentApi {
|
|
|
38
38
|
private maxConcurrency = 1,
|
|
39
39
|
/** How long to wait between jobs */
|
|
40
40
|
private pollIntervalMs = 100,
|
|
41
|
-
private log =
|
|
41
|
+
private log = createLogger('prover-client:prover-agent'),
|
|
42
42
|
) {}
|
|
43
43
|
|
|
44
44
|
setMaxConcurrency(maxConcurrency: number): Promise<void> {
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from '@aztec/circuit-types/interfaces';
|
|
13
13
|
import { Fr } from '@aztec/circuits.js';
|
|
14
14
|
import { times } from '@aztec/foundation/collection';
|
|
15
|
-
import {
|
|
15
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
16
16
|
import { NativeACVMSimulator } from '@aztec/simulator';
|
|
17
17
|
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
18
18
|
|
|
@@ -38,7 +38,7 @@ export class ProverClient implements EpochProverManager {
|
|
|
38
38
|
private telemetry: TelemetryClient,
|
|
39
39
|
private orchestratorClient: ProvingJobProducer,
|
|
40
40
|
private agentClient?: ProvingJobConsumer,
|
|
41
|
-
private log =
|
|
41
|
+
private log = createLogger('prover-client:tx-prover'),
|
|
42
42
|
) {
|
|
43
43
|
// TODO(palla/prover-node): Cache the paddingTx here, and not in each proving orchestrator,
|
|
44
44
|
// so it can be reused across multiple ones and not recomputed every time.
|