diff --git a/core/vm/contracts.libevm.go b/core/vm/contracts.libevm.go index d95f1314d327..dadd7e3f118d 100644 --- a/core/vm/contracts.libevm.go +++ b/core/vm/contracts.libevm.go @@ -92,7 +92,7 @@ func (t CallType) OpCode() OpCode { // regular types. func (args *evmCallArgs) run(p PrecompiledContract, input []byte, suppliedGas uint64) (ret []byte, remainingGas uint64, err error) { if p, ok := p.(statefulPrecompile); ok { - // `suppliedGas` is already held by the args. + // `suppliedGas` is already held by the args, and captured by `env()`. return p.run(args.env(), input) } // Gas consumption for regular precompiles was already handled by the native diff --git a/core/vm/contracts.libevm_test.go b/core/vm/contracts.libevm_test.go index e4d134ed17ea..21b8b88d02ff 100644 --- a/core/vm/contracts.libevm_test.go +++ b/core/vm/contracts.libevm_test.go @@ -149,11 +149,11 @@ func TestNewStatefulPrecompile(t *testing.T) { run := func(env vm.PrecompileEnvironment, input []byte, suppliedGas uint64) ([]byte, uint64, error) { if got, want := env.StateDB() != nil, !env.ReadOnly(); got != want { - return nil, suppliedGas, fmt.Errorf("PrecompileEnvironment().StateDB() must be non-nil i.f.f. not read-only; got non-nil? %t; want %t", got, want) + return nil, 0, fmt.Errorf("PrecompileEnvironment().StateDB() must be non-nil i.f.f. not read-only; got non-nil? %t; want %t", got, want) } hdr, err := env.BlockHeader() if err != nil { - return nil, suppliedGas, err + return nil, 0, err } out := &statefulPrecompileOutput{