@@ -209,6 +209,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
209
209
210
210
if msg == nil || msg .ExecutionPayload == nil {
211
211
log .Warn ("Empty preconfirmation block payload" , "peer" , from )
212
+ metrics .DriverPreconfInvalidEnvelopeCounter .Inc ()
212
213
return nil
213
214
}
214
215
@@ -223,6 +224,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
223
224
"gasUsed" , uint64 (msg .ExecutionPayload .GasUsed ),
224
225
"endOfSequencing" , msg .EndOfSequencing != nil ,
225
226
)
227
+ metrics .DriverPreconfEnvelopeCounter .Inc ()
226
228
227
229
// Check if the payload is valid.
228
230
if err := s .ValidateExecutionPayload (msg .ExecutionPayload ); err != nil {
@@ -234,7 +236,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
234
236
"parentHash" , msg .ExecutionPayload .ParentHash .Hex (),
235
237
"error" , err ,
236
238
)
237
- metrics .DriverPreconfP2PInvalidEnvelopeCounter .Inc ()
239
+ metrics .DriverPreconfInvalidEnvelopeCounter .Inc ()
238
240
return nil
239
241
}
240
242
@@ -260,8 +262,6 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Payload(
260
262
return nil
261
263
}
262
264
263
- metrics .DriverPreconfP2PEnvelopeCounter .Inc ()
264
-
265
265
// Ensure the preconfirmation block number is greater than the current head L1 origin block ID.
266
266
headL1Origin , err := checkMessageBlockNumber (ctx , s .rpc , msg )
267
267
if err != nil {
@@ -303,6 +303,8 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Response(
303
303
return nil
304
304
}
305
305
306
+ metrics .DriverPreconfOnL2UnsafeResponseCounter .Inc ()
307
+
306
308
// Ignore the message if it is in the cache already.
307
309
if s .payloadsCache .has (uint64 (msg .ExecutionPayload .BlockNumber ), msg .ExecutionPayload .BlockHash ) {
308
310
log .Debug (
@@ -324,7 +326,7 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Response(
324
326
"parentHash" , msg .ExecutionPayload .ParentHash .Hex (),
325
327
"error" , err ,
326
328
)
327
- metrics .DriverPreconfP2PInvalidEnvelopeCounter .Inc ()
329
+ metrics .DriverPreconfInvalidEnvelopeCounter .Inc ()
328
330
return nil
329
331
}
330
332
@@ -355,8 +357,6 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Response(
355
357
"transactions" , len (msg .ExecutionPayload .Transactions ),
356
358
)
357
359
358
- metrics .DriverPreconfP2PResponseEnvelopeCounter .Inc ()
359
-
360
360
// Ensure the preconfirmation block number is greater than the current head L1 origin block ID.
361
361
headL1Origin , err := checkMessageBlockNumber (ctx , s .rpc , msg )
362
362
if err != nil {
@@ -401,6 +401,8 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2Request(
401
401
402
402
log .Info ("🔊 New preconfirmation block request from P2P network" , "peer" , from , "hash" , hash .Hex ())
403
403
404
+ metrics .DriverPreconfOnL2UnsafeRequestCounter .Inc ()
405
+
404
406
headL1Origin , err := s .rpc .L2 .HeadL1Origin (ctx )
405
407
if err != nil && err .Error () != ethereum .NotFound .Error () {
406
408
return fmt .Errorf ("failed to fetch head L1 origin: %w" , err )
@@ -476,6 +478,8 @@ func (s *PreconfBlockAPIServer) OnUnsafeL2EndOfSequencingRequest(
476
478
"epoch" , epoch ,
477
479
)
478
480
481
+ metrics .DriverPreconfOnEndOfSequencingRequestCounter .Inc ()
482
+
479
483
hash , ok := s .sequencingEndedForEpochCache .Get (epoch )
480
484
if ! ok {
481
485
return fmt .Errorf ("failed to find the end of sequencing block for the given epoch: %d" , epoch )
@@ -635,6 +639,8 @@ func (s *PreconfBlockAPIServer) ImportMissingAncientsFromCache(
635
639
return fmt .Errorf ("failed to insert ancient preconfirmation blocks from cache: %w" , err )
636
640
}
637
641
642
+ metrics .DriverImportedPreconBlocksFromCacheCounter .Add (float64 (len (payloadsToImport )))
643
+
638
644
return nil
639
645
}
640
646
@@ -663,6 +669,8 @@ func (s *PreconfBlockAPIServer) ImportChildBlocksFromCache(
663
669
return fmt .Errorf ("failed to insert child preconfirmation blocks from cache: %w" , err )
664
670
}
665
671
672
+ metrics .DriverImportedPreconBlocksFromCacheCounter .Add (float64 (len (childPayloads )))
673
+
666
674
return nil
667
675
}
668
676
@@ -794,7 +802,7 @@ func (s *PreconfBlockAPIServer) GetLookahead() *Lookahead {
794
802
}
795
803
796
804
// CheckLookaheadHandover returns nil if feeRecipient is allowed to build at slot globalSlot (absolute L1 slot).
797
- // and checks the handover window to see if we need to request the end of sequencing
805
+ // and checks the handover window to see if we need to request the end of sequencing
798
806
// block.
799
807
func (s * PreconfBlockAPIServer ) CheckLookaheadHandover (feeRecipient common.Address , globalSlot uint64 ) error {
800
808
s .lookaheadMutex .Lock ()
@@ -868,6 +876,8 @@ func (s *PreconfBlockAPIServer) recordLatestSeenProposal(proposal *encoding.Last
868
876
"lastBlockID" , proposal .Pacaya ().GetLastBlockID (),
869
877
)
870
878
s .latestSeenProposal = proposal
879
+ metrics .DriverLastSeenBlockInProposalGauge .Set (float64 (proposal .Pacaya ().GetLastBlockID ()))
880
+
871
881
// If the latest seen proposal is reorged, reset the highest unsafe L2 payload block ID.
872
882
if s .latestSeenProposal .PreconfChainReorged {
873
883
s .highestUnsafeL2PayloadBlockID = proposal .Pacaya ().GetLastBlockID ()
@@ -877,6 +887,7 @@ func (s *PreconfBlockAPIServer) recordLatestSeenProposal(proposal *encoding.Last
877
887
"lastBlockID" , s .highestUnsafeL2PayloadBlockID ,
878
888
"highestUnsafeL2PayloadBlockID" , s .highestUnsafeL2PayloadBlockID ,
879
889
)
890
+ metrics .DriverReorgsByProposalCounter .Inc ()
880
891
}
881
892
}
882
893
@@ -1018,6 +1029,7 @@ func (s *PreconfBlockAPIServer) updateHighestUnsafeL2Payload(blockID uint64) {
1018
1029
)
1019
1030
}
1020
1031
s .highestUnsafeL2PayloadBlockID = blockID
1032
+ metrics .DriverHighestPreconfUnsafePayloadGauge .Set (float64 (blockID ))
1021
1033
}
1022
1034
1023
1035
// webSocketSever is a WebSocket server that handles incoming connections,
0 commit comments