diff --git a/core/vm/interpreter.go b/core/vm/interpreter.go index c7146651992f..8b8705a2ac17 100644 --- a/core/vm/interpreter.go +++ b/core/vm/interpreter.go @@ -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 @@ -83,6 +86,8 @@ type EVMInterpreter struct { evm *EVM cfg Config + paygasMode PaygasMode + intPool *intPool hasher keccakState // Keccak256 hasher instance shared across opcodes @@ -128,6 +133,7 @@ func NewEVMInterpreter(evm *EVM, cfg Config) *EVMInterpreter { } return &EVMInterpreter{ + paygasMode: cfg.PaygasMode, evm: evm, cfg: cfg, } diff --git a/core/vm/jump_table.go b/core/vm/jump_table.go index 38b29a23e1a2..a58a91088557 100644 --- a/core/vm/jump_table.go +++ b/core/vm/jump_table.go @@ -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()