@aztec/sequencer-client 0.0.1-commit.9b94fc1 → 0.0.1-commit.9badcec54
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/client/sequencer-client.d.ts +26 -16
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +76 -36
- package/dest/config.d.ts +35 -9
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +109 -50
- package/dest/global_variable_builder/fee_predictor.d.ts +37 -0
- package/dest/global_variable_builder/fee_predictor.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_predictor.js +128 -0
- package/dest/global_variable_builder/fee_provider.d.ts +21 -0
- package/dest/global_variable_builder/fee_provider.d.ts.map +1 -0
- package/dest/global_variable_builder/fee_provider.js +58 -0
- package/dest/global_variable_builder/global_builder.d.ts +25 -17
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +44 -68
- package/dest/global_variable_builder/index.d.ts +4 -2
- package/dest/global_variable_builder/index.d.ts.map +1 -1
- package/dest/global_variable_builder/index.js +2 -0
- package/dest/index.d.ts +2 -3
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -2
- package/dest/publisher/config.d.ts +53 -20
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +124 -39
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_tx_failed_store/factory.d.ts +11 -0
- package/dest/publisher/l1_tx_failed_store/factory.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/factory.js +22 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts +58 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/failed_tx_store.js +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts +15 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/file_store_failed_tx_store.js +34 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts +4 -0
- package/dest/publisher/l1_tx_failed_store/index.d.ts.map +1 -0
- package/dest/publisher/l1_tx_failed_store/index.js +2 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +15 -8
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +28 -4
- package/dest/publisher/sequencer-publisher-metrics.d.ts +3 -3
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +23 -86
- package/dest/publisher/sequencer-publisher.d.ts +114 -80
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +1008 -242
- package/dest/sequencer/chain_state_overrides.d.ts +25 -0
- package/dest/sequencer/chain_state_overrides.d.ts.map +1 -0
- package/dest/sequencer/chain_state_overrides.js +39 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +119 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1355 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts +34 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job_metrics.js +72 -0
- package/dest/sequencer/checkpoint_voter.d.ts +34 -0
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_voter.js +106 -0
- package/dest/sequencer/config.d.ts +3 -2
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/events.d.ts +47 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +4 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +3 -1
- package/dest/sequencer/metrics.d.ts +38 -7
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +220 -73
- package/dest/sequencer/sequencer.d.ts +138 -134
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +812 -657
- package/dest/sequencer/timetable.d.ts +67 -16
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +158 -64
- package/dest/sequencer/types.d.ts +3 -0
- package/dest/sequencer/types.d.ts.map +1 -0
- package/dest/sequencer/types.js +1 -0
- package/dest/sequencer/utils.d.ts +14 -8
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +7 -4
- package/dest/test/index.d.ts +6 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +95 -0
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -0
- package/dest/test/mock_checkpoint_builder.js +231 -0
- package/dest/test/utils.d.ts +53 -0
- package/dest/test/utils.d.ts.map +1 -0
- package/dest/test/utils.js +104 -0
- package/package.json +31 -30
- package/src/client/sequencer-client.ts +102 -62
- package/src/config.ts +128 -60
- package/src/global_variable_builder/README.md +44 -0
- package/src/global_variable_builder/fee_predictor.ts +172 -0
- package/src/global_variable_builder/fee_provider.ts +75 -0
- package/src/global_variable_builder/global_builder.ts +64 -96
- package/src/global_variable_builder/index.ts +3 -1
- package/src/index.ts +1 -7
- package/src/publisher/config.ts +166 -51
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +57 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +46 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-publisher-factory.ts +43 -13
- package/src/publisher/sequencer-publisher-metrics.ts +19 -71
- package/src/publisher/sequencer-publisher.ts +761 -321
- package/src/sequencer/README.md +601 -0
- package/src/sequencer/chain_state_overrides.ts +87 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1137 -0
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +119 -0
- package/src/sequencer/config.ts +2 -1
- package/src/sequencer/events.ts +27 -0
- package/src/sequencer/index.ts +3 -1
- package/src/sequencer/metrics.ts +273 -83
- package/src/sequencer/sequencer.ts +607 -857
- package/src/sequencer/timetable.ts +188 -81
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +18 -9
- package/src/test/index.ts +5 -6
- package/src/test/mock_checkpoint_builder.ts +323 -0
- package/src/test/utils.ts +167 -0
- package/dest/sequencer/block_builder.d.ts +0 -27
- package/dest/sequencer/block_builder.d.ts.map +0 -1
- package/dest/sequencer/block_builder.js +0 -134
- package/dest/tx_validator/nullifier_cache.d.ts +0 -14
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -17
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -53
- package/src/sequencer/block_builder.ts +0 -222
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/tx_validator_factory.ts +0 -132
package/src/sequencer/metrics.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EthAddress } from '@aztec/aztec.js/addresses';
|
|
2
|
-
import type { RollupContract } from '@aztec/ethereum';
|
|
2
|
+
import type { RollupContract } from '@aztec/ethereum/contracts';
|
|
3
|
+
import type { L1FeeAnalysisResult } from '@aztec/ethereum/l1-fee-analysis';
|
|
3
4
|
import type { SlotNumber } from '@aztec/foundation/branded-types';
|
|
4
5
|
import {
|
|
5
6
|
Attributes,
|
|
@@ -10,7 +11,7 @@ import {
|
|
|
10
11
|
type TelemetryClient,
|
|
11
12
|
type Tracer,
|
|
12
13
|
type UpDownCounter,
|
|
13
|
-
|
|
14
|
+
createUpDownCounterWithDefault,
|
|
14
15
|
} from '@aztec/telemetry-client';
|
|
15
16
|
|
|
16
17
|
import { type Hex, formatUnits } from 'viem';
|
|
@@ -38,9 +39,33 @@ export class SequencerMetrics {
|
|
|
38
39
|
private filledSlots: UpDownCounter;
|
|
39
40
|
|
|
40
41
|
private blockProposalFailed: UpDownCounter;
|
|
41
|
-
private
|
|
42
|
-
private
|
|
42
|
+
private checkpointProposalSuccess: UpDownCounter;
|
|
43
|
+
private checkpointPrecheckFailed: UpDownCounter;
|
|
44
|
+
private checkpointProposalFailed: UpDownCounter;
|
|
45
|
+
private checkpointSuccess: UpDownCounter;
|
|
43
46
|
private slashingAttempts: UpDownCounter;
|
|
47
|
+
private pipelineDepth: Gauge;
|
|
48
|
+
private pipelineDiscards: UpDownCounter;
|
|
49
|
+
|
|
50
|
+
// Fisherman fee analysis metrics
|
|
51
|
+
private fishermanWouldBeIncluded: UpDownCounter;
|
|
52
|
+
private fishermanTimeBeforeBlock: Histogram;
|
|
53
|
+
private fishermanPendingBlobTxCount: Histogram;
|
|
54
|
+
private fishermanIncludedBlobTxCount: Histogram;
|
|
55
|
+
private fishermanPendingBlobCount: Histogram;
|
|
56
|
+
private fishermanIncludedBlobCount: Histogram;
|
|
57
|
+
private fishermanBlockBlobsFull: UpDownCounter;
|
|
58
|
+
private fishermanMaxBlobCapacity: Histogram;
|
|
59
|
+
private fishermanCalculatedPriorityFee: Histogram;
|
|
60
|
+
private fishermanPriorityFeeDelta: Histogram;
|
|
61
|
+
private fishermanEstimatedCost: Histogram;
|
|
62
|
+
private fishermanEstimatedOverpayment: Histogram;
|
|
63
|
+
private fishermanMinedBlobTxPriorityFee: Histogram;
|
|
64
|
+
private fishermanMinedBlobTxTotalCost: Histogram;
|
|
65
|
+
|
|
66
|
+
private blockInterBlockTime: Histogram;
|
|
67
|
+
private lastBlockBuiltTimestamp?: number;
|
|
68
|
+
private lastBlockBuiltSlot?: SlotNumber;
|
|
44
69
|
|
|
45
70
|
private lastSeenSlot?: SlotNumber;
|
|
46
71
|
|
|
@@ -52,104 +77,123 @@ export class SequencerMetrics {
|
|
|
52
77
|
this.meter = client.getMeter(name);
|
|
53
78
|
this.tracer = client.getTracer(name);
|
|
54
79
|
|
|
55
|
-
this.blockCounter = this.meter
|
|
56
|
-
|
|
57
|
-
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION, {
|
|
58
|
-
unit: 'ms',
|
|
59
|
-
description: 'Duration to build a block',
|
|
60
|
-
valueType: ValueType.INT,
|
|
80
|
+
this.blockCounter = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_COUNT, {
|
|
81
|
+
[Attributes.STATUS]: ['failed', 'built'],
|
|
61
82
|
});
|
|
62
83
|
|
|
63
|
-
this.
|
|
64
|
-
unit: 'mana/s',
|
|
65
|
-
description: 'Mana per second when building a block',
|
|
66
|
-
valueType: ValueType.INT,
|
|
67
|
-
});
|
|
84
|
+
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION);
|
|
68
85
|
|
|
69
|
-
this.
|
|
70
|
-
Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION,
|
|
71
|
-
{
|
|
72
|
-
unit: 'ms',
|
|
73
|
-
description:
|
|
74
|
-
'The time difference between when the sequencer needed to transition to a new state and when it actually did.',
|
|
75
|
-
valueType: ValueType.INT,
|
|
76
|
-
},
|
|
77
|
-
);
|
|
86
|
+
this.blockBuildManaPerSecond = this.meter.createGauge(Metrics.SEQUENCER_BLOCK_BUILD_MANA_PER_SECOND);
|
|
78
87
|
|
|
79
|
-
|
|
80
|
-
this.blockCounter.add(0, {
|
|
81
|
-
[Attributes.STATUS]: 'failed',
|
|
82
|
-
});
|
|
83
|
-
this.blockCounter.add(0, {
|
|
84
|
-
[Attributes.STATUS]: 'built',
|
|
85
|
-
});
|
|
88
|
+
this.blockInterBlockTime = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_INTER_BLOCK_TIME);
|
|
86
89
|
|
|
87
|
-
this.
|
|
88
|
-
valueType: ValueType.DOUBLE,
|
|
89
|
-
description: 'The rewards earned',
|
|
90
|
-
});
|
|
90
|
+
this.stateTransitionBufferDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION);
|
|
91
91
|
|
|
92
|
-
this.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
});
|
|
92
|
+
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_SLOT_REWARDS);
|
|
93
|
+
|
|
94
|
+
this.slots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLOT_COUNT);
|
|
96
95
|
|
|
97
96
|
/**
|
|
98
97
|
* NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
|
|
99
98
|
* Instead, use a computed metric, `slots - filledSlots` to get the number of slots a sequencer has missed.
|
|
100
99
|
*/
|
|
101
|
-
this.filledSlots = this.meter
|
|
102
|
-
valueType: ValueType.INT,
|
|
103
|
-
description: 'The number of slots this sequencer has filled',
|
|
104
|
-
});
|
|
100
|
+
this.filledSlots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_FILLED_SLOT_COUNT);
|
|
105
101
|
|
|
106
|
-
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
102
|
+
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION);
|
|
103
|
+
|
|
104
|
+
this.allowanceToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_TIME_ALLOWANCE);
|
|
105
|
+
|
|
106
|
+
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT);
|
|
107
|
+
|
|
108
|
+
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT);
|
|
109
|
+
|
|
110
|
+
this.blockProposalFailed = createUpDownCounterWithDefault(
|
|
111
|
+
this.meter,
|
|
112
|
+
Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT,
|
|
113
|
+
);
|
|
111
114
|
|
|
112
|
-
this.
|
|
113
|
-
|
|
115
|
+
this.checkpointProposalSuccess = createUpDownCounterWithDefault(
|
|
116
|
+
this.meter,
|
|
117
|
+
Metrics.SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
this.checkpointSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_SUCCESS_COUNT);
|
|
121
|
+
|
|
122
|
+
this.checkpointPrecheckFailed = createUpDownCounterWithDefault(
|
|
123
|
+
this.meter,
|
|
124
|
+
Metrics.SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT,
|
|
114
125
|
{
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
126
|
+
[Attributes.ERROR_TYPE]: [
|
|
127
|
+
'slot_already_taken',
|
|
128
|
+
'rollup_contract_check_failed',
|
|
129
|
+
'slot_mismatch',
|
|
130
|
+
'block_number_mismatch',
|
|
131
|
+
],
|
|
118
132
|
},
|
|
119
133
|
);
|
|
120
134
|
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
135
|
+
this.checkpointProposalFailed = createUpDownCounterWithDefault(
|
|
136
|
+
this.meter,
|
|
137
|
+
Metrics.SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT,
|
|
138
|
+
);
|
|
125
139
|
|
|
126
|
-
this.
|
|
127
|
-
valueType: ValueType.INT,
|
|
128
|
-
description: 'The minimum number of attestations required to publish a block',
|
|
129
|
-
});
|
|
140
|
+
this.slashingAttempts = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT);
|
|
130
141
|
|
|
131
|
-
this.
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
});
|
|
142
|
+
this.pipelineDepth = this.meter.createGauge(Metrics.SEQUENCER_PIPELINE_DEPTH);
|
|
143
|
+
this.pipelineDiscards = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_PIPELINE_DISCARDS_COUNT);
|
|
144
|
+
this.pipelineDepth.record(0);
|
|
135
145
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
146
|
+
// Fisherman fee analysis metrics
|
|
147
|
+
this.fishermanWouldBeIncluded = createUpDownCounterWithDefault(
|
|
148
|
+
this.meter,
|
|
149
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED,
|
|
150
|
+
{
|
|
151
|
+
[Attributes.OK]: [true, false],
|
|
152
|
+
[Attributes.BLOCK_FULL]: ['true', 'false'],
|
|
153
|
+
},
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK);
|
|
157
|
+
|
|
158
|
+
this.fishermanPendingBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_TX_COUNT);
|
|
159
|
+
|
|
160
|
+
this.fishermanIncludedBlobTxCount = this.meter.createHistogram(
|
|
161
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_TX_COUNT,
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
this.fishermanCalculatedPriorityFee = this.meter.createHistogram(
|
|
165
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_CALCULATED_PRIORITY_FEE,
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
this.fishermanPriorityFeeDelta = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PRIORITY_FEE_DELTA);
|
|
169
|
+
|
|
170
|
+
this.fishermanEstimatedCost = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_COST);
|
|
140
171
|
|
|
141
|
-
this.
|
|
142
|
-
Metrics.
|
|
172
|
+
this.fishermanEstimatedOverpayment = this.meter.createHistogram(
|
|
173
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_OVERPAYMENT,
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
this.fishermanMinedBlobTxPriorityFee = this.meter.createHistogram(
|
|
177
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_PRIORITY_FEE,
|
|
178
|
+
);
|
|
179
|
+
|
|
180
|
+
this.fishermanMinedBlobTxTotalCost = this.meter.createHistogram(
|
|
181
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST,
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
this.fishermanPendingBlobCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_COUNT);
|
|
185
|
+
|
|
186
|
+
this.fishermanIncludedBlobCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_COUNT);
|
|
187
|
+
|
|
188
|
+
this.fishermanBlockBlobsFull = createUpDownCounterWithDefault(
|
|
189
|
+
this.meter,
|
|
190
|
+
Metrics.FISHERMAN_FEE_ANALYSIS_BLOCK_BLOBS_FULL,
|
|
143
191
|
{
|
|
144
|
-
|
|
145
|
-
description: 'The number of times block proposal pre-build checks failed',
|
|
192
|
+
[Attributes.OK]: [true, false],
|
|
146
193
|
},
|
|
147
194
|
);
|
|
148
195
|
|
|
149
|
-
this.
|
|
150
|
-
valueType: ValueType.INT,
|
|
151
|
-
description: 'The number of slashing action attempts',
|
|
152
|
-
});
|
|
196
|
+
this.fishermanMaxBlobCapacity = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY);
|
|
153
197
|
}
|
|
154
198
|
|
|
155
199
|
public recordRequiredAttestations(requiredAttestationsCount: number, allowanceMs: number) {
|
|
@@ -166,12 +210,20 @@ export class SequencerMetrics {
|
|
|
166
210
|
this.timeToCollectAttestations.record(Math.ceil(durationMs));
|
|
167
211
|
}
|
|
168
212
|
|
|
169
|
-
recordBuiltBlock(buildDurationMs: number, totalMana: number) {
|
|
213
|
+
recordBuiltBlock(buildDurationMs: number, totalMana: number, slot: SlotNumber) {
|
|
170
214
|
this.blockCounter.add(1, {
|
|
171
215
|
[Attributes.STATUS]: 'built',
|
|
172
216
|
});
|
|
173
217
|
this.blockBuildDuration.record(Math.ceil(buildDurationMs));
|
|
174
218
|
this.blockBuildManaPerSecond.record(Math.ceil((totalMana * 1000) / buildDurationMs));
|
|
219
|
+
|
|
220
|
+
// Only record inter-block time between blocks built within the same slot.
|
|
221
|
+
const now = Date.now();
|
|
222
|
+
if (this.lastBlockBuiltTimestamp !== undefined && this.lastBlockBuiltSlot === slot) {
|
|
223
|
+
this.blockInterBlockTime.record(now - this.lastBlockBuiltTimestamp);
|
|
224
|
+
}
|
|
225
|
+
this.lastBlockBuiltTimestamp = now;
|
|
226
|
+
this.lastBlockBuiltSlot = slot;
|
|
175
227
|
}
|
|
176
228
|
|
|
177
229
|
recordFailedBlock() {
|
|
@@ -186,6 +238,14 @@ export class SequencerMetrics {
|
|
|
186
238
|
});
|
|
187
239
|
}
|
|
188
240
|
|
|
241
|
+
recordPipelineDepth(depth: number) {
|
|
242
|
+
this.pipelineDepth.record(depth);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
recordPipelineDiscard(count = 1) {
|
|
246
|
+
this.pipelineDiscards.add(count);
|
|
247
|
+
}
|
|
248
|
+
|
|
189
249
|
incOpenSlot(slot: SlotNumber, proposer: string) {
|
|
190
250
|
// sequencer went through the loop a second time. Noop
|
|
191
251
|
if (slot === this.lastSeenSlot) {
|
|
@@ -218,23 +278,153 @@ export class SequencerMetrics {
|
|
|
218
278
|
}
|
|
219
279
|
}
|
|
220
280
|
|
|
281
|
+
recordCheckpointSuccess() {
|
|
282
|
+
this.checkpointSuccess.add(1);
|
|
283
|
+
}
|
|
284
|
+
|
|
221
285
|
recordBlockProposalFailed(reason?: string) {
|
|
222
286
|
this.blockProposalFailed.add(1, {
|
|
223
287
|
...(reason && { [Attributes.ERROR_TYPE]: reason }),
|
|
224
288
|
});
|
|
225
289
|
}
|
|
226
290
|
|
|
227
|
-
|
|
228
|
-
this.
|
|
291
|
+
recordCheckpointProposalSuccess() {
|
|
292
|
+
this.checkpointProposalSuccess.add(1);
|
|
229
293
|
}
|
|
230
294
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
295
|
+
recordCheckpointPrecheckFailed(
|
|
296
|
+
checkType: 'slot_already_taken' | 'rollup_contract_check_failed' | 'slot_mismatch' | 'block_number_mismatch',
|
|
297
|
+
) {
|
|
298
|
+
this.checkpointPrecheckFailed.add(1, { [Attributes.ERROR_TYPE]: checkType });
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
recordCheckpointProposalFailed(reason?: string) {
|
|
302
|
+
this.checkpointProposalFailed.add(1, {
|
|
303
|
+
...(reason && { [Attributes.ERROR_TYPE]: reason }),
|
|
234
304
|
});
|
|
235
305
|
}
|
|
236
306
|
|
|
237
307
|
recordSlashingAttempt(actionCount: number) {
|
|
238
308
|
this.slashingAttempts.add(actionCount);
|
|
239
309
|
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Records metrics for a completed fisherman fee analysis
|
|
313
|
+
* @param analysis - The completed fee analysis result
|
|
314
|
+
*/
|
|
315
|
+
recordFishermanFeeAnalysis(analysis: L1FeeAnalysisResult) {
|
|
316
|
+
// In fisherman mode, we should always have strategy results
|
|
317
|
+
if (!analysis.computedPrices.strategyResults || analysis.computedPrices.strategyResults.length === 0) {
|
|
318
|
+
// This should never happen in fisherman mode - log an error
|
|
319
|
+
// We don't record metrics without strategy IDs as that defeats the purpose
|
|
320
|
+
throw new Error(
|
|
321
|
+
`No strategy results found in fisherman fee analysis ${analysis.id}. This indicates a bug in the fee analysis.`,
|
|
322
|
+
);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
// Record metrics for each strategy separately
|
|
326
|
+
for (const strategyResult of analysis.computedPrices.strategyResults) {
|
|
327
|
+
const strategyAttributes = {
|
|
328
|
+
[Attributes.FISHERMAN_FEE_STRATEGY_ID]: strategyResult.strategyId,
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
// Record pending block snapshot data (once per strategy for comparison)
|
|
332
|
+
this.fishermanPendingBlobTxCount.record(analysis.pendingSnapshot.pendingBlobTxCount, strategyAttributes);
|
|
333
|
+
this.fishermanPendingBlobCount.record(analysis.pendingSnapshot.pendingBlobCount, strategyAttributes);
|
|
334
|
+
|
|
335
|
+
// Record mined block data if available
|
|
336
|
+
if (analysis.minedBlock) {
|
|
337
|
+
this.fishermanIncludedBlobTxCount.record(analysis.minedBlock.includedBlobTxCount, strategyAttributes);
|
|
338
|
+
this.fishermanIncludedBlobCount.record(analysis.minedBlock.includedBlobCount, strategyAttributes);
|
|
339
|
+
|
|
340
|
+
// Record actual fees from blob transactions in the mined block
|
|
341
|
+
for (const blobTx of analysis.minedBlock.includedBlobTxs) {
|
|
342
|
+
// Record priority fee per gas in Gwei
|
|
343
|
+
const priorityFeeGwei = Number(blobTx.maxPriorityFeePerGas) / 1e9;
|
|
344
|
+
this.fishermanMinedBlobTxPriorityFee.record(priorityFeeGwei, strategyAttributes);
|
|
345
|
+
|
|
346
|
+
// Calculate total cost in ETH
|
|
347
|
+
// Cost = (gas * (baseFee + priorityFee)) + (blobCount * blobGasPerBlob * blobBaseFee)
|
|
348
|
+
const baseFee = analysis.minedBlock.baseFeePerGas;
|
|
349
|
+
const effectiveGasPrice = baseFee + blobTx.maxPriorityFeePerGas;
|
|
350
|
+
|
|
351
|
+
// Calculate execution cost using actual gas limit from the transaction
|
|
352
|
+
const executionCost = blobTx.gas * effectiveGasPrice;
|
|
353
|
+
|
|
354
|
+
// Calculate blob cost using maxFeePerBlobGas * blobCount * GAS_PER_BLOB
|
|
355
|
+
const blobCost = blobTx.maxFeePerBlobGas * BigInt(blobTx.blobCount) * 131072n; // 128KB per blob
|
|
356
|
+
|
|
357
|
+
const totalCostWei = executionCost + blobCost;
|
|
358
|
+
const totalCostEth = Number(totalCostWei) / 1e18;
|
|
359
|
+
|
|
360
|
+
this.fishermanMinedBlobTxTotalCost.record(totalCostEth, strategyAttributes);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// Record the calculated priority fee for this strategy
|
|
365
|
+
const calculatedPriorityFeeGwei = Number(strategyResult.calculatedPriorityFee) / 1e9;
|
|
366
|
+
this.fishermanCalculatedPriorityFee.record(calculatedPriorityFeeGwei, strategyAttributes);
|
|
367
|
+
|
|
368
|
+
// Record analysis results if available
|
|
369
|
+
if (analysis.analysis) {
|
|
370
|
+
this.fishermanTimeBeforeBlock.record(Math.ceil(analysis.analysis.timeBeforeBlockMs), strategyAttributes);
|
|
371
|
+
|
|
372
|
+
// Record whether the block reached 100% blob capacity
|
|
373
|
+
if (analysis.analysis.blockBlobsFull) {
|
|
374
|
+
this.fishermanBlockBlobsFull.add(1, { ...strategyAttributes, [Attributes.OK]: true });
|
|
375
|
+
} else {
|
|
376
|
+
this.fishermanBlockBlobsFull.add(1, { ...strategyAttributes, [Attributes.OK]: false });
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Record the max blob capacity for this block
|
|
380
|
+
this.fishermanMaxBlobCapacity.record(analysis.analysis.maxBlobCapacity, strategyAttributes);
|
|
381
|
+
|
|
382
|
+
// Record strategy-specific inclusion result
|
|
383
|
+
if (strategyResult.wouldBeIncluded !== undefined) {
|
|
384
|
+
const inclusionAttributes = {
|
|
385
|
+
...strategyAttributes,
|
|
386
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false',
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
if (strategyResult.wouldBeIncluded) {
|
|
390
|
+
this.fishermanWouldBeIncluded.add(1, { ...inclusionAttributes, [Attributes.OK]: true });
|
|
391
|
+
} else {
|
|
392
|
+
this.fishermanWouldBeIncluded.add(1, {
|
|
393
|
+
...inclusionAttributes,
|
|
394
|
+
[Attributes.OK]: false,
|
|
395
|
+
...(strategyResult.exclusionReason && { [Attributes.ERROR_TYPE]: strategyResult.exclusionReason }),
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// Record strategy-specific priority fee delta
|
|
401
|
+
if (strategyResult.priorityFeeDelta !== undefined) {
|
|
402
|
+
const priorityFeeDeltaGwei = Number(strategyResult.priorityFeeDelta) / 1e9;
|
|
403
|
+
const deltaAttributes = {
|
|
404
|
+
...strategyAttributes,
|
|
405
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false',
|
|
406
|
+
};
|
|
407
|
+
this.fishermanPriorityFeeDelta.record(priorityFeeDeltaGwei, deltaAttributes);
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// Record estimated cost if available
|
|
411
|
+
if (strategyResult.estimatedCostEth !== undefined) {
|
|
412
|
+
const costAttributes = {
|
|
413
|
+
...strategyAttributes,
|
|
414
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false',
|
|
415
|
+
};
|
|
416
|
+
this.fishermanEstimatedCost.record(strategyResult.estimatedCostEth, costAttributes);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
// Record estimated overpayment if available
|
|
420
|
+
if (strategyResult.estimatedOverpaymentEth !== undefined) {
|
|
421
|
+
const overpaymentAttributes = {
|
|
422
|
+
...strategyAttributes,
|
|
423
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false',
|
|
424
|
+
};
|
|
425
|
+
this.fishermanEstimatedOverpayment.record(strategyResult.estimatedOverpaymentEth, overpaymentAttributes);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
240
430
|
}
|