mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
feat(metrics): add skipped txs metrics for miner (#494)
This commit is contained in:
parent
ef328dbb6e
commit
24d856758b
2 changed files with 18 additions and 1 deletions
|
|
@ -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()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue