@aztec/prover-node 0.0.1-commit.f2ce05ee → 0.0.1-commit.f504929
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/bin/run-failed-epoch.js +5 -2
- package/dest/config.d.ts +4 -7
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +14 -17
- package/dest/factory.d.ts +19 -13
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +15 -55
- package/dest/job/epoch-proving-job.d.ts +1 -1
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +21 -10
- package/dest/prover-node.d.ts +18 -8
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +9 -6
- package/dest/prover-publisher-factory.d.ts +3 -3
- package/dest/prover-publisher-factory.d.ts.map +1 -1
- package/package.json +22 -22
- package/src/bin/run-failed-epoch.ts +4 -1
- package/src/config.ts +21 -29
- package/src/factory.ts +48 -100
- package/src/job/epoch-proving-job.ts +30 -16
- package/src/prover-node.ts +11 -7
- package/src/prover-publisher-factory.ts +2 -2
|
@@ -2,14 +2,14 @@ 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
4
|
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ProverPublisherConfig, ProverTxSenderConfig } from '@aztec/sequencer-client';
|
|
6
6
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
7
7
|
import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
8
8
|
export declare class ProverPublisherFactory {
|
|
9
9
|
private config;
|
|
10
10
|
private deps;
|
|
11
11
|
private bindings?;
|
|
12
|
-
constructor(config:
|
|
12
|
+
constructor(config: ProverTxSenderConfig & ProverPublisherConfig, deps: {
|
|
13
13
|
rollupContract: RollupContract;
|
|
14
14
|
publisherManager: PublisherManager<L1TxUtils>;
|
|
15
15
|
telemetry?: TelemetryClient;
|
|
@@ -22,4 +22,4 @@ export declare class ProverPublisherFactory {
|
|
|
22
22
|
*/
|
|
23
23
|
create(): Promise<ProverNodePublisher>;
|
|
24
24
|
}
|
|
25
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicHJvdmVyLXB1Ymxpc2hlci1mYWN0b3J5LmQudHMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcHJvdmVyLXB1Ymxpc2hlci1mYWN0b3J5LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLE9BQU8sS0FBSyxFQUFFLGNBQWMsRUFBRSxNQUFNLDJCQUEyQixDQUFDO0FBQ2hFLE9BQU8sS0FBSyxFQUFFLFNBQVMsRUFBRSxNQUFNLDZCQUE2QixDQUFDO0FBQzdELE9BQU8sS0FBSyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sbUNBQW1DLENBQUM7QUFDMUUsT0FBTyxLQUFLLEVBQUUsY0FBYyxFQUFFLE1BQU0sdUJBQXVCLENBQUM7QUFDNUQsT0FBTyxLQUFLLEVBQUUscUJBQXFCLEVBQUUsb0JBQW9CLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUMzRixPQUFPLEtBQUssRUFBRSxlQUFlLEVBQUUsTUFBTSx5QkFBeUIsQ0FBQztBQUUvRCxPQUFPLEVBQUUsbUJBQW1CLEVBQUUsTUFBTSw0QkFBNEIsQ0FBQztBQUVqRSxxQkFBYSxzQkFBc0I7SUFFL0IsT0FBTyxDQUFDLE1BQU07SUFDZCxPQUFPLENBQUMsSUFBSTtJQUtaLE9BQU8sQ0FBQyxRQUFRLENBQUM7SUFQbkIsWUFDVSxNQUFNLEVBQUUsb0JBQW9CLEdBQUcscUJBQXFCLEVBQ3BELElBQUksRUFBRTtRQUNaLGNBQWMsRUFBRSxjQUFjLENBQUM7UUFDL0IsZ0JBQWdCLEVBQUUsZ0JBQWdCLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDOUMsU0FBUyxDQUFDLEVBQUUsZUFBZSxDQUFDO0tBQzdCLEVBQ08sUUFBUSxDQUFDLDRCQUFnQixFQUMvQjtJQUVTLEtBQUssa0JBRWpCO0lBRU0sSUFBSSxTQUVWO0lBRUQ7OztPQUdHO0lBQ1UsTUFBTSxJQUFJLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQVdsRDtDQUNGIn0=
|
|
@@ -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,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,
|
|
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,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC3F,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,oBAAoB,GAAG,qBAAqB,EACpD,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"}
|
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.f504929",
|
|
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.f504929",
|
|
60
|
+
"@aztec/bb-prover": "0.0.1-commit.f504929",
|
|
61
|
+
"@aztec/blob-client": "0.0.1-commit.f504929",
|
|
62
|
+
"@aztec/blob-lib": "0.0.1-commit.f504929",
|
|
63
|
+
"@aztec/constants": "0.0.1-commit.f504929",
|
|
64
|
+
"@aztec/epoch-cache": "0.0.1-commit.f504929",
|
|
65
|
+
"@aztec/ethereum": "0.0.1-commit.f504929",
|
|
66
|
+
"@aztec/foundation": "0.0.1-commit.f504929",
|
|
67
|
+
"@aztec/kv-store": "0.0.1-commit.f504929",
|
|
68
|
+
"@aztec/l1-artifacts": "0.0.1-commit.f504929",
|
|
69
|
+
"@aztec/node-keystore": "0.0.1-commit.f504929",
|
|
70
|
+
"@aztec/node-lib": "0.0.1-commit.f504929",
|
|
71
|
+
"@aztec/noir-protocol-circuits-types": "0.0.1-commit.f504929",
|
|
72
|
+
"@aztec/p2p": "0.0.1-commit.f504929",
|
|
73
|
+
"@aztec/protocol-contracts": "0.0.1-commit.f504929",
|
|
74
|
+
"@aztec/prover-client": "0.0.1-commit.f504929",
|
|
75
|
+
"@aztec/sequencer-client": "0.0.1-commit.f504929",
|
|
76
|
+
"@aztec/simulator": "0.0.1-commit.f504929",
|
|
77
|
+
"@aztec/stdlib": "0.0.1-commit.f504929",
|
|
78
|
+
"@aztec/telemetry-client": "0.0.1-commit.f504929",
|
|
79
|
+
"@aztec/world-state": "0.0.1-commit.f504929",
|
|
80
80
|
"source-map-support": "^0.5.21",
|
|
81
81
|
"tslib": "^2.4.0",
|
|
82
82
|
"viem": "npm:@aztec/viem@2.38.2"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
|
+
import { getL1ContractsConfigEnvVars } from '@aztec/ethereum/config';
|
|
2
3
|
import type { L1ContractAddresses } from '@aztec/ethereum/l1-contract-addresses';
|
|
3
4
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
5
|
import { jsonParseWithSchema, jsonStringify } from '@aztec/foundation/json-rpc';
|
|
@@ -22,8 +23,10 @@ async function rerunFailedEpoch(provingJobUrl: string, baseLocalDir: string) {
|
|
|
22
23
|
const dataDir = join(localDir, 'state');
|
|
23
24
|
|
|
24
25
|
const env = getProverNodeConfigFromEnv();
|
|
26
|
+
const l1Config = getL1ContractsConfigEnvVars();
|
|
25
27
|
const config = {
|
|
26
|
-
...
|
|
28
|
+
...env,
|
|
29
|
+
...l1Config,
|
|
27
30
|
dataDirectory: dataDir,
|
|
28
31
|
dataStoreMapSizeKb: env.dataStoreMapSizeKb ?? 1024 * 1024,
|
|
29
32
|
proverId: env.proverId ?? EthAddress.random(),
|
package/src/config.ts
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
|
|
2
1
|
import type { ACVMConfig, BBConfig } from '@aztec/bb-prover/config';
|
|
3
|
-
import { type GenesisStateConfig, genesisStateConfigMappings } from '@aztec/ethereum/config';
|
|
4
2
|
import {
|
|
5
3
|
type ConfigMappingsType,
|
|
6
4
|
booleanConfigHelper,
|
|
7
5
|
getConfigFromMappings,
|
|
8
6
|
numberConfigHelper,
|
|
7
|
+
pickConfigMappings,
|
|
9
8
|
} from '@aztec/foundation/config';
|
|
10
9
|
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
11
10
|
import { type KeyStoreConfig, keyStoreConfigMappings } from '@aztec/node-keystore/config';
|
|
12
11
|
import { ethPrivateKeySchema } from '@aztec/node-keystore/schemas';
|
|
13
12
|
import type { KeyStore } from '@aztec/node-keystore/types';
|
|
14
13
|
import { type SharedNodeConfig, sharedNodeConfigMappings } from '@aztec/node-lib/config';
|
|
15
|
-
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
16
14
|
import {
|
|
17
15
|
type ProverAgentConfig,
|
|
18
16
|
type ProverBrokerConfig,
|
|
@@ -21,24 +19,19 @@ import {
|
|
|
21
19
|
} from '@aztec/prover-client/broker/config';
|
|
22
20
|
import { type ProverClientUserConfig, bbConfigMappings, proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
23
21
|
import {
|
|
24
|
-
type
|
|
25
|
-
type
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
type ProverPublisherConfig,
|
|
23
|
+
type ProverTxSenderConfig,
|
|
24
|
+
proverPublisherConfigMappings,
|
|
25
|
+
proverTxSenderConfigMappings,
|
|
28
26
|
} from '@aztec/sequencer-client/config';
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
P2PConfig &
|
|
34
|
-
WorldStateConfig &
|
|
35
|
-
PublisherConfig &
|
|
36
|
-
TxSenderConfig &
|
|
27
|
+
|
|
28
|
+
export type ProverNodeConfig = ProverClientUserConfig &
|
|
29
|
+
ProverPublisherConfig &
|
|
30
|
+
ProverTxSenderConfig &
|
|
37
31
|
DataStoreConfig &
|
|
38
32
|
KeyStoreConfig &
|
|
39
|
-
SharedNodeConfig &
|
|
40
33
|
SpecificProverNodeConfig &
|
|
41
|
-
|
|
34
|
+
Pick<SharedNodeConfig, 'web3SignerUrl'>;
|
|
42
35
|
|
|
43
36
|
export type SpecificProverNodeConfig = {
|
|
44
37
|
proverNodeMaxPendingJobs: number;
|
|
@@ -53,7 +46,7 @@ export type SpecificProverNodeConfig = {
|
|
|
53
46
|
txGatheringMaxParallelRequestsPerNode: number;
|
|
54
47
|
};
|
|
55
48
|
|
|
56
|
-
const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProverNodeConfig> = {
|
|
49
|
+
export const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProverNodeConfig> = {
|
|
57
50
|
proverNodeMaxPendingJobs: {
|
|
58
51
|
env: 'PROVER_NODE_MAX_PENDING_JOBS',
|
|
59
52
|
description: 'The maximum number of pending jobs for the prover node',
|
|
@@ -108,15 +101,11 @@ const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProverNodeCon
|
|
|
108
101
|
export const proverNodeConfigMappings: ConfigMappingsType<ProverNodeConfig> = {
|
|
109
102
|
...dataConfigMappings,
|
|
110
103
|
...keyStoreConfigMappings,
|
|
111
|
-
...archiverConfigMappings,
|
|
112
104
|
...proverClientConfigMappings,
|
|
113
|
-
...
|
|
114
|
-
...
|
|
115
|
-
...getPublisherConfigMappings('PROVER'),
|
|
116
|
-
...getTxSenderConfigMappings('PROVER'),
|
|
105
|
+
...proverPublisherConfigMappings,
|
|
106
|
+
...proverTxSenderConfigMappings,
|
|
117
107
|
...specificProverNodeConfigMappings,
|
|
118
|
-
...
|
|
119
|
-
...sharedNodeConfigMappings,
|
|
108
|
+
...pickConfigMappings(sharedNodeConfigMappings, ['web3SignerUrl']),
|
|
120
109
|
};
|
|
121
110
|
|
|
122
111
|
export function getProverNodeConfigFromEnv(): ProverNodeConfig {
|
|
@@ -143,7 +132,7 @@ function createKeyStoreFromWeb3Signer(config: ProverNodeConfig): KeyStore | unde
|
|
|
143
132
|
}
|
|
144
133
|
|
|
145
134
|
// Also, we need at least one publisher address.
|
|
146
|
-
const publishers = config.
|
|
135
|
+
const publishers = config.proverPublisherAddresses ?? [];
|
|
147
136
|
|
|
148
137
|
if (publishers.length === 0) {
|
|
149
138
|
return undefined;
|
|
@@ -164,8 +153,8 @@ function createKeyStoreFromWeb3Signer(config: ProverNodeConfig): KeyStore | unde
|
|
|
164
153
|
|
|
165
154
|
function createKeyStoreFromPublisherKeys(config: ProverNodeConfig): KeyStore | undefined {
|
|
166
155
|
// Extract the publisher keys from the provided config.
|
|
167
|
-
const publisherKeys = config.
|
|
168
|
-
? config.
|
|
156
|
+
const publisherKeys = config.proverPublisherPrivateKeys
|
|
157
|
+
? config.proverPublisherPrivateKeys.map((k: { getValue: () => string }) => ethPrivateKeySchema.parse(k.getValue()))
|
|
169
158
|
: [];
|
|
170
159
|
|
|
171
160
|
// There must be at least 1.
|
|
@@ -194,7 +183,10 @@ function createKeyStoreFromPublisherKeys(config: ProverNodeConfig): KeyStore | u
|
|
|
194
183
|
|
|
195
184
|
export function createKeyStoreForProver(config: ProverNodeConfig): KeyStore | undefined {
|
|
196
185
|
if (config.web3SignerUrl !== undefined && config.web3SignerUrl.length > 0) {
|
|
197
|
-
|
|
186
|
+
const keyStore = createKeyStoreFromWeb3Signer(config);
|
|
187
|
+
if (keyStore) {
|
|
188
|
+
return keyStore;
|
|
189
|
+
}
|
|
198
190
|
}
|
|
199
191
|
|
|
200
192
|
return createKeyStoreFromPublisherKeys(config);
|
package/src/factory.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { Archiver } from '@aztec/archiver';
|
|
2
|
+
import type { BlobClientInterface } from '@aztec/blob-client/client';
|
|
3
|
+
import { Blob } from '@aztec/blob-lib';
|
|
4
|
+
import type { EpochCacheInterface } from '@aztec/epoch-cache';
|
|
5
5
|
import { createEthereumChain } from '@aztec/ethereum/chain';
|
|
6
6
|
import { RollupContract } from '@aztec/ethereum/contracts';
|
|
7
7
|
import { L1TxUtils } from '@aztec/ethereum/l1-tx-utils';
|
|
@@ -9,26 +9,27 @@ import { PublisherManager } from '@aztec/ethereum/publisher-manager';
|
|
|
9
9
|
import { pick } from '@aztec/foundation/collection';
|
|
10
10
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
11
11
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
12
|
-
import
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
createForwarderL1TxUtilsFromEthSigner,
|
|
17
|
-
createL1TxUtilsFromEthSignerWithStore,
|
|
18
|
-
} from '@aztec/node-lib/factories';
|
|
19
|
-
import { NodeRpcTxSource, createP2PClient } from '@aztec/p2p';
|
|
20
|
-
import { type ProverClientConfig, createProverClient } from '@aztec/prover-client';
|
|
12
|
+
import { KeystoreManager } from '@aztec/node-keystore';
|
|
13
|
+
import { createForwarderL1TxUtilsFromSigners, createL1TxUtilsFromSigners } from '@aztec/node-lib/factories';
|
|
14
|
+
import { type ProverClientConfig, type ProverClientUserConfig, createProverClient } from '@aztec/prover-client';
|
|
21
15
|
import { createAndStartProvingBroker } from '@aztec/prover-client/broker';
|
|
22
|
-
import
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
import {
|
|
17
|
+
type ProverPublisherConfig,
|
|
18
|
+
type ProverTxSenderConfig,
|
|
19
|
+
getPublisherConfigFromProverConfig,
|
|
20
|
+
} from '@aztec/sequencer-client';
|
|
21
|
+
import type {
|
|
22
|
+
ITxProvider,
|
|
23
|
+
ProverConfig,
|
|
24
|
+
ProvingJobBroker,
|
|
25
|
+
Service,
|
|
26
|
+
WorldStateSynchronizer,
|
|
27
|
+
} from '@aztec/stdlib/interfaces/server';
|
|
26
28
|
import { L1Metrics, type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
27
|
-
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
28
29
|
|
|
29
30
|
import { createPublicClient, fallback, http } from 'viem';
|
|
30
31
|
|
|
31
|
-
import
|
|
32
|
+
import type { SpecificProverNodeConfig } from './config.js';
|
|
32
33
|
import { EpochMonitor } from './monitors/epoch-monitor.js';
|
|
33
34
|
import { ProverNode } from './prover-node.js';
|
|
34
35
|
import { ProverPublisherFactory } from './prover-publisher-factory.js';
|
|
@@ -36,54 +37,42 @@ import { ProverPublisherFactory } from './prover-publisher-factory.js';
|
|
|
36
37
|
export type ProverNodeDeps = {
|
|
37
38
|
telemetry?: TelemetryClient;
|
|
38
39
|
log?: Logger;
|
|
39
|
-
|
|
40
|
-
archiver?: Archiver;
|
|
40
|
+
archiver: Archiver;
|
|
41
41
|
publisherFactory?: ProverPublisherFactory;
|
|
42
42
|
broker?: ProvingJobBroker;
|
|
43
43
|
l1TxUtils?: L1TxUtils;
|
|
44
44
|
dateProvider?: DateProvider;
|
|
45
|
+
worldStateSynchronizer: WorldStateSynchronizer;
|
|
46
|
+
p2pClient: { getTxProvider(): ITxProvider } & Partial<Service>;
|
|
47
|
+
epochCache: EpochCacheInterface;
|
|
48
|
+
blobClient: BlobClientInterface;
|
|
49
|
+
keyStoreManager?: KeystoreManager;
|
|
45
50
|
};
|
|
46
51
|
|
|
47
|
-
/** Creates a new prover node given a config
|
|
52
|
+
/** Creates a new prover node subsystem given a config and dependencies */
|
|
48
53
|
export async function createProverNode(
|
|
49
|
-
userConfig:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
userConfig: SpecificProverNodeConfig &
|
|
55
|
+
ProverConfig &
|
|
56
|
+
ProverClientUserConfig &
|
|
57
|
+
ProverPublisherConfig &
|
|
58
|
+
ProverTxSenderConfig,
|
|
59
|
+
deps: ProverNodeDeps,
|
|
54
60
|
) {
|
|
55
61
|
const config = { ...userConfig };
|
|
56
62
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
57
63
|
const dateProvider = deps.dateProvider ?? new DateProvider();
|
|
58
|
-
const
|
|
59
|
-
const log = deps.log ?? createLogger('prover-node');
|
|
60
|
-
|
|
61
|
-
// Build a key store from file if given or from environment otherwise
|
|
62
|
-
let keyStoreManager: KeystoreManager | undefined;
|
|
63
|
-
const keyStoreProvided = config.keyStoreDirectory !== undefined && config.keyStoreDirectory.length > 0;
|
|
64
|
-
if (keyStoreProvided) {
|
|
65
|
-
const keyStores = loadKeystores(config.keyStoreDirectory!);
|
|
66
|
-
keyStoreManager = new KeystoreManager(mergeKeystores(keyStores));
|
|
67
|
-
} else {
|
|
68
|
-
const keyStore = createKeyStoreForProver(config);
|
|
69
|
-
if (keyStore) {
|
|
70
|
-
keyStoreManager = new KeystoreManager(keyStore);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
64
|
+
const log = deps.log ?? createLogger('prover');
|
|
73
65
|
|
|
74
|
-
|
|
66
|
+
const { p2pClient, archiver, keyStoreManager, worldStateSynchronizer } = deps;
|
|
75
67
|
|
|
76
68
|
// Extract the prover signers from the key store and verify that we have one.
|
|
69
|
+
await keyStoreManager?.validateSigners();
|
|
77
70
|
const proverSigners = keyStoreManager?.createProverSigners();
|
|
78
71
|
|
|
79
72
|
if (proverSigners === undefined) {
|
|
80
73
|
throw new Error('Failed to create prover key store configuration');
|
|
81
74
|
} else if (proverSigners.signers.length === 0) {
|
|
82
75
|
throw new Error('No prover signers found in the key store');
|
|
83
|
-
} else if (!keyStoreProvided) {
|
|
84
|
-
log.warn(
|
|
85
|
-
'KEY STORE CREATED FROM ENVIRONMENT, IT IS RECOMMENDED TO USE A FILE-BASED KEY STORE IN PRODUCTION ENVIRONMENTS',
|
|
86
|
-
);
|
|
87
76
|
}
|
|
88
77
|
|
|
89
78
|
log.info(`Creating prover with publishers ${proverSigners.signers.map(signer => signer.address.toString()).join()}`);
|
|
@@ -95,27 +84,7 @@ export async function createProverNode(
|
|
|
95
84
|
const proverId = proverSigners.id ?? proverIdInUserConfig ?? proverSigners.signers[0].address;
|
|
96
85
|
|
|
97
86
|
// Now create the prover client configuration from this.
|
|
98
|
-
const proverClientConfig: ProverClientConfig = {
|
|
99
|
-
...config,
|
|
100
|
-
proverId,
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
await trySnapshotSync(config, log);
|
|
104
|
-
|
|
105
|
-
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config);
|
|
106
|
-
|
|
107
|
-
const archiver =
|
|
108
|
-
deps.archiver ??
|
|
109
|
-
(await createArchiver(config, { blobClient, epochCache, telemetry, dateProvider }, { blockUntilSync: true }));
|
|
110
|
-
log.verbose(`Created archiver and synced to block ${await archiver.getBlockNumber()}`);
|
|
111
|
-
|
|
112
|
-
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
113
|
-
config,
|
|
114
|
-
archiver,
|
|
115
|
-
options.prefilledPublicData,
|
|
116
|
-
telemetry,
|
|
117
|
-
);
|
|
118
|
-
await worldStateSynchronizer.start();
|
|
87
|
+
const proverClientConfig: ProverClientConfig = { ...config, proverId };
|
|
119
88
|
|
|
120
89
|
const broker = deps.broker ?? (await createAndStartProvingBroker(config, telemetry));
|
|
121
90
|
|
|
@@ -134,15 +103,15 @@ export async function createProverNode(
|
|
|
134
103
|
|
|
135
104
|
const l1TxUtils = deps.l1TxUtils
|
|
136
105
|
? [deps.l1TxUtils]
|
|
137
|
-
: config.
|
|
138
|
-
? await
|
|
106
|
+
: config.proverPublisherForwarderAddress
|
|
107
|
+
? await createForwarderL1TxUtilsFromSigners(
|
|
139
108
|
publicClient,
|
|
140
109
|
proverSigners.signers,
|
|
141
|
-
config.
|
|
110
|
+
config.proverPublisherForwarderAddress,
|
|
142
111
|
{ ...config, scope: 'prover' },
|
|
143
|
-
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider },
|
|
112
|
+
{ telemetry, logger: log.createChild('l1-tx-utils'), dateProvider, kzg: Blob.getViemKzgInstance() },
|
|
144
113
|
)
|
|
145
|
-
: await
|
|
114
|
+
: await createL1TxUtilsFromSigners(
|
|
146
115
|
publicClient,
|
|
147
116
|
proverSigners.signers,
|
|
148
117
|
{ ...config, scope: 'prover' },
|
|
@@ -153,36 +122,10 @@ export async function createProverNode(
|
|
|
153
122
|
deps.publisherFactory ??
|
|
154
123
|
new ProverPublisherFactory(config, {
|
|
155
124
|
rollupContract,
|
|
156
|
-
publisherManager: new PublisherManager(l1TxUtils, config, log.getBindings()),
|
|
125
|
+
publisherManager: new PublisherManager(l1TxUtils, getPublisherConfigFromProverConfig(config), log.getBindings()),
|
|
157
126
|
telemetry,
|
|
158
127
|
});
|
|
159
128
|
|
|
160
|
-
const proofVerifier = new QueuedIVCVerifier(
|
|
161
|
-
config,
|
|
162
|
-
config.realProofs || config.debugForceTxProofVerification
|
|
163
|
-
? await BBCircuitVerifier.new(config)
|
|
164
|
-
: new TestCircuitVerifier(config.proverTestVerificationDelayMs),
|
|
165
|
-
);
|
|
166
|
-
|
|
167
|
-
const p2pClient = await createP2PClient(
|
|
168
|
-
P2PClientType.Prover,
|
|
169
|
-
config,
|
|
170
|
-
archiver,
|
|
171
|
-
proofVerifier,
|
|
172
|
-
worldStateSynchronizer,
|
|
173
|
-
epochCache,
|
|
174
|
-
getPackageVersion() ?? '',
|
|
175
|
-
dateProvider,
|
|
176
|
-
telemetry,
|
|
177
|
-
{
|
|
178
|
-
txCollectionNodeSources: deps.aztecNodeTxProvider
|
|
179
|
-
? [new NodeRpcTxSource(deps.aztecNodeTxProvider, 'TestNode')]
|
|
180
|
-
: [],
|
|
181
|
-
},
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
await p2pClient.start();
|
|
185
|
-
|
|
186
129
|
const proverNodeConfig = {
|
|
187
130
|
...pick(
|
|
188
131
|
config,
|
|
@@ -213,6 +156,9 @@ export async function createProverNode(
|
|
|
213
156
|
l1TxUtils.map(utils => utils.getSenderAddress()),
|
|
214
157
|
);
|
|
215
158
|
|
|
159
|
+
// Extract the shared delayer from the first L1TxUtils instance (all instances share the same delayer)
|
|
160
|
+
const delayer = l1TxUtils[0]?.delayer;
|
|
161
|
+
|
|
216
162
|
return new ProverNode(
|
|
217
163
|
prover,
|
|
218
164
|
publisherFactory,
|
|
@@ -226,5 +172,7 @@ export async function createProverNode(
|
|
|
226
172
|
l1Metrics,
|
|
227
173
|
proverNodeConfig,
|
|
228
174
|
telemetry,
|
|
175
|
+
delayer,
|
|
176
|
+
dateProvider,
|
|
229
177
|
);
|
|
230
178
|
}
|
|
@@ -149,7 +149,9 @@ export class EpochProvingJob implements Traceable {
|
|
|
149
149
|
|
|
150
150
|
try {
|
|
151
151
|
const blobFieldsPerCheckpoint = this.checkpoints.map(checkpoint => checkpoint.toBlobFields());
|
|
152
|
+
this.log.info(`Blob fields per checkpoint: ${timer.ms()}ms`);
|
|
152
153
|
const finalBlobBatchingChallenges = await buildFinalBlobChallenges(blobFieldsPerCheckpoint);
|
|
154
|
+
this.log.info(`Final blob batching challeneger: ${timer.ms()}ms`);
|
|
153
155
|
|
|
154
156
|
this.prover.startNewEpoch(epochNumber, epochSizeCheckpoints, finalBlobBatchingChallenges);
|
|
155
157
|
await this.prover.startChonkVerifierCircuits(Array.from(this.txs.values()));
|
|
@@ -193,7 +195,8 @@ export class EpochProvingJob implements Traceable {
|
|
|
193
195
|
previousHeader,
|
|
194
196
|
);
|
|
195
197
|
|
|
196
|
-
for (
|
|
198
|
+
for (let blockIndex = 0; blockIndex < checkpoint.blocks.length; blockIndex++) {
|
|
199
|
+
const block = checkpoint.blocks[blockIndex];
|
|
197
200
|
const globalVariables = block.header.globalVariables;
|
|
198
201
|
const txs = this.getTxs(block);
|
|
199
202
|
|
|
@@ -211,8 +214,12 @@ export class EpochProvingJob implements Traceable {
|
|
|
211
214
|
// Start block proving
|
|
212
215
|
await this.prover.startNewBlock(block.number, globalVariables.timestamp, txs.length);
|
|
213
216
|
|
|
214
|
-
// Process public fns
|
|
215
|
-
|
|
217
|
+
// Process public fns. L1 to L2 messages are only inserted for the first block of a checkpoint,
|
|
218
|
+
// as the fork for subsequent blocks already includes them from the previous block's synced state.
|
|
219
|
+
const db = await this.createFork(
|
|
220
|
+
BlockNumber(block.number - 1),
|
|
221
|
+
blockIndex === 0 ? l1ToL2Messages : undefined,
|
|
222
|
+
);
|
|
216
223
|
const config = PublicSimulatorConfig.from({
|
|
217
224
|
proverId: this.prover.getProverId().toField(),
|
|
218
225
|
skipFeeEnforcement: false,
|
|
@@ -295,22 +302,29 @@ export class EpochProvingJob implements Traceable {
|
|
|
295
302
|
}
|
|
296
303
|
|
|
297
304
|
/**
|
|
298
|
-
* Create a new db fork for tx processing, inserting
|
|
305
|
+
* Create a new db fork for tx processing, optionally inserting L1 to L2 messages.
|
|
306
|
+
* L1 to L2 messages should only be inserted for the first block in a checkpoint,
|
|
307
|
+
* as subsequent blocks' synced state already includes them.
|
|
299
308
|
* REFACTOR: The prover already spawns a db fork of its own for each block, so we may be able to do away with just one fork.
|
|
300
309
|
*/
|
|
301
|
-
private async createFork(blockNumber: BlockNumber, l1ToL2Messages: Fr[]) {
|
|
310
|
+
private async createFork(blockNumber: BlockNumber, l1ToL2Messages: Fr[] | undefined) {
|
|
311
|
+
this.log.verbose(`Creating fork at ${blockNumber}`, { blockNumber });
|
|
302
312
|
const db = await this.dbProvider.fork(blockNumber);
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
313
|
+
|
|
314
|
+
if (l1ToL2Messages !== undefined) {
|
|
315
|
+
this.log.verbose(`Inserting ${l1ToL2Messages.length} L1 to L2 messages in fork`, {
|
|
316
|
+
blockNumber,
|
|
317
|
+
l1ToL2Messages: l1ToL2Messages.map(m => m.toString()),
|
|
318
|
+
});
|
|
319
|
+
const l1ToL2MessagesPadded = padArrayEnd<Fr, number>(
|
|
320
|
+
l1ToL2Messages,
|
|
321
|
+
Fr.ZERO,
|
|
322
|
+
NUMBER_OF_L1_L2_MESSAGES_PER_ROLLUP,
|
|
323
|
+
'Too many L1 to L2 messages',
|
|
324
|
+
);
|
|
325
|
+
await db.appendLeaves(MerkleTreeId.L1_TO_L2_MESSAGE_TREE, l1ToL2MessagesPadded);
|
|
326
|
+
}
|
|
327
|
+
|
|
314
328
|
return db;
|
|
315
329
|
}
|
|
316
330
|
|
package/src/prover-node.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Archiver } from '@aztec/archiver';
|
|
2
2
|
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import type { Delayer } from '@aztec/ethereum/l1-tx-utils';
|
|
3
4
|
import { BlockNumber, CheckpointNumber, EpochNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import { assertRequired, compact, pick, sum } from '@aztec/foundation/collection';
|
|
5
6
|
import type { Fr } from '@aztec/foundation/curves/bn254';
|
|
@@ -7,7 +8,6 @@ import { memoize } from '@aztec/foundation/decorators';
|
|
|
7
8
|
import { createLogger } from '@aztec/foundation/log';
|
|
8
9
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
9
10
|
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
10
|
-
import type { P2PClient } from '@aztec/p2p';
|
|
11
11
|
import { PublicProcessorFactory } from '@aztec/simulator/server';
|
|
12
12
|
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
13
13
|
import type { Checkpoint } from '@aztec/stdlib/checkpoint';
|
|
@@ -17,6 +17,7 @@ import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers
|
|
|
17
17
|
import {
|
|
18
18
|
type EpochProverManager,
|
|
19
19
|
EpochProvingJobTerminalState,
|
|
20
|
+
type ITxProvider,
|
|
20
21
|
type ProverNodeApi,
|
|
21
22
|
type Service,
|
|
22
23
|
type WorldStateSyncStatus,
|
|
@@ -24,7 +25,6 @@ import {
|
|
|
24
25
|
tryStop,
|
|
25
26
|
} from '@aztec/stdlib/interfaces/server';
|
|
26
27
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
27
|
-
import type { P2PClientType } from '@aztec/stdlib/p2p';
|
|
28
28
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
29
29
|
import {
|
|
30
30
|
Attributes,
|
|
@@ -55,7 +55,6 @@ type DataStoreOptions = Pick<DataStoreConfig, 'dataDirectory'> & Pick<ChainConfi
|
|
|
55
55
|
*/
|
|
56
56
|
export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable {
|
|
57
57
|
private log = createLogger('prover-node');
|
|
58
|
-
private dateProvider = new DateProvider();
|
|
59
58
|
|
|
60
59
|
private jobs: Map<string, EpochProvingJob> = new Map();
|
|
61
60
|
private config: ProverNodeOptions;
|
|
@@ -73,12 +72,14 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
73
72
|
protected readonly l1ToL2MessageSource: L1ToL2MessageSource,
|
|
74
73
|
protected readonly contractDataSource: ContractDataSource,
|
|
75
74
|
protected readonly worldState: WorldStateSynchronizer,
|
|
76
|
-
protected readonly p2pClient:
|
|
75
|
+
protected readonly p2pClient: { getTxProvider(): ITxProvider } & Partial<Service>,
|
|
77
76
|
protected readonly epochsMonitor: EpochMonitor,
|
|
78
77
|
protected readonly rollupContract: RollupContract,
|
|
79
78
|
protected readonly l1Metrics: L1Metrics,
|
|
80
79
|
config: Partial<ProverNodeOptions> = {},
|
|
81
80
|
protected readonly telemetryClient: TelemetryClient = getTelemetryClient(),
|
|
81
|
+
private delayer?: Delayer,
|
|
82
|
+
private readonly dateProvider: DateProvider = new DateProvider(),
|
|
82
83
|
) {
|
|
83
84
|
this.config = {
|
|
84
85
|
proverNodePollingIntervalMs: 1_000,
|
|
@@ -111,6 +112,11 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
111
112
|
return this.p2pClient;
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
/** Returns the shared tx delayer for prover L1 txs, if enabled. Test-only. */
|
|
116
|
+
public getDelayer(): Delayer | undefined {
|
|
117
|
+
return this.delayer;
|
|
118
|
+
}
|
|
119
|
+
|
|
114
120
|
/**
|
|
115
121
|
* Handles an epoch being completed by starting a proof for it if there are no active jobs for it.
|
|
116
122
|
* @param epochNumber - The epoch number that was just completed.
|
|
@@ -155,17 +161,15 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
155
161
|
|
|
156
162
|
/**
|
|
157
163
|
* Stops the prover node and all its dependencies.
|
|
164
|
+
* Resources not owned by this node (shared with the parent aztec-node) are skipped.
|
|
158
165
|
*/
|
|
159
166
|
async stop() {
|
|
160
167
|
this.log.info('Stopping ProverNode');
|
|
161
168
|
await this.epochsMonitor.stop();
|
|
162
169
|
await this.prover.stop();
|
|
163
|
-
await tryStop(this.p2pClient);
|
|
164
|
-
await tryStop(this.l2BlockSource);
|
|
165
170
|
await tryStop(this.publisherFactory);
|
|
166
171
|
this.publisher?.interrupt();
|
|
167
172
|
await Promise.all(Array.from(this.jobs.values()).map(job => job.stop()));
|
|
168
|
-
await this.worldState.stop();
|
|
169
173
|
this.rewardsMetrics.stop();
|
|
170
174
|
this.l1Metrics.stop();
|
|
171
175
|
await this.telemetryClient.stop();
|
|
@@ -2,14 +2,14 @@ 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
4
|
import type { LoggerBindings } from '@aztec/foundation/log';
|
|
5
|
-
import type {
|
|
5
|
+
import type { ProverPublisherConfig, ProverTxSenderConfig } from '@aztec/sequencer-client';
|
|
6
6
|
import type { TelemetryClient } from '@aztec/telemetry-client';
|
|
7
7
|
|
|
8
8
|
import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
9
9
|
|
|
10
10
|
export class ProverPublisherFactory {
|
|
11
11
|
constructor(
|
|
12
|
-
private config:
|
|
12
|
+
private config: ProverTxSenderConfig & ProverPublisherConfig,
|
|
13
13
|
private deps: {
|
|
14
14
|
rollupContract: RollupContract;
|
|
15
15
|
publisherManager: PublisherManager<L1TxUtils>;
|