diff --git a/eventcheck/gaspowercheck/gas_power_check.go b/eventcheck/gaspowercheck/gas_power_check.go index 954ed5edf..afe6a6230 100644 --- a/eventcheck/gaspowercheck/gas_power_check.go +++ b/eventcheck/gaspowercheck/gas_power_check.go @@ -2,6 +2,7 @@ package gaspowercheck import ( "errors" + "github.com/ethereum/go-ethereum/metrics" "math/big" "time" @@ -17,6 +18,8 @@ import ( var ( // ErrWrongGasPowerLeft indicates that event's GasPowerLeft is miscalculated. ErrWrongGasPowerLeft = errors.New("event has wrong GasPowerLeft") + + notEnoughGasPowerCounter = metrics.GetOrRegisterCounter("events/validate/wrong_gas_power", nil) ) type ValidatorState struct { @@ -173,6 +176,7 @@ func (v *Checker) Validate(e inter.EventI, selfParent inter.EventI) error { } for i := range gasPowers.Gas { if e.GasPowerLeft().Gas[i]+e.GasPowerUsed() != gasPowers.Gas[i] { // GasPowerUsed is checked in basic_check + notEnoughGasPowerCounter.Inc(1) return ErrWrongGasPowerLeft } } diff --git a/gossip/c_event_callbacks.go b/gossip/c_event_callbacks.go index b60835aad..1ea1c08c8 100644 --- a/gossip/c_event_callbacks.go +++ b/gossip/c_event_callbacks.go @@ -2,6 +2,7 @@ package gossip import ( "errors" + "github.com/ethereum/go-ethereum/metrics" "math/big" "sync/atomic" @@ -27,6 +28,8 @@ var ( errNonExistingEpoch = errors.New("epoch doesn't exist") errSameEpoch = errors.New("epoch hasn't changed") errDirtyEvmSnap = errors.New("EVM snapshot is dirty") + + notEnoughGasPowerCounter = metrics.GetOrRegisterCounter("events/build/not_enough_gas_power", nil) ) func (s *Service) buildEvent(e *inter.MutableEventPayload, onIndexed func()) error { @@ -63,6 +66,7 @@ func (s *Service) buildEvent(e *inter.MutableEventPayload, onIndexed func()) err return err } if e.GasPowerUsed() > availableGasPower.Min() { + notEnoughGasPowerCounter.Inc(1) return emitter.ErrNotEnoughGasPower } e.SetGasPowerLeft(availableGasPower.Sub(e.GasPowerUsed()))