@aztec/prover-node 0.0.1-commit.c7c42ec → 0.0.1-commit.c80b6263
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/actions/download-epoch-proving-job.d.ts +1 -1
- package/dest/actions/rerun-epoch-proving-job.d.ts +3 -2
- package/dest/actions/rerun-epoch-proving-job.d.ts.map +1 -1
- package/dest/actions/rerun-epoch-proving-job.js +5 -3
- package/dest/factory.d.ts +1 -3
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +13 -12
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -0
- package/dest/job/epoch-proving-job.d.ts +3 -2
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +395 -18
- package/dest/metrics.d.ts +1 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +26 -100
- package/dest/monitors/epoch-monitor.d.ts +1 -1
- package/dest/monitors/epoch-monitor.d.ts.map +1 -1
- package/dest/monitors/epoch-monitor.js +1 -10
- package/dest/prover-node-publisher.d.ts +4 -3
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +9 -8
- package/dest/prover-node.d.ts +2 -2
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +400 -22
- package/dest/prover-publisher-factory.d.ts +4 -2
- package/dest/prover-publisher-factory.d.ts.map +1 -1
- package/dest/prover-publisher-factory.js +4 -2
- package/package.json +23 -23
- package/src/actions/rerun-epoch-proving-job.ts +5 -3
- package/src/factory.ts +22 -14
- package/src/index.ts +1 -0
- package/src/job/epoch-proving-job.ts +15 -7
- package/src/metrics.ts +20 -83
- package/src/monitors/epoch-monitor.ts +1 -8
- package/src/prover-node-publisher.ts +10 -7
- package/src/prover-node.ts +3 -1
- package/src/prover-publisher-factory.ts +11 -5
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
3
3
|
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
4
|
+
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
4
5
|
import type { PublisherConfig, TxSenderConfig } from '@aztec/sequencer-client';
|
|
5
6
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
6
7
|
import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
7
8
|
export declare class ProverPublisherFactory {
|
|
8
9
|
private config;
|
|
9
10
|
private deps;
|
|
11
|
+
private bindings?;
|
|
10
12
|
constructor(config: TxSenderConfig & PublisherConfig, deps: {
|
|
11
13
|
rollupContract: RollupContract;
|
|
12
14
|
publisherManager: PublisherManager<L1TxUtils>;
|
|
13
15
|
telemetry?: TelemetryClient;
|
|
14
|
-
});
|
|
16
|
+
}, bindings?: LoggerBindings | undefined);
|
|
15
17
|
start(): Promise<void>;
|
|
16
18
|
stop(): void;
|
|
17
19
|
/**
|
|
@@ -20,4 +22,4 @@ export declare class ProverPublisherFactory {
|
|
|
20
22
|
*/
|
|
21
23
|
create(): Promise<ProverNodePublisher>;
|
|
22
24
|
}
|
|
23
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmVyLXB1Ymxpc2hlci1mYWN0b3J5LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHJvdmVyLXB1Ymxpc2hlci1mYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDMUUsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDNUQsT0FBTyxLQUFLLEVBQUUsZUFBZSxFQUFFLGNBQWMsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBQy9FLE9BQU8sS0FBSyxFQUFFLGVBQWUsRUFBRSxNQUFNLHlCQUF5QixDQUFDO0FBRS9ELE9BQU8sRUFBRSxtQkFBbUIsRUFBRSxNQUFNLDRCQUE0QixDQUFDO0FBRWpFLHFCQUFhLHNCQUFzQjtJQUUvQixPQUFPLENBQUMsTUFBTTtJQUNkLE9BQU8sQ0FBQyxJQUFJO0lBS1osT0FBTyxDQUFDLFFBQVEsQ0FBQztJQVBuQixZQUNVLE1BQU0sRUFBRSxjQUFjLEdBQUcsZUFBZSxFQUN4QyxJQUFJLEVBQUU7UUFDWixjQUFjLEVBQUUsY0FBYyxDQUFDO1FBQy9CLGdCQUFnQixFQUFFLGdCQUFnQixDQUFDLFNBQVMsQ0FBQyxDQUFDO1FBQzlDLFNBQVMsQ0FBQyxFQUFFLGVBQWUsQ0FBQztLQUM3QixFQUNPLFFBQVEsQ0FBQyw0QkFBZ0IsRUFDL0I7SUFFUyxLQUFLLGtCQUVqQjtJQUVNLElBQUksU0FFVjtJQUVEOzs7T0FHRztJQUNVLE1BQU0sSUFBSSxPQUFPLENBQUMsbUJBQW1CLENBQUMsQ0FXbEQ7Q0FDRiJ9
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover-publisher-factory.d.ts","sourceRoot":"","sources":["../src/prover-publisher-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"prover-publisher-factory.d.ts","sourceRoot":"","sources":["../src/prover-publisher-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,qBAAa,sBAAsB;IAE/B,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,QAAQ,CAAC;IAPnB,YACU,MAAM,EAAE,cAAc,GAAG,eAAe,EACxC,IAAI,EAAE;QACZ,cAAc,EAAE,cAAc,CAAC;QAC/B,gBAAgB,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC9C,SAAS,CAAC,EAAE,eAAe,CAAC;KAC7B,EACO,QAAQ,CAAC,4BAAgB,EAC/B;IAES,KAAK,kBAEjB;IAEM,IAAI,SAEV;IAED;;;OAGG;IACU,MAAM,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAWlD;CACF"}
|
|
@@ -2,9 +2,11 @@ import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
|
2
2
|
export class ProverPublisherFactory {
|
|
3
3
|
config;
|
|
4
4
|
deps;
|
|
5
|
-
|
|
5
|
+
bindings;
|
|
6
|
+
constructor(config, deps, bindings){
|
|
6
7
|
this.config = config;
|
|
7
8
|
this.deps = deps;
|
|
9
|
+
this.bindings = bindings;
|
|
8
10
|
}
|
|
9
11
|
async start() {
|
|
10
12
|
await this.deps.publisherManager.loadState();
|
|
@@ -21,6 +23,6 @@ export class ProverPublisherFactory {
|
|
|
21
23
|
rollupContract: this.deps.rollupContract,
|
|
22
24
|
l1TxUtils: l1Publisher,
|
|
23
25
|
telemetry: this.deps.telemetry
|
|
24
|
-
});
|
|
26
|
+
}, this.bindings);
|
|
25
27
|
}
|
|
26
28
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-node",
|
|
3
|
-
"version": "0.0.1-commit.
|
|
3
|
+
"version": "0.0.1-commit.c80b6263",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -56,27 +56,27 @@
|
|
|
56
56
|
]
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@aztec/archiver": "0.0.1-commit.
|
|
60
|
-
"@aztec/bb-prover": "0.0.1-commit.
|
|
61
|
-
"@aztec/blob-client": "0.0.1-commit.
|
|
62
|
-
"@aztec/blob-lib": "0.0.1-commit.
|
|
63
|
-
"@aztec/constants": "0.0.1-commit.
|
|
64
|
-
"@aztec/epoch-cache": "0.0.1-commit.
|
|
65
|
-
"@aztec/ethereum": "0.0.1-commit.
|
|
66
|
-
"@aztec/foundation": "0.0.1-commit.
|
|
67
|
-
"@aztec/kv-store": "0.0.1-commit.
|
|
68
|
-
"@aztec/l1-artifacts": "0.0.1-commit.
|
|
69
|
-
"@aztec/node-keystore": "0.0.1-commit.
|
|
70
|
-
"@aztec/node-lib": "0.0.1-commit.
|
|
71
|
-
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.
|
|
72
|
-
"@aztec/p2p": "0.0.1-commit.
|
|
73
|
-
"@aztec/protocol-contracts": "0.0.1-commit.
|
|
74
|
-
"@aztec/prover-client": "0.0.1-commit.
|
|
75
|
-
"@aztec/sequencer-client": "0.0.1-commit.
|
|
76
|
-
"@aztec/simulator": "0.0.1-commit.
|
|
77
|
-
"@aztec/stdlib": "0.0.1-commit.
|
|
78
|
-
"@aztec/telemetry-client": "0.0.1-commit.
|
|
79
|
-
"@aztec/world-state": "0.0.1-commit.
|
|
59
|
+
"@aztec/archiver": "0.0.1-commit.c80b6263",
|
|
60
|
+
"@aztec/bb-prover": "0.0.1-commit.c80b6263",
|
|
61
|
+
"@aztec/blob-client": "0.0.1-commit.c80b6263",
|
|
62
|
+
"@aztec/blob-lib": "0.0.1-commit.c80b6263",
|
|
63
|
+
"@aztec/constants": "0.0.1-commit.c80b6263",
|
|
64
|
+
"@aztec/epoch-cache": "0.0.1-commit.c80b6263",
|
|
65
|
+
"@aztec/ethereum": "0.0.1-commit.c80b6263",
|
|
66
|
+
"@aztec/foundation": "0.0.1-commit.c80b6263",
|
|
67
|
+
"@aztec/kv-store": "0.0.1-commit.c80b6263",
|
|
68
|
+
"@aztec/l1-artifacts": "0.0.1-commit.c80b6263",
|
|
69
|
+
"@aztec/node-keystore": "0.0.1-commit.c80b6263",
|
|
70
|
+
"@aztec/node-lib": "0.0.1-commit.c80b6263",
|
|
71
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.c80b6263",
|
|
72
|
+
"@aztec/p2p": "0.0.1-commit.c80b6263",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.c80b6263",
|
|
74
|
+
"@aztec/prover-client": "0.0.1-commit.c80b6263",
|
|
75
|
+
"@aztec/sequencer-client": "0.0.1-commit.c80b6263",
|
|
76
|
+
"@aztec/simulator": "0.0.1-commit.c80b6263",
|
|
77
|
+
"@aztec/stdlib": "0.0.1-commit.c80b6263",
|
|
78
|
+
"@aztec/telemetry-client": "0.0.1-commit.c80b6263",
|
|
79
|
+
"@aztec/world-state": "0.0.1-commit.c80b6263",
|
|
80
80
|
"source-map-support": "^0.5.21",
|
|
81
81
|
"tslib": "^2.4.0",
|
|
82
82
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"@types/jest": "^30.0.0",
|
|
87
87
|
"@types/node": "^22.15.17",
|
|
88
88
|
"@types/source-map-support": "^0.5.10",
|
|
89
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
89
|
+
"@typescript/native-preview": "7.0.0-dev.20260113.1",
|
|
90
90
|
"jest": "^30.0.0",
|
|
91
91
|
"jest-mock-extended": "^4.0.0",
|
|
92
92
|
"ts-node": "^10.9.1",
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createArchiverStore } from '@aztec/archiver';
|
|
2
|
+
import type { L1ContractsConfig } from '@aztec/ethereum/config';
|
|
2
3
|
import type { Logger } from '@aztec/foundation/log';
|
|
3
4
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
4
5
|
import { type ProverClientConfig, createProverClient } from '@aztec/prover-client';
|
|
@@ -21,7 +22,7 @@ import { ProverNodeJobMetrics } from '../metrics.js';
|
|
|
21
22
|
export async function rerunEpochProvingJob(
|
|
22
23
|
localPath: string,
|
|
23
24
|
log: Logger,
|
|
24
|
-
config: DataStoreConfig & ProverBrokerConfig & ProverClientConfig,
|
|
25
|
+
config: DataStoreConfig & ProverBrokerConfig & ProverClientConfig & Pick<L1ContractsConfig, 'aztecEpochDuration'>,
|
|
25
26
|
) {
|
|
26
27
|
const jobData = deserializeEpochProvingJobData(readFileSync(localPath));
|
|
27
28
|
log.info(`Loaded proving job data for epoch ${jobData.epochNumber}`);
|
|
@@ -29,8 +30,8 @@ export async function rerunEpochProvingJob(
|
|
|
29
30
|
const telemetry = getTelemetryClient();
|
|
30
31
|
const metrics = new ProverNodeJobMetrics(telemetry.getMeter('prover-job'), telemetry.getTracer('prover-job'));
|
|
31
32
|
const worldState = await createWorldState(config);
|
|
32
|
-
const archiver = await createArchiverStore(config);
|
|
33
|
-
const publicProcessorFactory = new PublicProcessorFactory(archiver);
|
|
33
|
+
const archiver = await createArchiverStore(config, { epochDuration: config.aztecEpochDuration });
|
|
34
|
+
const publicProcessorFactory = new PublicProcessorFactory(archiver, undefined, undefined, log.getBindings());
|
|
34
35
|
|
|
35
36
|
const publisher = { submitEpochProof: () => Promise.resolve(true) };
|
|
36
37
|
const l2BlockSourceForReorgDetection = undefined;
|
|
@@ -52,6 +53,7 @@ export async function rerunEpochProvingJob(
|
|
|
52
53
|
metrics,
|
|
53
54
|
deadline,
|
|
54
55
|
{ skipEpochCheck: true },
|
|
56
|
+
log.getBindings(),
|
|
55
57
|
);
|
|
56
58
|
|
|
57
59
|
log.info(`Rerunning epoch proving job for epoch ${jobData.epochNumber}`);
|
package/src/factory.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
2
2
|
import { BBCircuitVerifier, QueuedIVCVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
3
|
-
import {
|
|
3
|
+
import { createBlobClientWithFileStores } from '@aztec/blob-client/client';
|
|
4
4
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
5
5
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
6
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
@@ -12,7 +12,10 @@ import { DateProvider } from '@aztec/foundation/timer';
|
|
|
12
12
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
13
13
|
import { type KeyStoreConfig, KeystoreManager, loadKeystores, mergeKeystores } from '@aztec/node-keystore';
|
|
14
14
|
import { trySnapshotSync } from '@aztec/node-lib/actions';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
createForwarderL1TxUtilsFromEthSigner,
|
|
17
|
+
createL1TxUtilsFromEthSignerWithStore,
|
|
18
|
+
} from '@aztec/node-lib/factories';
|
|
16
19
|
import { NodeRpcTxSource, createP2PClient } from '@aztec/p2p';
|
|
17
20
|
import { type ProverClientConfig, createProverClient } from '@aztec/prover-client';
|
|
18
21
|
import { createAndStartProvingBroker } from '@aztec/prover-client/broker';
|
|
@@ -36,7 +39,6 @@ export type ProverNodeDeps = {
|
|
|
36
39
|
aztecNodeTxProvider?: Pick<AztecNode, 'getTxsByHash'>;
|
|
37
40
|
archiver?: Archiver;
|
|
38
41
|
publisherFactory?: ProverPublisherFactory;
|
|
39
|
-
blobClient?: BlobClientInterface;
|
|
40
42
|
broker?: ProvingJobBroker;
|
|
41
43
|
l1TxUtils?: L1TxUtils;
|
|
42
44
|
dateProvider?: DateProvider;
|
|
@@ -53,8 +55,7 @@ export async function createProverNode(
|
|
|
53
55
|
const config = { ...userConfig };
|
|
54
56
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
55
57
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
56
|
-
const blobClient =
|
|
57
|
-
deps.blobClient ?? createBlobClient(config, { logger: createLogger('prover-node:blob-client:client') });
|
|
58
|
+
const blobClient = await createBlobClientWithFileStores(config, createLogger('prover-node:blob-client:client'));
|
|
58
59
|
const log = deps.log ?? createLogger('prover-node');
|
|
59
60
|
|
|
60
61
|
// Build a key store from file if given or from environment otherwise
|
|
@@ -108,9 +109,8 @@ export async function createProverNode(
|
|
|
108
109
|
(await createArchiver(config, { blobClient, epochCache, telemetry, dateProvider }, { blockUntilSync: true }));
|
|
109
110
|
log.verbose(`Created archiver and synced to block ${await archiver.getBlockNumber()}`);
|
|
110
111
|
|
|
111
|
-
const worldStateConfig = { ...config, worldStateProvenBlocksOnly: false };
|
|
112
112
|
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
113
|
-
|
|
113
|
+
config,
|
|
114
114
|
archiver,
|
|
115
115
|
options.prefilledPublicData,
|
|
116
116
|
telemetry,
|
|
@@ -134,18 +134,26 @@ export async function createProverNode(
|
|
|
134
134
|
|
|
135
135
|
const l1TxUtils = deps.l1TxUtils
|
|
136
136
|
? [deps.l1TxUtils]
|
|
137
|
-
:
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
: config.publisherForwarderAddress
|
|
138
|
+
? await createForwarderL1TxUtilsFromEthSigner(
|
|
139
|
+
publicClient,
|
|
140
|
+
proverSigners.signers,
|
|
141
|
+
config.publisherForwarderAddress,
|
|
142
|
+
{ ...config, scope: 'prover' },
|
|
143
|
+
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider },
|
|
144
|
+
)
|
|
145
|
+
: await createL1TxUtilsFromEthSignerWithStore(
|
|
146
|
+
publicClient,
|
|
147
|
+
proverSigners.signers,
|
|
148
|
+
{ ...config, scope: 'prover' },
|
|
149
|
+
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider },
|
|
150
|
+
);
|
|
143
151
|
|
|
144
152
|
const publisherFactory =
|
|
145
153
|
deps.publisherFactory ??
|
|
146
154
|
new ProverPublisherFactory(config, {
|
|
147
155
|
rollupContract,
|
|
148
|
-
publisherManager: new PublisherManager(l1TxUtils, config),
|
|
156
|
+
publisherManager: new PublisherManager(l1TxUtils, config, log.getBindings()),
|
|
149
157
|
telemetry,
|
|
150
158
|
});
|
|
151
159
|
|
package/src/index.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { asyncPool } from '@aztec/foundation/async-pool';
|
|
|
3
3
|
import { BlockNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
4
4
|
import { padArrayEnd } from '@aztec/foundation/collection';
|
|
5
5
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
6
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
6
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
7
7
|
import { RunningPromise, promiseWithResolvers } from '@aztec/foundation/promise';
|
|
8
8
|
import { Timer } from '@aztec/foundation/timer';
|
|
9
9
|
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
@@ -11,7 +11,7 @@ import { protocolContractsHash } from '@aztec/protocol-contracts';
|
|
|
11
11
|
import { buildFinalBlobChallenges } from '@aztec/prover-client/helpers';
|
|
12
12
|
import type { PublicProcessor, PublicProcessorFactory } from '@aztec/simulator/server';
|
|
13
13
|
import { PublicSimulatorConfig } from '@aztec/stdlib/avm';
|
|
14
|
-
import type {
|
|
14
|
+
import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
|
|
15
15
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
16
16
|
import {
|
|
17
17
|
type EpochProver,
|
|
@@ -43,7 +43,7 @@ export type EpochProvingJobOptions = {
|
|
|
43
43
|
*/
|
|
44
44
|
export class EpochProvingJob implements Traceable {
|
|
45
45
|
private state: EpochProvingJobState = 'initialized';
|
|
46
|
-
private log
|
|
46
|
+
private log: Logger;
|
|
47
47
|
private uuid: string;
|
|
48
48
|
|
|
49
49
|
private runPromise: Promise<void> | undefined;
|
|
@@ -62,9 +62,14 @@ export class EpochProvingJob implements Traceable {
|
|
|
62
62
|
private metrics: ProverNodeJobMetrics,
|
|
63
63
|
private deadline: Date | undefined,
|
|
64
64
|
private config: EpochProvingJobOptions,
|
|
65
|
+
bindings?: LoggerBindings,
|
|
65
66
|
) {
|
|
66
67
|
validateEpochProvingJobData(data);
|
|
67
68
|
this.uuid = crypto.randomUUID();
|
|
69
|
+
this.log = createLogger('prover-node:epoch-proving-job', {
|
|
70
|
+
...bindings,
|
|
71
|
+
instanceId: `epoch-${data.epochNumber}`,
|
|
72
|
+
});
|
|
68
73
|
this.tracer = metrics.tracer;
|
|
69
74
|
}
|
|
70
75
|
|
|
@@ -362,11 +367,14 @@ export class EpochProvingJob implements Traceable {
|
|
|
362
367
|
const intervalMs = Math.ceil((await l2BlockSource.getL1Constants()).ethereumSlotDuration / 2) * 1000;
|
|
363
368
|
this.epochCheckPromise = new RunningPromise(
|
|
364
369
|
async () => {
|
|
365
|
-
const
|
|
366
|
-
const blockHashes = await Promise.all(
|
|
370
|
+
const blockHeaders = await l2BlockSource.getCheckpointedBlockHeadersForEpoch(this.epochNumber);
|
|
371
|
+
const blockHashes = await Promise.all(blockHeaders.map(async header => (await header.hash()).toField()));
|
|
367
372
|
const thisBlocks = this.checkpoints.flatMap(checkpoint => checkpoint.blocks);
|
|
368
373
|
const thisBlockHashes = await Promise.all(thisBlocks.map(block => block.hash()));
|
|
369
|
-
if (
|
|
374
|
+
if (
|
|
375
|
+
blockHeaders.length !== thisBlocks.length ||
|
|
376
|
+
!blockHashes.every((block, i) => block.equals(thisBlockHashes[i]))
|
|
377
|
+
) {
|
|
370
378
|
this.log.warn('Epoch blocks changed underfoot', {
|
|
371
379
|
uuid: this.uuid,
|
|
372
380
|
epochNumber: this.epochNumber,
|
|
@@ -388,7 +396,7 @@ export class EpochProvingJob implements Traceable {
|
|
|
388
396
|
return [this.data.previousBlockHeader, ...lastBlocks.map(block => block.header).slice(0, -1)];
|
|
389
397
|
}
|
|
390
398
|
|
|
391
|
-
private getTxs(block:
|
|
399
|
+
private getTxs(block: L2Block): Tx[] {
|
|
392
400
|
return block.body.txEffects.map(txEffect => this.txs.get(txEffect.txHash.toString())!);
|
|
393
401
|
}
|
|
394
402
|
|
package/src/metrics.ts
CHANGED
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
type TelemetryClient,
|
|
14
14
|
type Tracer,
|
|
15
15
|
type UpDownCounter,
|
|
16
|
-
|
|
16
|
+
createUpDownCounterWithDefault,
|
|
17
17
|
} from '@aztec/telemetry-client';
|
|
18
18
|
|
|
19
19
|
import { formatEther, formatUnits } from 'viem';
|
|
@@ -30,28 +30,11 @@ export class ProverNodeJobMetrics {
|
|
|
30
30
|
public readonly tracer: Tracer,
|
|
31
31
|
private logger = createLogger('prover-node:publisher:metrics'),
|
|
32
32
|
) {
|
|
33
|
-
this.proverEpochExecutionDuration = this.meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
this.provingJobDuration = this.meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
|
|
39
|
-
description: 'Duration of proving job',
|
|
40
|
-
unit: 's',
|
|
41
|
-
valueType: ValueType.DOUBLE,
|
|
42
|
-
});
|
|
43
|
-
this.provingJobCheckpoints = this.meter.createGauge(Metrics.PROVER_NODE_JOB_CHECKPOINTS, {
|
|
44
|
-
description: 'Number of checkpoints in a proven epoch',
|
|
45
|
-
valueType: ValueType.INT,
|
|
46
|
-
});
|
|
47
|
-
this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS, {
|
|
48
|
-
description: 'Number of blocks in a proven epoch',
|
|
49
|
-
valueType: ValueType.INT,
|
|
50
|
-
});
|
|
51
|
-
this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS, {
|
|
52
|
-
description: 'Number of transactions in a proven epoch',
|
|
53
|
-
valueType: ValueType.INT,
|
|
54
|
-
});
|
|
33
|
+
this.proverEpochExecutionDuration = this.meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION);
|
|
34
|
+
this.provingJobDuration = this.meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION);
|
|
35
|
+
this.provingJobCheckpoints = this.meter.createGauge(Metrics.PROVER_NODE_JOB_CHECKPOINTS);
|
|
36
|
+
this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS);
|
|
37
|
+
this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS);
|
|
55
38
|
}
|
|
56
39
|
|
|
57
40
|
public recordProvingJob(
|
|
@@ -81,15 +64,9 @@ export class ProverNodeRewardsMetrics {
|
|
|
81
64
|
private rollup: RollupContract,
|
|
82
65
|
private logger = createLogger('prover-node:publisher:metrics'),
|
|
83
66
|
) {
|
|
84
|
-
this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH
|
|
85
|
-
valueType: ValueType.DOUBLE,
|
|
86
|
-
description: 'The rewards earned',
|
|
87
|
-
});
|
|
67
|
+
this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH);
|
|
88
68
|
|
|
89
|
-
this.accumulatedRewards = this.meter
|
|
90
|
-
valueType: ValueType.DOUBLE,
|
|
91
|
-
description: 'The rewards earned (total)',
|
|
92
|
-
});
|
|
69
|
+
this.accumulatedRewards = createUpDownCounterWithDefault(this.meter, Metrics.PROVER_NODE_REWARDS_TOTAL);
|
|
93
70
|
}
|
|
94
71
|
|
|
95
72
|
public async start() {
|
|
@@ -150,68 +127,28 @@ export class ProverNodePublisherMetrics {
|
|
|
150
127
|
) {
|
|
151
128
|
this.meter = client.getMeter(name);
|
|
152
129
|
|
|
153
|
-
this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE
|
|
154
|
-
description: 'The gas price used for transactions',
|
|
155
|
-
unit: 'gwei',
|
|
156
|
-
valueType: ValueType.DOUBLE,
|
|
157
|
-
});
|
|
130
|
+
this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE);
|
|
158
131
|
|
|
159
|
-
this.txCount = this.meter
|
|
160
|
-
|
|
132
|
+
this.txCount = createUpDownCounterWithDefault(this.meter, Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
133
|
+
[Attributes.L1_TX_TYPE]: ['submitProof'],
|
|
134
|
+
[Attributes.OK]: [true, false],
|
|
161
135
|
});
|
|
162
136
|
|
|
163
|
-
this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION
|
|
164
|
-
description: 'The duration of transaction processing',
|
|
165
|
-
unit: 'ms',
|
|
166
|
-
valueType: ValueType.INT,
|
|
167
|
-
});
|
|
137
|
+
this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION);
|
|
168
138
|
|
|
169
|
-
this.txGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS
|
|
170
|
-
description: 'The gas consumed by transactions',
|
|
171
|
-
unit: 'gas',
|
|
172
|
-
valueType: ValueType.INT,
|
|
173
|
-
});
|
|
139
|
+
this.txGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS);
|
|
174
140
|
|
|
175
|
-
this.txCalldataSize = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE
|
|
176
|
-
description: 'The size of the calldata in transactions',
|
|
177
|
-
unit: 'By',
|
|
178
|
-
valueType: ValueType.INT,
|
|
179
|
-
});
|
|
141
|
+
this.txCalldataSize = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE);
|
|
180
142
|
|
|
181
|
-
this.txCalldataGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS
|
|
182
|
-
description: 'The gas consumed by the calldata in transactions',
|
|
183
|
-
unit: 'gas',
|
|
184
|
-
valueType: ValueType.INT,
|
|
185
|
-
});
|
|
143
|
+
this.txCalldataGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS);
|
|
186
144
|
|
|
187
|
-
this.txBlobDataGasUsed = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED
|
|
188
|
-
description: 'The amount of blob gas used in transactions',
|
|
189
|
-
unit: 'gas',
|
|
190
|
-
valueType: ValueType.INT,
|
|
191
|
-
});
|
|
145
|
+
this.txBlobDataGasUsed = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED);
|
|
192
146
|
|
|
193
|
-
this.txBlobDataGasCost = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST
|
|
194
|
-
description: 'The gas cost of blobs in transactions',
|
|
195
|
-
unit: 'gwei',
|
|
196
|
-
valueType: ValueType.INT,
|
|
197
|
-
});
|
|
147
|
+
this.txBlobDataGasCost = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST);
|
|
198
148
|
|
|
199
|
-
this.txTotalFee = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE
|
|
200
|
-
description: 'How much L1 tx costs',
|
|
201
|
-
unit: 'gwei',
|
|
202
|
-
valueType: ValueType.DOUBLE,
|
|
203
|
-
advice: {
|
|
204
|
-
explicitBucketBoundaries: [
|
|
205
|
-
0.001, 0.002, 0.004, 0.008, 0.01, 0.02, 0.04, 0.08, 0.1, 0.2, 0.4, 0.8, 1, 1.2, 1.4, 1.8, 2,
|
|
206
|
-
],
|
|
207
|
-
},
|
|
208
|
-
});
|
|
149
|
+
this.txTotalFee = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE);
|
|
209
150
|
|
|
210
|
-
this.senderBalance = this.meter.createGauge(Metrics.L1_PUBLISHER_BALANCE
|
|
211
|
-
unit: 'eth',
|
|
212
|
-
description: 'The balance of the sender address',
|
|
213
|
-
valueType: ValueType.DOUBLE,
|
|
214
|
-
});
|
|
151
|
+
this.senderBalance = this.meter.createGauge(Metrics.L1_PUBLISHER_BALANCE);
|
|
215
152
|
}
|
|
216
153
|
|
|
217
154
|
recordFailedTx() {
|
|
@@ -4,13 +4,7 @@ import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
|
4
4
|
import { sleep } from '@aztec/foundation/sleep';
|
|
5
5
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
6
6
|
import { type L1RollupConstants, getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
7
|
-
import {
|
|
8
|
-
type TelemetryClient,
|
|
9
|
-
type Traceable,
|
|
10
|
-
type Tracer,
|
|
11
|
-
getTelemetryClient,
|
|
12
|
-
trackSpan,
|
|
13
|
-
} from '@aztec/telemetry-client';
|
|
7
|
+
import { type TelemetryClient, type Traceable, type Tracer, getTelemetryClient } from '@aztec/telemetry-client';
|
|
14
8
|
|
|
15
9
|
export interface EpochMonitorHandler {
|
|
16
10
|
handleEpochReadyToProve(epochNumber: EpochNumber): Promise<boolean>;
|
|
@@ -73,7 +67,6 @@ export class EpochMonitor implements Traceable {
|
|
|
73
67
|
this.log.info('Stopped EpochMonitor');
|
|
74
68
|
}
|
|
75
69
|
|
|
76
|
-
@trackSpan('EpochMonitor.work')
|
|
77
70
|
public async work() {
|
|
78
71
|
const { epochToProve, blockNumber, slotNumber } = await this.getEpochNumberToProve();
|
|
79
72
|
this.log.debug(`Epoch to prove: ${epochToProve}`, { blockNumber, slotNumber });
|
|
@@ -7,7 +7,7 @@ import { CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
|
7
7
|
import { areArraysEqual } from '@aztec/foundation/collection';
|
|
8
8
|
import { Fr } from '@aztec/foundation/curves/bn254';
|
|
9
9
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
10
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
10
|
+
import { type Logger, type LoggerBindings, createLogger } from '@aztec/foundation/log';
|
|
11
11
|
import type { Tuple } from '@aztec/foundation/serialize';
|
|
12
12
|
import { Timer } from '@aztec/foundation/timer';
|
|
13
13
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
@@ -39,7 +39,7 @@ export class ProverNodePublisher {
|
|
|
39
39
|
private interrupted = false;
|
|
40
40
|
private metrics: ProverNodePublisherMetrics;
|
|
41
41
|
|
|
42
|
-
protected log
|
|
42
|
+
protected log: Logger;
|
|
43
43
|
|
|
44
44
|
protected rollupContract: RollupContract;
|
|
45
45
|
|
|
@@ -52,10 +52,12 @@ export class ProverNodePublisher {
|
|
|
52
52
|
l1TxUtils: L1TxUtils;
|
|
53
53
|
telemetry?: TelemetryClient;
|
|
54
54
|
},
|
|
55
|
+
bindings?: LoggerBindings,
|
|
55
56
|
) {
|
|
56
57
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
57
58
|
|
|
58
59
|
this.metrics = new ProverNodePublisherMetrics(telemetry, 'ProverNode');
|
|
60
|
+
this.log = createLogger('prover-node:l1-tx-publisher', bindings);
|
|
59
61
|
|
|
60
62
|
this.rollupContract = deps.rollupContract;
|
|
61
63
|
this.l1TxUtils = deps.l1TxUtils;
|
|
@@ -172,17 +174,17 @@ export class ProverNodePublisher {
|
|
|
172
174
|
|
|
173
175
|
// Check the archive for the immediate checkpoint before the epoch
|
|
174
176
|
const checkpointLog = await this.rollupContract.getCheckpoint(CheckpointNumber(fromCheckpoint - 1));
|
|
175
|
-
if (publicInputs.previousArchiveRoot.
|
|
177
|
+
if (!publicInputs.previousArchiveRoot.equals(checkpointLog.archive)) {
|
|
176
178
|
throw new Error(
|
|
177
|
-
`Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive}`,
|
|
179
|
+
`Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive.toString()}`,
|
|
178
180
|
);
|
|
179
181
|
}
|
|
180
182
|
|
|
181
183
|
// Check the archive for the last checkpoint in the epoch
|
|
182
184
|
const endCheckpointLog = await this.rollupContract.getCheckpoint(toCheckpoint);
|
|
183
|
-
if (publicInputs.endArchiveRoot.
|
|
185
|
+
if (!publicInputs.endArchiveRoot.equals(endCheckpointLog.archive)) {
|
|
184
186
|
throw new Error(
|
|
185
|
-
`End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive}`,
|
|
187
|
+
`End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive.toString()}`,
|
|
186
188
|
);
|
|
187
189
|
}
|
|
188
190
|
|
|
@@ -200,7 +202,7 @@ export class ProverNodePublisher {
|
|
|
200
202
|
);
|
|
201
203
|
const argsPublicInputs = [...publicInputs.toFields()];
|
|
202
204
|
|
|
203
|
-
if (!areArraysEqual(rollupPublicInputs
|
|
205
|
+
if (!areArraysEqual(rollupPublicInputs, argsPublicInputs, (a, b) => a.equals(b))) {
|
|
204
206
|
const fmt = (inputs: Fr[] | readonly string[]) => inputs.map(x => x.toString()).join(', ');
|
|
205
207
|
throw new Error(
|
|
206
208
|
`Root rollup public inputs mismatch:\nRollup: ${fmt(rollupPublicInputs)}\nComputed:${fmt(argsPublicInputs)}`,
|
|
@@ -266,6 +268,7 @@ export class ProverNodePublisher {
|
|
|
266
268
|
{
|
|
267
269
|
previousArchive: args.publicInputs.previousArchiveRoot.toString(),
|
|
268
270
|
endArchive: args.publicInputs.endArchiveRoot.toString(),
|
|
271
|
+
outHash: args.publicInputs.outHash.toString(),
|
|
269
272
|
proverId: EthAddress.fromField(args.publicInputs.constants.proverId).toString(),
|
|
270
273
|
} /*_args*/,
|
|
271
274
|
makeTuple(AZTEC_MAX_EPOCH_DURATION * 2, i =>
|
package/src/prover-node.ts
CHANGED
|
@@ -288,6 +288,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
288
288
|
this.contractDataSource,
|
|
289
289
|
this.dateProvider,
|
|
290
290
|
this.telemetryClient,
|
|
291
|
+
this.log.getBindings(),
|
|
291
292
|
);
|
|
292
293
|
|
|
293
294
|
// Set deadline for this job to run. It will abort if it takes too long.
|
|
@@ -311,7 +312,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
311
312
|
const l1ToL2Messages = await this.gatherMessages(epochNumber, checkpoints);
|
|
312
313
|
const [firstBlock] = checkpoints[0].blocks;
|
|
313
314
|
const previousBlockHeader = await this.gatherPreviousBlockHeader(epochNumber, firstBlock.number - 1);
|
|
314
|
-
const [lastPublishedCheckpoint] = await this.l2BlockSource.
|
|
315
|
+
const [lastPublishedCheckpoint] = await this.l2BlockSource.getCheckpoints(checkpoints.at(-1)!.number, 1);
|
|
315
316
|
const attestations = lastPublishedCheckpoint?.attestations ?? [];
|
|
316
317
|
|
|
317
318
|
return { checkpoints, txs, l1ToL2Messages, epochNumber, previousBlockHeader, attestations };
|
|
@@ -384,6 +385,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
384
385
|
this.jobMetrics,
|
|
385
386
|
deadline,
|
|
386
387
|
{ parallelBlockLimit, skipSubmitProof: proverNodeDisableProofPublish, ...opts },
|
|
388
|
+
this.log.getBindings(),
|
|
387
389
|
);
|
|
388
390
|
}
|
|
389
391
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
2
2
|
import type { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
3
3
|
import type { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
4
|
+
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
4
5
|
import type { PublisherConfig, TxSenderConfig } from '@aztec/sequencer-client';
|
|
5
6
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
6
7
|
|
|
@@ -14,6 +15,7 @@ export class ProverPublisherFactory {
|
|
|
14
15
|
publisherManager: PublisherManager<L1TxUtils>;
|
|
15
16
|
telemetry?: TelemetryClient;
|
|
16
17
|
},
|
|
18
|
+
private bindings?: LoggerBindings,
|
|
17
19
|
) {}
|
|
18
20
|
|
|
19
21
|
public async start() {
|
|
@@ -30,10 +32,14 @@ export class ProverPublisherFactory {
|
|
|
30
32
|
*/
|
|
31
33
|
public async create(): Promise<ProverNodePublisher> {
|
|
32
34
|
const l1Publisher = await this.deps.publisherManager.getAvailablePublisher();
|
|
33
|
-
return new ProverNodePublisher(
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
return new ProverNodePublisher(
|
|
36
|
+
this.config,
|
|
37
|
+
{
|
|
38
|
+
rollupContract: this.deps.rollupContract,
|
|
39
|
+
l1TxUtils: l1Publisher,
|
|
40
|
+
telemetry: this.deps.telemetry,
|
|
41
|
+
},
|
|
42
|
+
this.bindings,
|
|
43
|
+
);
|
|
38
44
|
}
|
|
39
45
|
}
|