diff --git a/miner/worker.go b/miner/worker.go index 0e463f2bcb..fc455efc49 100644 --- a/miner/worker.go +++ b/miner/worker.go @@ -36,6 +36,7 @@ import ( "github.com/scroll-tech/go-ethereum/core/types" "github.com/scroll-tech/go-ethereum/event" "github.com/scroll-tech/go-ethereum/log" + "github.com/scroll-tech/go-ethereum/metrics" "github.com/scroll-tech/go-ethereum/params" "github.com/scroll-tech/go-ethereum/rollup/circuitcapacitychecker" "github.com/scroll-tech/go-ethereum/trie" @@ -81,6 +82,16 @@ const ( staleThreshold = 7 ) +var ( + // Metrics for the skipped txs + l1TxGasLimitExceededCounter = metrics.NewRegisteredCounter("miner/skipped_txs/l1/gas_limit_exceeded", nil) + l1TxRowConsumptionOverflowCounter = metrics.NewRegisteredCounter("miner/skipped_txs/l1/row_consumption_overflow", nil) + l2TxRowConsumptionOverflowCounter = metrics.NewRegisteredCounter("miner/skipped_txs/l2/row_consumption_overflow", nil) + l1TxCccUnknownErrCounter = metrics.NewRegisteredCounter("miner/skipped_txs/l1/ccc_unknown_err", nil) + l2TxCccUnknownErrCounter = metrics.NewRegisteredCounter("miner/skipped_txs/l2/ccc_unknown_err", nil) + l1TxStrangeErrCounter = metrics.NewRegisteredCounter("miner/skipped_txs/l1/strange_err", nil) +) + // environment is the worker's current environment and holds all of the current state information. type environment struct { signer types.Signer @@ -1026,6 +1037,7 @@ loop: w.current.nextL1MsgIndex = queueIndex + 1 txs.Shift() rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, "gas limit exceeded", w.current.header.Number.Uint64(), nil) + l1TxGasLimitExceededCounter.Inc(1) case errors.Is(err, core.ErrGasLimitReached): // Pop the current out-of-gas transaction without shifting in the next from the account @@ -1086,11 +1098,13 @@ loop: queueIndex := tx.AsL1MessageTx().QueueIndex log.Info("Skipping L1 message", "queueIndex", queueIndex, "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "first tx row consumption overflow") w.current.nextL1MsgIndex = queueIndex + 1 + l1TxRowConsumptionOverflowCounter.Inc(1) } else { // Skip L2 transaction and all other transactions from the same sender account log.Info("Skipping L2 message", "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "first tx row consumption overflow") txs.Pop() w.eth.TxPool().RemoveTx(tx.Hash(), true) + l2TxRowConsumptionOverflowCounter.Inc(1) } // Reset ccc so that we can process other transactions for this block @@ -1111,6 +1125,7 @@ loop: w.current.nextL1MsgIndex = queueIndex + 1 // TODO: propagate more info about the error from CCC rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, "unknown circuit capacity checker error", w.current.header.Number.Uint64(), nil) + l1TxCccUnknownErrCounter.Inc(1) // Normally we would do `txs.Shift()` here. // However, after `ErrUnknown`, ccc might remain in an @@ -1124,6 +1139,7 @@ loop: log.Info("Skipping L2 message", "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "unknown row consumption error") // TODO: propagate more info about the error from CCC rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, "unknown circuit capacity checker error", w.current.header.Number.Uint64(), nil) + l2TxCccUnknownErrCounter.Inc(1) // Normally we would do `txs.Pop()` here. // However, after `ErrUnknown`, ccc might remain in an @@ -1141,6 +1157,7 @@ loop: log.Info("Skipping L1 message", "queueIndex", queueIndex, "tx", tx.Hash().String(), "block", w.current.header.Number, "reason", "strange error", "err", err) w.current.nextL1MsgIndex = queueIndex + 1 rawdb.WriteSkippedTransaction(w.eth.ChainDb(), tx, fmt.Sprintf("strange error: %v", err), w.current.header.Number.Uint64(), nil) + l1TxStrangeErrCounter.Inc(1) } txs.Shift() } diff --git a/params/version.go b/params/version.go index f525aa1228..70c5ef0f07 100644 --- a/params/version.go +++ b/params/version.go @@ -24,7 +24,7 @@ import ( const ( VersionMajor = 4 // Major version component of the current release VersionMinor = 3 // Minor version component of the current release - VersionPatch = 58 // Patch version component of the current release + VersionPatch = 59 // Patch version component of the current release VersionMeta = "sepolia" // Version metadata to append to the version string )