@aztec/prover-node 0.76.4-devnet-test-rc3 → 0.77.0-testnet-ignition.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/config.d.ts +5 -8
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +24 -51
- package/dest/factory.d.ts +6 -3
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +23 -45
- package/dest/http.d.ts +1 -1
- package/dest/http.d.ts.map +1 -1
- package/dest/http.js +2 -4
- package/dest/index.js +0 -1
- package/dest/job/epoch-proving-job.d.ts +8 -4
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +233 -190
- package/dest/metrics.d.ts +5 -2
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +50 -25
- package/dest/monitors/epoch-monitor.d.ts +22 -4
- package/dest/monitors/epoch-monitor.d.ts.map +1 -1
- package/dest/monitors/epoch-monitor.js +102 -48
- package/dest/monitors/index.d.ts +0 -1
- package/dest/monitors/index.d.ts.map +1 -1
- package/dest/monitors/index.js +0 -2
- package/dest/prover-coordination/config.js +2 -3
- package/dest/prover-coordination/factory.d.ts +5 -5
- package/dest/prover-coordination/factory.d.ts.map +1 -1
- package/dest/prover-coordination/factory.js +11 -8
- package/dest/prover-coordination/index.js +0 -1
- package/dest/prover-node-publisher.d.ts +5 -11
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +68 -61
- package/dest/prover-node.d.ts +23 -32
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +237 -289
- package/dest/test/index.d.ts +2 -2
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +2 -1
- package/package.json +21 -22
- package/src/config.ts +18 -62
- package/src/factory.ts +18 -47
- package/src/http.ts +2 -2
- package/src/job/epoch-proving-job.ts +15 -13
- package/src/metrics.ts +26 -5
- package/src/monitors/epoch-monitor.ts +57 -13
- package/src/monitors/index.ts +0 -1
- package/src/prover-coordination/factory.ts +9 -12
- package/src/prover-node-publisher.ts +29 -24
- package/src/prover-node.ts +53 -128
- package/src/test/index.ts +2 -2
- package/dest/bond/bond-manager.d.ts +0 -22
- package/dest/bond/bond-manager.d.ts.map +0 -1
- package/dest/bond/bond-manager.js +0 -42
- package/dest/bond/config.d.ts +0 -8
- package/dest/bond/config.d.ts.map +0 -1
- package/dest/bond/config.js +0 -17
- package/dest/bond/escrow-contract.d.ts +0 -19
- package/dest/bond/escrow-contract.d.ts.map +0 -1
- package/dest/bond/escrow-contract.js +0 -32
- package/dest/bond/factory.d.ts +0 -6
- package/dest/bond/factory.d.ts.map +0 -1
- package/dest/bond/factory.js +0 -17
- package/dest/bond/index.d.ts +0 -3
- package/dest/bond/index.d.ts.map +0 -1
- package/dest/bond/index.js +0 -3
- package/dest/bond/token-contract.d.ts +0 -26
- package/dest/bond/token-contract.d.ts.map +0 -1
- package/dest/bond/token-contract.js +0 -58
- package/dest/monitors/claims-monitor.d.ts +0 -24
- package/dest/monitors/claims-monitor.d.ts.map +0 -1
- package/dest/monitors/claims-monitor.js +0 -54
- package/dest/quote-provider/http.d.ts +0 -15
- package/dest/quote-provider/http.d.ts.map +0 -1
- package/dest/quote-provider/http.js +0 -33
- package/dest/quote-provider/index.d.ts +0 -6
- package/dest/quote-provider/index.d.ts.map +0 -1
- package/dest/quote-provider/index.js +0 -2
- package/dest/quote-provider/simple.d.ts +0 -9
- package/dest/quote-provider/simple.d.ts.map +0 -1
- package/dest/quote-provider/simple.js +0 -11
- package/dest/quote-provider/utils.d.ts +0 -4
- package/dest/quote-provider/utils.d.ts.map +0 -1
- package/dest/quote-provider/utils.js +0 -8
- package/dest/quote-signer.d.ts +0 -13
- package/dest/quote-signer.d.ts.map +0 -1
- package/dest/quote-signer.js +0 -18
- package/src/bond/bond-manager.ts +0 -48
- package/src/bond/config.ts +0 -25
- package/src/bond/escrow-contract.ts +0 -50
- package/src/bond/factory.ts +0 -28
- package/src/bond/index.ts +0 -2
- package/src/bond/token-contract.ts +0 -72
- package/src/monitors/claims-monitor.ts +0 -69
- package/src/quote-provider/http.ts +0 -48
- package/src/quote-provider/index.ts +0 -8
- package/src/quote-provider/simple.ts +0 -15
- package/src/quote-provider/utils.ts +0 -10
- package/src/quote-signer.ts +0 -24
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.0-testnet-ignition.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
18
18
|
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
19
19
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
20
|
-
"test": "
|
|
20
|
+
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
21
21
|
},
|
|
22
22
|
"jest": {
|
|
23
23
|
"moduleNameMapper": {
|
|
@@ -47,31 +47,30 @@
|
|
|
47
47
|
"reporters": [
|
|
48
48
|
"default"
|
|
49
49
|
],
|
|
50
|
-
"testTimeout":
|
|
50
|
+
"testTimeout": 120000,
|
|
51
51
|
"setupFiles": [
|
|
52
52
|
"../../foundation/src/jest/setup.mjs"
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@aztec/archiver": "0.
|
|
57
|
-
"@aztec/bb-prover": "0.
|
|
58
|
-
"@aztec/blob-sink": "0.
|
|
59
|
-
"@aztec/
|
|
60
|
-
"@aztec/
|
|
61
|
-
"@aztec/
|
|
62
|
-
"@aztec/
|
|
63
|
-
"@aztec/
|
|
64
|
-
"@aztec/
|
|
65
|
-
"@aztec/
|
|
66
|
-
"@aztec/
|
|
67
|
-
"@aztec/
|
|
68
|
-
"@aztec/
|
|
69
|
-
"@aztec/
|
|
70
|
-
"@aztec/
|
|
71
|
-
"@aztec/
|
|
72
|
-
"@aztec/telemetry-client": "0.
|
|
73
|
-
"@aztec/
|
|
74
|
-
"@aztec/world-state": "0.76.4-devnet-test-rc3",
|
|
56
|
+
"@aztec/archiver": "0.77.0-testnet-ignition.17",
|
|
57
|
+
"@aztec/bb-prover": "0.77.0-testnet-ignition.17",
|
|
58
|
+
"@aztec/blob-sink": "0.77.0-testnet-ignition.17",
|
|
59
|
+
"@aztec/constants": "0.77.0-testnet-ignition.17",
|
|
60
|
+
"@aztec/epoch-cache": "0.77.0-testnet-ignition.17",
|
|
61
|
+
"@aztec/ethereum": "0.77.0-testnet-ignition.17",
|
|
62
|
+
"@aztec/foundation": "0.77.0-testnet-ignition.17",
|
|
63
|
+
"@aztec/kv-store": "0.77.0-testnet-ignition.17",
|
|
64
|
+
"@aztec/l1-artifacts": "0.77.0-testnet-ignition.17",
|
|
65
|
+
"@aztec/noir-protocol-circuits-types": "0.77.0-testnet-ignition.17",
|
|
66
|
+
"@aztec/p2p": "0.77.0-testnet-ignition.17",
|
|
67
|
+
"@aztec/protocol-contracts": "0.77.0-testnet-ignition.17",
|
|
68
|
+
"@aztec/prover-client": "0.77.0-testnet-ignition.17",
|
|
69
|
+
"@aztec/sequencer-client": "0.77.0-testnet-ignition.17",
|
|
70
|
+
"@aztec/simulator": "0.77.0-testnet-ignition.17",
|
|
71
|
+
"@aztec/stdlib": "0.77.0-testnet-ignition.17",
|
|
72
|
+
"@aztec/telemetry-client": "0.77.0-testnet-ignition.17",
|
|
73
|
+
"@aztec/world-state": "0.77.0-testnet-ignition.17",
|
|
75
74
|
"source-map-support": "^0.5.21",
|
|
76
75
|
"tslib": "^2.4.0",
|
|
77
76
|
"viem": "2.22.8"
|
package/src/config.ts
CHANGED
|
@@ -1,41 +1,29 @@
|
|
|
1
|
-
import { type ArchiverConfig, archiverConfigMappings
|
|
2
|
-
import {
|
|
1
|
+
import { type ArchiverConfig, archiverConfigMappings } from '@aztec/archiver/config';
|
|
2
|
+
import type { ACVMConfig, BBConfig } from '@aztec/bb-prover/config';
|
|
3
3
|
import {
|
|
4
4
|
type ConfigMappingsType,
|
|
5
|
-
|
|
5
|
+
booleanConfigHelper,
|
|
6
6
|
getConfigFromMappings,
|
|
7
7
|
numberConfigHelper,
|
|
8
8
|
} from '@aztec/foundation/config';
|
|
9
|
-
import { type DataStoreConfig, dataConfigMappings
|
|
10
|
-
import { type P2PConfig,
|
|
9
|
+
import { type DataStoreConfig, dataConfigMappings } from '@aztec/kv-store/config';
|
|
10
|
+
import { type P2PConfig, p2pConfigMappings } from '@aztec/p2p/config';
|
|
11
11
|
import {
|
|
12
12
|
type ProverAgentConfig,
|
|
13
13
|
type ProverBrokerConfig,
|
|
14
14
|
proverAgentConfigMappings,
|
|
15
15
|
proverBrokerConfigMappings,
|
|
16
16
|
} from '@aztec/prover-client/broker';
|
|
17
|
-
import {
|
|
18
|
-
type ProverClientConfig,
|
|
19
|
-
bbConfigMappings,
|
|
20
|
-
getProverEnvVars,
|
|
21
|
-
proverClientConfigMappings,
|
|
22
|
-
} from '@aztec/prover-client/config';
|
|
17
|
+
import { type ProverClientConfig, bbConfigMappings, proverClientConfigMappings } from '@aztec/prover-client/config';
|
|
23
18
|
import {
|
|
24
19
|
type PublisherConfig,
|
|
25
20
|
type TxSenderConfig,
|
|
26
|
-
getPublisherConfigFromEnv,
|
|
27
21
|
getPublisherConfigMappings,
|
|
28
|
-
getTxSenderConfigFromEnv,
|
|
29
22
|
getTxSenderConfigMappings,
|
|
30
23
|
} from '@aztec/sequencer-client/config';
|
|
31
|
-
import { type WorldStateConfig,
|
|
24
|
+
import { type WorldStateConfig, worldStateConfigMappings } from '@aztec/world-state/config';
|
|
32
25
|
|
|
33
|
-
import { type
|
|
34
|
-
import {
|
|
35
|
-
type ProverCoordinationConfig,
|
|
36
|
-
getTxProviderConfigFromEnv,
|
|
37
|
-
proverCoordinationConfigMappings,
|
|
38
|
-
} from './prover-coordination/config.js';
|
|
26
|
+
import { type ProverCoordinationConfig, proverCoordinationConfigMappings } from './prover-coordination/config.js';
|
|
39
27
|
|
|
40
28
|
export type ProverNodeConfig = ArchiverConfig &
|
|
41
29
|
ProverClientConfig &
|
|
@@ -45,9 +33,10 @@ export type ProverNodeConfig = ArchiverConfig &
|
|
|
45
33
|
TxSenderConfig &
|
|
46
34
|
DataStoreConfig &
|
|
47
35
|
ProverCoordinationConfig &
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
SpecificProverNodeConfig & {
|
|
37
|
+
/** Whether to populate the genesis state with initial fee juice for the test accounts */
|
|
38
|
+
testAccounts: boolean;
|
|
39
|
+
};
|
|
51
40
|
|
|
52
41
|
type SpecificProverNodeConfig = {
|
|
53
42
|
proverNodeMaxPendingJobs: number;
|
|
@@ -58,12 +47,6 @@ type SpecificProverNodeConfig = {
|
|
|
58
47
|
txGatheringMaxParallelRequests: number;
|
|
59
48
|
};
|
|
60
49
|
|
|
61
|
-
export type QuoteProviderConfig = {
|
|
62
|
-
quoteProviderBasisPointFee: number;
|
|
63
|
-
quoteProviderBondAmount: bigint;
|
|
64
|
-
quoteProviderUrl?: string;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
50
|
const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProverNodeConfig> = {
|
|
68
51
|
proverNodeMaxPendingJobs: {
|
|
69
52
|
env: 'PROVER_NODE_MAX_PENDING_JOBS',
|
|
@@ -97,24 +80,6 @@ const specificProverNodeConfigMappings: ConfigMappingsType<SpecificProverNodeCon
|
|
|
97
80
|
},
|
|
98
81
|
};
|
|
99
82
|
|
|
100
|
-
const quoteProviderConfigMappings: ConfigMappingsType<QuoteProviderConfig> = {
|
|
101
|
-
quoteProviderBasisPointFee: {
|
|
102
|
-
env: 'QUOTE_PROVIDER_BASIS_POINT_FEE',
|
|
103
|
-
description: 'The basis point fee to charge for providing quotes',
|
|
104
|
-
...numberConfigHelper(100),
|
|
105
|
-
},
|
|
106
|
-
quoteProviderBondAmount: {
|
|
107
|
-
env: 'QUOTE_PROVIDER_BOND_AMOUNT',
|
|
108
|
-
description: 'The bond amount to charge for providing quotes',
|
|
109
|
-
...bigintConfigHelper(1000n),
|
|
110
|
-
},
|
|
111
|
-
quoteProviderUrl: {
|
|
112
|
-
env: 'QUOTE_PROVIDER_URL',
|
|
113
|
-
description:
|
|
114
|
-
'The URL of the remote quote provider. Overrides QUOTE_PROVIDER_BASIS_POINT_FEE and QUOTE_PROVIDER_BOND_AMOUNT.',
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
83
|
export const proverNodeConfigMappings: ConfigMappingsType<ProverNodeConfig> = {
|
|
119
84
|
...dataConfigMappings,
|
|
120
85
|
...archiverConfigMappings,
|
|
@@ -124,25 +89,16 @@ export const proverNodeConfigMappings: ConfigMappingsType<ProverNodeConfig> = {
|
|
|
124
89
|
...getPublisherConfigMappings('PROVER'),
|
|
125
90
|
...getTxSenderConfigMappings('PROVER'),
|
|
126
91
|
...proverCoordinationConfigMappings,
|
|
127
|
-
...quoteProviderConfigMappings,
|
|
128
|
-
...proverBondManagerConfigMappings,
|
|
129
92
|
...specificProverNodeConfigMappings,
|
|
93
|
+
testAccounts: {
|
|
94
|
+
env: 'TEST_ACCOUNTS',
|
|
95
|
+
description: 'Whether to populate the genesis state with initial fee juice for the test accounts.',
|
|
96
|
+
...booleanConfigHelper(false),
|
|
97
|
+
},
|
|
130
98
|
};
|
|
131
99
|
|
|
132
100
|
export function getProverNodeConfigFromEnv(): ProverNodeConfig {
|
|
133
|
-
return
|
|
134
|
-
...getP2PConfigFromEnv(),
|
|
135
|
-
...getDataConfigFromEnv(),
|
|
136
|
-
...getArchiverConfigFromEnv(),
|
|
137
|
-
...getProverEnvVars(),
|
|
138
|
-
...getWorldStateConfigFromEnv(),
|
|
139
|
-
...getPublisherConfigFromEnv('PROVER'),
|
|
140
|
-
...getTxSenderConfigFromEnv('PROVER'),
|
|
141
|
-
...getTxProviderConfigFromEnv(),
|
|
142
|
-
...getConfigFromMappings(quoteProviderConfigMappings),
|
|
143
|
-
...getConfigFromMappings(specificProverNodeConfigMappings),
|
|
144
|
-
...getConfigFromMappings(proverBondManagerConfigMappings),
|
|
145
|
-
};
|
|
101
|
+
return getConfigFromMappings(proverNodeConfigMappings);
|
|
146
102
|
}
|
|
147
103
|
|
|
148
104
|
export function getProverNodeBrokerConfigFromEnv(): ProverBrokerConfig {
|
package/src/factory.ts
CHANGED
|
@@ -1,30 +1,21 @@
|
|
|
1
1
|
import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
2
2
|
import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
3
|
-
import { type ProverCoordination, type ProvingJobBroker } from '@aztec/circuit-types';
|
|
4
3
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
5
4
|
import { L1TxUtils, RollupContract, createEthereumChain, createL1Clients } from '@aztec/ethereum';
|
|
6
|
-
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
7
|
-
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
8
5
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
9
|
-
import {
|
|
10
|
-
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
6
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
11
7
|
import { createProverClient } from '@aztec/prover-client';
|
|
12
8
|
import { createAndStartProvingBroker } from '@aztec/prover-client/broker';
|
|
9
|
+
import type { ProverCoordination, ProvingJobBroker } from '@aztec/stdlib/interfaces/server';
|
|
10
|
+
import type { PublicDataTreeLeaf } from '@aztec/stdlib/trees';
|
|
13
11
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
14
12
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
15
13
|
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
import { createBondManager } from './bond/factory.js';
|
|
19
|
-
import { type ProverNodeConfig, type QuoteProviderConfig } from './config.js';
|
|
20
|
-
import { ClaimsMonitor } from './monitors/claims-monitor.js';
|
|
14
|
+
import type { ProverNodeConfig } from './config.js';
|
|
21
15
|
import { EpochMonitor } from './monitors/epoch-monitor.js';
|
|
22
16
|
import { createProverCoordination } from './prover-coordination/factory.js';
|
|
23
17
|
import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
24
18
|
import { ProverNode, type ProverNodeOptions } from './prover-node.js';
|
|
25
|
-
import { HttpQuoteProvider } from './quote-provider/http.js';
|
|
26
|
-
import { SimpleQuoteProvider } from './quote-provider/simple.js';
|
|
27
|
-
import { QuoteSigner } from './quote-signer.js';
|
|
28
19
|
|
|
29
20
|
/** Creates a new prover node given a config. */
|
|
30
21
|
export async function createProverNode(
|
|
@@ -39,6 +30,9 @@ export async function createProverNode(
|
|
|
39
30
|
broker?: ProvingJobBroker;
|
|
40
31
|
l1TxUtils?: L1TxUtils;
|
|
41
32
|
} = {},
|
|
33
|
+
options: {
|
|
34
|
+
prefilledPublicData?: PublicDataTreeLeaf[];
|
|
35
|
+
} = {},
|
|
42
36
|
) {
|
|
43
37
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
44
38
|
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config);
|
|
@@ -47,15 +41,20 @@ export async function createProverNode(
|
|
|
47
41
|
log.verbose(`Created archiver and synced to block ${await archiver.getBlockNumber()}`);
|
|
48
42
|
|
|
49
43
|
const worldStateConfig = { ...config, worldStateProvenBlocksOnly: false };
|
|
50
|
-
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
44
|
+
const worldStateSynchronizer = await createWorldStateSynchronizer(
|
|
45
|
+
worldStateConfig,
|
|
46
|
+
archiver,
|
|
47
|
+
options.prefilledPublicData,
|
|
48
|
+
telemetry,
|
|
49
|
+
);
|
|
51
50
|
await worldStateSynchronizer.start();
|
|
52
51
|
|
|
53
52
|
const broker = deps.broker ?? (await createAndStartProvingBroker(config, telemetry));
|
|
54
53
|
const prover = await createProverClient(config, worldStateSynchronizer, broker, telemetry);
|
|
55
54
|
|
|
56
|
-
const {
|
|
57
|
-
const chain = createEthereumChain(
|
|
58
|
-
const { publicClient, walletClient } = createL1Clients(
|
|
55
|
+
const { l1RpcUrls: rpcUrls, l1ChainId: chainId, publisherPrivateKey } = config;
|
|
56
|
+
const chain = createEthereumChain(rpcUrls, chainId);
|
|
57
|
+
const { publicClient, walletClient } = createL1Clients(rpcUrls, publisherPrivateKey, chain.chainInfo);
|
|
59
58
|
|
|
60
59
|
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
61
60
|
|
|
@@ -64,7 +63,7 @@ export async function createProverNode(
|
|
|
64
63
|
|
|
65
64
|
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config);
|
|
66
65
|
|
|
67
|
-
// If config.p2pEnabled is true, createProverCoordination will create a p2p client where
|
|
66
|
+
// If config.p2pEnabled is true, createProverCoordination will create a p2p client where txs are requested
|
|
68
67
|
// If config.p2pEnabled is false, createProverCoordination request information from the AztecNode
|
|
69
68
|
const proverCoordination = await createProverCoordination(config, {
|
|
70
69
|
aztecNodeTxProvider: deps.aztecNodeTxProvider,
|
|
@@ -74,9 +73,6 @@ export async function createProverNode(
|
|
|
74
73
|
telemetry,
|
|
75
74
|
});
|
|
76
75
|
|
|
77
|
-
const quoteProvider = createQuoteProvider(config);
|
|
78
|
-
const quoteSigner = createQuoteSigner(config);
|
|
79
|
-
|
|
80
76
|
const proverNodeConfig: ProverNodeOptions = {
|
|
81
77
|
maxPendingJobs: config.proverNodeMaxPendingJobs,
|
|
82
78
|
pollingIntervalMs: config.proverNodePollingIntervalMs,
|
|
@@ -86,11 +82,7 @@ export async function createProverNode(
|
|
|
86
82
|
txGatheringTimeoutMs: config.txGatheringTimeoutMs,
|
|
87
83
|
};
|
|
88
84
|
|
|
89
|
-
const
|
|
90
|
-
const epochMonitor = new EpochMonitor(archiver, proverNodeConfig, telemetry);
|
|
91
|
-
|
|
92
|
-
const escrowContractAddress = await rollupContract.getProofCommitmentEscrow();
|
|
93
|
-
const bondManager = await createBondManager(EthAddress.fromString(escrowContractAddress), walletClient, config);
|
|
85
|
+
const epochMonitor = await EpochMonitor.create(archiver, proverNodeConfig, telemetry);
|
|
94
86
|
|
|
95
87
|
return new ProverNode(
|
|
96
88
|
prover,
|
|
@@ -100,29 +92,8 @@ export async function createProverNode(
|
|
|
100
92
|
archiver,
|
|
101
93
|
worldStateSynchronizer,
|
|
102
94
|
proverCoordination,
|
|
103
|
-
quoteProvider,
|
|
104
|
-
quoteSigner,
|
|
105
|
-
claimsMonitor,
|
|
106
95
|
epochMonitor,
|
|
107
|
-
bondManager,
|
|
108
96
|
proverNodeConfig,
|
|
109
97
|
telemetry,
|
|
110
98
|
);
|
|
111
99
|
}
|
|
112
|
-
|
|
113
|
-
function createQuoteProvider(config: QuoteProviderConfig) {
|
|
114
|
-
return config.quoteProviderUrl
|
|
115
|
-
? new HttpQuoteProvider(config.quoteProviderUrl)
|
|
116
|
-
: new SimpleQuoteProvider(config.quoteProviderBasisPointFee, config.quoteProviderBondAmount);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function createQuoteSigner(config: ProverNodeConfig) {
|
|
120
|
-
// REFACTOR: We need a package that just returns an instance of a rollup contract ready to use
|
|
121
|
-
const { l1RpcUrl: rpcUrl, l1ChainId: chainId, l1Contracts } = config;
|
|
122
|
-
const chain = createEthereumChain(rpcUrl, chainId);
|
|
123
|
-
const client = createPublicClient({ chain: chain.chainInfo, transport: http(chain.rpcUrl) });
|
|
124
|
-
const address = getAddress(l1Contracts.rollupAddress.toString());
|
|
125
|
-
const rollupContract = getContract({ address, abi: RollupAbi, client });
|
|
126
|
-
const privateKey = config.publisherPrivateKey;
|
|
127
|
-
return QuoteSigner.new(Buffer32.fromString(privateKey), rollupContract);
|
|
128
|
-
}
|
package/src/http.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { ProverNodeApiSchema } from '@aztec/
|
|
1
|
+
import { ProverNodeApiSchema } from '@aztec/stdlib/interfaces/server';
|
|
2
2
|
import { createTracedJsonRpcServer } from '@aztec/telemetry-client';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import type { ProverNode } from './prover-node.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Wrap a ProverNode instance with a JSON RPC HTTP server.
|
|
@@ -1,25 +1,23 @@
|
|
|
1
|
+
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
2
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
3
|
+
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
4
|
+
import { Timer } from '@aztec/foundation/timer';
|
|
5
|
+
import type { PublicProcessor, PublicProcessorFactory } from '@aztec/simulator/server';
|
|
6
|
+
import type { L2Block, L2BlockSource } from '@aztec/stdlib/block';
|
|
1
7
|
import {
|
|
2
8
|
type EpochProver,
|
|
3
9
|
type EpochProvingJobState,
|
|
4
10
|
EpochProvingJobTerminalState,
|
|
5
11
|
type ForkMerkleTreeOperations,
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
type ProcessedTx,
|
|
10
|
-
type Tx,
|
|
11
|
-
} from '@aztec/circuit-types';
|
|
12
|
-
import { asyncPool } from '@aztec/foundation/async-pool';
|
|
13
|
-
import { createLogger } from '@aztec/foundation/log';
|
|
14
|
-
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
15
|
-
import { Timer } from '@aztec/foundation/timer';
|
|
16
|
-
import { type PublicProcessor, type PublicProcessorFactory } from '@aztec/simulator/server';
|
|
12
|
+
} from '@aztec/stdlib/interfaces/server';
|
|
13
|
+
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
14
|
+
import type { ProcessedTx, Tx } from '@aztec/stdlib/tx';
|
|
17
15
|
import { Attributes, type Traceable, type Tracer, trackSpan } from '@aztec/telemetry-client';
|
|
18
16
|
|
|
19
17
|
import * as crypto from 'node:crypto';
|
|
20
18
|
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
19
|
+
import type { ProverNodeMetrics } from '../metrics.js';
|
|
20
|
+
import type { ProverNodePublisher } from '../prover-node-publisher.js';
|
|
23
21
|
|
|
24
22
|
/**
|
|
25
23
|
* Job that grabs a range of blocks from the unfinalised chain from L1, gets their txs given their hashes,
|
|
@@ -63,6 +61,10 @@ export class EpochProvingJob implements Traceable {
|
|
|
63
61
|
return this.state;
|
|
64
62
|
}
|
|
65
63
|
|
|
64
|
+
public getEpochNumber(): bigint {
|
|
65
|
+
return this.epochNumber;
|
|
66
|
+
}
|
|
67
|
+
|
|
66
68
|
/**
|
|
67
69
|
* Proves the given epoch and submits the proof to L1.
|
|
68
70
|
*/
|
package/src/metrics.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger } from '@aztec/foundation/log';
|
|
2
|
+
import type { L1PublishProofStats, L1PublishStats } from '@aztec/stdlib/stats';
|
|
2
3
|
import {
|
|
3
4
|
Attributes,
|
|
5
|
+
type Gauge,
|
|
4
6
|
type Histogram,
|
|
5
7
|
Metrics,
|
|
6
8
|
type TelemetryClient,
|
|
@@ -25,7 +27,13 @@ export class ProverNodeMetrics {
|
|
|
25
27
|
txBlobDataGasUsed: Histogram;
|
|
26
28
|
txBlobDataGasCost: Histogram;
|
|
27
29
|
|
|
28
|
-
|
|
30
|
+
private senderBalance: Gauge;
|
|
31
|
+
|
|
32
|
+
constructor(
|
|
33
|
+
public readonly client: TelemetryClient,
|
|
34
|
+
name = 'ProverNode',
|
|
35
|
+
private logger = createLogger('prover-node:publisher:metrics'),
|
|
36
|
+
) {
|
|
29
37
|
const meter = client.getMeter(name);
|
|
30
38
|
this.proverEpochExecutionDuration = meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
|
|
31
39
|
description: 'Duration of execution of an epoch by the prover',
|
|
@@ -34,8 +42,8 @@ export class ProverNodeMetrics {
|
|
|
34
42
|
});
|
|
35
43
|
this.provingJobDuration = meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
|
|
36
44
|
description: 'Duration of proving job',
|
|
37
|
-
unit: '
|
|
38
|
-
valueType: ValueType.
|
|
45
|
+
unit: 's',
|
|
46
|
+
valueType: ValueType.DOUBLE,
|
|
39
47
|
});
|
|
40
48
|
this.provingJobBlocks = meter.createHistogram(Metrics.PROVER_NODE_JOB_BLOCKS, {
|
|
41
49
|
description: 'Number of blocks in a proven epoch',
|
|
@@ -91,6 +99,12 @@ export class ProverNodeMetrics {
|
|
|
91
99
|
unit: 'gwei',
|
|
92
100
|
valueType: ValueType.INT,
|
|
93
101
|
});
|
|
102
|
+
|
|
103
|
+
this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
104
|
+
unit: 'eth',
|
|
105
|
+
description: 'The balance of the sender address',
|
|
106
|
+
valueType: ValueType.DOUBLE,
|
|
107
|
+
});
|
|
94
108
|
}
|
|
95
109
|
|
|
96
110
|
recordFailedTx() {
|
|
@@ -106,11 +120,18 @@ export class ProverNodeMetrics {
|
|
|
106
120
|
|
|
107
121
|
public recordProvingJob(executionTimeMs: number, totalTimeMs: number, numBlocks: number, numTxs: number) {
|
|
108
122
|
this.proverEpochExecutionDuration.record(Math.ceil(executionTimeMs));
|
|
109
|
-
this.provingJobDuration.record(
|
|
123
|
+
this.provingJobDuration.record(totalTimeMs / 1000);
|
|
110
124
|
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
111
125
|
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
112
126
|
}
|
|
113
127
|
|
|
128
|
+
public recordSenderBalance(wei: bigint, senderAddress: string) {
|
|
129
|
+
const eth = parseFloat(formatEther(wei, 'wei'));
|
|
130
|
+
this.senderBalance.record(eth, {
|
|
131
|
+
[Attributes.SENDER_ADDRESS]: senderAddress,
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
|
|
114
135
|
private recordTx(durationMs: number, stats: L1PublishStats) {
|
|
115
136
|
const attributes = {
|
|
116
137
|
[Attributes.L1_TX_TYPE]: 'submitProof',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { type L2BlockSource } from '@aztec/circuit-types';
|
|
2
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
2
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
3
|
+
import type { L2BlockSource } from '@aztec/stdlib/block';
|
|
4
|
+
import { type L1RollupConstants, getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
|
|
4
5
|
import {
|
|
5
6
|
type TelemetryClient,
|
|
6
7
|
type Traceable,
|
|
@@ -10,21 +11,31 @@ import {
|
|
|
10
11
|
} from '@aztec/telemetry-client';
|
|
11
12
|
|
|
12
13
|
export interface EpochMonitorHandler {
|
|
13
|
-
|
|
14
|
-
handleEpochCompleted(epochNumber: bigint): Promise<void>;
|
|
14
|
+
handleEpochReadyToProve(epochNumber: bigint): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* Fires an event when a new epoch ready to prove is detected.
|
|
19
|
+
*
|
|
20
|
+
* We define an epoch as ready to prove when:
|
|
21
|
+
* - The epoch is complete
|
|
22
|
+
* - Its blocks have not been reorg'd out due to a missing L2 proof
|
|
23
|
+
* - Its first block is the immediate successor of the last proven block
|
|
24
|
+
*
|
|
25
|
+
* This class periodically hits the L2BlockSource.
|
|
26
|
+
* On start it will trigger the event for the last epoch ready to prove.
|
|
27
|
+
*/
|
|
17
28
|
export class EpochMonitor implements Traceable {
|
|
18
29
|
private runningPromise: RunningPromise;
|
|
19
30
|
private log = createLogger('prover-node:epoch-monitor');
|
|
20
31
|
public readonly tracer: Tracer;
|
|
21
32
|
|
|
22
33
|
private handler: EpochMonitorHandler | undefined;
|
|
23
|
-
|
|
24
34
|
private latestEpochNumber: bigint | undefined;
|
|
25
35
|
|
|
26
36
|
constructor(
|
|
27
37
|
private readonly l2BlockSource: L2BlockSource,
|
|
38
|
+
private readonly l1Constants: Pick<L1RollupConstants, 'epochDuration'>,
|
|
28
39
|
private options: { pollingIntervalMs: number },
|
|
29
40
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
30
41
|
) {
|
|
@@ -32,12 +43,26 @@ export class EpochMonitor implements Traceable {
|
|
|
32
43
|
this.runningPromise = new RunningPromise(this.work.bind(this), this.log, this.options.pollingIntervalMs);
|
|
33
44
|
}
|
|
34
45
|
|
|
46
|
+
public static async create(
|
|
47
|
+
l2BlockSource: L2BlockSource,
|
|
48
|
+
options: { pollingIntervalMs: number },
|
|
49
|
+
telemetry: TelemetryClient = getTelemetryClient(),
|
|
50
|
+
): Promise<EpochMonitor> {
|
|
51
|
+
const l1Constants = await l2BlockSource.getL1Constants();
|
|
52
|
+
return new EpochMonitor(l2BlockSource, l1Constants, options, telemetry);
|
|
53
|
+
}
|
|
54
|
+
|
|
35
55
|
public start(handler: EpochMonitorHandler) {
|
|
36
56
|
this.handler = handler;
|
|
37
57
|
this.runningPromise.start();
|
|
38
58
|
this.log.info('Started EpochMonitor', this.options);
|
|
39
59
|
}
|
|
40
60
|
|
|
61
|
+
/** Exposed for testing */
|
|
62
|
+
public setHandler(handler: EpochMonitorHandler) {
|
|
63
|
+
this.handler = handler;
|
|
64
|
+
}
|
|
65
|
+
|
|
41
66
|
public async stop() {
|
|
42
67
|
await this.runningPromise.stop();
|
|
43
68
|
this.log.info('Stopped EpochMonitor');
|
|
@@ -45,18 +70,37 @@ export class EpochMonitor implements Traceable {
|
|
|
45
70
|
|
|
46
71
|
@trackSpan('EpochMonitor.work')
|
|
47
72
|
public async work() {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
73
|
+
const { epochToProve, blockNumber, slotNumber } = await this.getEpochNumberToProve();
|
|
74
|
+
if (epochToProve === undefined) {
|
|
75
|
+
this.log.trace(`Next block to prove ${blockNumber} not yet mined`, { blockNumber });
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
if (this.latestEpochNumber !== undefined && epochToProve <= this.latestEpochNumber) {
|
|
79
|
+
this.log.trace(`Epoch ${epochToProve} already processed`, { epochToProve, blockNumber, slotNumber });
|
|
54
80
|
return;
|
|
55
81
|
}
|
|
56
82
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
this.
|
|
83
|
+
const isCompleted = await this.l2BlockSource.isEpochComplete(epochToProve);
|
|
84
|
+
if (!isCompleted) {
|
|
85
|
+
this.log.trace(`Epoch ${epochToProve} is not complete`, { epochToProve, blockNumber, slotNumber });
|
|
86
|
+
return;
|
|
60
87
|
}
|
|
88
|
+
|
|
89
|
+
this.log.debug(`Epoch ${epochToProve} is ready to be proven`);
|
|
90
|
+
await this.handler?.handleEpochReadyToProve(epochToProve);
|
|
91
|
+
this.latestEpochNumber = epochToProve;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private async getEpochNumberToProve() {
|
|
95
|
+
const lastBlockProven = await this.l2BlockSource.getProvenBlockNumber();
|
|
96
|
+
const firstBlockToProve = lastBlockProven + 1;
|
|
97
|
+
const firstBlockHeaderToProve = await this.l2BlockSource.getBlockHeader(firstBlockToProve);
|
|
98
|
+
if (!firstBlockHeaderToProve) {
|
|
99
|
+
return { epochToProve: undefined, blockNumber: firstBlockToProve };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const firstSlotOfEpochToProve = firstBlockHeaderToProve.getSlot();
|
|
103
|
+
const epochToProve = getEpochAtSlot(firstSlotOfEpochToProve, this.l1Constants);
|
|
104
|
+
return { epochToProve, blockNumber: firstBlockToProve, slotNumber: firstSlotOfEpochToProve };
|
|
61
105
|
}
|
|
62
106
|
}
|
package/src/monitors/index.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ArchiveSource, Archiver } from '@aztec/archiver';
|
|
2
2
|
import { BBCircuitVerifier, TestCircuitVerifier } from '@aztec/bb-prover';
|
|
3
|
-
import {
|
|
4
|
-
P2PClientType,
|
|
5
|
-
type ProverCoordination,
|
|
6
|
-
type WorldStateSynchronizer,
|
|
7
|
-
createAztecNodeClient,
|
|
8
|
-
getComponentsVersionsFromConfig,
|
|
9
|
-
} from '@aztec/circuit-types';
|
|
10
|
-
import { type EpochCache } from '@aztec/epoch-cache';
|
|
3
|
+
import type { EpochCache } from '@aztec/epoch-cache';
|
|
11
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
12
|
-
import {
|
|
13
|
-
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/
|
|
5
|
+
import type { DataStoreConfig } from '@aztec/kv-store/config';
|
|
6
|
+
import { getVKTreeRoot } from '@aztec/noir-protocol-circuits-types/vk-tree';
|
|
14
7
|
import { createP2PClient } from '@aztec/p2p';
|
|
15
8
|
import { protocolContractTreeRoot } from '@aztec/protocol-contracts';
|
|
9
|
+
import { createAztecNodeClient } from '@aztec/stdlib/interfaces/client';
|
|
10
|
+
import type { ProverCoordination, WorldStateSynchronizer } from '@aztec/stdlib/interfaces/server';
|
|
11
|
+
import { P2PClientType } from '@aztec/stdlib/p2p';
|
|
12
|
+
import { getComponentsVersionsFromConfig } from '@aztec/stdlib/versioning';
|
|
16
13
|
import { type TelemetryClient, makeTracedFetch } from '@aztec/telemetry-client';
|
|
17
14
|
|
|
18
|
-
import {
|
|
15
|
+
import type { ProverNodeConfig } from '../config.js';
|
|
19
16
|
|
|
20
17
|
// We return a reference to the P2P client so that the prover node can stop the service when it shuts down.
|
|
21
18
|
type ProverCoordinationDeps = {
|