Skip to content

Commit

Permalink
vm: fix gas underflow
Browse files Browse the repository at this point in the history
Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign committed Aug 6, 2024
1 parent cf22fe9 commit 10967b8
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
// if the PC ends up in a new "chunk" of verkleized code, charge the
// associated costs.
contractAddr := contract.Address()
contract.Gas -= in.evm.TxContext.Accesses.TouchCodeChunksRangeAndChargeGas(contractAddr[:], pc, 1, uint64(len(contract.Code)), false)
if !contract.UseGas(in.evm.TxContext.Accesses.TouchCodeChunksRangeAndChargeGas(contractAddr[:], pc, 1, uint64(len(contract.Code)), false)) {
return nil, ErrOutOfGas
}
}

// Get the operation from the jump table and validate the stack to ensure there are
Expand Down

0 comments on commit 10967b8

Please sign in to comment.