diff --git a/x/vm/statedb/journal.go b/x/vm/statedb/journal.go index a008ffe6b..a0a9dcd3d 100644 --- a/x/vm/statedb/journal.go +++ b/x/vm/statedb/journal.go @@ -188,6 +188,13 @@ func (pc precompileCallChange) Revert(s *StateDB) { // Restore processed events counter s.processedEventsCount = pc.prevProcessedEventCount + + // fix: decrement the precompile calls counter so that a reverted call + // does not permanently consume a slot in the per-tx limit, preventing + // an attacker from exhausting the limit via deliberate reverts. + if s.precompileCallsCounter > 0 { + s.precompileCallsCounter-- + } } func (pc precompileCallChange) Dirtied() *common.Address { @@ -301,4 +308,4 @@ func (ch accessListAddSlotChange) Revert(s *StateDB) { func (ch accessListAddSlotChange) Dirtied() *common.Address { return nil -} +} \ No newline at end of file