@@ -527,13 +527,43 @@ func (f *finalizer) handleProcessTransactionResponse(ctx context.Context, tx *Tx
527
527
}
528
528
529
529
// Check remaining resources
530
+
530
531
overflow , overflowResource := f .wipBatch .imRemainingResources .Sub (state.BatchResources {ZKCounters : result .UsedZkCounters , Bytes : uint64 (len (tx .RawTx ))})
531
532
if overflow {
532
533
log .Infof ("current tx %s exceeds the remaining batch resources, overflow resource: %s, updating metadata for tx in worker and continuing" , tx .HashStr , overflowResource )
533
- start := time .Now ()
534
- f .workerIntf .UpdateTxZKCounters (result .BlockResponses [0 ].TransactionResponses [0 ].TxHash , tx .From , result .UsedZkCounters )
535
- metrics .WorkerProcessingTime (time .Since (start ))
536
- return nil , ErrBatchResourceUnderFlow
534
+ if ! f .batchConstraints .IsWithinConstraints (result .UsedZkCounters ) {
535
+ log .Warnf ("current tx %s exceeds the max limit for batch resources (node OOC), setting tx as invalid in the pool" , tx .HashStr )
536
+
537
+ event := & event.Event {
538
+ ReceivedAt : time .Now (),
539
+ Source : event .Source_Node ,
540
+ Component : event .Component_Sequencer ,
541
+ Level : event .Level_Error ,
542
+ EventID : event .EventID_NodeOOC ,
543
+ Description : fmt .Sprintf ("tx: %s exceeds node max limit batch resources (node OOC), from: %s, IP: %s" , tx .HashStr , tx .FromStr , tx .IP ),
544
+ }
545
+
546
+ eventErr := f .eventLog .LogEvent (ctx , event )
547
+ if eventErr != nil {
548
+ log .Errorf ("error storing finalizer halt event, error: %v" , eventErr )
549
+ }
550
+
551
+ // Delete the transaction from the txSorted list
552
+ f .workerIntf .DeleteTx (tx .Hash , tx .From )
553
+
554
+ errMsg := "node OOC"
555
+ err = f .poolIntf .UpdateTxStatus (ctx , tx .Hash , pool .TxStatusInvalid , false , & errMsg )
556
+ if err != nil {
557
+ log .Errorf ("failed to update status to invalid in the pool for tx %s, error: %v" , tx .Hash .String (), err )
558
+ }
559
+
560
+ return nil , ErrBatchResourceUnderFlow
561
+ } else {
562
+ start := time .Now ()
563
+ f .workerIntf .UpdateTxZKCounters (result .BlockResponses [0 ].TransactionResponses [0 ].TxHash , tx .From , result .UsedZkCounters )
564
+ metrics .WorkerProcessingTime (time .Since (start ))
565
+ return nil , ErrBatchResourceUnderFlow
566
+ }
537
567
}
538
568
539
569
// Save Enabled, GasPriceOC, BalanceOC and final effective gas price for later logging
0 commit comments