Skip to content

Commit

Permalink
Merge pull request #9 from quilt/paygas-price
Browse files Browse the repository at this point in the history
Store the gas price popped by PAYGAS
  • Loading branch information
SamWilsn authored Jun 2, 2020
2 parents 0d45538 + afd41ce commit 92e2040
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
11 changes: 7 additions & 4 deletions core/vm/instructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 2 additions & 0 deletions core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package vm

import (
"hash"
"math/big"
"sync/atomic"

"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -87,6 +88,7 @@ type EVMInterpreter struct {
cfg Config

paygasMode PaygasMode
paygasPrice *big.Int

intPool *intPool

Expand Down

0 comments on commit 92e2040

Please sign in to comment.