@aztec/sequencer-client 4.0.0-nightly.20260107 → 4.0.0-nightly.20260110
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/global_variable_builder/global_builder.d.ts +4 -4
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +11 -11
- package/dest/publisher/sequencer-publisher-metrics.d.ts +1 -1
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +15 -86
- package/dest/publisher/sequencer-publisher.d.ts +3 -2
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +398 -3
- package/dest/sequencer/checkpoint_proposal_job.d.ts +5 -3
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +429 -1
- package/dest/sequencer/metrics.d.ts +1 -1
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +27 -118
- package/dest/sequencer/sequencer.d.ts +2 -1
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +18 -6
- package/dest/test/utils.d.ts +1 -1
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +3 -4
- package/package.json +27 -27
- package/src/global_variable_builder/global_builder.ts +11 -11
- package/src/publisher/sequencer-publisher-metrics.ts +14 -70
- package/src/publisher/sequencer-publisher.ts +9 -3
- package/src/sequencer/checkpoint_proposal_job.ts +17 -1
- package/src/sequencer/metrics.ts +20 -128
- package/src/sequencer/sequencer.ts +5 -2
- package/src/test/utils.ts +4 -10
package/src/sequencer/metrics.ts
CHANGED
|
@@ -11,7 +11,6 @@ import {
|
|
|
11
11
|
type TelemetryClient,
|
|
12
12
|
type Tracer,
|
|
13
13
|
type UpDownCounter,
|
|
14
|
-
ValueType,
|
|
15
14
|
} from '@aztec/telemetry-client';
|
|
16
15
|
|
|
17
16
|
import { type Hex, formatUnits } from 'viem';
|
|
@@ -70,33 +69,13 @@ export class SequencerMetrics {
|
|
|
70
69
|
|
|
71
70
|
this.blockCounter = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_COUNT);
|
|
72
71
|
|
|
73
|
-
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION
|
|
74
|
-
unit: 'ms',
|
|
75
|
-
description: 'Duration to build a block',
|
|
76
|
-
valueType: ValueType.INT,
|
|
77
|
-
});
|
|
72
|
+
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION);
|
|
78
73
|
|
|
79
|
-
this.blockBuildManaPerSecond = this.meter.createGauge(Metrics.SEQUENCER_BLOCK_BUILD_MANA_PER_SECOND
|
|
80
|
-
unit: 'mana/s',
|
|
81
|
-
description: 'Mana per second when building a block',
|
|
82
|
-
valueType: ValueType.INT,
|
|
83
|
-
});
|
|
74
|
+
this.blockBuildManaPerSecond = this.meter.createGauge(Metrics.SEQUENCER_BLOCK_BUILD_MANA_PER_SECOND);
|
|
84
75
|
|
|
85
|
-
this.stateTransitionBufferDuration = this.meter.createHistogram(
|
|
86
|
-
Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION,
|
|
87
|
-
{
|
|
88
|
-
unit: 'ms',
|
|
89
|
-
description:
|
|
90
|
-
'The time difference between when the sequencer needed to transition to a new state and when it actually did.',
|
|
91
|
-
valueType: ValueType.INT,
|
|
92
|
-
},
|
|
93
|
-
);
|
|
76
|
+
this.stateTransitionBufferDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION);
|
|
94
77
|
|
|
95
|
-
this.blockAttestationDelay = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_ATTESTATION_DELAY
|
|
96
|
-
unit: 'ms',
|
|
97
|
-
description: 'The time difference between block proposal and minimal attestation count reached,',
|
|
98
|
-
valueType: ValueType.INT,
|
|
99
|
-
});
|
|
78
|
+
this.blockAttestationDelay = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_ATTESTATION_DELAY);
|
|
100
79
|
|
|
101
80
|
// Init gauges and counters
|
|
102
81
|
this.blockCounter.add(0, {
|
|
@@ -106,152 +85,65 @@ export class SequencerMetrics {
|
|
|
106
85
|
[Attributes.STATUS]: 'built',
|
|
107
86
|
});
|
|
108
87
|
|
|
109
|
-
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_REWARDS
|
|
110
|
-
valueType: ValueType.DOUBLE,
|
|
111
|
-
description: 'The rewards earned',
|
|
112
|
-
});
|
|
88
|
+
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_REWARDS);
|
|
113
89
|
|
|
114
|
-
this.slots = this.meter.createUpDownCounter(Metrics.SEQUENCER_SLOT_COUNT
|
|
115
|
-
valueType: ValueType.INT,
|
|
116
|
-
description: 'The number of slots this sequencer was selected for',
|
|
117
|
-
});
|
|
90
|
+
this.slots = this.meter.createUpDownCounter(Metrics.SEQUENCER_SLOT_COUNT);
|
|
118
91
|
|
|
119
92
|
/**
|
|
120
93
|
* NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
|
|
121
94
|
* Instead, use a computed metric, `slots - filledSlots` to get the number of slots a sequencer has missed.
|
|
122
95
|
*/
|
|
123
|
-
this.filledSlots = this.meter.createUpDownCounter(Metrics.SEQUENCER_FILLED_SLOT_COUNT
|
|
124
|
-
valueType: ValueType.INT,
|
|
125
|
-
description: 'The number of slots this sequencer has filled',
|
|
126
|
-
});
|
|
96
|
+
this.filledSlots = this.meter.createUpDownCounter(Metrics.SEQUENCER_FILLED_SLOT_COUNT);
|
|
127
97
|
|
|
128
|
-
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION
|
|
129
|
-
description: 'The time spent collecting attestations from committee members',
|
|
130
|
-
unit: 'ms',
|
|
131
|
-
valueType: ValueType.INT,
|
|
132
|
-
});
|
|
98
|
+
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION);
|
|
133
99
|
|
|
134
|
-
this.allowanceToCollectAttestations = this.meter.createGauge(
|
|
135
|
-
Metrics.SEQUENCER_COLLECT_ATTESTATIONS_TIME_ALLOWANCE,
|
|
136
|
-
{
|
|
137
|
-
description: 'Maximum amount of time to collect attestations',
|
|
138
|
-
unit: 'ms',
|
|
139
|
-
valueType: ValueType.INT,
|
|
140
|
-
},
|
|
141
|
-
);
|
|
100
|
+
this.allowanceToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_TIME_ALLOWANCE);
|
|
142
101
|
|
|
143
|
-
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT
|
|
144
|
-
valueType: ValueType.INT,
|
|
145
|
-
description: 'The minimum number of attestations required to publish a block',
|
|
146
|
-
});
|
|
102
|
+
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT);
|
|
147
103
|
|
|
148
|
-
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT
|
|
149
|
-
valueType: ValueType.INT,
|
|
150
|
-
description: 'The minimum number of attestations required to publish a block',
|
|
151
|
-
});
|
|
104
|
+
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT);
|
|
152
105
|
|
|
153
|
-
this.blockProposalFailed = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT
|
|
154
|
-
valueType: ValueType.INT,
|
|
155
|
-
description: 'The number of times block proposal failed (including validation builds)',
|
|
156
|
-
});
|
|
106
|
+
this.blockProposalFailed = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT);
|
|
157
107
|
|
|
158
|
-
this.blockProposalSuccess = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_SUCCESS_COUNT
|
|
159
|
-
valueType: ValueType.INT,
|
|
160
|
-
description: 'The number of times block proposal succeeded (including validation builds)',
|
|
161
|
-
});
|
|
108
|
+
this.blockProposalSuccess = this.meter.createUpDownCounter(Metrics.SEQUENCER_BLOCK_PROPOSAL_SUCCESS_COUNT);
|
|
162
109
|
|
|
163
|
-
this.checkpointSuccess = this.meter.createUpDownCounter(Metrics.SEQUENCER_CHECKPOINT_SUCCESS_COUNT
|
|
164
|
-
valueType: ValueType.INT,
|
|
165
|
-
description: 'The number of times checkpoint publishing succeeded',
|
|
166
|
-
});
|
|
110
|
+
this.checkpointSuccess = this.meter.createUpDownCounter(Metrics.SEQUENCER_CHECKPOINT_SUCCESS_COUNT);
|
|
167
111
|
|
|
168
112
|
this.blockProposalPrecheckFailed = this.meter.createUpDownCounter(
|
|
169
113
|
Metrics.SEQUENCER_BLOCK_PROPOSAL_PRECHECK_FAILED_COUNT,
|
|
170
|
-
{
|
|
171
|
-
valueType: ValueType.INT,
|
|
172
|
-
description: 'The number of times block proposal pre-build checks failed',
|
|
173
|
-
},
|
|
174
114
|
);
|
|
175
115
|
|
|
176
|
-
this.slashingAttempts = this.meter.createUpDownCounter(Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT
|
|
177
|
-
valueType: ValueType.INT,
|
|
178
|
-
description: 'The number of slashing action attempts',
|
|
179
|
-
});
|
|
116
|
+
this.slashingAttempts = this.meter.createUpDownCounter(Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT);
|
|
180
117
|
|
|
181
118
|
// Fisherman fee analysis metrics
|
|
182
|
-
this.fishermanWouldBeIncluded = this.meter.createUpDownCounter(Metrics.FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED
|
|
183
|
-
valueType: ValueType.INT,
|
|
184
|
-
description: 'Whether the transaction would have been included in the block',
|
|
185
|
-
});
|
|
119
|
+
this.fishermanWouldBeIncluded = this.meter.createUpDownCounter(Metrics.FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED);
|
|
186
120
|
|
|
187
|
-
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK
|
|
188
|
-
unit: 'ms',
|
|
189
|
-
description: 'Time in ms between fee analysis and block being mined',
|
|
190
|
-
valueType: ValueType.INT,
|
|
191
|
-
});
|
|
121
|
+
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK);
|
|
192
122
|
|
|
193
|
-
this.fishermanPendingBlobTxCount = this.meter.createHistogram(
|
|
194
|
-
Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_TX_COUNT,
|
|
195
|
-
{
|
|
196
|
-
description: 'Number of blob transactions seen in the pending block',
|
|
197
|
-
valueType: ValueType.INT,
|
|
198
|
-
},
|
|
199
|
-
);
|
|
123
|
+
this.fishermanPendingBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_TX_COUNT);
|
|
200
124
|
|
|
201
125
|
this.fishermanIncludedBlobTxCount = this.meter.createHistogram(
|
|
202
126
|
Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_TX_COUNT,
|
|
203
|
-
{
|
|
204
|
-
description: 'Number of blob transactions that got included in the mined block',
|
|
205
|
-
valueType: ValueType.INT,
|
|
206
|
-
},
|
|
207
127
|
);
|
|
208
128
|
|
|
209
129
|
this.fishermanCalculatedPriorityFee = this.meter.createHistogram(
|
|
210
130
|
Metrics.FISHERMAN_FEE_ANALYSIS_CALCULATED_PRIORITY_FEE,
|
|
211
|
-
{
|
|
212
|
-
unit: 'gwei',
|
|
213
|
-
description: 'Priority fee calculated by each strategy',
|
|
214
|
-
valueType: ValueType.DOUBLE,
|
|
215
|
-
},
|
|
216
131
|
);
|
|
217
132
|
|
|
218
|
-
this.fishermanPriorityFeeDelta = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PRIORITY_FEE_DELTA
|
|
219
|
-
unit: 'gwei',
|
|
220
|
-
description: 'Difference between our priority fee and minimum included priority fee',
|
|
221
|
-
valueType: ValueType.DOUBLE,
|
|
222
|
-
});
|
|
133
|
+
this.fishermanPriorityFeeDelta = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PRIORITY_FEE_DELTA);
|
|
223
134
|
|
|
224
|
-
this.fishermanEstimatedCost = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_COST
|
|
225
|
-
unit: 'eth',
|
|
226
|
-
description: 'Estimated total cost in ETH for the transaction with this strategy',
|
|
227
|
-
valueType: ValueType.DOUBLE,
|
|
228
|
-
});
|
|
135
|
+
this.fishermanEstimatedCost = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_COST);
|
|
229
136
|
|
|
230
137
|
this.fishermanEstimatedOverpayment = this.meter.createHistogram(
|
|
231
138
|
Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_OVERPAYMENT,
|
|
232
|
-
{
|
|
233
|
-
unit: 'eth',
|
|
234
|
-
description: 'Estimated overpayment in ETH vs minimum required for inclusion',
|
|
235
|
-
valueType: ValueType.DOUBLE,
|
|
236
|
-
},
|
|
237
139
|
);
|
|
238
140
|
|
|
239
141
|
this.fishermanMinedBlobTxPriorityFee = this.meter.createHistogram(
|
|
240
142
|
Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_PRIORITY_FEE,
|
|
241
|
-
{
|
|
242
|
-
unit: 'gwei',
|
|
243
|
-
description: 'Priority fee per gas for blob transactions in mined blocks',
|
|
244
|
-
valueType: ValueType.DOUBLE,
|
|
245
|
-
},
|
|
246
143
|
);
|
|
247
144
|
|
|
248
145
|
this.fishermanMinedBlobTxTotalCost = this.meter.createHistogram(
|
|
249
146
|
Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST,
|
|
250
|
-
{
|
|
251
|
-
unit: 'eth',
|
|
252
|
-
description: 'Total cost in ETH for blob transactions in mined blocks',
|
|
253
|
-
valueType: ValueType.DOUBLE,
|
|
254
|
-
},
|
|
255
147
|
);
|
|
256
148
|
}
|
|
257
149
|
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
import type { L1ToL2MessageSource } from '@aztec/stdlib/messaging';
|
|
25
25
|
import { pickFromSchema } from '@aztec/stdlib/schemas';
|
|
26
26
|
import { MerkleTreeId } from '@aztec/stdlib/trees';
|
|
27
|
-
import { type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
27
|
+
import { Attributes, type TelemetryClient, type Tracer, getTelemetryClient, trackSpan } from '@aztec/telemetry-client';
|
|
28
28
|
import type { ValidatorClient } from '@aztec/validator-client';
|
|
29
29
|
|
|
30
30
|
import EventEmitter from 'node:events';
|
|
@@ -160,7 +160,6 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
160
160
|
this.log.info('Stopped sequencer');
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
@trackSpan('Sequencer.work')
|
|
164
163
|
/** Main sequencer loop with a try/catch */
|
|
165
164
|
protected async safeWork() {
|
|
166
165
|
try {
|
|
@@ -198,6 +197,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
198
197
|
* - Collect attestations for the final block
|
|
199
198
|
* - Submit checkpoint
|
|
200
199
|
*/
|
|
200
|
+
@trackSpan('Sequencer.work')
|
|
201
201
|
protected async work() {
|
|
202
202
|
this.setState(SequencerState.SYNCHRONIZING, undefined);
|
|
203
203
|
const { slot, ts, now, epoch } = this.epochCache.getEpochAndSlotInNextL1Slot();
|
|
@@ -233,6 +233,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
233
233
|
* This is the initial step in the main loop.
|
|
234
234
|
* @returns CheckpointProposalJob if successful, undefined if we are not yet synced or are not the proposer.
|
|
235
235
|
*/
|
|
236
|
+
@trackSpan('Sequencer.prepareCheckpointProposal')
|
|
236
237
|
private async prepareCheckpointProposal(
|
|
237
238
|
slot: SlotNumber,
|
|
238
239
|
ts: bigint,
|
|
@@ -401,6 +402,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
401
402
|
this,
|
|
402
403
|
this.setState.bind(this),
|
|
403
404
|
this.log,
|
|
405
|
+
this.tracer,
|
|
404
406
|
);
|
|
405
407
|
}
|
|
406
408
|
|
|
@@ -555,6 +557,7 @@ export class Sequencer extends (EventEmitter as new () => TypedEventEmitter<Sequ
|
|
|
555
557
|
* Tries to vote on slashing actions and governance when the sync check fails but we're past the max time for initializing a proposal.
|
|
556
558
|
* This allows the sequencer to participate in governance/slashing votes even when it cannot build blocks.
|
|
557
559
|
*/
|
|
560
|
+
@trackSpan('Seqeuencer.tryVoteWhenSyncFails', ({ slot }) => ({ [Attributes.SLOT_NUMBER]: slot }))
|
|
558
561
|
protected async tryVoteWhenSyncFails(args: { slot: SlotNumber; ts: bigint }): Promise<void> {
|
|
559
562
|
const { slot } = args;
|
|
560
563
|
|
package/src/test/utils.ts
CHANGED
|
@@ -11,13 +11,7 @@ import { CommitteeAttestation, L2BlockNew } from '@aztec/stdlib/block';
|
|
|
11
11
|
import { BlockAttestation, BlockProposal, ConsensusPayload } from '@aztec/stdlib/p2p';
|
|
12
12
|
import { CheckpointHeader } from '@aztec/stdlib/rollup';
|
|
13
13
|
import { makeAppendOnlyTreeSnapshot, mockTxForRollup } from '@aztec/stdlib/testing';
|
|
14
|
-
import {
|
|
15
|
-
BlockHeader,
|
|
16
|
-
ContentCommitment,
|
|
17
|
-
GlobalVariables,
|
|
18
|
-
type Tx,
|
|
19
|
-
makeProcessedTxFromPrivateOnlyTx,
|
|
20
|
-
} from '@aztec/stdlib/tx';
|
|
14
|
+
import { BlockHeader, GlobalVariables, type Tx, makeProcessedTxFromPrivateOnlyTx } from '@aztec/stdlib/tx';
|
|
21
15
|
|
|
22
16
|
import type { MockProxy } from 'jest-mock-extended';
|
|
23
17
|
|
|
@@ -77,15 +71,15 @@ export function createMockSignatures(signer: Secp256k1Signer): CommitteeAttestat
|
|
|
77
71
|
|
|
78
72
|
/**
|
|
79
73
|
* Creates a CheckpointHeader from an L2BlockNew for testing purposes.
|
|
80
|
-
* Uses mock values for
|
|
81
|
-
* L2BlockNew doesn't have these fields.
|
|
74
|
+
* Uses mock values for blockHeadersHash, blobsHash and inHash since L2BlockNew doesn't have these fields.
|
|
82
75
|
*/
|
|
83
76
|
function createCheckpointHeaderFromBlock(block: L2BlockNew): CheckpointHeader {
|
|
84
77
|
const gv = block.header.globalVariables;
|
|
85
78
|
return new CheckpointHeader(
|
|
86
79
|
block.header.lastArchive.root,
|
|
87
80
|
Fr.random(), // blockHeadersHash - mock value for testing
|
|
88
|
-
|
|
81
|
+
Fr.random(), // blobsHash - mock value for testing
|
|
82
|
+
Fr.random(), // inHash - mock value for testing
|
|
89
83
|
gv.slotNumber,
|
|
90
84
|
gv.timestamp,
|
|
91
85
|
gv.coinbase,
|