@aztec/prover-node 0.0.1-commit.fcb71a6 → 0.0.1-commit.fffb133c

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/src/metrics.ts CHANGED
@@ -13,7 +13,6 @@ import {
13
13
  type TelemetryClient,
14
14
  type Tracer,
15
15
  type UpDownCounter,
16
- ValueType,
17
16
  } from '@aztec/telemetry-client';
18
17
 
19
18
  import { formatEther, formatUnits } from 'viem';
@@ -30,28 +29,11 @@ export class ProverNodeJobMetrics {
30
29
  public readonly tracer: Tracer,
31
30
  private logger = createLogger('prover-node:publisher:metrics'),
32
31
  ) {
33
- this.proverEpochExecutionDuration = this.meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION, {
34
- description: 'Duration of execution of an epoch by the prover',
35
- unit: 'ms',
36
- valueType: ValueType.INT,
37
- });
38
- this.provingJobDuration = this.meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION, {
39
- description: 'Duration of proving job',
40
- unit: 's',
41
- valueType: ValueType.DOUBLE,
42
- });
43
- this.provingJobCheckpoints = this.meter.createGauge(Metrics.PROVER_NODE_JOB_CHECKPOINTS, {
44
- description: 'Number of checkpoints in a proven epoch',
45
- valueType: ValueType.INT,
46
- });
47
- this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS, {
48
- description: 'Number of blocks in a proven epoch',
49
- valueType: ValueType.INT,
50
- });
51
- this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS, {
52
- description: 'Number of transactions in a proven epoch',
53
- valueType: ValueType.INT,
54
- });
32
+ this.proverEpochExecutionDuration = this.meter.createHistogram(Metrics.PROVER_NODE_EXECUTION_DURATION);
33
+ this.provingJobDuration = this.meter.createHistogram(Metrics.PROVER_NODE_JOB_DURATION);
34
+ this.provingJobCheckpoints = this.meter.createGauge(Metrics.PROVER_NODE_JOB_CHECKPOINTS);
35
+ this.provingJobBlocks = this.meter.createGauge(Metrics.PROVER_NODE_JOB_BLOCKS);
36
+ this.provingJobTransactions = this.meter.createGauge(Metrics.PROVER_NODE_JOB_TRANSACTIONS);
55
37
  }
56
38
 
57
39
  public recordProvingJob(
@@ -81,15 +63,9 @@ export class ProverNodeRewardsMetrics {
81
63
  private rollup: RollupContract,
82
64
  private logger = createLogger('prover-node:publisher:metrics'),
83
65
  ) {
84
- this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH, {
85
- valueType: ValueType.DOUBLE,
86
- description: 'The rewards earned',
87
- });
66
+ this.rewards = this.meter.createObservableGauge(Metrics.PROVER_NODE_REWARDS_PER_EPOCH);
88
67
 
89
- this.accumulatedRewards = this.meter.createUpDownCounter(Metrics.PROVER_NODE_REWARDS_TOTAL, {
90
- valueType: ValueType.DOUBLE,
91
- description: 'The rewards earned (total)',
92
- });
68
+ this.accumulatedRewards = this.meter.createUpDownCounter(Metrics.PROVER_NODE_REWARDS_TOTAL);
93
69
  }
94
70
 
95
71
  public async start() {
@@ -150,68 +126,25 @@ export class ProverNodePublisherMetrics {
150
126
  ) {
151
127
  this.meter = client.getMeter(name);
152
128
 
153
- this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE, {
154
- description: 'The gas price used for transactions',
155
- unit: 'gwei',
156
- valueType: ValueType.DOUBLE,
157
- });
129
+ this.gasPrice = this.meter.createHistogram(Metrics.L1_PUBLISHER_GAS_PRICE);
158
130
 
159
- this.txCount = this.meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT, {
160
- description: 'The number of transactions processed',
161
- });
131
+ this.txCount = this.meter.createUpDownCounter(Metrics.L1_PUBLISHER_TX_COUNT);
162
132
 
163
- this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION, {
164
- description: 'The duration of transaction processing',
165
- unit: 'ms',
166
- valueType: ValueType.INT,
167
- });
133
+ this.txDuration = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_DURATION);
168
134
 
169
- this.txGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS, {
170
- description: 'The gas consumed by transactions',
171
- unit: 'gas',
172
- valueType: ValueType.INT,
173
- });
135
+ this.txGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_GAS);
174
136
 
175
- this.txCalldataSize = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE, {
176
- description: 'The size of the calldata in transactions',
177
- unit: 'By',
178
- valueType: ValueType.INT,
179
- });
137
+ this.txCalldataSize = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_SIZE);
180
138
 
181
- this.txCalldataGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS, {
182
- description: 'The gas consumed by the calldata in transactions',
183
- unit: 'gas',
184
- valueType: ValueType.INT,
185
- });
139
+ this.txCalldataGas = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_CALLDATA_GAS);
186
140
 
187
- this.txBlobDataGasUsed = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED, {
188
- description: 'The amount of blob gas used in transactions',
189
- unit: 'gas',
190
- valueType: ValueType.INT,
191
- });
141
+ this.txBlobDataGasUsed = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_USED);
192
142
 
193
- this.txBlobDataGasCost = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST, {
194
- description: 'The gas cost of blobs in transactions',
195
- unit: 'gwei',
196
- valueType: ValueType.INT,
197
- });
143
+ this.txBlobDataGasCost = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_BLOBDATA_GAS_COST);
198
144
 
