From afd41ce587ac72edb4a511ca7635712701bc2ced Mon Sep 17 00:00:00 2001 From: Sam Wilson Date: Mon, 1 Jun 2020 12:57:23 -0400 Subject: [PATCH] Store the gas price popped by PAYGAS --- core/vm/instructions.go | 11 +++++++---- core/vm/interpreter.go | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/core/vm/instructions.go b/core/vm/instructions.go index 5c0d4dbc2524..30fe5e3a4ce8 100644 --- a/core/vm/instructions.go +++ b/core/vm/instructions.go @@ -903,13 +903,16 @@ func makeLog(size int) executionFunc { } func opPaygas(pc *uint64, interpreter *EVMInterpreter, callContext *callCtx) ([]byte, error) { - - // TODO: Store the popped value - if interpreter.paygasMode != PaygasNoOp { + gasprice := callContext.stack.pop() + if interpreter.paygasMode == PaygasNoOp { + interpreter.intPool.put(gasprice) + } else { + // TODO: Check the computed value against the GasPrice set in the tx interpreter.evm.snapshots[len(interpreter.evm.snapshots)-1] = interpreter.evm.StateDB.Snapshot() interpreter.paygasMode = PaygasNoOp + interpreter.paygasPrice = gasprice } - interpreter.intPool.put(callContext.stack.pop()) + return nil, nil } diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index aae3e7859ce0..dd08b5127192 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -18,6 +18,7 @@ package vm import ( "hash" + "math/big" "sync/atomic" "github.com/ethereum/go-ethereum/common" @@ -87,6 +88,7 @@ type EVMInterpreter struct { cfg Config paygasMode PaygasMode + paygasPrice *big.Int intPool *intPool