diff options
author | Péter Szilágyi <peterke@gmail.com> | 2018-03-05 20:23:48 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 20:23:48 +0800 |
commit | 223fe3f26e8ec7133ed1d7ed3d460c8fc86ef9f8 (patch) | |
tree | a6b744b7af001b8bbd2e0e2ef93f11586ab4d38c /core | |
parent | 478143d69a13103a6809ef41a64b25db8c2438ee (diff) | |
parent | b7e57ca1d029d08d214a098d7aa123201b121774 (diff) | |
download | go-tangerine-223fe3f26e8ec7133ed1d7ed3d460c8fc86ef9f8.tar.gz go-tangerine-223fe3f26e8ec7133ed1d7ed3d460c8fc86ef9f8.tar.zst go-tangerine-223fe3f26e8ec7133ed1d7ed3d460c8fc86ef9f8.zip |
Merge pull request #16229 from karalabe/evm-call-fix
cmd/evm, core/vm, internal/ethapi: don't disable call gas metering
Diffstat (limited to 'core')
-rw-r--r-- | core/vm/interpreter.go | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index e12dd7e5a..95490adfc 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -37,8 +37,6 @@ type Config struct { // NoRecursion disabled Interpreter call, callcode, // delegate call and create. NoRecursion bool - // Disable gas metering - DisableGasMetering bool // Enable recording of SHA3/keccak preimages EnablePreimageRecording bool // JumpTable contains the EVM instruction table. This @@ -189,14 +187,11 @@ func (in *Interpreter) Run(contract *Contract, input []byte) (ret []byte, err er return nil, errGasUintOverflow } } - - if !in.cfg.DisableGasMetering { - // consume the gas and return an error if not enough gas is available. - // cost is explicitly set so that the capture state defer method cas get the proper cost - cost, err = operation.gasCost(in.gasTable, in.evm, contract, stack, mem, memorySize) - if err != nil || !contract.UseGas(cost) { - return nil, ErrOutOfGas - } + // consume the gas and return an error if not enough gas is available. + // cost is explicitly set so that the capture state defer method cas get the proper cost + cost, err = operation.gasCost(in.gasTable, in.evm, contract, stack, mem, memorySize) + if err != nil || !contract.UseGas(cost) { + return nil, ErrOutOfGas } if memorySize > 0 { mem.Resize(memorySize) |