@aztec/prover-node 0.85.0-alpha-testnet.2 → 0.85.0-nightly.20250418
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/factory.d.ts.map +1 -1
- package/dest/factory.js +3 -1
- 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 +1 -1
- package/dest/metrics.d.ts +27 -4
- package/dest/metrics.d.ts.map +1 -1
- package/dest/metrics.js +104 -36
- package/dest/prover-node-publisher.d.ts +1 -0
- package/dest/prover-node-publisher.d.ts.map +1 -1
- package/dest/prover-node-publisher.js +5 -2
- package/dest/prover-node.d.ts +3 -2
- package/dest/prover-node.d.ts.map +1 -1
- package/dest/prover-node.js +14 -7
- package/package.json +20 -22
- package/src/factory.ts +2 -1
- package/src/job/epoch-proving-job.ts +3 -3
- package/src/metrics.ts +111 -38
- package/src/prover-node-publisher.ts +7 -3
- package/src/prover-node.ts +21 -7
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAkB,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,KAAK,uBAAuB,EAAwB,MAAM,yBAAyB,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAwD,MAAM,iBAAiB,CAAC;AAClG,OAAO,EAAE,KAAK,MAAM,EAAgB,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAI9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC5F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,yBAAyB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AgB,EAAiB,MAAM,aAAa,CAAC;AAGnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,UAAU,EAA0B,MAAM,kBAAkB,CAAC;AAEtE,gDAAgD;AAChD,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,gBAAgB,GAAG,eAAe,EAC9C,IAAI,GAAE;IACJ,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mBAAmB,CAAC,EAAE,kBAAkB,CAAC;IACzC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAChC,cAAc,CAAC,EAAE,uBAAuB,CAAC;IACzC,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;CAClB,EACN,OAAO,GAAE;IACP,mBAAmB,CAAC,EAAE,kBAAkB,EAAE,CAAC;CACvC,uBAqEP"}
|
package/dest/factory.js
CHANGED
|
@@ -16,7 +16,9 @@ import { ProverNode } from './prover-node.js';
|
|
|
16
16
|
/** Creates a new prover node given a config. */ export async function createProverNode(userConfig, deps = {}, options = {}) {
|
|
17
17
|
const config = resolveConfig(userConfig);
|
|
18
18
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
19
|
-
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config
|
|
19
|
+
const blobSinkClient = deps.blobSinkClient ?? createBlobSinkClient(config, {
|
|
20
|
+
logger: createLogger('prover-node:blob-sink:client')
|
|
21
|
+
});
|
|
20
22
|
const log = deps.log ?? createLogger('prover-node');
|
|
21
23
|
await trySnapshotSync(config, log);
|
|
22
24
|
const archiver = deps.archiver ?? await createArchiver(config, blobSinkClient, {
|
|
@@ -4,7 +4,7 @@ import { type EpochProver, type EpochProvingJobState, EpochProvingJobTerminalSta
|
|
|
4
4
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
5
5
|
import type { Tx } from '@aztec/stdlib/tx';
|
|
6
6
|
import { type Traceable, type Tracer } from '@aztec/telemetry-client';
|
|
7
|
-
import type {
|
|
7
|
+
import type { ProverNodeJobMetrics } from '../metrics.js';
|
|
8
8
|
import type { ProverNodePublisher } from '../prover-node-publisher.js';
|
|
9
9
|
/**
|
|
10
10
|
* Job that grabs a range of blocks from the unfinalised chain from L1, gets their txs given their hashes,
|
|
@@ -31,7 +31,7 @@ export declare class EpochProvingJob implements Traceable {
|
|
|
31
31
|
private epochCheckPromise;
|
|
32
32
|
private deadlineTimeoutHandler;
|
|
33
33
|
readonly tracer: Tracer;
|
|
34
|
-
constructor(dbProvider: ForkMerkleTreeOperations, epochNumber: bigint, blocks: L2Block[], txs: Tx[], prover: EpochProver, publicProcessorFactory: PublicProcessorFactory, publisher: ProverNodePublisher, l2BlockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, metrics:
|
|
34
|
+
constructor(dbProvider: ForkMerkleTreeOperations, epochNumber: bigint, blocks: L2Block[], txs: Tx[], prover: EpochProver, publicProcessorFactory: PublicProcessorFactory, publisher: ProverNodePublisher, l2BlockSource: L2BlockSource, l1ToL2MessageSource: L1ToL2MessageSource, metrics: ProverNodeJobMetrics, deadline: Date | undefined, config?: {
|
|
35
35
|
parallelBlockLimit: number;
|
|
36
36
|
});
|
|
37
37
|
getId(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epoch-proving-job.d.ts","sourceRoot":"","sources":["../../src/job/epoch-proving-job.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAmB,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACvF,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,oBAAoB,EACzB,4BAA4B,EAC5B,KAAK,wBAAwB,EAC9B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAA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AAG,CAAiD;IAC5D,OAAO,CAAC,IAAI,CAAS;IAErB,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,iBAAiB,CAA6B;IACtD,OAAO,CAAC,sBAAsB,CAA6B;IAE3D,SAAgB,MAAM,EAAE,MAAM,CAAC;gBAGrB,UAAU,EAAE,wBAAwB,EACpC,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,OAAO,EAAE,EACjB,GAAG,EAAE,EAAE,EAAE,EACT,MAAM,EAAE,WAAW,EACnB,sBAAsB,EAAE,sBAAsB,EAC9C,SAAS,EAAE,mBAAmB,EAC9B,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,OAAO,EAAE,oBAAoB,EAC7B,QAAQ,EAAE,IAAI,GAAG,SAAS,EAC1B,MAAM,GAAE;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAA+B;IAMtE,KAAK,IAAI,MAAM;IAIf,QAAQ,IAAI,oBAAoB;IAIhC,cAAc,IAAI,MAAM;IAIxB,WAAW,IAAI,IAAI,GAAG,SAAS;IAItC;;OAEG;IAIU,GAAG;IAqGhB,OAAO,CAAC,aAAa;IAKrB,OAAO,CAAC,UAAU;IAML,IAAI,CAAC,KAAK,GAAE,4BAAwC;IASjE,OAAO,CAAC,oBAAoB;IAoB5B;;;OAGG;YACW,kBAAkB;YA2BlB,cAAc;YAOd,MAAM;IAQpB,OAAO,CAAC,iBAAiB;YAIX,UAAU;CAmBzB;AASD,OAAO,EAAE,KAAK,oBAAoB,EAAE,CAAC"}
|
|
@@ -53,7 +53,7 @@ import * as crypto from 'node:crypto';
|
|
|
53
53
|
this.state = 'initialized';
|
|
54
54
|
this.log = createLogger('prover-node:epoch-proving-job');
|
|
55
55
|
this.uuid = crypto.randomUUID();
|
|
56
|
-
this.tracer = metrics.
|
|
56
|
+
this.tracer = metrics.tracer;
|
|
57
57
|
}
|
|
58
58
|
getId() {
|
|
59
59
|
return this.uuid;
|
package/dest/metrics.d.ts
CHANGED
|
@@ -1,12 +1,35 @@
|
|
|
1
|
+
import type { RollupContract } from '@aztec/ethereum';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
1
3
|
import type { L1PublishProofStats } from '@aztec/stdlib/stats';
|
|
2
|
-
import { type Gauge, type Histogram, type TelemetryClient, type UpDownCounter } from '@aztec/telemetry-client';
|
|
3
|
-
export declare class
|
|
4
|
-
|
|
4
|
+
import { type Gauge, type Histogram, type Meter, type TelemetryClient, type Tracer, type UpDownCounter } from '@aztec/telemetry-client';
|
|
5
|
+
export declare class ProverNodeJobMetrics {
|
|
6
|
+
private meter;
|
|
7
|
+
readonly tracer: Tracer;
|
|
5
8
|
private logger;
|
|
6
9
|
proverEpochExecutionDuration: Histogram;
|
|
7
10
|
provingJobDuration: Histogram;
|
|
8
11
|
provingJobBlocks: Gauge;
|
|
9
12
|
provingJobTransactions: Gauge;
|
|
13
|
+
constructor(meter: Meter, tracer: Tracer, logger?: import("@aztec/foundation/log").Logger);
|
|
14
|
+
recordProvingJob(executionTimeMs: number, totalTimeMs: number, numBlocks: number, numTxs: number): void;
|
|
15
|
+
}
|
|
16
|
+
export declare class ProverNodeRewardsMetrics {
|
|
17
|
+
private meter;
|
|
18
|
+
private coinbase;
|
|
19
|
+
private rollup;
|
|
20
|
+
private logger;
|
|
21
|
+
private rewards;
|
|
22
|
+
private accumulatedRewards;
|
|
23
|
+
private prevEpoch;
|
|
24
|
+
private proofSubmissionWindow;
|
|
25
|
+
constructor(meter: Meter, coinbase: EthAddress, rollup: RollupContract, logger?: import("@aztec/foundation/log").Logger);
|
|
26
|
+
start(): Promise<void>;
|
|
27
|
+
stop(): void;
|
|
28
|
+
private observe;
|
|
29
|
+
}
|
|
30
|
+
export declare class ProverNodePublisherMetrics {
|
|
31
|
+
readonly client: TelemetryClient;
|
|
32
|
+
private logger;
|
|
10
33
|
gasPrice: Histogram;
|
|
11
34
|
txCount: UpDownCounter;
|
|
12
35
|
txDuration: Histogram;
|
|
@@ -17,10 +40,10 @@ export declare class ProverNodeMetrics {
|
|
|
17
40
|
txBlobDataGasCost: Histogram;
|
|
18
41
|
txTotalFee: Histogram;
|
|
19
42
|
private senderBalance;
|
|
43
|
+
private meter;
|
|
20
44
|
constructor(client: TelemetryClient, name?: string, logger?: import("@aztec/foundation/log").Logger);
|
|
21
45
|
recordFailedTx(): void;
|
|
22
46
|
recordSubmitProof(durationMs: number, stats: L1PublishProofStats): void;
|
|
23
|
-
recordProvingJob(executionTimeMs: number, totalTimeMs: number, numBlocks: number, numTxs: number): void;
|
|
24
47
|
recordSenderBalance(wei: bigint, senderAddress: string): void;
|
|
25
48
|
private recordTx;
|
|
26
49
|
}
|
package/dest/metrics.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../src/metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,KAAK,EAAE,mBAAmB,EAAkB,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAGL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,KAAK,EAGV,KAAK,eAAe,EACpB,KAAK,MAAM,EACX,KAAK,aAAa,EAEnB,MAAM,yBAAyB,CAAC;AAIjC,qBAAa,oBAAoB;IAO7B,OAAO,CAAC,KAAK;aACG,MAAM,EAAE,MAAM;IAC9B,OAAO,CAAC,MAAM;IARhB,4BAA4B,EAAE,SAAS,CAAC;IACxC,kBAAkB,EAAE,SAAS,CAAC;IAC9B,gBAAgB,EAAE,KAAK,CAAC;IACxB,sBAAsB,EAAE,KAAK,CAAC;gBAGpB,KAAK,EAAE,KAAK,EACJ,MAAM,EAAE,MAAM,E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1,84 +1,158 @@
|
|
|
1
1
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
2
|
import { Attributes, Metrics, ValueType } from '@aztec/telemetry-client';
|
|
3
|
-
import { formatEther } from 'viem';
|
|
4
|
-
export class
|
|
5
|
-
|
|
3
|
+
import { formatEther, formatUnits } from 'viem';
|
|
4
|
+
export class ProverNodeJobMetrics {
|
|
5
|
+
meter;
|
|
6
|
+
tracer;
|
|
6
7
|
logger;
|
|
7
8
|
proverEpochExecutionDuration;
|
|
8
9
|
provingJobDuration;
|
|
9
10
|
provingJobBlocks;
|
|
10
11
|
provingJobTransactions;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
txGas;
|
|
15
|
-
txCalldataSize;
|
|
16
|
-
txCalldataGas;
|
|
17
|
-
txBlobDataGasUsed;
|
|
18
|
-
txBlobDataGasCost;
|
|
19
|
-
txTotalFee;
|
|
20
|
-
senderBalance;
|
|
21
|
-
constructor(client, name = 'ProverNode', logger = createLogger('prover-node:publisher:metrics')){
|
|
22
|
-
this.client = client;
|
|
12
|
+
constructor(meter, tracer, logger = createLogger('prover-node:publisher:metrics')){
|
|
13
|
+
this.meter = meter;
|
|
14
|
+
this.tracer = tracer;
|
|
23
15
|
this.logger = logger;
|
|
24
|
-
|
|
25
|
-
this.proverEpochExecutionDuration = meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
|
|
16
|
+
this.proverEpochExecutionDuration = this.meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
|
|
26
17
|
description: 'Duration of execution of an epoch by the prover',
|
|
27
18
|
unit: 'ms',
|
|
28
19
|
valueType: ValueType.INT
|
|
29
20
|
});
|
|
30
|
-
this.provingJobDuration = meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
|
|
21
|
+
this.provingJobDuration = this.meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
|
|
31
22
|
description: 'Duration of proving job',
|
|
32
23
|
unit: 's',
|
|
33
24
|
valueType: ValueType.DOUBLE
|
|
34
25
|
});
|
|
35
|
-
this.provingJobBlocks = meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS, {
|
|
26
|
+
this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS, {
|
|
36
27
|
description: 'Number of blocks in a proven epoch',
|
|
37
28
|
valueType: ValueType.INT
|
|
38
29
|
});
|
|
39
|
-
this.provingJobTransactions = meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS, {
|
|
30
|
+
this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS, {
|
|
40
31
|
description: 'Number of transactions in a proven epoch',
|
|
41
32
|
valueType: ValueType.INT
|
|
42
33
|
});
|
|
43
|
-
|
|
34
|
+
}
|
|
35
|
+
recordProvingJob(executionTimeMs, totalTimeMs, numBlocks, numTxs) {
|
|
36
|
+
this.proverEpochExecutionDuration.record(Math.ceil(executionTimeMs));
|
|
37
|
+
this.provingJobDuration.record(totalTimeMs / 1000);
|
|
38
|
+
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
39
|
+
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
export class ProverNodeRewardsMetrics {
|
|
43
|
+
meter;
|
|
44
|
+
coinbase;
|
|
45
|
+
rollup;
|
|
46
|
+
logger;
|
|
47
|
+
rewards;
|
|
48
|
+
accumulatedRewards;
|
|
49
|
+
prevEpoch;
|
|
50
|
+
proofSubmissionWindow;
|
|
51
|
+
constructor(meter, coinbase, rollup, logger = createLogger('prover-node:publisher:metrics')){
|
|
52
|
+
this.meter = meter;
|
|
53
|
+
this.coinbase = coinbase;
|
|
54
|
+
this.rollup = rollup;
|
|
55
|
+
this.logger = logger;
|
|
56
|
+
this.prevEpoch = -1n;
|
|
57
|
+
this.proofSubmissionWindow = 0n;
|
|
58
|
+
this.observe = async (observer)=>{
|
|
59
|
+
const slot = await this.rollup.getSlotNumber();
|
|
60
|
+
// look at the prev epoch so that we get an accurate value, after proof submission window has closed
|
|
61
|
+
if (slot > this.proofSubmissionWindow) {
|
|
62
|
+
const closedEpoch = await this.rollup.getEpochNumberForSlotNumber(slot - this.proofSubmissionWindow);
|
|
63
|
+
const rewards = await this.rollup.getSpecificProverRewardsForEpoch(closedEpoch, this.coinbase);
|
|
64
|
+
const fmt = parseFloat(formatUnits(rewards, 18));
|
|
65
|
+
observer.observe(this.rewards, fmt, {
|
|
66
|
+
[Attributes.COINBASE]: this.coinbase.toString()
|
|
67
|
+
});
|
|
68
|
+
// only accumulate once per epoch
|
|
69
|
+
if (closedEpoch > this.prevEpoch) {
|
|
70
|
+
this.prevEpoch = closedEpoch;
|
|
71
|
+
this.accumulatedRewards.add(fmt, {
|
|
72
|
+
[Attributes.COINBASE]: this.coinbase.toString()
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH, {
|
|
78
|
+
valueType: ValueType.DOUBLE,
|
|
79
|
+
description: 'The rewards earned'
|
|
80
|
+
});
|
|
81
|
+
this.accumulatedRewards = this.meter.createUpDownCounter(Metrics.PROVER_NODE_REWARDS_TOTAL, {
|
|
82
|
+
valueType: ValueType.DOUBLE,
|
|
83
|
+
description: 'The rewards earned (total)'
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
async start() {
|
|
87
|
+
this.proofSubmissionWindow = await this.rollup.getProofSubmissionWindow();
|
|
88
|
+
this.meter.addBatchObservableCallback(this.observe, [
|
|
89
|
+
this.rewards
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
stop() {
|
|
93
|
+
this.meter.removeBatchObservableCallback(this.observe, [
|
|
94
|
+
this.rewards
|
|
95
|
+
]);
|
|
96
|
+
}
|
|
97
|
+
observe;
|
|
98
|
+
}
|
|
99
|
+
export class ProverNodePublisherMetrics {
|
|
100
|
+
client;
|
|
101
|
+
logger;
|
|
102
|
+
gasPrice;
|
|
103
|
+
txCount;
|
|
104
|
+
txDuration;
|
|
105
|
+
txGas;
|
|
106
|
+
txCalldataSize;
|
|
107
|
+
txCalldataGas;
|
|
108
|
+
txBlobDataGasUsed;
|
|
109
|
+
txBlobDataGasCost;
|
|
110
|
+
txTotalFee;
|
|
111
|
+
senderBalance;
|
|
112
|
+
meter;
|
|
113
|
+
constructor(client, name = 'ProverNode', logger = createLogger('prover-node:publisher:metrics')){
|
|
114
|
+
this.client = client;
|
|
115
|
+
this.logger = logger;
|
|
116
|
+
this.meter = client.getMeter(name);
|
|
117
|
+
this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE, {
|
|
44
118
|
description: 'The gas price used for transactions',
|
|
45
119
|
unit: 'gwei',
|
|
46
120
|
valueType: ValueType.DOUBLE
|
|
47
121
|
});
|
|
48
|
-
this.txCount = meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
122
|
+
this.txCount = this.meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
49
123
|
description: 'The number of transactions processed'
|
|
50
124
|
});
|
|
51
|
-
this.txDuration = meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
|
|
125
|
+
this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
|
|
52
126
|
description: 'The duration of transaction processing',
|
|
53
127
|
unit: 'ms',
|
|
54
128
|
valueType: ValueType.INT
|
|
55
129
|
});
|
|
56
|
-
this.txGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
|
|
130
|
+
this.txGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
|
|
57
131
|
description: 'The gas consumed by transactions',
|
|
58
132
|
unit: 'gas',
|
|
59
133
|
valueType: ValueType.INT
|
|
60
134
|
});
|
|
61
|
-
this.txCalldataSize = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
|
|
135
|
+
this.txCalldataSize = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
|
|
62
136
|
description: 'The size of the calldata in transactions',
|
|
63
137
|
unit: 'By',
|
|
64
138
|
valueType: ValueType.INT
|
|
65
139
|
});
|
|
66
|
-
this.txCalldataGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
|
|
140
|
+
this.txCalldataGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
|
|
67
141
|
description: 'The gas consumed by the calldata in transactions',
|
|
68
142
|
unit: 'gas',
|
|
69
143
|
valueType: ValueType.INT
|
|
70
144
|
});
|
|
71
|
-
this.txBlobDataGasUsed = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
|
|
145
|
+
this.txBlobDataGasUsed = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
|
|
72
146
|
description: 'The amount of blob gas used in transactions',
|
|
73
147
|
unit: 'gas',
|
|
74
148
|
valueType: ValueType.INT
|
|
75
149
|
});
|
|
76
|
-
this.txBlobDataGasCost = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
|
|
150
|
+
this.txBlobDataGasCost = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
|
|
77
151
|
description: 'The gas cost of blobs in transactions',
|
|
78
152
|
unit: 'gwei',
|
|
79
153
|
valueType: ValueType.INT
|
|
80
154
|
});
|
|
81
|
-
this.txTotalFee = meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
|
|
155
|
+
this.txTotalFee = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
|
|
82
156
|
description: 'How much L1 tx costs',
|
|
83
157
|
unit: 'gwei',
|
|
84
158
|
valueType: ValueType.DOUBLE,
|
|
@@ -104,7 +178,7 @@ export class ProverNodeMetrics {
|
|
|
104
178
|
]
|
|
105
179
|
}
|
|
106
180
|
});
|
|
107
|
-
this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
181
|
+
this.senderBalance = this.meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
108
182
|
unit: 'eth',
|
|
109
183
|
description: 'The balance of the sender address',
|
|
110
184
|
valueType: ValueType.DOUBLE
|
|
@@ -119,12 +193,6 @@ export class ProverNodeMetrics {
|
|
|
119
193
|
recordSubmitProof(durationMs, stats) {
|
|
120
194
|
this.recordTx(durationMs, stats);
|
|
121
195
|
}
|
|
122
|
-
recordProvingJob(executionTimeMs, totalTimeMs, numBlocks, numTxs) {
|
|
123
|
-
this.proverEpochExecutionDuration.record(Math.ceil(executionTimeMs));
|
|
124
|
-
this.provingJobDuration.record(totalTimeMs / 1000);
|
|
125
|
-
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
126
|
-
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
127
|
-
}
|
|
128
196
|
recordSenderBalance(wei, senderAddress) {
|
|
129
197
|
const eth = parseFloat(formatEther(wei, 'wei'));
|
|
130
198
|
this.senderBalance.record(eth, {
|
|
@@ -36,6 +36,7 @@ export declare class ProverNodePublisher {
|
|
|
36
36
|
l1TxUtils: L1TxUtils;
|
|
37
37
|
telemetry?: TelemetryClient;
|
|
38
38
|
});
|
|
39
|
+
getRollupContract(): RollupContract;
|
|
39
40
|
/**
|
|
40
41
|
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
41
42
|
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover-node-publisher.d.ts","sourceRoot":"","sources":["../src/prover-node-publisher.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE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7B;IAYI,iBAAiB;IAIxB;;;;;OAKG;IACI,SAAS;IAKhB,wDAAwD;IACjD,OAAO;IAIP,gBAAgB;IAIV,gBAAgB,CAAC,IAAI,EAAE;QAClC,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,OAAO,EAAE,MAAM,CAAC;QAChB,YAAY,EAAE,sBAAsB,CAAC;QACrC,KAAK,EAAE,KAAK,CAAC;KACd,GAAG,OAAO,CAAC,OAAO,CAAC;YA+CN,4BAA4B;YAwD5B,sBAAsB;IAmDpC,OAAO,CAAC,uBAAuB;cA8Bf,kBAAkB;CAGnC"}
|
|
@@ -9,7 +9,7 @@ import { Timer } from '@aztec/foundation/timer';
|
|
|
9
9
|
import { RollupAbi } from '@aztec/l1-artifacts';
|
|
10
10
|
import { getTelemetryClient } from '@aztec/telemetry-client';
|
|
11
11
|
import { encodeFunctionData } from 'viem';
|
|
12
|
-
import {
|
|
12
|
+
import { ProverNodePublisherMetrics } from './metrics.js';
|
|
13
13
|
export class ProverNodePublisher {
|
|
14
14
|
interruptibleSleep = new InterruptibleSleep();
|
|
15
15
|
sleepTimeMs;
|
|
@@ -21,10 +21,13 @@ export class ProverNodePublisher {
|
|
|
21
21
|
constructor(config, deps){
|
|
22
22
|
this.sleepTimeMs = config?.l1PublishRetryIntervalMS ?? 60_000;
|
|
23
23
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
24
|
-
this.metrics = new
|
|
24
|
+
this.metrics = new ProverNodePublisherMetrics(telemetry, 'ProverNode');
|
|
25
25
|
this.rollupContract = deps.rollupContract;
|
|
26
26
|
this.l1TxUtils = deps.l1TxUtils;
|
|
27
27
|
}
|
|
28
|
+
getRollupContract() {
|
|
29
|
+
return this.rollupContract;
|
|
30
|
+
}
|
|
28
31
|
/**
|
|
29
32
|
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
30
33
|
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
package/dest/prover-node.d.ts
CHANGED
|
@@ -39,7 +39,8 @@ export declare class ProverNode implements EpochMonitorHandler, ProverNodeApi, T
|
|
|
39
39
|
private dateProvider;
|
|
40
40
|
private jobs;
|
|
41
41
|
private options;
|
|
42
|
-
private
|
|
42
|
+
private jobMetrics;
|
|
43
|
+
private rewardsMetrics;
|
|
43
44
|
private l1Metrics;
|
|
44
45
|
private txFetcher;
|
|
45
46
|
private lastBlockNumber;
|
|
@@ -56,7 +57,7 @@ export declare class ProverNode implements EpochMonitorHandler, ProverNodeApi, T
|
|
|
56
57
|
* Starts the prover node so it periodically checks for unproven epochs in the unfinalised chain from L1 and
|
|
57
58
|
* starts proving jobs for them.
|
|
58
59
|
*/
|
|
59
|
-
start(): void
|
|
60
|
+
start(): Promise<void>;
|
|
60
61
|
/**
|
|
61
62
|
* Stops the prover node and all its dependencies.
|
|
62
63
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prover-node.d.ts","sourceRoot":"","sources":["../src/prover-node.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prover-node.d.ts","sourceRoot":"","sources":["../src/prover-node.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAEjE,OAAO,EACL,KAAK,kBAAkB,EAEvB,KAAK,kBAAkB,EACvB,KAAK,aAAa,EAClB,KAAK,OAAO,EACZ,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAE5B,MAAM,iCAAiC,CAAC;AACzC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC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E,MAAM,GAClB,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,oBAAoB,CAAA;KAAE,EAAE,CAAC;IAM5D,OAAO,CAAC,uBAAuB;YAMjB,gBAAgB;IA8B9B,OAAO,CAAC,cAAc;IAItB,kHAAkH;YAEpG,WAAW;YAeX,eAAe;YAQf,YAAY;YAQZ,SAAS;IAiBvB,sCAAsC;IACtC,SAAS,CAAC,uBAAuB,CAC/B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,IAAI,GAAG,SAAS,EAC1B,MAAM,EAAE,OAAO,EAAE,EACjB,GAAG,EAAE,EAAE,EAAE,EACT,sBAAsB,EAAE,sBAAsB;IAkBhD,sCAAsC;cACtB,eAAe;CAGhC"}
|
package/dest/prover-node.js
CHANGED
|
@@ -6,6 +6,7 @@ function _ts_decorate(decorators, target, key, desc) {
|
|
|
6
6
|
}
|
|
7
7
|
import { compact } from '@aztec/foundation/collection';
|
|
8
8
|
import { memoize } from '@aztec/foundation/decorators';
|
|
9
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
9
10
|
import { createLogger } from '@aztec/foundation/log';
|
|
10
11
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
11
12
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
@@ -14,7 +15,7 @@ import { getProofSubmissionDeadlineTimestamp } from '@aztec/stdlib/epoch-helpers
|
|
|
14
15
|
import { EpochProvingJobTerminalState, tryStop } from '@aztec/stdlib/interfaces/server';
|
|
15
16
|
import { Attributes, L1Metrics, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
16
17
|
import { EpochProvingJob } from './job/epoch-proving-job.js';
|
|
17
|
-
import {
|
|
18
|
+
import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
18
19
|
/**
|
|
19
20
|
* An Aztec Prover Node is a standalone process that monitors the unfinalised chain on L1 for unproven blocks,
|
|
20
21
|
* submits bids for proving them, and monitors if they are accepted. If so, the prover node fetches the txs
|
|
@@ -34,7 +35,8 @@ import { ProverNodeMetrics } from './metrics.js';
|
|
|
34
35
|
dateProvider;
|
|
35
36
|
jobs;
|
|
36
37
|
options;
|
|
37
|
-
|
|
38
|
+
jobMetrics;
|
|
39
|
+
rewardsMetrics;
|
|
38
40
|
l1Metrics;
|
|
39
41
|
txFetcher;
|
|
40
42
|
lastBlockNumber;
|
|
@@ -64,8 +66,10 @@ import { ProverNodeMetrics } from './metrics.js';
|
|
|
64
66
|
txGatheringMaxParallelRequests: 100,
|
|
65
67
|
...compact(options)
|
|
66
68
|
};
|
|
67
|
-
|
|
69
|
+
const meter = telemetryClient.getMeter('ProverNode');
|
|
68
70
|
this.tracer = telemetryClient.getTracer('ProverNode');
|
|
71
|
+
this.jobMetrics = new ProverNodeJobMetrics(meter, telemetryClient.getTracer('EpochProvingJob'));
|
|
72
|
+
this.rewardsMetrics = new ProverNodeRewardsMetrics(meter, EthAddress.fromField(this.prover.getProverId()), this.publisher.getRollupContract());
|
|
69
73
|
this.txFetcher = new RunningPromise(()=>this.checkForTxs(), this.log, this.options.txGatheringIntervalMs);
|
|
70
74
|
}
|
|
71
75
|
getProverId() {
|
|
@@ -105,10 +109,11 @@ import { ProverNodeMetrics } from './metrics.js';
|
|
|
105
109
|
/**
|
|
106
110
|
* Starts the prover node so it periodically checks for unproven epochs in the unfinalised chain from L1 and
|
|
107
111
|
* starts proving jobs for them.
|
|
108
|
-
*/ start() {
|
|
112
|
+
*/ async start() {
|
|
109
113
|
this.txFetcher.start();
|
|
110
114
|
this.epochsMonitor.start(this);
|
|
111
115
|
this.l1Metrics.start();
|
|
116
|
+
await this.rewardsMetrics.start();
|
|
112
117
|
this.log.info(`Started Prover Node with prover id ${this.prover.getProverId().toString()}`, this.options);
|
|
113
118
|
}
|
|
114
119
|
/**
|
|
@@ -124,11 +129,13 @@ import { ProverNodeMetrics } from './metrics.js';
|
|
|
124
129
|
await this.worldState.stop();
|
|
125
130
|
await tryStop(this.coordination);
|
|
126
131
|
this.l1Metrics.stop();
|
|
132
|
+
this.rewardsMetrics.stop();
|
|
127
133
|
await this.telemetryClient.stop();
|
|
128
134
|
this.log.info('Stopped ProverNode');
|
|
129
135
|
}
|
|
130
|
-
/** Returns world state status. */ getWorldStateSyncStatus() {
|
|
131
|
-
|
|
136
|
+
/** Returns world state status. */ async getWorldStateSyncStatus() {
|
|
137
|
+
const { syncSummary } = await this.worldState.status();
|
|
138
|
+
return syncSummary;
|
|
132
139
|
}
|
|
133
140
|
/** Returns archiver status. */ getL2Tips() {
|
|
134
141
|
return this.l2BlockSource.getL2Tips();
|
|
@@ -247,7 +254,7 @@ import { ProverNodeMetrics } from './metrics.js';
|
|
|
247
254
|
throw new Error(`Txs not found for epoch ${epochNumber}: ${missingTxHashes}`);
|
|
248
255
|
}
|
|
249
256
|
/** Extracted for testing purposes. */ doCreateEpochProvingJob(epochNumber, deadline, blocks, txs, publicProcessorFactory) {
|
|
250
|
-
return new EpochProvingJob(this.worldState, epochNumber, blocks, txs, this.prover.createEpochProver(), publicProcessorFactory, this.publisher, this.l2BlockSource, this.l1ToL2MessageSource, this.
|
|
257
|
+
return new EpochProvingJob(this.worldState, epochNumber, blocks, txs, this.prover.createEpochProver(), publicProcessorFactory, this.publisher, this.l2BlockSource, this.l1ToL2MessageSource, this.jobMetrics, deadline, {
|
|
251
258
|
parallelBlockLimit: this.options.maxParallelBlocksPerEpoch
|
|
252
259
|
});
|
|
253
260
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/prover-node",
|
|
3
|
-
"version": "0.85.0-
|
|
3
|
+
"version": "0.85.0-nightly.20250418",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -14,8 +14,6 @@
|
|
|
14
14
|
"build": "yarn clean && tsc -b",
|
|
15
15
|
"build:dev": "tsc -b --watch",
|
|
16
16
|
"clean": "rm -rf ./dest .tsbuildinfo",
|
|
17
|
-
"formatting": "run -T prettier --check ./src && run -T eslint ./src",
|
|
18
|
-
"formatting:fix": "run -T eslint --fix ./src && run -T prettier -w ./src",
|
|
19
17
|
"bb": "node --no-warnings ./dest/bb/index.js",
|
|
20
18
|
"test": "NODE_NO_WARNINGS=1 node --experimental-vm-modules ../node_modules/.bin/jest --passWithNoTests --maxWorkers=${JEST_MAX_WORKERS:-8}"
|
|
21
19
|
},
|
|
@@ -53,25 +51,25 @@
|
|
|
53
51
|
]
|
|
54
52
|
},
|
|
55
53
|
"dependencies": {
|
|
56
|
-
"@aztec/archiver": "0.85.0-
|
|
57
|
-
"@aztec/bb-prover": "0.85.0-
|
|
58
|
-
"@aztec/blob-sink": "0.85.0-
|
|
59
|
-
"@aztec/constants": "0.85.0-
|
|
60
|
-
"@aztec/epoch-cache": "0.85.0-
|
|
61
|
-
"@aztec/ethereum": "0.85.0-
|
|
62
|
-
"@aztec/foundation": "0.85.0-
|
|
63
|
-
"@aztec/kv-store": "0.85.0-
|
|
64
|
-
"@aztec/l1-artifacts": "0.85.0-
|
|
65
|
-
"@aztec/node-lib": "0.85.0-
|
|
66
|
-
"@aztec/noir-protocol-circuits-types": "0.85.0-
|
|
67
|
-
"@aztec/p2p": "0.85.0-
|
|
68
|
-
"@aztec/protocol-contracts": "0.85.0-
|
|
69
|
-
"@aztec/prover-client": "0.85.0-
|
|
70
|
-
"@aztec/sequencer-client": "0.85.0-
|
|
71
|
-
"@aztec/simulator": "0.85.0-
|
|
72
|
-
"@aztec/stdlib": "0.85.0-
|
|
73
|
-
"@aztec/telemetry-client": "0.85.0-
|
|
74
|
-
"@aztec/world-state": "0.85.0-
|
|
54
|
+
"@aztec/archiver": "0.85.0-nightly.20250418",
|
|
55
|
+
"@aztec/bb-prover": "0.85.0-nightly.20250418",
|
|
56
|
+
"@aztec/blob-sink": "0.85.0-nightly.20250418",
|
|
57
|
+
"@aztec/constants": "0.85.0-nightly.20250418",
|
|
58
|
+
"@aztec/epoch-cache": "0.85.0-nightly.20250418",
|
|
59
|
+
"@aztec/ethereum": "0.85.0-nightly.20250418",
|
|
60
|
+
"@aztec/foundation": "0.85.0-nightly.20250418",
|
|
61
|
+
"@aztec/kv-store": "0.85.0-nightly.20250418",
|
|
62
|
+
"@aztec/l1-artifacts": "0.85.0-nightly.20250418",
|
|
63
|
+
"@aztec/node-lib": "0.85.0-nightly.20250418",
|
|
64
|
+
"@aztec/noir-protocol-circuits-types": "0.85.0-nightly.20250418",
|
|
65
|
+
"@aztec/p2p": "0.85.0-nightly.20250418",
|
|
66
|
+
"@aztec/protocol-contracts": "0.85.0-nightly.20250418",
|
|
67
|
+
"@aztec/prover-client": "0.85.0-nightly.20250418",
|
|
68
|
+
"@aztec/sequencer-client": "0.85.0-nightly.20250418",
|
|
69
|
+
"@aztec/simulator": "0.85.0-nightly.20250418",
|
|
70
|
+
"@aztec/stdlib": "0.85.0-nightly.20250418",
|
|
71
|
+
"@aztec/telemetry-client": "0.85.0-nightly.20250418",
|
|
72
|
+
"@aztec/world-state": "0.85.0-nightly.20250418",
|
|
75
73
|
"source-map-support": "^0.5.21",
|
|
76
74
|
"tslib": "^2.4.0",
|
|
77
75
|
"viem": "2.23.7"
|
package/src/factory.ts
CHANGED
|
@@ -37,7 +37,8 @@ export async function createProverNode(
|
|
|
37
37
|
) {
|
|
38
38
|
const config = resolveConfig(userConfig);
|
|
39
39
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
40
|
-
const blobSinkClient =
|
|
40
|
+
const blobSinkClient =
|
|
41
|
+
deps.blobSinkClient ?? createBlobSinkClient(config, { logger: createLogger('prover-node:blob-sink:client') });
|
|
41
42
|
const log = deps.log ?? createLogger('prover-node');
|
|
42
43
|
|
|
43
44
|
await trySnapshotSync(config, log);
|
|
@@ -16,7 +16,7 @@ import { Attributes, type Traceable, type Tracer, trackSpan } from '@aztec/telem
|
|
|
16
16
|
|
|
17
17
|
import * as crypto from 'node:crypto';
|
|
18
18
|
|
|
19
|
-
import type {
|
|
19
|
+
import type { ProverNodeJobMetrics } from '../metrics.js';
|
|
20
20
|
import type { ProverNodePublisher } from '../prover-node-publisher.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
@@ -45,12 +45,12 @@ export class EpochProvingJob implements Traceable {
|
|
|
45
45
|
private publisher: ProverNodePublisher,
|
|
46
46
|
private l2BlockSource: L2BlockSource,
|
|
47
47
|
private l1ToL2MessageSource: L1ToL2MessageSource,
|
|
48
|
-
private metrics:
|
|
48
|
+
private metrics: ProverNodeJobMetrics,
|
|
49
49
|
private deadline: Date | undefined,
|
|
50
50
|
private config: { parallelBlockLimit: number } = { parallelBlockLimit: 32 },
|
|
51
51
|
) {
|
|
52
52
|
this.uuid = crypto.randomUUID();
|
|
53
|
-
this.tracer = metrics.
|
|
53
|
+
this.tracer = metrics.tracer;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
public getId(): string {
|
package/src/metrics.ts
CHANGED
|
@@ -1,107 +1,187 @@
|
|
|
1
|
+
import type { RollupContract } from '@aztec/ethereum';
|
|
2
|
+
import type { EthAddress } from '@aztec/foundation/eth-address';
|
|
1
3
|
import { createLogger } from '@aztec/foundation/log';
|
|
2
4
|
import type { L1PublishProofStats, L1PublishStats } from '@aztec/stdlib/stats';
|
|
3
5
|
import {
|
|
4
6
|
Attributes,
|
|
7
|
+
type BatchObservableResult,
|
|
5
8
|
type Gauge,
|
|
6
9
|
type Histogram,
|
|
10
|
+
type Meter,
|
|
7
11
|
Metrics,
|
|
12
|
+
type ObservableGauge,
|
|
8
13
|
type TelemetryClient,
|
|
14
|
+
type Tracer,
|
|
9
15
|
type UpDownCounter,
|
|
10
16
|
ValueType,
|
|
11
17
|
} from '@aztec/telemetry-client';
|
|
12
18
|
|
|
13
|
-
import { formatEther } from 'viem';
|
|
19
|
+
import { formatEther, formatUnits } from 'viem';
|
|
14
20
|
|
|
15
|
-
export class
|
|
21
|
+
export class ProverNodeJobMetrics {
|
|
16
22
|
proverEpochExecutionDuration: Histogram;
|
|
17
23
|
provingJobDuration: Histogram;
|
|
18
24
|
provingJobBlocks: Gauge;
|
|
19
25
|
provingJobTransactions: Gauge;
|
|
20
26
|
|
|
21
|
-
gasPrice: Histogram;
|
|
22
|
-
txCount: UpDownCounter;
|
|
23
|
-
txDuration: Histogram;
|
|
24
|
-
txGas: Histogram;
|
|
25
|
-
txCalldataSize: Histogram;
|
|
26
|
-
txCalldataGas: Histogram;
|
|
27
|
-
txBlobDataGasUsed: Histogram;
|
|
28
|
-
txBlobDataGasCost: Histogram;
|
|
29
|
-
txTotalFee: Histogram;
|
|
30
|
-
|
|
31
|
-
private senderBalance: Gauge;
|
|
32
|
-
|
|
33
27
|
constructor(
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
private meter: Meter,
|
|
29
|
+
public readonly tracer: Tracer,
|
|
36
30
|
private logger = createLogger('prover-node:publisher:metrics'),
|
|
37
31
|
) {
|
|
38
|
-
|
|
39
|
-
this.proverEpochExecutionDuration = meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
|
|
32
|
+
this.proverEpochExecutionDuration = this.meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
|
|
40
33
|
description: 'Duration of execution of an epoch by the prover',
|
|
41
34
|
unit: 'ms',
|
|
42
35
|
valueType: ValueType.INT,
|
|
43
36
|
});
|
|
44
|
-
this.provingJobDuration = meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
|
|
37
|
+
this.provingJobDuration = this.meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
|
|
45
38
|
description: 'Duration of proving job',
|
|
46
39
|
unit: 's',
|
|
47
40
|
valueType: ValueType.DOUBLE,
|
|
48
41
|
});
|
|
49
|
-
this.provingJobBlocks = meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS, {
|
|
42
|
+
this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS, {
|
|
50
43
|
description: 'Number of blocks in a proven epoch',
|
|
51
44
|
valueType: ValueType.INT,
|
|
52
45
|
});
|
|
53
|
-
this.provingJobTransactions = meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS, {
|
|
46
|
+
this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS, {
|
|
54
47
|
description: 'Number of transactions in a proven epoch',
|
|
55
48
|
valueType: ValueType.INT,
|
|
56
49
|
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
public recordProvingJob(executionTimeMs: number, totalTimeMs: number, numBlocks: number, numTxs: number) {
|
|
53
|
+
this.proverEpochExecutionDuration.record(Math.ceil(executionTimeMs));
|
|
54
|
+
this.provingJobDuration.record(totalTimeMs / 1000);
|
|
55
|
+
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
56
|
+
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export class ProverNodeRewardsMetrics {
|
|
61
|
+
private rewards: ObservableGauge;
|
|
62
|
+
private accumulatedRewards: UpDownCounter;
|
|
63
|
+
private prevEpoch = -1n;
|
|
64
|
+
private proofSubmissionWindow = 0n;
|
|
65
|
+
|
|
66
|
+
constructor(
|
|
67
|
+
private meter: Meter,
|
|
68
|
+
private coinbase: EthAddress,
|
|
69
|
+
private rollup: RollupContract,
|
|
70
|
+
private logger = createLogger('prover-node:publisher:metrics'),
|
|
71
|
+
) {
|
|
72
|
+
this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH, {
|
|
73
|
+
valueType: ValueType.DOUBLE,
|
|
74
|
+
description: 'The rewards earned',
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
this.accumulatedRewards = this.meter.createUpDownCounter(Metrics.PROVER_NODE_REWARDS_TOTAL, {
|
|
78
|
+
valueType: ValueType.DOUBLE,
|
|
79
|
+
description: 'The rewards earned (total)',
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
public async start() {
|
|
84
|
+
this.proofSubmissionWindow = await this.rollup.getProofSubmissionWindow();
|
|
85
|
+
this.meter.addBatchObservableCallback(this.observe, [this.rewards]);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public stop() {
|
|
89
|
+
this.meter.removeBatchObservableCallback(this.observe, [this.rewards]);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
private observe = async (observer: BatchObservableResult): Promise<void> => {
|
|
93
|
+
const slot = await this.rollup.getSlotNumber();
|
|
94
|
+
|
|
95
|
+
// look at the prev epoch so that we get an accurate value, after proof submission window has closed
|
|
96
|
+
if (slot > this.proofSubmissionWindow) {
|
|
97
|
+
const closedEpoch = await this.rollup.getEpochNumberForSlotNumber(slot - this.proofSubmissionWindow);
|
|
98
|
+
const rewards = await this.rollup.getSpecificProverRewardsForEpoch(closedEpoch, this.coinbase);
|
|
99
|
+
|
|
100
|
+
const fmt = parseFloat(formatUnits(rewards, 18));
|
|
101
|
+
|
|
102
|
+
observer.observe(this.rewards, fmt, {
|
|
103
|
+
[Attributes.COINBASE]: this.coinbase.toString(),
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// only accumulate once per epoch
|
|
107
|
+
if (closedEpoch > this.prevEpoch) {
|
|
108
|
+
this.prevEpoch = closedEpoch;
|
|
109
|
+
this.accumulatedRewards.add(fmt, {
|
|
110
|
+
[Attributes.COINBASE]: this.coinbase.toString(),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
57
116
|
|
|
58
|
-
|
|
117
|
+
export class ProverNodePublisherMetrics {
|
|
118
|
+
gasPrice: Histogram;
|
|
119
|
+
txCount: UpDownCounter;
|
|
120
|
+
txDuration: Histogram;
|
|
121
|
+
txGas: Histogram;
|
|
122
|
+
txCalldataSize: Histogram;
|
|
123
|
+
txCalldataGas: Histogram;
|
|
124
|
+
txBlobDataGasUsed: Histogram;
|
|
125
|
+
txBlobDataGasCost: Histogram;
|
|
126
|
+
txTotalFee: Histogram;
|
|
127
|
+
|
|
128
|
+
private senderBalance: Gauge;
|
|
129
|
+
private meter: Meter;
|
|
130
|
+
|
|
131
|
+
constructor(
|
|
132
|
+
public readonly client: TelemetryClient,
|
|
133
|
+
name = 'ProverNode',
|
|
134
|
+
private logger = createLogger('prover-node:publisher:metrics'),
|
|
135
|
+
) {
|
|
136
|
+
this.meter = client.getMeter(name);
|
|
137
|
+
|
|
138
|
+
this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE, {
|
|
59
139
|
description: 'The gas price used for transactions',
|
|
60
140
|
unit: 'gwei',
|
|
61
141
|
valueType: ValueType.DOUBLE,
|
|
62
142
|
});
|
|
63
143
|
|
|
64
|
-
this.txCount = meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
144
|
+
this.txCount = this.meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
|
|
65
145
|
description: 'The number of transactions processed',
|
|
66
146
|
});
|
|
67
147
|
|
|
68
|
-
this.txDuration = meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
|
|
148
|
+
this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
|
|
69
149
|
description: 'The duration of transaction processing',
|
|
70
150
|
unit: 'ms',
|
|
71
151
|
valueType: ValueType.INT,
|
|
72
152
|
});
|
|
73
153
|
|
|
74
|
-
this.txGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
|
|
154
|
+
this.txGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
|
|
75
155
|
description: 'The gas consumed by transactions',
|
|
76
156
|
unit: 'gas',
|
|
77
157
|
valueType: ValueType.INT,
|
|
78
158
|
});
|
|
79
159
|
|
|
80
|
-
this.txCalldataSize = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
|
|
160
|
+
this.txCalldataSize = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
|
|
81
161
|
description: 'The size of the calldata in transactions',
|
|
82
162
|
unit: 'By',
|
|
83
163
|
valueType: ValueType.INT,
|
|
84
164
|
});
|
|
85
165
|
|
|
86
|
-
this.txCalldataGas = meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
|
|
166
|
+
this.txCalldataGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
|
|
87
167
|
description: 'The gas consumed by the calldata in transactions',
|
|
88
168
|
unit: 'gas',
|
|
89
169
|
valueType: ValueType.INT,
|
|
90
170
|
});
|
|
91
171
|
|
|
92
|
-
this.txBlobDataGasUsed = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
|
|
172
|
+
this.txBlobDataGasUsed = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
|
|
93
173
|
description: 'The amount of blob gas used in transactions',
|
|
94
174
|
unit: 'gas',
|
|
95
175
|
valueType: ValueType.INT,
|
|
96
176
|
});
|
|
97
177
|
|
|
98
|
-
this.txBlobDataGasCost = meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
|
|
178
|
+
this.txBlobDataGasCost = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
|
|
99
179
|
description: 'The gas cost of blobs in transactions',
|
|
100
180
|
unit: 'gwei',
|
|
101
181
|
valueType: ValueType.INT,
|
|
102
182
|
});
|
|
103
183
|
|
|
104
|
-
this.txTotalFee = meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
|
|
184
|
+
this.txTotalFee = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
|
|
105
185
|
description: 'How much L1 tx costs',
|
|
106
186
|
unit: 'gwei',
|
|
107
187
|
valueType: ValueType.DOUBLE,
|
|
@@ -112,7 +192,7 @@ export class ProverNodeMetrics {
|
|
|
112
192
|
},
|
|
113
193
|
});
|
|
114
194
|
|
|
115
|
-
this.senderBalance = meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
195
|
+
this.senderBalance = this.meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
|
|
116
196
|
unit: 'eth',
|
|
117
197
|
description: 'The balance of the sender address',
|
|
118
198
|
valueType: ValueType.DOUBLE,
|
|
@@ -130,13 +210,6 @@ export class ProverNodeMetrics {
|
|
|
130
210
|
this.recordTx(durationMs, stats);
|
|
131
211
|
}
|
|
132
212
|
|
|
133
|
-
public recordProvingJob(executionTimeMs: number, totalTimeMs: number, numBlocks: number, numTxs: number) {
|
|
134
|
-
this.proverEpochExecutionDuration.record(Math.ceil(executionTimeMs));
|
|
135
|
-
this.provingJobDuration.record(totalTimeMs / 1000);
|
|
136
|
-
this.provingJobBlocks.record(Math.floor(numBlocks));
|
|
137
|
-
this.provingJobTransactions.record(Math.floor(numTxs));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
213
|
public recordSenderBalance(wei: bigint, senderAddress: string) {
|
|
141
214
|
const eth = parseFloat(formatEther(wei, 'wei'));
|
|
142
215
|
this.senderBalance.record(eth, {
|
|
@@ -17,7 +17,7 @@ import { type TelemetryClient, getTelemetryClient } from '@aztec/telemetry-clien
|
|
|
17
17
|
|
|
18
18
|
import { type Hex, type TransactionReceipt, encodeFunctionData } from 'viem';
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { ProverNodePublisherMetrics } from './metrics.js';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
23
|
* Stats for a sent transaction.
|
|
@@ -40,7 +40,7 @@ export class ProverNodePublisher {
|
|
|
40
40
|
private interruptibleSleep = new InterruptibleSleep();
|
|
41
41
|
private sleepTimeMs: number;
|
|
42
42
|
private interrupted = false;
|
|
43
|
-
private metrics:
|
|
43
|
+
private metrics: ProverNodePublisherMetrics;
|
|
44
44
|
|
|
45
45
|
protected log = createLogger('prover-node:l1-tx-publisher');
|
|
46
46
|
|
|
@@ -60,12 +60,16 @@ export class ProverNodePublisher {
|
|
|
60
60
|
|
|
61
61
|
const telemetry = deps.telemetry ?? getTelemetryClient();
|
|
62
62
|
|
|
63
|
-
this.metrics = new
|
|
63
|
+
this.metrics = new ProverNodePublisherMetrics(telemetry, 'ProverNode');
|
|
64
64
|
|
|
65
65
|
this.rollupContract = deps.rollupContract;
|
|
66
66
|
this.l1TxUtils = deps.l1TxUtils;
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
+
public getRollupContract() {
|
|
70
|
+
return this.rollupContract;
|
|
71
|
+
}
|
|
72
|
+
|
|
69
73
|
/**
|
|
70
74
|
* Calling `interrupt` will cause any in progress call to `publishRollup` to return `false` asap.
|
|
71
75
|
* Be warned, the call may return false even if the tx subsequently gets successfully mined.
|
package/src/prover-node.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { compact } from '@aztec/foundation/collection';
|
|
2
2
|
import { memoize } from '@aztec/foundation/decorators';
|
|
3
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
3
4
|
import { createLogger } from '@aztec/foundation/log';
|
|
4
5
|
import { RunningPromise } from '@aztec/foundation/running-promise';
|
|
5
6
|
import { DateProvider } from '@aztec/foundation/timer';
|
|
@@ -33,7 +34,7 @@ import {
|
|
|
33
34
|
} from '@aztec/telemetry-client';
|
|
34
35
|
|
|
35
36
|
import { EpochProvingJob, type EpochProvingJobState } from './job/epoch-proving-job.js';
|
|
36
|
-
import {
|
|
37
|
+
import { ProverNodeJobMetrics, ProverNodeRewardsMetrics } from './metrics.js';
|
|
37
38
|
import type { EpochMonitor, EpochMonitorHandler } from './monitors/epoch-monitor.js';
|
|
38
39
|
import type { ProverNodePublisher } from './prover-node-publisher.js';
|
|
39
40
|
|
|
@@ -58,7 +59,8 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
58
59
|
|
|
59
60
|
private jobs: Map<string, EpochProvingJob> = new Map();
|
|
60
61
|
private options: ProverNodeOptions;
|
|
61
|
-
private
|
|
62
|
+
private jobMetrics: ProverNodeJobMetrics;
|
|
63
|
+
private rewardsMetrics: ProverNodeRewardsMetrics;
|
|
62
64
|
private l1Metrics: L1Metrics;
|
|
63
65
|
|
|
64
66
|
private txFetcher: RunningPromise;
|
|
@@ -92,8 +94,17 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
92
94
|
...compact(options),
|
|
93
95
|
};
|
|
94
96
|
|
|
95
|
-
|
|
97
|
+
const meter = telemetryClient.getMeter('ProverNode');
|
|
96
98
|
this.tracer = telemetryClient.getTracer('ProverNode');
|
|
99
|
+
|
|
100
|
+
this.jobMetrics = new ProverNodeJobMetrics(meter, telemetryClient.getTracer('EpochProvingJob'));
|
|
101
|
+
|
|
102
|
+
this.rewardsMetrics = new ProverNodeRewardsMetrics(
|
|
103
|
+
meter,
|
|
104
|
+
EthAddress.fromField(this.prover.getProverId()),
|
|
105
|
+
this.publisher.getRollupContract(),
|
|
106
|
+
);
|
|
107
|
+
|
|
97
108
|
this.txFetcher = new RunningPromise(() => this.checkForTxs(), this.log, this.options.txGatheringIntervalMs);
|
|
98
109
|
}
|
|
99
110
|
|
|
@@ -139,10 +150,11 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
139
150
|
* Starts the prover node so it periodically checks for unproven epochs in the unfinalised chain from L1 and
|
|
140
151
|
* starts proving jobs for them.
|
|
141
152
|
*/
|
|
142
|
-
start() {
|
|
153
|
+
async start() {
|
|
143
154
|
this.txFetcher.start();
|
|
144
155
|
this.epochsMonitor.start(this);
|
|
145
156
|
this.l1Metrics.start();
|
|
157
|
+
await this.rewardsMetrics.start();
|
|
146
158
|
this.log.info(`Started Prover Node with prover id ${this.prover.getProverId().toString()}`, this.options);
|
|
147
159
|
}
|
|
148
160
|
|
|
@@ -160,13 +172,15 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
160
172
|
await this.worldState.stop();
|
|
161
173
|
await tryStop(this.coordination);
|
|
162
174
|
this.l1Metrics.stop();
|
|
175
|
+
this.rewardsMetrics.stop();
|
|
163
176
|
await this.telemetryClient.stop();
|
|
164
177
|
this.log.info('Stopped ProverNode');
|
|
165
178
|
}
|
|
166
179
|
|
|
167
180
|
/** Returns world state status. */
|
|
168
|
-
public getWorldStateSyncStatus(): Promise<WorldStateSyncStatus> {
|
|
169
|
-
|
|
181
|
+
public async getWorldStateSyncStatus(): Promise<WorldStateSyncStatus> {
|
|
182
|
+
const { syncSummary } = await this.worldState.status();
|
|
183
|
+
return syncSummary;
|
|
170
184
|
}
|
|
171
185
|
|
|
172
186
|
/** Returns archiver status. */
|
|
@@ -336,7 +350,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
|
|
|
336
350
|
this.publisher,
|
|
337
351
|
this.l2BlockSource,
|
|
338
352
|
this.l1ToL2MessageSource,
|
|
339
|
-
this.
|
|
353
|
+
this.jobMetrics,
|
|
340
354
|
deadline,
|
|
341
355
|
{ parallelBlockLimit: this.options.maxParallelBlocksPerEpoch },
|
|
342
356
|
);
|