@aztec/prover-node 0.71.0 → 0.73.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/bond/escrow-contract.d.ts +2 -5
- package/dest/bond/escrow-contract.d.ts.map +1 -1
- package/dest/bond/escrow-contract.js +1 -1
- package/dest/bond/factory.d.ts +3 -6
- package/dest/bond/factory.d.ts.map +1 -1
- package/dest/bond/factory.js +2 -4
- package/dest/bond/token-contract.d.ts +2 -5
- package/dest/bond/token-contract.d.ts.map +1 -1
- package/dest/bond/token-contract.js +1 -1
- package/dest/factory.d.ts +4 -2
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +13 -9
- package/dest/http.js +3 -3
- package/dest/index.d.ts +3 -2
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +4 -3
- package/dest/job/epoch-proving-job.d.ts +2 -2
- package/dest/job/epoch-proving-job.d.ts.map +1 -1
- package/dest/job/epoch-proving-job.js +21 -15
- package/dest/metrics.d.ts +13 -1
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +74 -2
- package/dest/monitors/claims-monitor.d.ts +2 -2
- package/dest/monitors/claims-monitor.d.ts.map +1 -1
- package/dest/monitors/claims-monitor.js +1 -1
- package/dest/prover-coordination/factory.d.ts.map +1 -1
- package/dest/prover-coordination/factory.js +3 -2
- package/dest/prover-node-publisher.d.ts +67 -0
- package/dest/prover-node-publisher.d.ts.map +1 -0
- package/dest/prover-node-publisher.js +183 -0
- package/dest/prover-node.d.ts +3 -3
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +1 -1
- package/dest/test/index.d.ts +2 -2
- package/dest/test/index.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/bond/escrow-contract.ts +2 -15
- package/src/bond/factory.ts +4 -24
- package/src/bond/token-contract.ts +2 -15
- package/src/factory.ts +16 -9
- package/src/http.ts +2 -2
- package/src/index.ts +3 -2
- package/src/job/epoch-proving-job.ts +22 -16
- package/src/metrics.ts +107 -1
- package/src/monitors/claims-monitor.ts +3 -2
- package/src/prover-coordination/factory.ts +2 -2
- package/src/prover-node-publisher.ts +276 -0
- package/src/prover-node.ts +2 -2
- package/src/test/index.ts +2 -2
package/src/bond/factory.ts
CHANGED
|
@@ -1,19 +1,6 @@
|
|
|
1
|
-
import { EthAddress } from '@aztec/circuits.js';
|
|
1
|
+
import { type EthAddress } from '@aztec/circuits.js';
|
|
2
|
+
import { type L1Clients } from '@aztec/ethereum';
|
|
2
3
|
import { compact } from '@aztec/foundation/collection';
|
|
3
|
-
import { type RollupAbi } from '@aztec/l1-artifacts';
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
type Chain,
|
|
7
|
-
type Client,
|
|
8
|
-
type GetContractReturnType,
|
|
9
|
-
type HttpTransport,
|
|
10
|
-
type PrivateKeyAccount,
|
|
11
|
-
type PublicActions,
|
|
12
|
-
type PublicClient,
|
|
13
|
-
type PublicRpcSchema,
|
|
14
|
-
type WalletActions,
|
|
15
|
-
type WalletRpcSchema,
|
|
16
|
-
} from 'viem';
|
|
17
4
|
|
|
18
5
|
import { BondManager } from './bond-manager.js';
|
|
19
6
|
import { type ProverBondManagerConfig, getProverBondManagerConfigFromEnv } from './config.js';
|
|
@@ -21,21 +8,14 @@ import { EscrowContract } from './escrow-contract.js';
|
|
|
21
8
|
import { TokenContract } from './token-contract.js';
|
|
22
9
|
|
|
23
10
|
export async function createBondManager(
|
|
24
|
-
|
|
25
|
-
client:
|
|
26
|
-
HttpTransport,
|
|
27
|
-
Chain,
|
|
28
|
-
PrivateKeyAccount,
|
|
29
|
-
[...WalletRpcSchema, ...PublicRpcSchema],
|
|
30
|
-
PublicActions<HttpTransport, Chain> & WalletActions<Chain, PrivateKeyAccount>
|
|
31
|
-
>,
|
|
11
|
+
escrowContractAddress: EthAddress,
|
|
12
|
+
client: L1Clients['walletClient'],
|
|
32
13
|
overrides: Partial<ProverBondManagerConfig> = {},
|
|
33
14
|
) {
|
|
34
15
|
const config = { ...getProverBondManagerConfigFromEnv(), ...compact(overrides) };
|
|
35
16
|
const { proverMinimumEscrowAmount: minimumStake, proverTargetEscrowAmount: maybeTargetStake } = config;
|
|
36
17
|
const targetStake = maybeTargetStake ?? minimumStake * 2n;
|
|
37
18
|
|
|
38
|
-
const escrowContractAddress = EthAddress.fromString(await rollupContract.read.PROOF_COMMITMENT_ESCROW());
|
|
39
19
|
const escrow = new EscrowContract(client, escrowContractAddress);
|
|
40
20
|
|
|
41
21
|
const tokenContractAddress = await escrow.getTokenAddress();
|
|
@@ -1,18 +1,14 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/circuits.js';
|
|
2
|
+
import { type L1Clients } from '@aztec/ethereum';
|
|
2
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
3
4
|
import { IERC20Abi, TestERC20Abi } from '@aztec/l1-artifacts';
|
|
4
5
|
|
|
5
6
|
import {
|
|
6
7
|
type Chain,
|
|
7
|
-
type Client,
|
|
8
8
|
type GetContractReturnType,
|
|
9
9
|
type HttpTransport,
|
|
10
10
|
type PrivateKeyAccount,
|
|
11
|
-
type PublicActions,
|
|
12
|
-
type PublicRpcSchema,
|
|
13
|
-
type WalletActions,
|
|
14
11
|
type WalletClient,
|
|
15
|
-
type WalletRpcSchema,
|
|
16
12
|
getContract,
|
|
17
13
|
} from 'viem';
|
|
18
14
|
|
|
@@ -23,16 +19,7 @@ export class TokenContract {
|
|
|
23
19
|
private token: GetContractReturnType<typeof IERC20Abi, WalletClient<HttpTransport, Chain, PrivateKeyAccount>>;
|
|
24
20
|
private logger = createLogger('prover-node:token-contract');
|
|
25
21
|
|
|
26
|
-
constructor(
|
|
27
|
-
private readonly client: Client<
|
|
28
|
-
HttpTransport,
|
|
29
|
-
Chain,
|
|
30
|
-
PrivateKeyAccount,
|
|
31
|
-
[...WalletRpcSchema, ...PublicRpcSchema],
|
|
32
|
-
PublicActions<HttpTransport, Chain> & WalletActions<Chain, PrivateKeyAccount>
|
|
33
|
-
>,
|
|
34
|
-
address: EthAddress,
|
|
35
|
-
) {
|
|
22
|
+
constructor(private readonly client: L1Clients['walletClient'], address: EthAddress) {
|
|
36
23
|
this.token = getContract({ address: address.toString(), abi: IERC20Abi, client });
|
|
37
24
|
}
|
|
38
25
|
|
package/src/factory.ts
CHANGED
|
@@ -2,14 +2,14 @@ import { type Archiver, createArchiver } from '@aztec/archiver';
|
|
|
2
2
|
import { type BlobSinkClientInterface, createBlobSinkClient } from '@aztec/blob-sink/client';
|
|
3
3
|
import { type ProverCoordination, type ProvingJobBroker } from '@aztec/circuit-types';
|
|
4
4
|
import { EpochCache } from '@aztec/epoch-cache';
|
|
5
|
-
import { createEthereumChain } from '@aztec/ethereum';
|
|
5
|
+
import { L1TxUtils, RollupContract, createEthereumChain, createL1Clients } from '@aztec/ethereum';
|
|
6
6
|
import { Buffer32 } from '@aztec/foundation/buffer';
|
|
7
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
7
8
|
import { type Logger, createLogger } from '@aztec/foundation/log';
|
|
8
9
|
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
9
10
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
10
11
|
import { createProverClient } from '@aztec/prover-client';
|
|
11
12
|
import { createAndStartProvingBroker } from '@aztec/prover-client/broker';
|
|
12
|
-
import { L1Publisher } from '@aztec/sequencer-client';
|
|
13
13
|
import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-client';
|
|
14
14
|
import { createWorldStateSynchronizer } from '@aztec/world-state';
|
|
15
15
|
|
|
@@ -20,6 +20,7 @@ import { type ProverNodeConfig, type QuoteProviderConfig } from './config.js';
|
|
|
20
20
|
import { ClaimsMonitor } from './monitors/claims-monitor.js';
|
|
21
21
|
import { EpochMonitor } from './monitors/epoch-monitor.js';
|
|
22
22
|
import { createProverCoordination } from './prover-coordination/factory.js';
|
|
23
|
+
import { ProverNodePublisher } from './prover-node-publisher.js';
|
|
23
24
|
import { ProverNode, type ProverNodeOptions } from './prover-node.js';
|
|
24
25
|
import { HttpQuoteProvider } from './quote-provider/http.js';
|
|
25
26
|
import { SimpleQuoteProvider } from './quote-provider/simple.js';
|
|
@@ -33,13 +34,14 @@ export async function createProverNode(
|
|
|
33
34
|
log?: Logger;
|
|
34
35
|
aztecNodeTxProvider?: ProverCoordination;
|
|
35
36
|
archiver?: Archiver;
|
|
36
|
-
publisher?:
|
|
37
|
+
publisher?: ProverNodePublisher;
|
|
37
38
|
blobSinkClient?: BlobSinkClientInterface;
|
|
38
39
|
broker?: ProvingJobBroker;
|
|
40
|
+
l1TxUtils?: L1TxUtils;
|
|
39
41
|
} = {},
|
|
40
42
|
) {
|
|
41
43
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
42
|
-
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config
|
|
44
|
+
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config);
|
|
43
45
|
const log = deps.log ?? createLogger('prover-node');
|
|
44
46
|
const archiver = deps.archiver ?? (await createArchiver(config, blobSinkClient, { blockUntilSync: true }, telemetry));
|
|
45
47
|
log.verbose(`Created archiver and synced to block ${await archiver.getBlockNumber()}`);
|
|
@@ -51,8 +53,14 @@ export async function createProverNode(
|
|
|
51
53
|
const broker = deps.broker ?? (await createAndStartProvingBroker(config, telemetry));
|
|
52
54
|
const prover = await createProverClient(config, worldStateSynchronizer, broker, telemetry);
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
const
|
|
56
|
+
const { l1RpcUrl: rpcUrl, l1ChainId: chainId, publisherPrivateKey } = config;
|
|
57
|
+
const chain = createEthereumChain(rpcUrl, chainId);
|
|
58
|
+
const { publicClient, walletClient } = createL1Clients(rpcUrl, publisherPrivateKey, chain.chainInfo);
|
|
59
|
+
|
|
60
|
+
const rollupContract = new RollupContract(publicClient, config.l1Contracts.rollupAddress.toString());
|
|
61
|
+
|
|
62
|
+
const l1TxUtils = deps.l1TxUtils ?? new L1TxUtils(publicClient, walletClient, log, config);
|
|
63
|
+
const publisher = deps.publisher ?? new ProverNodePublisher(config, { telemetry, rollupContract, l1TxUtils });
|
|
56
64
|
|
|
57
65
|
const epochCache = await EpochCache.create(config.l1Contracts.rollupAddress, config);
|
|
58
66
|
|
|
@@ -81,9 +89,8 @@ export async function createProverNode(
|
|
|
81
89
|
const claimsMonitor = new ClaimsMonitor(publisher, proverNodeConfig, telemetry);
|
|
82
90
|
const epochMonitor = new EpochMonitor(archiver, proverNodeConfig, telemetry);
|
|
83
91
|
|
|
84
|
-
const
|
|
85
|
-
const
|
|
86
|
-
const bondManager = await createBondManager(rollupContract, walletClient, config);
|
|
92
|
+
const escrowContractAddress = await rollupContract.getProofCommitmentEscrow();
|
|
93
|
+
const bondManager = await createBondManager(EthAddress.fromString(escrowContractAddress), walletClient, config);
|
|
87
94
|
|
|
88
95
|
return new ProverNode(
|
|
89
96
|
prover,
|
package/src/http.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProverNodeApiSchema } from '@aztec/circuit-types';
|
|
2
|
-
import {
|
|
2
|
+
import { createTracedJsonRpcServer } from '@aztec/telemetry-client';
|
|
3
3
|
|
|
4
4
|
import { type ProverNode } from './prover-node.js';
|
|
5
5
|
|
|
@@ -9,5 +9,5 @@ import { type ProverNode } from './prover-node.js';
|
|
|
9
9
|
* @returns An JSON-RPC HTTP server
|
|
10
10
|
*/
|
|
11
11
|
export function createProverNodeRpcServer(node: ProverNode) {
|
|
12
|
-
return
|
|
12
|
+
return createTracedJsonRpcServer(node, ProverNodeApiSchema);
|
|
13
13
|
}
|
package/src/index.ts
CHANGED
|
@@ -13,13 +13,13 @@ import { asyncPool } from '@aztec/foundation/async-pool';
|
|
|
13
13
|
import { createLogger } from '@aztec/foundation/log';
|
|
14
14
|
import { promiseWithResolvers } from '@aztec/foundation/promise';
|
|
15
15
|
import { Timer } from '@aztec/foundation/timer';
|
|
16
|
-
import { type L1Publisher } from '@aztec/sequencer-client';
|
|
17
16
|
import { type PublicProcessor, type PublicProcessorFactory } from '@aztec/simulator/server';
|
|
18
17
|
import { Attributes, type Traceable, type Tracer, trackSpan } from '@aztec/telemetry-client';
|
|
19
18
|
|
|
20
19
|
import * as crypto from 'node:crypto';
|
|
21
20
|
|
|
22
21
|
import { type ProverNodeMetrics } from '../metrics.js';
|
|
22
|
+
import { type ProverNodePublisher } from '../prover-node-publisher.js';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Job that grabs a range of blocks from the unfinalised chain from L1, gets their txs given their hashes,
|
|
@@ -43,7 +43,7 @@ export class EpochProvingJob implements Traceable {
|
|
|
43
43
|
private txs: Tx[],
|
|
44
44
|
private prover: EpochProver,
|
|
45
45
|
private publicProcessorFactory: PublicProcessorFactory,
|
|
46
|
-
private publisher:
|
|
46
|
+
private publisher: ProverNodePublisher,
|
|
47
47
|
private l2BlockSource: L2BlockSource,
|
|
48
48
|
private l1ToL2MessageSource: L1ToL2MessageSource,
|
|
49
49
|
private metrics: ProverNodeMetrics,
|
|
@@ -91,40 +91,40 @@ export class EpochProvingJob implements Traceable {
|
|
|
91
91
|
|
|
92
92
|
try {
|
|
93
93
|
this.prover.startNewEpoch(epochNumber, fromBlock, epochSizeBlocks);
|
|
94
|
-
this.prover.startTubeCircuits(this.txs);
|
|
94
|
+
await this.prover.startTubeCircuits(this.txs);
|
|
95
95
|
|
|
96
96
|
await asyncPool(this.config.parallelBlockLimit, this.blocks, async block => {
|
|
97
97
|
this.checkState();
|
|
98
98
|
|
|
99
99
|
const globalVariables = block.header.globalVariables;
|
|
100
|
-
const txs = this.getTxs(block);
|
|
100
|
+
const txs = await this.getTxs(block);
|
|
101
101
|
const l1ToL2Messages = await this.getL1ToL2Messages(block);
|
|
102
|
-
const previousHeader = await this.getBlockHeader(block.number - 1)
|
|
102
|
+
const previousHeader = (await this.getBlockHeader(block.number - 1))!;
|
|
103
103
|
|
|
104
104
|
this.log.verbose(`Starting processing block ${block.number}`, {
|
|
105
105
|
number: block.number,
|
|
106
|
-
blockHash: block.hash().toString(),
|
|
106
|
+
blockHash: (await block.hash()).toString(),
|
|
107
107
|
lastArchive: block.header.lastArchive.root,
|
|
108
108
|
noteHashTreeRoot: block.header.state.partial.noteHashTree.root,
|
|
109
109
|
nullifierTreeRoot: block.header.state.partial.nullifierTree.root,
|
|
110
110
|
publicDataTreeRoot: block.header.state.partial.publicDataTree.root,
|
|
111
|
-
previousHeader: previousHeader
|
|
111
|
+
previousHeader: previousHeader.hash(),
|
|
112
112
|
uuid: this.uuid,
|
|
113
113
|
...globalVariables,
|
|
114
114
|
});
|
|
115
115
|
|
|
116
116
|
// Start block proving
|
|
117
|
-
await this.prover.startNewBlock(globalVariables, l1ToL2Messages);
|
|
117
|
+
await this.prover.startNewBlock(globalVariables, l1ToL2Messages, previousHeader);
|
|
118
118
|
|
|
119
119
|
// Process public fns
|
|
120
120
|
const db = await this.dbProvider.fork(block.number - 1);
|
|
121
|
-
const publicProcessor = this.publicProcessorFactory.create(db,
|
|
121
|
+
const publicProcessor = this.publicProcessorFactory.create(db, globalVariables, true);
|
|
122
122
|
const processed = await this.processTxs(publicProcessor, txs);
|
|
123
123
|
await this.prover.addTxs(processed);
|
|
124
124
|
await db.close();
|
|
125
125
|
this.log.verbose(`Processed all ${txs.length} txs for block ${block.number}`, {
|
|
126
126
|
blockNumber: block.number,
|
|
127
|
-
blockHash: block.hash().toString(),
|
|
127
|
+
blockHash: (await block.hash()).toString(),
|
|
128
128
|
uuid: this.uuid,
|
|
129
129
|
});
|
|
130
130
|
|
|
@@ -144,7 +144,10 @@ export class EpochProvingJob implements Traceable {
|
|
|
144
144
|
throw new Error('Failed to submit epoch proof to L1');
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
-
this.log.info(`Submitted proof for epoch
|
|
147
|
+
this.log.info(`Submitted proof for epoch ${epochNumber} (blocks ${fromBlock} to ${toBlock})`, {
|
|
148
|
+
epochNumber,
|
|
149
|
+
uuid: this.uuid,
|
|
150
|
+
});
|
|
148
151
|
this.state = 'completed';
|
|
149
152
|
this.metrics.recordProvingJob(executionTime, timer.ms(), epochSizeBlocks, epochSizeTxs);
|
|
150
153
|
} catch (err: any) {
|
|
@@ -202,17 +205,20 @@ export class EpochProvingJob implements Traceable {
|
|
|
202
205
|
}
|
|
203
206
|
}
|
|
204
207
|
|
|
205
|
-
/* Returns the header for the given block number, or
|
|
206
|
-
private getBlockHeader(blockNumber: number) {
|
|
208
|
+
/* Returns the header for the given block number, or the genesis block for block zero. */
|
|
209
|
+
private async getBlockHeader(blockNumber: number) {
|
|
207
210
|
if (blockNumber === 0) {
|
|
208
|
-
return
|
|
211
|
+
return (await this.dbProvider.fork()).getInitialHeader();
|
|
209
212
|
}
|
|
210
213
|
return this.l2BlockSource.getBlockHeader(blockNumber);
|
|
211
214
|
}
|
|
212
215
|
|
|
213
|
-
private getTxs(block: L2Block): Tx[] {
|
|
216
|
+
private async getTxs(block: L2Block): Promise<Tx[]> {
|
|
214
217
|
const txHashes = block.body.txEffects.map(tx => tx.txHash.toBigInt());
|
|
215
|
-
|
|
218
|
+
const txsAndHashes = await Promise.all(this.txs.map(async tx => ({ tx, hash: await tx.getTxHash() })));
|
|
219
|
+
return txsAndHashes
|
|
220
|
+
.filter(txAndHash => txHashes.includes(txAndHash.hash.toBigInt()))
|
|
221
|
+
.map(txAndHash => txAndHash.tx);
|
|
216
222
|
}
|
|
217
223
|
|
|
218
224
|
private getL1ToL2Messages(block: L2Block) {
|
package/src/metrics.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type L1PublishProofStats, type L1PublishStats } from '@aztec/circuit-types/stats';
|
|
2
|
+
import {
|
|
3
|
+
Attributes,
|
|
4
|
+
type Histogram,
|
|
5
|
+
Metrics,
|
|
6
|
+
type TelemetryClient,
|
|
7
|
+
type UpDownCounter,
|
|
8
|
+
ValueType,
|
|
9
|
+
} from '@aztec/telemetry-client';
|
|
10
|
+
|
|
11
|
+
import { formatEther } from 'viem';
|
|
2
12
|
|
|
3
13
|
export class ProverNodeMetrics {
|
|
4
14
|
proverEpochExecutionDuration: Histogram;
|
|
@@ -6,6 +16,15 @@ export class ProverNodeMetrics {
|
|
|
6
16
|
provingJobBlocks: Histogram;
|
|
7
17
|
provingJobTransactions: Histogram;
|
|
8
18
|
|
|
19
|
+
gasPrice: Histogram;
|
|
20
|
+
txCount: UpDownCounter;
|
|
21
|
+
txDuration: Histogram;
|
|
22
|
+
txGas: Histogram;
|
|
23
|
+
txCalldataSize: Histogram;
|
|
24
|
+
txCalldataGas: Histogram;
|
|
25
|
+
txBlobDataGasUsed: Histogram;
|
|
26
|
+
txBlobDataGasCost: Histogram;
|
|
27
|
+
|
|
9
28
|
constructor(public readonly client: TelemetryClient, name = 'ProverNode') {
|
|
10
29
|
const meter = client.getMeter(name);
|
|
11
30
|
this.proverEpochExecutionDuration = meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
|
|
@@ -26,6 +45,63 @@ export class ProverNodeMetrics {
|
|
|
26
45
|
description: 'Number of transactions in a proven epoch',
|
|
27
46
|
valueType: ValueType.INT,
|
|
28
47
|
});
|
|
48
|
+
|
|
49
|
+
this.gasPrice = meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE, {
|
|
50
|
+
description: 'The gas price used for transactions',
|
|
51
|
+
unit: 'gwei',
|
|
52
|
+
valueType: ValueType.DOUBLE,
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
this.txCount = meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
56
|
+
description: 'The number of transactions processed',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
this.txDuration = meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
|
|
60
|
+
description: 'The duration of transaction processing',
|
|
61
|
+
unit: 'ms',
|
|
62
|
+
valueType: ValueType.INT,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
this.txGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
|
|
66
|
+
description: 'The gas consumed by transactions',
|
|
67
|
+
unit: 'gas',
|
|
68
|
+
valueType: ValueType.INT,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
this.txCalldataSize = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
|
|
72
|
+
description: 'The size of the calldata in transactions',
|
|
73
|
+
unit: 'By',
|
|
74
|
+
valueType: ValueType.INT,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
this.txCalldataGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
|
|
78
|
+
description: 'The gas consumed by the calldata in transactions',
|
|
79
|
+
unit: 'gas',
|
|
80
|
+
valueType: ValueType.INT,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
this.txBlobDataGasUsed = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
|
|
84
|
+
description: 'The amount of blob gas used in transactions',
|
|
85
|
+
unit: 'gas',
|
|
86
|
+
valueType: ValueType.INT,
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
this.txBlobDataGasCost = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
|
|
90
|
+
description: 'The gas cost of blobs in transactions',
|
|
91
|
+
unit: 'gwei',
|
|
92
|
+
valueType: ValueType.INT,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
recordFailedTx() {
|
|
97
|
+
this.txCount.add(1, {
|
|
98
|
+
[Attributes.L1_TX_TYPE]: 'submitProof',
|
|
99
|
+
[Attributes.OK]: false,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
recordSubmitProof(durationMs: number, stats: L1PublishProofStats) {
|
|
104
|
+
this.recordTx(durationMs, stats);
|
|
29
105
|
}
|
|
30
106
|
|
|
31
107
|
public recordProvingJob(executionTimeMs: number, totalTimeMs: number, numBlocks: number, numTxs: number) {
|
|
@@ -34,4 +110,34 @@ export class ProverNodeMetrics {
|
|
|
34
110
|
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
35
111
|
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
36
112
|
}
|
|
113
|
+
|
|
114
|
+
private recordTx(durationMs: number, stats: L1PublishStats) {
|
|
115
|
+
const attributes = {
|
|
116
|
+
[Attributes.L1_TX_TYPE]: 'submitProof',
|
|
117
|
+
[Attributes.L1_SENDER]: stats.sender,
|
|
118
|
+
} as const;
|
|
119
|
+
|
|
120
|
+
this.txCount.add(1, {
|
|
121
|
+
...attributes,
|
|
122
|
+
[Attributes.OK]: true,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
this.txDuration.record(Math.ceil(durationMs), attributes);
|
|
126
|
+
this.txGas.record(
|
|
127
|
+
// safe to downcast - total block limit is 30M gas which fits in a JS number
|
|
128
|
+
Number(stats.gasUsed),
|
|
129
|
+
attributes,
|
|
130
|
+
);
|
|
131
|
+
this.txCalldataGas.record(stats.calldataGas, attributes);
|
|
132
|
+
this.txCalldataSize.record(stats.calldataSize, attributes);
|
|
133
|
+
|
|
134
|
+
this.txBlobDataGasCost.record(Number(stats.blobDataGas), attributes);
|
|
135
|
+
this.txBlobDataGasUsed.record(Number(stats.blobGasUsed), attributes);
|
|
136
|
+
|
|
137
|
+
try {
|
|
138
|
+
this.gasPrice.record(parseInt(formatEther(stats.gasPrice, 'gwei'), 10));
|
|
139
|
+
} catch (e) {
|
|
140
|
+
// ignore
|
|
141
|
+
}
|
|
142
|
+
}
|
|
37
143
|
}
|
|
@@ -2,7 +2,6 @@ import { type EpochProofClaim } from '@aztec/circuit-types';
|
|
|
2
2
|
import { type EthAddress } from '@aztec/circuits.js';
|
|
3
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
4
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
|
-
import { type L1Publisher } from '@aztec/sequencer-client';
|
|
6
5
|
import {
|
|
7
6
|
type TelemetryClient,
|
|
8
7
|
type Traceable,
|
|
@@ -11,6 +10,8 @@ import {
|
|
|
11
10
|
trackSpan,
|
|
12
11
|
} from '@aztec/telemetry-client';
|
|
13
12
|
|
|
13
|
+
import { type ProverNodePublisher } from '../prover-node-publisher.js';
|
|
14
|
+
|
|
14
15
|
export interface ClaimsMonitorHandler {
|
|
15
16
|
handleClaim(proofClaim: EpochProofClaim): Promise<void>;
|
|
16
17
|
}
|
|
@@ -25,7 +26,7 @@ export class ClaimsMonitor implements Traceable {
|
|
|
25
26
|
public readonly tracer: Tracer;
|
|
26
27
|
|
|
27
28
|
constructor(
|
|
28
|
-
private readonly l1Publisher:
|
|
29
|
+
private readonly l1Publisher: ProverNodePublisher,
|
|
29
30
|
private options: { pollingIntervalMs: number },
|
|
30
31
|
telemetry: TelemetryClient = getTelemetryClient(),
|
|
31
32
|
) {
|
|
@@ -10,7 +10,7 @@ import { type EpochCache } from '@aztec/epoch-cache';
|
|
|
10
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
11
11
|
import { type DataStoreConfig } from '@aztec/kv-store/config';
|
|
12
12
|
import { createP2PClient } from '@aztec/p2p';
|
|
13
|
-
import { type TelemetryClient } from '@aztec/telemetry-client';
|
|
13
|
+
import { type TelemetryClient, makeTracedFetch } from '@aztec/telemetry-client';
|
|
14
14
|
|
|
15
15
|
import { type ProverNodeConfig } from '../config.js';
|
|
16
16
|
|
|
@@ -64,7 +64,7 @@ export async function createProverCoordination(
|
|
|
64
64
|
|
|
65
65
|
if (config.proverCoordinationNodeUrl) {
|
|
66
66
|
log.info('Using prover coordination via node url');
|
|
67
|
-
return createAztecNodeClient(config.proverCoordinationNodeUrl);
|
|
67
|
+
return createAztecNodeClient(config.proverCoordinationNodeUrl, makeTracedFetch([1, 2, 3], false));
|
|
68
68
|
} else {
|
|
69
69
|
throw new Error(`Aztec Node URL for Tx Provider is not set.`);
|
|
70
70
|
}
|