@aztec/sequencer-client 0.0.0-test.1 → 0.0.1-commit.017a351
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/index.d.ts +1 -1
- package/dest/client/sequencer-client.d.ts +43 -33
- package/dest/client/sequencer-client.d.ts.map +1 -1
- package/dest/client/sequencer-client.js +117 -62
- package/dest/config.d.ts +38 -17
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +172 -85
- 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 +26 -17
- package/dest/global_variable_builder/global_builder.d.ts.map +1 -1
- package/dest/global_variable_builder/global_builder.js +45 -61
- 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 -4
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +1 -3
- package/dest/publisher/config.d.ts +60 -27
- package/dest/publisher/config.d.ts.map +1 -1
- package/dest/publisher/config.js +124 -32
- package/dest/publisher/index.d.ts +4 -1
- package/dest/publisher/index.d.ts.map +1 -1
- package/dest/publisher/index.js +3 -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 +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-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 +50 -0
- package/dest/publisher/sequencer-publisher-factory.d.ts.map +1 -0
- package/dest/publisher/sequencer-publisher-factory.js +75 -0
- package/dest/publisher/sequencer-publisher-metrics.d.ts +5 -4
- package/dest/publisher/sequencer-publisher-metrics.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher-metrics.js +34 -62
- package/dest/publisher/sequencer-publisher.d.ts +170 -97
- package/dest/publisher/sequencer-publisher.d.ts.map +1 -1
- package/dest/publisher/sequencer-publisher.js +1255 -276
- package/dest/sequencer/automine/automine_factory.d.ts +54 -0
- package/dest/sequencer/automine/automine_factory.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_factory.js +84 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts +151 -0
- package/dest/sequencer/automine/automine_sequencer.d.ts.map +1 -0
- package/dest/sequencer/automine/automine_sequencer.js +509 -0
- package/dest/sequencer/chain_state_overrides.d.ts +61 -0
- package/dest/sequencer/chain_state_overrides.d.ts.map +1 -0
- package/dest/sequencer/chain_state_overrides.js +98 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts +150 -0
- package/dest/sequencer/checkpoint_proposal_job.d.ts.map +1 -0
- package/dest/sequencer/checkpoint_proposal_job.js +1792 -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 +7 -1
- package/dest/sequencer/config.d.ts.map +1 -1
- package/dest/sequencer/errors.d.ts +11 -0
- package/dest/sequencer/errors.d.ts.map +1 -0
- package/dest/sequencer/errors.js +15 -0
- package/dest/sequencer/events.d.ts +92 -0
- package/dest/sequencer/events.d.ts.map +1 -0
- package/dest/sequencer/events.js +1 -0
- package/dest/sequencer/index.d.ts +6 -2
- package/dest/sequencer/index.d.ts.map +1 -1
- package/dest/sequencer/index.js +5 -1
- package/dest/sequencer/metrics.d.ts +64 -13
- package/dest/sequencer/metrics.d.ts.map +1 -1
- package/dest/sequencer/metrics.js +309 -68
- package/dest/sequencer/sequencer.d.ts +205 -135
- package/dest/sequencer/sequencer.d.ts.map +1 -1
- package/dest/sequencer/sequencer.js +1208 -523
- package/dest/sequencer/timetable.d.ts +85 -25
- package/dest/sequencer/timetable.d.ts.map +1 -1
- package/dest/sequencer/timetable.js +177 -60
- 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 +20 -38
- package/dest/sequencer/utils.d.ts.map +1 -1
- package/dest/sequencer/utils.js +12 -47
- package/dest/test/index.d.ts +9 -3
- package/dest/test/index.d.ts.map +1 -1
- package/dest/test/index.js +0 -4
- 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 +105 -0
- package/package.json +46 -45
- package/src/client/sequencer-client.ts +158 -103
- package/src/config.ts +201 -99
- 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 +68 -76
- package/src/global_variable_builder/index.ts +3 -1
- package/src/index.ts +10 -3
- package/src/publisher/config.ts +184 -59
- package/src/publisher/index.ts +7 -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-bundle-simulator.ts +254 -0
- package/src/publisher/sequencer-publisher-factory.ts +121 -0
- package/src/publisher/sequencer-publisher-metrics.ts +33 -63
- package/src/publisher/sequencer-publisher.ts +1101 -350
- package/src/sequencer/README.md +243 -0
- package/src/sequencer/automine/README.md +46 -0
- package/src/sequencer/automine/automine_factory.ts +145 -0
- package/src/sequencer/automine/automine_sequencer.ts +595 -0
- package/src/sequencer/chain_state_overrides.ts +162 -0
- package/src/sequencer/checkpoint_proposal_job.ts +1632 -0
- package/src/sequencer/checkpoint_proposal_job_metrics.ts +128 -0
- package/src/sequencer/checkpoint_voter.ts +119 -0
- package/src/sequencer/config.ts +8 -0
- package/src/sequencer/errors.ts +21 -0
- package/src/sequencer/events.ts +76 -0
- package/src/sequencer/index.ts +5 -1
- package/src/sequencer/metrics.ts +397 -75
- package/src/sequencer/sequencer.ts +1013 -579
- package/src/sequencer/timetable.ts +225 -60
- package/src/sequencer/types.ts +6 -0
- package/src/sequencer/utils.ts +28 -60
- package/src/test/index.ts +11 -5
- package/src/test/mock_checkpoint_builder.ts +323 -0
- package/src/test/utils.ts +185 -0
- package/dest/sequencer/allowed.d.ts +0 -3
- package/dest/sequencer/allowed.d.ts.map +0 -1
- package/dest/sequencer/allowed.js +0 -27
- package/dest/slasher/factory.d.ts +0 -7
- package/dest/slasher/factory.d.ts.map +0 -1
- package/dest/slasher/factory.js +0 -8
- package/dest/slasher/index.d.ts +0 -3
- package/dest/slasher/index.d.ts.map +0 -1
- package/dest/slasher/index.js +0 -2
- package/dest/slasher/slasher_client.d.ts +0 -75
- package/dest/slasher/slasher_client.d.ts.map +0 -1
- package/dest/slasher/slasher_client.js +0 -132
- package/dest/tx_validator/archive_cache.d.ts +0 -14
- package/dest/tx_validator/archive_cache.d.ts.map +0 -1
- package/dest/tx_validator/archive_cache.js +0 -22
- package/dest/tx_validator/gas_validator.d.ts +0 -14
- package/dest/tx_validator/gas_validator.d.ts.map +0 -1
- package/dest/tx_validator/gas_validator.js +0 -78
- package/dest/tx_validator/nullifier_cache.d.ts +0 -16
- package/dest/tx_validator/nullifier_cache.d.ts.map +0 -1
- package/dest/tx_validator/nullifier_cache.js +0 -24
- package/dest/tx_validator/phases_validator.d.ts +0 -12
- package/dest/tx_validator/phases_validator.d.ts.map +0 -1
- package/dest/tx_validator/phases_validator.js +0 -80
- package/dest/tx_validator/test_utils.d.ts +0 -23
- package/dest/tx_validator/test_utils.d.ts.map +0 -1
- package/dest/tx_validator/test_utils.js +0 -26
- package/dest/tx_validator/tx_validator_factory.d.ts +0 -18
- package/dest/tx_validator/tx_validator_factory.d.ts.map +0 -1
- package/dest/tx_validator/tx_validator_factory.js +0 -50
- package/src/sequencer/allowed.ts +0 -36
- package/src/slasher/factory.ts +0 -15
- package/src/slasher/index.ts +0 -2
- package/src/slasher/slasher_client.ts +0 -193
- package/src/tx_validator/archive_cache.ts +0 -28
- package/src/tx_validator/gas_validator.ts +0 -101
- package/src/tx_validator/nullifier_cache.ts +0 -30
- package/src/tx_validator/phases_validator.ts +0 -98
- package/src/tx_validator/test_utils.ts +0 -48
- package/src/tx_validator/tx_validator_factory.ts +0 -120
|
@@ -1,102 +1,343 @@
|
|
|
1
|
-
import { Attributes, Metrics,
|
|
2
|
-
import {
|
|
1
|
+
import { Attributes, Metrics, createUpDownCounterWithDefault } from '@aztec/telemetry-client';
|
|
2
|
+
import { formatUnits } from 'viem';
|
|
3
3
|
export class SequencerMetrics {
|
|
4
|
+
rollup;
|
|
4
5
|
tracer;
|
|
6
|
+
meter;
|
|
5
7
|
blockCounter;
|
|
6
8
|
blockBuildDuration;
|
|
7
9
|
blockBuildManaPerSecond;
|
|
8
10
|
stateTransitionBufferDuration;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
blockBuilderInsertions;
|
|
11
|
+
stateDuration;
|
|
12
|
+
// these are gauges because for individual sequencers building a block is not something that happens often enough to warrant a histogram
|
|
12
13
|
timeToCollectAttestations;
|
|
13
|
-
|
|
14
|
-
|
|
14
|
+
allowanceToCollectAttestations;
|
|
15
|
+
requiredAttestions;
|
|
16
|
+
collectedAttestions;
|
|
17
|
+
rewards;
|
|
18
|
+
slots;
|
|
19
|
+
filledSlots;
|
|
20
|
+
blockProposalFailed;
|
|
21
|
+
checkpointProposalSuccess;
|
|
22
|
+
checkpointPrecheckFailed;
|
|
23
|
+
checkpointProposalFailed;
|
|
24
|
+
checkpointSuccess;
|
|
25
|
+
slashingAttempts;
|
|
26
|
+
pipelineDepth;
|
|
27
|
+
pipelineDiscards;
|
|
28
|
+
pipelineParentCheckpointMismatches;
|
|
29
|
+
// Fisherman fee analysis metrics
|
|
30
|
+
fishermanWouldBeIncluded;
|
|
31
|
+
fishermanTimeBeforeBlock;
|
|
32
|
+
fishermanPendingBlobTxCount;
|
|
33
|
+
fishermanIncludedBlobTxCount;
|
|
34
|
+
fishermanPendingBlobCount;
|
|
35
|
+
fishermanIncludedBlobCount;
|
|
36
|
+
fishermanBlockBlobsFull;
|
|
37
|
+
fishermanMaxBlobCapacity;
|
|
38
|
+
fishermanCalculatedPriorityFee;
|
|
39
|
+
fishermanPriorityFeeDelta;
|
|
40
|
+
fishermanEstimatedCost;
|
|
41
|
+
fishermanEstimatedOverpayment;
|
|
42
|
+
fishermanMinedBlobTxPriorityFee;
|
|
43
|
+
fishermanMinedBlobTxTotalCost;
|
|
44
|
+
blockInterBlockTime;
|
|
45
|
+
lastBlockBuiltTimestamp;
|
|
46
|
+
lastBlockBuiltSlot;
|
|
47
|
+
lastSeenSlot;
|
|
48
|
+
constructor(client, rollup, name = 'Sequencer'){
|
|
49
|
+
this.rollup = rollup;
|
|
50
|
+
this.meter = client.getMeter(name);
|
|
15
51
|
this.tracer = client.getTracer(name);
|
|
16
|
-
this.blockCounter = meter
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
52
|
+
this.blockCounter = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_BLOCK_COUNT, {
|
|
53
|
+
[Attributes.STATUS]: [
|
|
54
|
+
'failed',
|
|
55
|
+
'built'
|
|
56
|
+
]
|
|
21
57
|
});
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
58
|
+
this.blockBuildDuration = this.meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_DURATION);
|
|
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);
|
|
61
|
+
this.stateTransitionBufferDuration = this.meter.createHistogram(Metrics.SEQUENCER_STATE_TRANSITION_BUFFER_DURATION);
|
|
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);
|
|
65
|
+
/**
|
|
66
|
+
* NOTE: we do not track missed slots as a separate metric. That would be difficult to determine
|
|
67
|
+
* Instead, use a computed metric, `slots - filledSlots` to get the number of slots a sequencer has missed.
|
|
68
|
+
*/ this.filledSlots = createUpDownCounterWithDefault(this.meter, Metrics.SEQUENCER_FILLED_SLOT_COUNT);
|
|
69
|
+
this.timeToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_DURATION);
|
|
70
|
+
this.allowanceToCollectAttestations = this.meter.createGauge(Metrics.SEQUENCER_COLLECT_ATTESTATIONS_TIME_ALLOWANCE);
|
|
71
|
+
this.requiredAttestions = this.meter.createGauge(Metrics.SEQUENCER_REQUIRED_ATTESTATIONS_COUNT);
|
|
72
|
+
this.collectedAttestions = this.meter.createGauge(Metrics.SEQUENCER_COLLECTED_ATTESTATIONS_COUNT);
|
|
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
|
+
]
|
|
26
83
|
});
|
|
27
|
-
this.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
+
]
|
|
31
96
|
});
|
|
32
|
-
|
|
33
|
-
|
|
97
|
+
this.pipelineDepth.record(0);
|
|
98
|
+
// Fisherman fee analysis metrics
|
|
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
|
+
]
|
|
34
108
|
});
|
|
35
|
-
|
|
36
|
-
|
|
109
|
+
this.fishermanTimeBeforeBlock = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_TIME_BEFORE_BLOCK);
|
|
110
|
+
this.fishermanPendingBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PENDING_BLOB_TX_COUNT);
|
|
111
|
+
this.fishermanIncludedBlobTxCount = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_INCLUDED_BLOB_TX_COUNT);
|
|
112
|
+
this.fishermanCalculatedPriorityFee = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_CALCULATED_PRIORITY_FEE);
|
|
113
|
+
this.fishermanPriorityFeeDelta = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_PRIORITY_FEE_DELTA);
|
|
114
|
+
this.fishermanEstimatedCost = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_COST);
|
|
115
|
+
this.fishermanEstimatedOverpayment = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_ESTIMATED_OVERPAYMENT);
|
|
116
|
+
this.fishermanMinedBlobTxPriorityFee = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MINED_BLOB_TX_PRIORITY_FEE);
|
|
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
|
+
]
|
|
37
125
|
});
|
|
38
|
-
this.
|
|
39
|
-
description: 'Current block number',
|
|
40
|
-
valueType: ValueType.INT
|
|
41
|
-
});
|
|
42
|
-
this.currentBlockSize = meter.createGauge(Metrics.SEQUENCER_CURRENT_BLOCK_SIZE, {
|
|
43
|
-
description: 'Current block size',
|
|
44
|
-
valueType: ValueType.INT
|
|
45
|
-
});
|
|
46
|
-
this.timeToCollectAttestations = meter.createGauge(Metrics.SEQUENCER_TIME_TO_COLLECT_ATTESTATIONS, {
|
|
47
|
-
description: 'The time spent collecting attestations from committee members',
|
|
48
|
-
valueType: ValueType.INT
|
|
49
|
-
});
|
|
50
|
-
this.blockBuilderInsertions = meter.createHistogram(Metrics.SEQUENCER_BLOCK_BUILD_INSERTION_TIME, {
|
|
51
|
-
description: 'Timer for tree insertions performed by the block builder',
|
|
52
|
-
unit: 'us',
|
|
53
|
-
valueType: ValueType.INT
|
|
54
|
-
});
|
|
55
|
-
this.setCurrentBlock(0, 0);
|
|
126
|
+
this.fishermanMaxBlobCapacity = this.meter.createHistogram(Metrics.FISHERMAN_FEE_ANALYSIS_MAX_BLOB_CAPACITY);
|
|
56
127
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return stop.bind(this);
|
|
128
|
+
recordRequiredAttestations(requiredAttestationsCount, allowanceMs) {
|
|
129
|
+
this.requiredAttestions.record(requiredAttestationsCount);
|
|
130
|
+
this.allowanceToCollectAttestations.record(Math.ceil(allowanceMs));
|
|
131
|
+
// reset
|
|
132
|
+
this.collectedAttestions.record(0);
|
|
133
|
+
this.timeToCollectAttestations.record(0);
|
|
64
134
|
}
|
|
65
|
-
|
|
66
|
-
this.
|
|
67
|
-
|
|
68
|
-
recordBlockBuilderTreeInsertions(timeUs) {
|
|
69
|
-
this.blockBuilderInsertions.record(Math.ceil(timeUs));
|
|
70
|
-
}
|
|
71
|
-
recordCancelledBlock() {
|
|
72
|
-
this.blockCounter.add(1, {
|
|
73
|
-
[Attributes.STATUS]: 'cancelled'
|
|
74
|
-
});
|
|
75
|
-
this.setCurrentBlock(0, 0);
|
|
135
|
+
recordCollectedAttestations(count, durationMs) {
|
|
136
|
+
this.collectedAttestions.record(count);
|
|
137
|
+
this.timeToCollectAttestations.record(Math.ceil(durationMs));
|
|
76
138
|
}
|
|
77
|
-
recordBuiltBlock(buildDurationMs, totalMana) {
|
|
139
|
+
recordBuiltBlock(buildDurationMs, totalMana, slot) {
|
|
78
140
|
this.blockCounter.add(1, {
|
|
79
141
|
[Attributes.STATUS]: 'built'
|
|
80
142
|
});
|
|
81
143
|
this.blockBuildDuration.record(Math.ceil(buildDurationMs));
|
|
82
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;
|
|
83
152
|
}
|
|
84
153
|
recordFailedBlock() {
|
|
85
154
|
this.blockCounter.add(1, {
|
|
86
155
|
[Attributes.STATUS]: 'failed'
|
|
87
156
|
});
|
|
88
|
-
this.setCurrentBlock(0, 0);
|
|
89
|
-
}
|
|
90
|
-
recordNewBlock(blockNumber, txCount) {
|
|
91
|
-
this.setCurrentBlock(blockNumber, txCount);
|
|
92
157
|
}
|
|
93
158
|
recordStateTransitionBufferMs(durationMs, state) {
|
|
94
159
|
this.stateTransitionBufferDuration.record(durationMs, {
|
|
95
160
|
[Attributes.SEQUENCER_STATE]: state
|
|
96
161
|
});
|
|
97
162
|
}
|
|
98
|
-
|
|
99
|
-
this.
|
|
100
|
-
|
|
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
|
+
}
|
|
179
|
+
incOpenSlot(slot, proposer) {
|
|
180
|
+
// sequencer went through the loop a second time. Noop
|
|
181
|
+
if (slot === this.lastSeenSlot) {
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
this.slots.add(1, {
|
|
185
|
+
[Attributes.BLOCK_PROPOSER]: proposer
|
|
186
|
+
});
|
|
187
|
+
this.lastSeenSlot = slot;
|
|
188
|
+
}
|
|
189
|
+
async incFilledSlot(proposer, coinbase) {
|
|
190
|
+
this.filledSlots.add(1, {
|
|
191
|
+
[Attributes.BLOCK_PROPOSER]: proposer
|
|
192
|
+
});
|
|
193
|
+
this.lastSeenSlot = undefined;
|
|
194
|
+
if (coinbase) {
|
|
195
|
+
try {
|
|
196
|
+
const rewards = await this.rollup.getSequencerRewards(coinbase);
|
|
197
|
+
const fmt = parseFloat(formatUnits(rewards, 18));
|
|
198
|
+
this.rewards.record(fmt, {
|
|
199
|
+
[Attributes.COINBASE]: coinbase.toString()
|
|
200
|
+
});
|
|
201
|
+
} catch {
|
|
202
|
+
// no-op
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
recordCheckpointSuccess() {
|
|
207
|
+
this.checkpointSuccess.add(1);
|
|
208
|
+
}
|
|
209
|
+
recordBlockProposalFailed(reason) {
|
|
210
|
+
this.blockProposalFailed.add(1, {
|
|
211
|
+
...reason && {
|
|
212
|
+
[Attributes.ERROR_TYPE]: reason
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
recordCheckpointProposalSuccess() {
|
|
217
|
+
this.checkpointProposalSuccess.add(1);
|
|
218
|
+
}
|
|
219
|
+
recordCheckpointPrecheckFailed(checkType) {
|
|
220
|
+
this.checkpointPrecheckFailed.add(1, {
|
|
221
|
+
[Attributes.ERROR_TYPE]: checkType
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
recordCheckpointProposalFailed(reason) {
|
|
225
|
+
this.checkpointProposalFailed.add(1, {
|
|
226
|
+
...reason && {
|
|
227
|
+
[Attributes.ERROR_TYPE]: reason
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
recordSlashingAttempt(actionCount) {
|
|
232
|
+
this.slashingAttempts.add(actionCount);
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Records metrics for a completed fisherman fee analysis
|
|
236
|
+
* @param analysis - The completed fee analysis result
|
|
237
|
+
*/ recordFishermanFeeAnalysis(analysis) {
|
|
238
|
+
// In fisherman mode, we should always have strategy results
|
|
239
|
+
if (!analysis.computedPrices.strategyResults || analysis.computedPrices.strategyResults.length === 0) {
|
|
240
|
+
// This should never happen in fisherman mode - log an error
|
|
241
|
+
// We don't record metrics without strategy IDs as that defeats the purpose
|
|
242
|
+
throw new Error(`No strategy results found in fisherman fee analysis ${analysis.id}. This indicates a bug in the fee analysis.`);
|
|
243
|
+
}
|
|
244
|
+
// Record metrics for each strategy separately
|
|
245
|
+
for (const strategyResult of analysis.computedPrices.strategyResults){
|
|
246
|
+
const strategyAttributes = {
|
|
247
|
+
[Attributes.FISHERMAN_FEE_STRATEGY_ID]: strategyResult.strategyId
|
|
248
|
+
};
|
|
249
|
+
// Record pending block snapshot data (once per strategy for comparison)
|
|
250
|
+
this.fishermanPendingBlobTxCount.record(analysis.pendingSnapshot.pendingBlobTxCount, strategyAttributes);
|
|
251
|
+
this.fishermanPendingBlobCount.record(analysis.pendingSnapshot.pendingBlobCount, strategyAttributes);
|
|
252
|
+
// Record mined block data if available
|
|
253
|
+
if (analysis.minedBlock) {
|
|
254
|
+
this.fishermanIncludedBlobTxCount.record(analysis.minedBlock.includedBlobTxCount, strategyAttributes);
|
|
255
|
+
this.fishermanIncludedBlobCount.record(analysis.minedBlock.includedBlobCount, strategyAttributes);
|
|
256
|
+
// Record actual fees from blob transactions in the mined block
|
|
257
|
+
for (const blobTx of analysis.minedBlock.includedBlobTxs){
|
|
258
|
+
// Record priority fee per gas in Gwei
|
|
259
|
+
const priorityFeeGwei = Number(blobTx.maxPriorityFeePerGas) / 1e9;
|
|
260
|
+
this.fishermanMinedBlobTxPriorityFee.record(priorityFeeGwei, strategyAttributes);
|
|
261
|
+
// Calculate total cost in ETH
|
|
262
|
+
// Cost = (gas * (baseFee + priorityFee)) + (blobCount * blobGasPerBlob * blobBaseFee)
|
|
263
|
+
const baseFee = analysis.minedBlock.baseFeePerGas;
|
|
264
|
+
const effectiveGasPrice = baseFee + blobTx.maxPriorityFeePerGas;
|
|
265
|
+
// Calculate execution cost using actual gas limit from the transaction
|
|
266
|
+
const executionCost = blobTx.gas * effectiveGasPrice;
|
|
267
|
+
// Calculate blob cost using maxFeePerBlobGas * blobCount * GAS_PER_BLOB
|
|
268
|
+
const blobCost = blobTx.maxFeePerBlobGas * BigInt(blobTx.blobCount) * 131072n; // 128KB per blob
|
|
269
|
+
const totalCostWei = executionCost + blobCost;
|
|
270
|
+
const totalCostEth = Number(totalCostWei) / 1e18;
|
|
271
|
+
this.fishermanMinedBlobTxTotalCost.record(totalCostEth, strategyAttributes);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// Record the calculated priority fee for this strategy
|
|
275
|
+
const calculatedPriorityFeeGwei = Number(strategyResult.calculatedPriorityFee) / 1e9;
|
|
276
|
+
this.fishermanCalculatedPriorityFee.record(calculatedPriorityFeeGwei, strategyAttributes);
|
|
277
|
+
// Record analysis results if available
|
|
278
|
+
if (analysis.analysis) {
|
|
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);
|
|
294
|
+
// Record strategy-specific inclusion result
|
|
295
|
+
if (strategyResult.wouldBeIncluded !== undefined) {
|
|
296
|
+
const inclusionAttributes = {
|
|
297
|
+
...strategyAttributes,
|
|
298
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
299
|
+
};
|
|
300
|
+
if (strategyResult.wouldBeIncluded) {
|
|
301
|
+
this.fishermanWouldBeIncluded.add(1, {
|
|
302
|
+
...inclusionAttributes,
|
|
303
|
+
[Attributes.OK]: true
|
|
304
|
+
});
|
|
305
|
+
} else {
|
|
306
|
+
this.fishermanWouldBeIncluded.add(1, {
|
|
307
|
+
...inclusionAttributes,
|
|
308
|
+
[Attributes.OK]: false,
|
|
309
|
+
...strategyResult.exclusionReason && {
|
|
310
|
+
[Attributes.ERROR_TYPE]: strategyResult.exclusionReason
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
// Record strategy-specific priority fee delta
|
|
316
|
+
if (strategyResult.priorityFeeDelta !== undefined) {
|
|
317
|
+
const priorityFeeDeltaGwei = Number(strategyResult.priorityFeeDelta) / 1e9;
|
|
318
|
+
const deltaAttributes = {
|
|
319
|
+
...strategyAttributes,
|
|
320
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
321
|
+
};
|
|
322
|
+
this.fishermanPriorityFeeDelta.record(priorityFeeDeltaGwei, deltaAttributes);
|
|
323
|
+
}
|
|
324
|
+
// Record estimated cost if available
|
|
325
|
+
if (strategyResult.estimatedCostEth !== undefined) {
|
|
326
|
+
const costAttributes = {
|
|
327
|
+
...strategyAttributes,
|
|
328
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
329
|
+
};
|
|
330
|
+
this.fishermanEstimatedCost.record(strategyResult.estimatedCostEth, costAttributes);
|
|
331
|
+
}
|
|
332
|
+
// Record estimated overpayment if available
|
|
333
|
+
if (strategyResult.estimatedOverpaymentEth !== undefined) {
|
|
334
|
+
const overpaymentAttributes = {
|
|
335
|
+
...strategyAttributes,
|
|
336
|
+
[Attributes.BLOCK_FULL]: analysis.analysis.blockBlobsFull ? 'true' : 'false'
|
|
337
|
+
};
|
|
338
|
+
this.fishermanEstimatedOverpayment.record(strategyResult.estimatedOverpaymentEth, overpaymentAttributes);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
101
342
|
}
|
|
102
343
|
}
|