Skip to content

Commit

Permalink
fix(tm2): overflow check when computing remaining gas. (#3745)
Browse files Browse the repository at this point in the history
Panic on overflow when computing the remaining gas, to avoid
inconsistent and wrong gas amounts.
  • Loading branch information
mvertes authored Feb 13, 2025
1 parent c61e217 commit 52a4198
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tm2/pkg/store/types/gas.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (g *basicGasMeter) Limit() Gas {
}

func (g *basicGasMeter) Remaining() Gas {
return g.Limit() - g.GasConsumedToLimit()
return overflow.Sub64p(g.Limit(), g.GasConsumedToLimit())
}

func (g *basicGasMeter) GasConsumedToLimit() Gas {
Expand Down

0 comments on commit 52a4198

Please sign in to comment.