199
- this.txTotalFee = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE, {
200
- description: 'How much L1 tx costs',
201
- unit: 'gwei',
202
- valueType: ValueType.DOUBLE,
203
- advice: {
204
- explicitBucketBoundaries: [
205
- 0.001, 0.002, 0.004, 0.008, 0.01, 0.02, 0.04, 0.08, 0.1, 0.2, 0.4, 0.8, 1, 1.2, 1.4, 1.8, 2,
206
- ],
207
- },
208
- });
145
+ this.txTotalFee = this.meter.createHistogram(Metrics.L1_PUBLISHER_TX_TOTAL_FEE);
209
146
 
210
- this.senderBalance = this.meter.createGauge(Metrics.L1_PUBLISHER_BALANCE, {
211
- unit: 'eth',
212
- description: 'The balance of the sender address',
213
- valueType: ValueType.DOUBLE,
214
- });
147
+ this.senderBalance = this.meter.createGauge(Metrics.L1_PUBLISHER_BALANCE);
215
148
  }
216
149
 
217
150
  recordFailedTx() {
@@ -4,13 +4,7 @@ import { RunningPromise } from '@aztec/foundation/running-promise';
4
4
  import { sleep } from '@aztec/foundation/sleep';
5
5
  import type { L2BlockSource } from '@aztec/stdlib/block';
6
6
  import { type L1RollupConstants, getEpochAtSlot } from '@aztec/stdlib/epoch-helpers';
7
- import {
8
- type TelemetryClient,
9
- type Traceable,
10
- type Tracer,
11
- getTelemetryClient,
12
- trackSpan,
13
- } from '@aztec/telemetry-client';
7
+ import { type TelemetryClient, type Traceable, type Tracer, getTelemetryClient } from '@aztec/telemetry-client';
14
8
 
15
9
  export interface EpochMonitorHandler {
16
10
  handleEpochReadyToProve(epochNumber: EpochNumber): Promise<boolean>;
@@ -73,7 +67,6 @@ export class EpochMonitor implements Traceable {
73
67
  this.log.info('Stopped EpochMonitor');
74
68
  }
75
69
 
76
- @trackSpan('EpochMonitor.work')
77
70
  public async work() {
78
71
  const { epochToProve, blockNumber, slotNumber } = await this.getEpochNumberToProve();
79
72
  this.log.debug(`Epoch to prove: ${epochToProve}`, { blockNumber, slotNumber });
@@ -172,17 +172,17 @@ export class ProverNodePublisher {
172
172
 
173
173
  // Check the archive for the immediate checkpoint before the epoch
174
174
  const checkpointLog = await this.rollupContract.getCheckpoint(CheckpointNumber(fromCheckpoint - 1));
175
- if (publicInputs.previousArchiveRoot.toString() !== checkpointLog.archive) {
175
+ if (!publicInputs.previousArchiveRoot.equals(checkpointLog.archive)) {
176
176
  throw new Error(
177
- `Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive}`,
177
+ `Previous archive root mismatch: ${publicInputs.previousArchiveRoot.toString()} !== ${checkpointLog.archive.toString()}`,
178
178
  );
179
179
  }
180
180
 
181
181
  // Check the archive for the last checkpoint in the epoch
182
182
  const endCheckpointLog = await this.rollupContract.getCheckpoint(toCheckpoint);
183
- if (publicInputs.endArchiveRoot.toString() !== endCheckpointLog.archive) {
183
+ if (!publicInputs.endArchiveRoot.equals(endCheckpointLog.archive)) {
184
184
  throw new Error(
185
- `End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive}`,
185
+ `End archive root mismatch: ${publicInputs.endArchiveRoot.toString()} !== ${endCheckpointLog.archive.toString()}`,
186
186
  );
187
187
  }
188
188
 
@@ -200,7 +200,7 @@ export class ProverNodePublisher {
200
200
  );
201
201
  const argsPublicInputs = [...publicInputs.toFields()];
202
202
 
203
- if (!areArraysEqual(rollupPublicInputs.map(Fr.fromHexString), argsPublicInputs, (a, b) => a.equals(b))) {
203
+ if (!areArraysEqual(rollupPublicInputs, argsPublicInputs, (a, b) => a.equals(b))) {
204
204
  const fmt = (inputs: Fr[] | readonly string[]) => inputs.map(x => x.toString()).join(', ');
205
205
  throw new Error(
206
206
  `Root rollup public inputs mismatch:\nRollup: ${fmt(rollupPublicInputs)}\nComputed:${fmt(argsPublicInputs)}`,
@@ -266,6 +266,7 @@ export class ProverNodePublisher {
266
266
  {
267
267
  previousArchive: args.publicInputs.previousArchiveRoot.toString(),
268
268
  endArchive: args.publicInputs.endArchiveRoot.toString(),
269
+ outHash: args.publicInputs.outHash.toString(),
269
270
  proverId: EthAddress.fromField(args.publicInputs.constants.proverId).toString(),
270
271
  } /*_args*/,
271
272
  makeTuple(AZTEC_MAX_EPOCH_DURATION * 2, i =>
@@ -311,7 +311,7 @@ export class ProverNode implements EpochMonitorHandler, ProverNodeApi, Traceable
311
311
  const l1ToL2Messages = await this.gatherMessages(epochNumber, checkpoints);
312
312
  const [firstBlock] = checkpoints[0].blocks;
313
313
  const previousBlockHeader = await this.gatherPreviousBlockHeader(epochNumber, firstBlock.number - 1);
314
- const [lastPublishedCheckpoint] = await this.l2BlockSource.getPublishedCheckpoints(checkpoints.at(-1)!.number, 1);
314
+ const [lastPublishedCheckpoint] = await this.l2BlockSource.getCheckpoints(checkpoints.at(-1)!.number, 1);
315
315
  const attestations = lastPublishedCheckpoint?.attestations ?? [];
316
316
 
317
317
  return { checkpoints, txs, l1ToL2Messages, epochNumber, previousBlockHeader, attestations };