@aztec/sequencer-client 0.0.1-commit.3469e52 → 0.0.1-commit.350e0a4d
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/README.md +281 -21
- package/dest/client/sequencer-client.d.ts +34 -11
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +77 -39
- package/dest/config.d.ts +32 -6
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +94 -48
- 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 +138 -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 +80 -0
- package/dest/global_variable_builder/global_builder.d.ts +13 -28
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +9 -66
- 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/publisher/config.d.ts +51 -17
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +131 -42
- package/dest/publisher/index.d.ts +2 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/l1_to_l2_messaging.d.ts +21 -0
- package/dest/publisher/l1_to_l2_messaging.d.ts.map +1 -0
- package/dest/publisher/l1_to_l2_messaging.js +70 -0
- 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 +98 -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 +68 -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 +36 -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 +3 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts +96 -0
- package/dest/publisher/sequencer-bundle-simulator.d.ts.map +1 -0
- package/dest/publisher/sequencer-bundle-simulator.js +198 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts +11 -5
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-factory.js +27 -3
- 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 +12 -4
- package/dest/publisher/sequencer-publisher.d.ts +122 -68
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +750 -364
- package/dest/publisher/write_json.d.ts +11 -0
- package/dest/publisher/write_json.d.ts.map +1 -0
- package/dest/publisher/write_json.js +57 -0
- package/dest/sequencer/automine/automine_factory.d.ts +56 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +85 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +189 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +690 -0
- package/dest/sequencer/automine/index.d.ts +3 -0
- package/dest/sequencer/automine/index.d.ts.map +1 -0
- package/dest/sequencer/automine/index.js +2 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +101 -22
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_proposal_job.js +922 -280
- 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 +1 -2
- package/dest/sequencer/checkpoint_voter.d.ts.map +1 -1
- package/dest/sequencer/checkpoint_voter.js +2 -5
- package/dest/sequencer/events.d.ts +62 -5
- package/dest/sequencer/events.d.ts.map +1 -1
- package/dest/sequencer/metrics.d.ts +23 -8
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +142 -36
- package/dest/sequencer/requests_tracker.d.ts +22 -0
- package/dest/sequencer/requests_tracker.d.ts.map +1 -0
- package/dest/sequencer/requests_tracker.js +33 -0
- package/dest/sequencer/sequencer.d.ts +181 -44
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +614 -216
- package/dest/sequencer/types.d.ts +2 -2
- package/dest/sequencer/types.d.ts.map +1 -1
- package/dest/test/index.d.ts +5 -7
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.d.ts +18 -15
- package/dest/test/mock_checkpoint_builder.d.ts.map +1 -1
- package/dest/test/mock_checkpoint_builder.js +63 -40
- package/dest/test/utils.d.ts +22 -8
- package/dest/test/utils.d.ts.map +1 -1
- package/dest/test/utils.js +33 -14
- package/package.json +30 -29
- package/src/client/sequencer-client.ts +110 -47
- package/src/config.ts +121 -58
- package/src/global_variable_builder/README.md +44 -0
- package/src/global_variable_builder/fee_predictor.ts +182 -0
- package/src/global_variable_builder/fee_provider.ts +97 -0
- package/src/global_variable_builder/global_builder.ts +20 -89
- package/src/global_variable_builder/index.ts +3 -1
- package/src/publisher/config.ts +173 -40
- package/src/publisher/index.ts +3 -0
- package/src/publisher/l1_to_l2_messaging.ts +85 -0
- package/src/publisher/l1_tx_failed_store/factory.ts +32 -0
- package/src/publisher/l1_tx_failed_store/failed_tx_store.ts +164 -0
- package/src/publisher/l1_tx_failed_store/file_store_failed_tx_store.ts +47 -0
- package/src/publisher/l1_tx_failed_store/index.ts +3 -0
- package/src/publisher/sequencer-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +38 -9
- package/src/publisher/sequencer-publisher-metrics.ts +7 -3
- package/src/publisher/sequencer-publisher.ts +854 -461
- package/src/publisher/write_json.ts +78 -0
- package/src/sequencer/README.md +162 -450
- package/src/sequencer/automine/README.md +60 -0
- package/src/sequencer/automine/automine_factory.ts +152 -0
- package/src/sequencer/automine/automine_sequencer.ts +796 -0
- package/src/sequencer/automine/index.ts +6 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1139 -328
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +1 -12
- package/src/sequencer/events.ts +66 -5
- package/src/sequencer/metrics.ts +164 -39
- package/src/sequencer/requests_tracker.ts +43 -0
- package/src/sequencer/sequencer.ts +729 -242
- package/src/sequencer/types.ts +1 -1
- package/src/test/index.ts +4 -6
- package/src/test/mock_checkpoint_builder.ts +93 -65
- package/src/test/utils.ts +81 -21
- package/dest/sequencer/timetable.d.ts +0 -90
- package/dest/sequencer/timetable.d.ts.map +0 -1
- package/dest/sequencer/timetable.js +0 -226
- package/src/sequencer/timetable.ts +0 -282
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Attributes, Metrics } from '@aztec/telemetry-client';
|
|
1
|
+
import { Attributes, Metrics, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
2
2
|
import { formatUnits } from 'viem';
|
|
3
|
-
// TODO(palla/mbps): Review all metrics and add any missing ones per checkpoint
|
|
4
3
|
export class SequencerMetrics {
|
|
5
4
|
rollup;
|
|
6
5
|
tracer;
|
|
@@ -9,6 +8,7 @@ export class SequencerMetrics {
|
|
|
9
8
|
blockBuildDuration;
|
|
10
9
|
blockBuildManaPerSecond;
|
|
11
10
|
stateTransitionBufferDuration;
|
|
11
|
+
stateDuration;
|
|
12
12
|
// these are gauges because for individual sequencers building a block is not something that happens often enough to warrant a histogram
|
|
13
13
|
timeToCollectAttestations;
|
|
14
14
|
allowanceToCollectAttestations;
|
|
@@ -18,56 +18,94 @@ export class SequencerMetrics {
|
|
|
18
18
|
slots;
|
|
19
19
|
filledSlots;
|
|
20
20
|
blockProposalFailed;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
checkpointProposalSuccess;
|
|
22
|
+
checkpointPrecheckFailed;
|
|
23
|
+
checkpointProposalFailed;
|
|
23
24
|
checkpointSuccess;
|
|
24
25
|
slashingAttempts;
|
|
25
|
-
|
|
26
|
+
pipelineDepth;
|
|
27
|
+
pipelineDiscards;
|
|
28
|
+
pipelineParentCheckpointMismatches;
|
|
26
29
|
// Fisherman fee analysis metrics
|
|
27
30
|
fishermanWouldBeIncluded;
|
|
28
31
|
fishermanTimeBeforeBlock;
|
|
29
32
|
fishermanPendingBlobTxCount;
|
|
30
33
|
fishermanIncludedBlobTxCount;
|
|
34
|
+
fishermanPendingBlobCount;
|
|
35
|
+
fishermanIncludedBlobCount;
|
|
36
|
+
fishermanBlockBlobsFull;
|
|
37
|
+
fishermanMaxBlobCapacity;
|
|
31
38
|
fishermanCalculatedPriorityFee;
|
|
32
39
|
fishermanPriorityFeeDelta;
|
|
33
40
|
fishermanEstimatedCost;
|
|
34
41
|
fishermanEstimatedOverpayment;
|
|
35
42
|
fishermanMinedBlobTxPriorityFee;
|
|
36
43
|
fishermanMinedBlobTxTotalCost;
|
|
44
|
+
blockInterBlockTime;
|
|
45
|
+
lastBlockBuiltTimestamp;
|
|
46
|
+
lastBlockBuiltSlot;
|
|
37
47
|
lastSeenSlot;
|
|
38
48
|
constructor(client, rollup, name = 'Sequencer'){
|
|
39
49
|
this.rollup = rollup;
|
|
40
50
|
this.meter = client.getMeter(name);
|
|
41
51
|
this.tracer = client.getTracer(name);
|
|
42
|
-
this.blockCounter = this.meter
|
|
52
|
+
this.blockCounter = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_COUNT, {
|
|
53
|
+
[Attributes.STATUS]: [
|
|
54
|
+
'failed',
|
|
55
|
+
'built'
|
|
56
|
+
]
|
|
57
|
+
});
|
|
43
58
|
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION);
|
|
44
59
|
this.blockBuildManaPerSecond = this.meter.createGauge(Metrics.SEQUENCER_BLOCK_BUILD_MANA_PER_SECOND);
|
|
60
|
+
this.blockInterBlockTime = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_INTER_BLOCK_TIME);
|
|
45
61
|
this.stateTransitionBufferDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION);
|
|
46
|
-
this.
|
|
47
|
-
|
|
48
|
-
this.
|
|
49
|
-
[Attributes.STATUS]: 'failed'
|
|
50
|
-
});
|
|
51
|
-
this.blockCounter.add(0, {
|
|
52
|
-
[Attributes.STATUS]: 'built'
|
|
53
|
-
});
|
|
54
|
-
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_REWARDS);
|
|
55
|
-
this.slots = this.meter.createUpDownCounter(Metrics.SEQUENCER_SLOT_COUNT);
|
|
62
|
+
this.stateDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_DURATION);
|
|
63
|
+
this.rewards = this.meter.createGauge(Metrics.SEQUENCER_CURRENT_SLOT_REWARDS);
|
|
64
|
+
this.slots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLOT_COUNT);
|
|
56
65
|
/**
|
|
57
66
|
* NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
|
|
58
67
|
* Instead, use a computed metric, `slots - filledSlots` to get the number of slots a sequencer has missed.
|
|
59
|
-
*/ this.filledSlots = this.meter
|
|
68
|
+
*/ this.filledSlots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_FILLED_SLOT_COUNT);
|
|
60
69
|
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION);
|
|
61
70
|
this.allowanceToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_TIME_ALLOWANCE);
|
|
62
71
|
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT);
|
|
63
72
|
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT);
|
|
64
|
-
this.blockProposalFailed = this.meter
|
|
65
|
-
this.
|
|
66
|
-
this.checkpointSuccess = this.meter
|
|
67
|
-
this.
|
|
68
|
-
|
|
73
|
+
this.blockProposalFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_PROPOSAL_FAILED_COUNT);
|
|
74
|
+
this.checkpointProposalSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_PROPOSAL_SUCCESS_COUNT);
|
|
75
|
+
this.checkpointSuccess = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_SUCCESS_COUNT);
|
|
76
|
+
this.checkpointPrecheckFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_PRECHECK_FAILED_COUNT, {
|
|
77
|
+
[Attributes.ERROR_TYPE]: [
|
|
78
|
+
'slot_already_taken',
|
|
79
|
+
'rollup_contract_check_failed',
|
|
80
|
+
'slot_mismatch',
|
|
81
|
+
'block_number_mismatch'
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
this.checkpointProposalFailed = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_CHECKPOINT_PROPOSAL_FAILED_COUNT);
|
|
85
|
+
this.slashingAttempts = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_SLASHING_ATTEMPTS_COUNT);
|
|
86
|
+
this.pipelineDepth = this.meter.createGauge(Metrics.SEQUENCER_PIPELINE_DEPTH);
|
|
87
|
+
this.pipelineDiscards = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_PIPELINE_DISCARDS_COUNT);
|
|
88
|
+
this.pipelineParentCheckpointMismatches = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_PIPELINE_PARENT_CHECKPOINT_MISMATCH_COUNT, {
|
|
89
|
+
[Attributes.ERROR_TYPE]: [
|
|
90
|
+
'archiver-sync-timeout',
|
|
91
|
+
'parent-not-on-l1',
|
|
92
|
+
'parent-hash-mismatch',
|
|
93
|
+
'parent-invalid-attestations',
|
|
94
|
+
'unexpected-parent-appeared'
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
this.pipelineDepth.record(0);
|
|
69
98
|
// Fisherman fee analysis metrics
|
|
70
|
-
this.fishermanWouldBeIncluded = this.meter
|
|
99
|
+
this.fishermanWouldBeIncluded = createUpDownCounterWithDefault(this.meter, Metrics.FISHERMAN_FEE_ANALYSIS_WOULD_BE_INCLUDED, {
|
|
100
|
+
[Attributes.OK]: [
|
|
101
|
+
true,
|
|
102
|
+
false
|
|
103
|
+
],
|
|
104
|
+
[Attributes.BLOCK_FULL]: [
|
|
105
|
+
'true',
|
|
106
|
+
'false'
|
|
107
|
+
]
|
|
108
|
+
});
|
|
71
109
|
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK);
|
|
72
110
|
this.fishermanPendingBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_TX_COUNT);
|
|
73
111
|
this.fishermanIncludedBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_TX_COUNT);
|
|
@@ -77,6 +115,15 @@ export class SequencerMetrics {
|
|
|
77
115
|
this.fishermanEstimatedOverpayment = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_OVERPAYMENT);
|
|
78
116
|
this.fishermanMinedBlobTxPriorityFee = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_PRIORITY_FEE);
|
|
79
117
|
this.fishermanMinedBlobTxTotalCost = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_TOTAL_COST);
|
|
118
|
+
this.fishermanPendingBlobCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_COUNT);
|
|
119
|
+
this.fishermanIncludedBlobCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_COUNT);
|
|
120
|
+
this.fishermanBlockBlobsFull = createUpDownCounterWithDefault(this.meter, Metrics.FISHERMAN_FEE_ANALYSIS_BLOCK_BLOBS_FULL, {
|
|
121
|
+
[Attributes.OK]: [
|
|
122
|
+
true,
|
|
123
|
+
false
|
|
124
|
+
]
|
|
125
|
+
});
|
|
126
|
+
this.fishermanMaxBlobCapacity = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY);
|
|
80
127
|
}
|
|
81
128
|
recordRequiredAttestations(requiredAttestationsCount, allowanceMs) {
|
|
82
129
|
this.requiredAttestions.record(requiredAttestationsCount);
|
|
@@ -85,19 +132,23 @@ export class SequencerMetrics {
|
|
|
85
132
|
this.collectedAttestions.record(0);
|
|
86
133
|
this.timeToCollectAttestations.record(0);
|
|
87
134
|
}
|
|
88
|
-
recordCheckpointAttestationDelay(duration) {
|
|
89
|
-
this.checkpointAttestationDelay.record(duration);
|
|
90
|
-
}
|
|
91
135
|
recordCollectedAttestations(count, durationMs) {
|
|
92
136
|
this.collectedAttestions.record(count);
|
|
93
137
|
this.timeToCollectAttestations.record(Math.ceil(durationMs));
|
|
94
138
|
}
|
|
95
|
-
recordBuiltBlock(buildDurationMs, totalMana) {
|
|
139
|
+
recordBuiltBlock(buildDurationMs, totalMana, slot) {
|
|
96
140
|
this.blockCounter.add(1, {
|
|
97
141
|
[Attributes.STATUS]: 'built'
|
|
98
142
|
});
|
|
99
143
|
this.blockBuildDuration.record(Math.ceil(buildDurationMs));
|
|
100
144
|
this.blockBuildManaPerSecond.record(Math.ceil(totalMana * 1000 / buildDurationMs));
|
|
145
|
+
// Only record inter-block time between blocks built within the same slot.
|
|
146
|
+
const now = Date.now();
|
|
147
|
+
if (this.lastBlockBuiltTimestamp !== undefined && this.lastBlockBuiltSlot === slot) {
|
|
148
|
+
this.blockInterBlockTime.record(now - this.lastBlockBuiltTimestamp);
|
|
149
|
+
}
|
|
150
|
+
this.lastBlockBuiltTimestamp = now;
|
|
151
|
+
this.lastBlockBuiltSlot = slot;
|
|
101
152
|
}
|
|
102
153
|
recordFailedBlock() {
|
|
103
154
|
this.blockCounter.add(1, {
|
|
@@ -109,6 +160,22 @@ export class SequencerMetrics {
|
|
|
109
160
|
[Attributes.SEQUENCER_STATE]: state
|
|
110
161
|
});
|
|
111
162
|
}
|
|
163
|
+
recordStateDuration(durationMs, state) {
|
|
164
|
+
this.stateDuration.record(Math.ceil(durationMs), {
|
|
165
|
+
[Attributes.SEQUENCER_STATE]: state
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
recordPipelineDepth(depth) {
|
|
169
|
+
this.pipelineDepth.record(depth);
|
|
170
|
+
}
|
|
171
|
+
recordPipelineDiscard(count = 1) {
|
|
172
|
+
this.pipelineDiscards.add(count);
|
|
173
|
+
}
|
|
174
|
+
recordPipelineParentCheckpointMismatch(reason) {
|
|
175
|
+
this.pipelineParentCheckpointMismatches.add(1, {
|
|
176
|
+
[Attributes.ERROR_TYPE]: reason
|
|
177
|
+
});
|
|
178
|
+
}
|
|
112
179
|
incOpenSlot(slot, proposer) {
|
|
113
180
|
// sequencer went through the loop a second time. Noop
|
|
114
181
|
if (slot === this.lastSeenSlot) {
|
|
@@ -146,14 +213,21 @@ export class SequencerMetrics {
|
|
|
146
213
|
}
|
|
147
214
|
});
|
|
148
215
|
}
|
|
149
|
-
|
|
150
|
-
this.
|
|
216
|
+
recordCheckpointProposalSuccess() {
|
|
217
|
+
this.checkpointProposalSuccess.add(1);
|
|
151
218
|
}
|
|
152
|
-
|
|
153
|
-
this.
|
|
219
|
+
recordCheckpointPrecheckFailed(checkType) {
|
|
220
|
+
this.checkpointPrecheckFailed.add(1, {
|
|
154
221
|
[Attributes.ERROR_TYPE]: checkType
|
|
155
222
|
});
|
|
156
223
|
}
|
|
224
|
+
recordCheckpointProposalFailed(reason) {
|
|
225
|
+
this.checkpointProposalFailed.add(1, {
|
|
226
|
+
...reason && {
|
|
227
|
+
[Attributes.ERROR_TYPE]: reason
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
157
231
|
recordSlashingAttempt(actionCount) {
|
|
158
232
|
this.slashingAttempts.add(actionCount);
|
|
159
233
|
}
|
|
@@ -174,9 +248,11 @@ export class SequencerMetrics {
|
|
|
174
248
|
};
|
|
175
249
|
// Record pending block snapshot data (once per strategy for comparison)
|
|
176
250
|
this.fishermanPendingBlobTxCount.record(analysis.pendingSnapshot.pendingBlobTxCount, strategyAttributes);
|
|
251
|
+
this.fishermanPendingBlobCount.record(analysis.pendingSnapshot.pendingBlobCount, strategyAttributes);
|
|
177
252
|
// Record mined block data if available
|
|
178
253
|
if (analysis.minedBlock) {
|
|
179
254
|
this.fishermanIncludedBlobTxCount.record(analysis.minedBlock.includedBlobTxCount, strategyAttributes);
|
|
255
|
+
this.fishermanIncludedBlobCount.record(analysis.minedBlock.includedBlobCount, strategyAttributes);
|
|
180
256
|
// Record actual fees from blob transactions in the mined block
|
|
181
257
|
for (const blobTx of analysis.minedBlock.includedBlobTxs){
|
|
182
258
|
// Record priority fee per gas in Gwei
|
|
@@ -201,16 +277,34 @@ export class SequencerMetrics {
|
|
|
201
277
|
// Record analysis results if available
|
|
202
278
|
if (analysis.analysis) {
|
|
203
279
|
this.fishermanTimeBeforeBlock.record(Math.ceil(analysis.analysis.timeBeforeBlockMs), strategyAttributes);
|
|
280
|
+
// Record whether the block reached 100% blob capacity
|
|
281
|
+
if (analysis.analysis.blockBlobsFull) {
|
|
282
|
+
this.fishermanBlockBlobsFull.add(1, {
|
|
283
|
+
...strategyAttributes,
|
|
284
|
+
[Attributes.OK]: true
|
|
285
|
+
});
|
|
286
|
+
} else {
|
|
287
|
+
this.fishermanBlockBlobsFull.add(1, {
|
|
288
|
+
...strategyAttributes,
|
|
289
|
+
[Attributes.OK]: false
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
// Record the max blob capacity for this block
|
|
293
|
+
this.fishermanMaxBlobCapacity.record(analysis.analysis.maxBlobCapacity, strategyAttributes);
|
|
204
294
|
// Record strategy-specific inclusion result
|
|
205
295
|
if (strategyResult.wouldBeIncluded !== undefined) {
|
|
296
|
+
const inclusionAttributes = {
|
|
297
|
+
...strategyAttributes,
|
|
298
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
299
|
+
};
|
|
206
300
|
if (strategyResult.wouldBeIncluded) {
|
|
207
301
|
this.fishermanWouldBeIncluded.add(1, {
|
|
208
|
-
...
|
|
302
|
+
...inclusionAttributes,
|
|
209
303
|
[Attributes.OK]: true
|
|
210
304
|
});
|
|
211
305
|
} else {
|
|
212
306
|
this.fishermanWouldBeIncluded.add(1, {
|
|
213
|
-
...
|
|
307
|
+
...inclusionAttributes,
|
|
214
308
|
[Attributes.OK]: false,
|
|
215
309
|
...strategyResult.exclusionReason && {
|
|
216
310
|
[Attributes.ERROR_TYPE]: strategyResult.exclusionReason
|
|
@@ -221,15 +315,27 @@ export class SequencerMetrics {
|
|
|
221
315
|
// Record strategy-specific priority fee delta
|
|
222
316
|
if (strategyResult.priorityFeeDelta !== undefined) {
|
|
223
317
|
const priorityFeeDeltaGwei = Number(strategyResult.priorityFeeDelta) / 1e9;
|
|
224
|
-
|
|
318
|
+
const deltaAttributes = {
|
|
319
|
+
...strategyAttributes,
|
|
320
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
321
|
+
};
|
|
322
|
+
this.fishermanPriorityFeeDelta.record(priorityFeeDeltaGwei, deltaAttributes);
|
|
225
323
|
}
|
|
226
324
|
// Record estimated cost if available
|
|
227
325
|
if (strategyResult.estimatedCostEth !== undefined) {
|
|
228
|
-
|
|
326
|
+
const costAttributes = {
|
|
327
|
+
...strategyAttributes,
|
|
328
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
329
|
+
};
|
|
330
|
+
this.fishermanEstimatedCost.record(strategyResult.estimatedCostEth, costAttributes);
|
|
229
331
|
}
|
|
230
332
|
// Record estimated overpayment if available
|
|
231
333
|
if (strategyResult.estimatedOverpaymentEth !== undefined) {
|
|
232
|
-
|
|
334
|
+
const overpaymentAttributes = {
|
|
335
|
+
...strategyAttributes,
|
|
336
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
337
|
+
};
|
|
338
|
+
this.fishermanEstimatedOverpayment.record(strategyResult.estimatedOverpaymentEth, overpaymentAttributes);
|
|
233
339
|
}
|
|
234
340
|
}
|
|
235
341
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tracks fire-and-forget requests so a shutdown path can interrupt any in-flight work and await it to
|
|
3
|
+
* settle. Each tracked request is a promise plus an optional interrupt callback; the entry removes itself
|
|
4
|
+
* from the bag once its promise settles, so the tracker only ever holds requests that are still in flight.
|
|
5
|
+
*/
|
|
6
|
+
export declare class RequestsTracker {
|
|
7
|
+
private readonly requests;
|
|
8
|
+
private nextId;
|
|
9
|
+
/** Number of in-flight requests currently tracked. */
|
|
10
|
+
get size(): number;
|
|
11
|
+
/**
|
|
12
|
+
* Tracks a fire-and-forget request. `interrupt`, when provided, is invoked by {@link interruptRequests}
|
|
13
|
+
* to cancel the in-flight work so its promise settles promptly. The entry auto-removes once `promise`
|
|
14
|
+
* settles, whether it resolves or rejects.
|
|
15
|
+
*/
|
|
16
|
+
trackRequest(promise: Promise<unknown>, interrupt?: () => void): void;
|
|
17
|
+
/** Interrupts every in-flight request that was tracked with an interrupt callback. */
|
|
18
|
+
interruptRequests(): void;
|
|
19
|
+
/** Awaits every currently in-flight request to settle. */
|
|
20
|
+
awaitRequests(): Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVxdWVzdHNfdHJhY2tlci5kLnRzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3NlcXVlbmNlci9yZXF1ZXN0c190cmFja2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUdBOzs7O0dBSUc7QUFDSCxxQkFBYSxlQUFlO0lBQzFCLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFxQztJQUM5RCxPQUFPLENBQUMsTUFBTSxDQUFLO0lBRW5CLHNEQUFzRDtJQUN0RCxJQUFXLElBQUksSUFBSSxNQUFNLENBRXhCO0lBRUQ7Ozs7T0FJRztJQUNJLFlBQVksQ0FBQyxPQUFPLEVBQUUsT0FBTyxDQUFDLE9BQU8sQ0FBQyxFQUFFLFNBQVMsQ0FBQyxFQUFFLE1BQU0sSUFBSSxHQUFHLElBQUksQ0FPM0U7SUFFRCxzRkFBc0Y7SUFDL0UsaUJBQWlCLElBQUksSUFBSSxDQUkvQjtJQUVELDBEQUEwRDtJQUM3QyxhQUFhLElBQUksT0FBTyxDQUFDLElBQUksQ0FBQyxDQUUxQztDQUNGIn0=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requests_tracker.d.ts","sourceRoot":"","sources":["../../src/sequencer/requests_tracker.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqC;IAC9D,OAAO,CAAC,MAAM,CAAK;IAEnB,sDAAsD;IACtD,IAAW,IAAI,IAAI,MAAM,CAExB;IAED;;;;OAIG;IACI,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,IAAI,GAAG,IAAI,CAO3E;IAED,sFAAsF;IAC/E,iBAAiB,IAAI,IAAI,CAI/B;IAED,0DAA0D;IAC7C,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAE1C;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/** A tracked request: the awaitable to wait on, plus an optional interrupt to cancel it early. */ /**
|
|
2
|
+
* Tracks fire-and-forget requests so a shutdown path can interrupt any in-flight work and await it to
|
|
3
|
+
* settle. Each tracked request is a promise plus an optional interrupt callback; the entry removes itself
|
|
4
|
+
* from the bag once its promise settles, so the tracker only ever holds requests that are still in flight.
|
|
5
|
+
*/ export class RequestsTracker {
|
|
6
|
+
requests = new Map();
|
|
7
|
+
nextId = 0;
|
|
8
|
+
/** Number of in-flight requests currently tracked. */ get size() {
|
|
9
|
+
return this.requests.size;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Tracks a fire-and-forget request. `interrupt`, when provided, is invoked by {@link interruptRequests}
|
|
13
|
+
* to cancel the in-flight work so its promise settles promptly. The entry auto-removes once `promise`
|
|
14
|
+
* settles, whether it resolves or rejects.
|
|
15
|
+
*/ trackRequest(promise, interrupt) {
|
|
16
|
+
const id = this.nextId++;
|
|
17
|
+
const settled = promise.then(()=>this.requests.delete(id), ()=>this.requests.delete(id));
|
|
18
|
+
this.requests.set(id, {
|
|
19
|
+
promise: settled,
|
|
20
|
+
interrupt
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
/** Interrupts every in-flight request that was tracked with an interrupt callback. */ interruptRequests() {
|
|
24
|
+
for (const { interrupt } of this.requests.values()){
|
|
25
|
+
interrupt?.();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/** Awaits every currently in-flight request to settle. */ async awaitRequests() {
|
|
29
|
+
await Promise.all([
|
|
30
|
+
...this.requests.values()
|
|
31
|
+
].map((request)=>request.promise));
|
|
32
|
+
}
|
|
33
|
+
}
|