Skip to content

Commit

Permalink
Merge pull request #3 from quilt/paygas-config
Browse files Browse the repository at this point in the history
Add flag for paygas mode to EVM interpreter
  • Loading branch information
SamWilsn authored May 21, 2020
2 parents 9917967 + 79b6c79 commit bfe712a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions core/vm/interpreter.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ type Config struct {
EVMInterpreter string // External EVM interpreter options

ExtraEips []int // Additional EIPS that are to be enabled

// paygasMode sets the behavior of the PAYGAS opcode.
PaygasMode PaygasMode
}

// Interpreter is used to run Ethereum based contracts and will utilise the
Expand Down Expand Up @@ -83,6 +86,8 @@ type EVMInterpreter struct {
evm *EVM
cfg Config

paygasMode PaygasMode

intPool *intPool

hasher keccakState // Keccak256 hasher instance shared across opcodes
Expand Down Expand Up @@ -128,6 +133,7 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter {
}

return &EVMInterpreter{
paygasMode: cfg.PaygasMode,
evm: evm,
cfg: cfg,
}
Expand Down
11 changes: 11 additions & 0 deletions core/vm/jump_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,17 @@ var (
// JumpTable contains the EVM opcodes supported at a given fork.
type JumpTable [256]operation

type PaygasMode = uint

const (
// Calling the PAYGAS opcode does nothing.
PaygasNoOp PaygasMode = iota
// Execution terminates as soon as PAYGAS is called.
PaygasHalt
// Execution continues after PAYGAS is called.
PaygasContinue
)

func newAccountAbstractionInstructionSet() JumpTable {
instructionSet := newIstanbulInstructionSet()

Expand Down

0 comments on commit bfe712a

Please sign in to comment.