From 6a10dfd0fe1fcae73b9b2d5574e45faa213fe690 Mon Sep 17 00:00:00 2001 From: andri lim Date: Mon, 24 Jun 2024 12:58:15 +0700 Subject: [PATCH] Remove pre and post opcode handlers from EVM (#2409) --- nimbus/evm/interpreter/op_handlers.nim | 4 +- .../op_handlers/oph_arithmetic.nim | 124 +++++++----------- .../interpreter/op_handlers/oph_blockdata.nim | 54 +++----- .../evm/interpreter/op_handlers/oph_call.nim | 19 +-- .../interpreter/op_handlers/oph_create.nim | 9 +- .../evm/interpreter/op_handlers/oph_defs.nim | 10 +- .../interpreter/op_handlers/oph_envinfo.nim | 99 ++++++-------- .../op_handlers/oph_gen_handlers.nim | 5 +- .../evm/interpreter/op_handlers/oph_hash.nim | 4 +- .../interpreter/op_handlers/oph_memory.nim | 99 ++++++-------- .../evm/interpreter/op_handlers/oph_push.nim | 4 +- .../interpreter/op_handlers/oph_sysops.nim | 34 ++--- 12 files changed, 177 insertions(+), 288 deletions(-) diff --git a/nimbus/evm/interpreter/op_handlers.nim b/nimbus/evm/interpreter/op_handlers.nim index dab733b4b..66ff96fad 100644 --- a/nimbus/evm/interpreter/op_handlers.nim +++ b/nimbus/evm/interpreter/op_handlers.nim @@ -97,7 +97,7 @@ const # # to pick right function when is a variable . Using # - # VmOpHandlers[fork][op].exec.run + # VmOpHandlers[fork][op].exec # # only works when is a constant. There seems to be some optimisation # that garbles the sub-structures elements , , and . @@ -113,7 +113,7 @@ const for op in Op: rc[fork][op].name = tab[op].name rc[fork][op].info = tab[op].info - rc[fork][op].run = tab[op].exec.run + rc[fork][op].run = tab[op].exec rc # ------------------------------------------------------------------------------ diff --git a/nimbus/evm/interpreter/op_handlers/oph_arithmetic.nim b/nimbus/evm/interpreter/op_handlers/oph_arithmetic.nim index 4e9dcf94f..20b8b4f62 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_arithmetic.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_arithmetic.nim @@ -290,179 +290,157 @@ const forks: VmOpAllForks, name: "add", info: "Addition operation", - exec: (prep: VmOpIgnore, - run: VmOpFn addOp, - post: VmOpIgnore)), + exec: VmOpFn addOp), + (opCode: Mul, ## 0x02, Multiplication forks: VmOpAllForks, name: "mul", info: "Multiplication operation", - exec: (prep: VmOpIgnore, - run: mulOp, - post: VmOpIgnore)), + exec: mulOp), + (opCode: Sub, ## 0x03, Subtraction forks: VmOpAllForks, name: "sub", info: "Subtraction operation", - exec: (prep: VmOpIgnore, - run: subOp, - post: VmOpIgnore)), + exec: subOp), + (opCode: Div, ## 0x04, Division forks: VmOpAllForks, name: "divide", info: "Integer division operation", - exec: (prep: VmOpIgnore, - run: divideOp, - post: VmOpIgnore)), + exec: divideOp), + (opCode: Sdiv, ## 0x05, Signed division forks: VmOpAllForks, name: "sdiv", info: "Signed integer division operation (truncated)", - exec: (prep: VmOpIgnore, - run: sdivOp, - post: VmOpIgnore)), + exec: sdivOp), + (opCode: Mod, ## 0x06, Modulo forks: VmOpAllForks, name: "modulo", info: "Modulo remainder operation", - exec: (prep: VmOpIgnore, - run: moduloOp, - post: VmOpIgnore)), + exec: moduloOp), + (opCode: Smod, ## 0x07, Signed modulo forks: VmOpAllForks, name: "smod", info: "Signed modulo remainder operation", - exec: (prep: VmOpIgnore, - run: smodOp, - post: VmOpIgnore)), + exec: smodOp), + (opCode: Addmod, ## 0x08, Modulo addition, Intermediate ## computations do not roll over at 2^256 forks: VmOpAllForks, name: "addmod", info: "Modulo addition operation", - exec: (prep: VmOpIgnore, - run: addmodOp, - post: VmOpIgnore)), + exec: addmodOp), + (opCode: Mulmod, ## 0x09, Modulo multiplication, Intermediate ## computations do not roll over at 2^256 forks: VmOpAllForks, name: "mulmod", info: "Modulo multiplication operation", - exec: (prep: VmOpIgnore, - run: mulmodOp, - post: VmOpIgnore)), + exec: mulmodOp), + (opCode: Exp, ## 0x0a, Exponentiation forks: VmOpAllForks, name: "exp", info: "Exponentiation operation", - exec: (prep: VmOpIgnore, - run: expOp, - post: VmOpIgnore)), + exec: expOp), + (opCode: SignExtend, ## 0x0b, Extend 2's complemet length forks: VmOpAllForks, name: "signExtend", info: "Extend length of two’s complement signed integer", - exec: (prep: VmOpIgnore, - run: signExtendOp, - post: VmOpIgnore)), + exec: signExtendOp), + (opCode: Lt, ## 0x10, Less-than forks: VmOpAllForks, name: "lt", info: "Less-than comparison", - exec: (prep: VmOpIgnore, - run: ltOp, - post: VmOpIgnore)), + exec: ltOp), + (opCode: Gt, ## 0x11, Greater-than forks: VmOpAllForks, name: "gt", info: "Greater-than comparison", - exec: (prep: VmOpIgnore, - run: gtOp, - post: VmOpIgnore)), + exec: gtOp), + (opCode: Slt, ## 0x12, Signed less-than forks: VmOpAllForks, name: "slt", info: "Signed less-than comparison", - exec: (prep: VmOpIgnore, - run: sltOp, - post: VmOpIgnore)), + exec: sltOp), + (opCode: Sgt, ## 0x13, Signed greater-than forks: VmOpAllForks, name: "sgt", info: "Signed greater-than comparison", - exec: (prep: VmOpIgnore, - run: sgtOp, - post: VmOpIgnore)), + exec: sgtOp), + (opCode: Eq, ## 0x14, Equality forks: VmOpAllForks, name: "eq", info: "Equality comparison", - exec: (prep: VmOpIgnore, - run: eqOp, - post: VmOpIgnore)), + exec: eqOp), + (opCode: IsZero, ## 0x15, Not operator forks: VmOpAllForks, name: "isZero", info: "Simple not operator (Note: real Yellow Paper description)", - exec: (prep: VmOpIgnore, - run: isZeroOp, - post: VmOpIgnore)), + exec: isZeroOp), + (opCode: And, ## 0x16, AND forks: VmOpAllForks, name: "andOp", info: "Bitwise AND operation", - exec: (prep: VmOpIgnore, - run: andOp, - post: VmOpIgnore)), + exec: andOp), + (opCode: Or, ## 0x17, OR forks: VmOpAllForks, name: "orOp", info: "Bitwise OR operation", - exec: (prep: VmOpIgnore, - run: orOp, - post: VmOpIgnore)), + exec: orOp), + (opCode: Xor, ## 0x18, XOR forks: VmOpAllForks, name: "xorOp", info: "Bitwise XOR operation", - exec: (prep: VmOpIgnore, - run: xorOp, - post: VmOpIgnore)), + exec: xorOp), + (opCode: Not, ## 0x19, NOT forks: VmOpAllForks, name: "notOp", info: "Bitwise NOT operation", - exec: (prep: VmOpIgnore, - run: notOp, - post: VmOpIgnore)), + exec: notOp), + (opCode: Byte, ## 0x1a, Retrieve byte forks: VmOpAllForks, name: "byteOp", info: "Retrieve single byte from word", - exec: (prep: VmOpIgnore, - run: byteOp, - post: VmOpIgnore)), + exec: byteOp), + # Constantinople's new opcodes @@ -470,25 +448,21 @@ const forks: VmOpConstantinopleAndLater, name: "shlOp", info: "Shift left", - exec: (prep: VmOpIgnore, - run: shlOp, - post: VmOpIgnore)), + exec: shlOp), + (opCode: Shr, ## 0x1c, Shift right logical forks: VmOpConstantinopleAndLater, name: "shrOp", info: "Logical shift right", - exec: (prep: VmOpIgnore, - run: shrOp, - post: VmOpIgnore)), + exec: shrOp), + (opCode: Sar, ## 0x1d, Shift right arithmetic forks: VmOpConstantinopleAndLater, name: "sarOp", info: "Arithmetic shift right", - exec: (prep: VmOpIgnore, - run: sarOp, - post: VmOpIgnore))] + exec: sarOp)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_blockdata.nim b/nimbus/evm/interpreter/op_handlers/oph_blockdata.nim index a61ec8aae..abbf05202 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_blockdata.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_blockdata.nim @@ -100,89 +100,77 @@ const forks: VmOpAllForks, name: "blockhash", info: "Get the hash of one of the 256 most recent complete blocks", - exec: (prep: VmOpIgnore, - run: blockhashOp, - post: VmOpIgnore)), + exec: blockhashOp), + (opCode: Coinbase, ## 0x41, Beneficiary address forks: VmOpAllForks, name: "coinbase", info: "Get the block's beneficiary address", - exec: (prep: VmOpIgnore, - run: coinBaseOp, - post: VmOpIgnore)), + exec: coinBaseOp), + (opCode: Timestamp, ## 0x42, Block timestamp. forks: VmOpAllForks, name: "timestamp", info: "Get the block's timestamp", - exec: (prep: VmOpIgnore, - run: timestampOp, - post: VmOpIgnore)), + exec: timestampOp), + (opCode: Number, ## 0x43, Block number forks: VmOpAllForks, name: "blockNumber", info: "Get the block's number", - exec: (prep: VmOpIgnore, - run: blocknumberOp, - post: VmOpIgnore)), + exec: blocknumberOp), + (opCode: Difficulty, ## 0x44, Block difficulty forks: VmOpAllForks, name: "difficulty", info: "Get the block's difficulty", - exec: (prep: VmOpIgnore, - run: difficultyOp, - post: VmOpIgnore)), + exec: difficultyOp), + (opCode: GasLimit, ## 0x45, Block gas limit forks: VmOpAllForks, name: "gasLimit", info: "Get the block's gas limit", - exec: (prep: VmOpIgnore, - run: gasLimitOp, - post: VmOpIgnore)), + exec: gasLimitOp), + (opCode: ChainIdOp, ## 0x46, EIP-155 chain identifier forks: VmOpIstanbulAndLater, name: "chainId", info: "Get current chain’s EIP-155 unique identifier", - exec: (prep: VmOpIgnore, - run: chainIdOp, - post: VmOpIgnore)), + exec: chainIdOp), + (opCode: SelfBalance, ## 0x47, Contract balance. forks: VmOpIstanbulAndLater, name: "selfBalance", info: "Get current contract's balance", - exec: (prep: VmOpIgnore, - run: selfBalanceOp, - post: VmOpIgnore)), + exec: selfBalanceOp), + (opCode: BaseFee, ## 0x48, EIP-1559 Block base fee. forks: VmOpLondonAndLater, name: "baseFee", info: "Get current block's EIP-1559 base fee", - exec: (prep: VmOpIgnore, - run: baseFeeOp, - post: VmOpIgnore)), + exec: baseFeeOp), + (opCode: BlobHash, ## 0x49, EIP-4844 Transaction versioned hash forks: VmOpCancunAndLater, name: "blobHash", info: "Get current transaction's EIP-4844 versioned hash", - exec: (prep: VmOpIgnore, - run: blobHashOp, - post: VmOpIgnore)), + exec: blobHashOp), + (opCode: BlobBaseFee, ## 0x4a, EIP-7516 Returns the current data-blob base-fee forks: VmOpCancunAndLater, name: "blobBaseFee", info: "Returns the current data-blob base-fee", - exec: (prep: VmOpIgnore, - run: blobBaseFeeOp, - post: VmOpIgnore))] + exec: blobBaseFeeOp)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_call.nim b/nimbus/evm/interpreter/op_handlers/oph_call.nim index 936eae77d..fe5bd45b4 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_call.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_call.nim @@ -514,34 +514,29 @@ const forks: VmOpAllForks, name: "call", info: "Message-Call into an account", - exec: (prep: VmOpIgnore, - run: callOp, - post: VmOpIgnore)), + exec: callOp), + (opCode: CallCode, ## 0xf2, Message-Call with alternative code forks: VmOpAllForks, name: "callCode", info: "Message-call into this account with alternative account's code", - exec: (prep: VmOpIgnore, - run: callCodeOp, - post: VmOpIgnore)), + exec: callCodeOp), + (opCode: DelegateCall, ## 0xf4, CallCode with persisting sender and value forks: VmOpHomesteadAndLater, name: "delegateCall", info: "Message-call into this account with an alternative account's " & "code but persisting the current values for sender and value.", - exec: (prep: VmOpIgnore, - run: delegateCallOp, - post: VmOpIgnore)), + exec: delegateCallOp), + (opCode: StaticCall, ## 0xfa, Static message-call into an account forks: VmOpByzantiumAndLater, name: "staticCall", info: "Static message-call into an account", - exec: (prep: VmOpIgnore, - run: staticCallOp, - post: VmOpIgnore))] + exec: staticCallOp)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_create.nim b/nimbus/evm/interpreter/op_handlers/oph_create.nim index af7cc3ac3..706c5d52f 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_create.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_create.nim @@ -255,17 +255,14 @@ const forks: VmOpAllForks, name: "create", info: "Create a new account with associated code", - exec: (prep: VmOpIgnore, - run: createOp, - post: VmOpIgnore)), + exec: createOp), + (opCode: Create2, ## 0xf5, Create using keccak256 forks: VmOpConstantinopleAndLater, name: "create2", info: "Behaves identically to CREATE, except using keccak256", - exec: (prep: VmOpIgnore, - run: create2Op, - post: VmOpIgnore))] + exec: create2Op)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_defs.nim b/nimbus/evm/interpreter/op_handlers/oph_defs.nim index a8ee01e65..ee4bfb7a3 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_defs.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_defs.nim @@ -28,20 +28,12 @@ type ## back via argument descriptor ``k`` proc(k: var VmCtx): EvmResultVoid {.nimcall, gcsafe, raises:[].} - - VmOpHanders* = tuple ## three step op code execution, typically - ## only the ``run`` entry is activated - prep: VmOpFn - run: VmOpFn - post: VmOpFn - - VmOpExec* = tuple ## op code handler entry opCode: Op ## index back-reference forks: set[EVMFork] ## forks applicable for this operation name: string ## handler name info: string ## handter info, explainer - exec: VmOpHanders + exec: VmOpFn # ------------------------------------------------------------------------------ # Public diff --git a/nimbus/evm/interpreter/op_handlers/oph_envinfo.nim b/nimbus/evm/interpreter/op_handlers/oph_envinfo.nim index 4493c6608..e04c5de12 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_envinfo.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_envinfo.nim @@ -253,163 +253,142 @@ const forks: VmOpAllForks, name: "address", info: "Get address of currently executing account", - exec: (prep: VmOpIgnore, - run: VmOpFn addressOp, - post: VmOpIgnore)), + exec: VmOpFn addressOp), + (opCode: Balance, ## 0x31, Balance forks: VmOpAllForks - VmOpBerlinAndLater, name: "balance", info: "Get balance of the given account", - exec: (prep: VmOpIgnore, - run: balanceOp, - post: VmOpIgnore)), + exec: balanceOp), + (opCode: Balance, ## 0x31, Balance for Berlin and later forks: VmOpBerlinAndLater, name: "balanceEIP2929", info: "EIP2929: Get balance of the given account", - exec: (prep: VmOpIgnore, - run: balanceEIP2929Op, - post: VmOpIgnore)), + exec: balanceEIP2929Op), + (opCode: Origin, ## 0x32, Origination address forks: VmOpAllForks, name: "origin", info: "Get execution origination address", - exec: (prep: VmOpIgnore, - run: originOp, - post: VmOpIgnore)), + exec: originOp), + (opCode: Caller, ## 0x33, Caller address forks: VmOpAllForks, name: "caller", info: "Get caller address", - exec: (prep: VmOpIgnore, - run: callerOp, - post: VmOpIgnore)), + exec: callerOp), + (opCode: CallValue, ## 0x34, Execution deposited value forks: VmOpAllForks, name: "callValue", info: "Get deposited value by the instruction/transaction " & "responsible for this execution", - exec: (prep: VmOpIgnore, - run: callValueOp, - post: VmOpIgnore)), + exec: callValueOp), + (opCode: CallDataLoad, ## 0x35, Input data forks: VmOpAllForks, name: "callDataLoad", info: "Get input data of current environment", - exec: (prep: VmOpIgnore, - run: callDataLoadOp, - post: VmOpIgnore)), + exec: callDataLoadOp), + (opCode: CallDataSize, ## 0x36, Size of input data forks: VmOpAllForks, name: "callDataSize", info: "Get size of input data in current environment", - exec: (prep: VmOpIgnore, - run: callDataSizeOp, - post: VmOpIgnore)), + exec: callDataSizeOp), + (opCode: CallDataCopy, ## 0x37, Copy input data to memory. forks: VmOpAllForks, name: "callDataCopy", info: "Copy input data in current environment to memory", - exec: (prep: VmOpIgnore, - run: callDataCopyOp, - post: VmOpIgnore)), + exec: callDataCopyOp), + (opCode: CodeSize, ## 0x38, Size of code forks: VmOpAllForks, name: "codeSize", info: "Get size of code running in current environment", - exec: (prep: VmOpIgnore, - run: codeSizeOp, - post: VmOpIgnore)), + exec: codeSizeOp), + (opCode: CodeCopy, ## 0x39, Copy code to memory. forks: VmOpAllForks, name: "codeCopy", info: "Copy code running in current environment to memory", - exec: (prep: VmOpIgnore, - run: codeCopyOp, - post: VmOpIgnore)), + exec: codeCopyOp), + (opCode: GasPrice, ## 0x3a, Gas price forks: VmOpAllForks, name: "gasPrice", info: "Get price of gas in current environment", - exec: (prep: VmOpIgnore, - run: gasPriceOp, - post: VmOpIgnore)), + exec: gasPriceOp), + (opCode: ExtCodeSize, ## 0x3b, Account code size forks: VmOpAllForks - VmOpBerlinAndLater, name: "extCodeSize", info: "Get size of an account's code", - exec: (prep: VmOpIgnore, - run: extCodeSizeOp, - post: VmOpIgnore)), + exec: extCodeSizeOp), + (opCode: ExtCodeSize, ## 0x3b, Account code size for Berlin and later forks: VmOpBerlinAndLater, name: "extCodeSizeEIP2929", info: "EIP2929: Get size of an account's code", - exec: (prep: VmOpIgnore, - run: extCodeSizeEIP2929Op, - post: VmOpIgnore)), + exec: extCodeSizeEIP2929Op), + (opCode: ExtCodeCopy, ## 0x3c, Account code copy to memory. forks: VmOpAllForks - VmOpBerlinAndLater, name: "extCodeCopy", info: "Copy an account's code to memory", - exec: (prep: VmOpIgnore, - run: extCodeCopyOp, - post: VmOpIgnore)), + exec: extCodeCopyOp), + (opCode: ExtCodeCopy, ## 0x3c, Account Code-copy for Berlin and later forks: VmOpBerlinAndLater, name: "extCodeCopyEIP2929", info: "EIP2929: Copy an account's code to memory", - exec: (prep: VmOpIgnore, - run: extCodeCopyEIP2929Op, - post: VmOpIgnore)), + exec: extCodeCopyEIP2929Op), + (opCode: ReturnDataSize, ## 0x3d, Previous call output data size forks: VmOpByzantiumAndLater, name: "returnDataSize", info: "Get size of output data from the previous call " & "from the current environment", - exec: (prep: VmOpIgnore, - run: returnDataSizeOp, - post: VmOpIgnore)), + exec: returnDataSizeOp), + (opCode: ReturnDataCopy, ## 0x3e, Previous call output data copy to memory forks: VmOpByzantiumAndLater, name: "returnDataCopy", info: "Copy output data from the previous call to memory", - exec: (prep: VmOpIgnore, - run: returnDataCopyOp, - post: VmOpIgnore)), + exec: returnDataCopyOp), + (opCode: ExtCodeHash, ## 0x3f, Contract hash forks: VmOpConstantinopleAndLater - VmOpBerlinAndLater, name: "extCodeHash", info: "Returns the keccak256 hash of a contract’s code", - exec: (prep: VmOpIgnore, - run: extCodeHashOp, - post: VmOpIgnore)), + exec: extCodeHashOp), + (opCode: ExtCodeHash, ## 0x3f, Contract hash for berlin and later forks: VmOpBerlinAndLater, name: "extCodeHashEIP2929", info: "EIP2929: Returns the keccak256 hash of a contract’s code", - exec: (prep: VmOpIgnore, - run: extCodeHashEIP2929Op, - post: VmOpIgnore))] + exec: extCodeHashEIP2929Op)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_gen_handlers.nim b/nimbus/evm/interpreter/op_handlers/oph_gen_handlers.nim index bff13538b..ee955091d 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_gen_handlers.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_gen_handlers.nim @@ -99,10 +99,7 @@ macro genOphList*(runHandler: static[OphNumToTextFn]; "info".asText(n.handlerInfo), nnkExprColonExpr.newTree( newIdentNode("exec"), - nnkPar.newTree( - "prep".asIdent("VmOpIgnore"), - "run".asIdent(n.runHandler), - "post".asIdent("VmOpIgnore")))) + newIdentNode(n.runHandler))) # => const *: seq[VmOpExec] = @[ ] result = nnkStmtList.newTree( diff --git a/nimbus/evm/interpreter/op_handlers/oph_hash.nim b/nimbus/evm/interpreter/op_handlers/oph_hash.nim index 595fd8eb1..a84c241c0 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_hash.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_hash.nim @@ -62,9 +62,7 @@ const forks: VmOpAllForks, name: "sha3", info: "Compute Keccak-256 hash", - exec: (prep: VmOpIgnore, - run: sha3Op, - post: VmOpIgnore))] + exec: sha3Op)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_memory.nim b/nimbus/evm/interpreter/op_handlers/oph_memory.nim index 6ca41b802..76ca0cdca 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_memory.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_memory.nim @@ -324,164 +324,143 @@ const forks: VmOpAllForks, name: "pop", info: "Remove item from stack", - exec: (prep: VmOpIgnore, - run: VmOpFn popOp, - post: VmOpIgnore)), + exec: VmOpFn popOp), + (opCode: Mload, ## 0x51, Load word from memory forks: VmOpAllForks, name: "mload", info: "Load word from memory", - exec: (prep: VmOpIgnore, - run: mloadOp, - post: VmOpIgnore)), + exec: mloadOp), + (opCode: Mstore, ## 0x52, Save word to memory forks: VmOpAllForks, name: "mstore", info: "Save word to memory", - exec: (prep: VmOpIgnore, - run: mstoreOp, - post: VmOpIgnore)), + exec: mstoreOp), + (opCode: Mstore8, ## 0x53, Save byte to memory forks: VmOpAllForks, name: "mstore8", info: "Save byte to memory", - exec: (prep: VmOpIgnore, - run: mstore8Op, - post: VmOpIgnore)), + exec: mstore8Op), + (opCode: Sload, ## 0x54, Load word from storage forks: VmOpAllForks - VmOpBerlinAndLater, name: "sload", info: "Load word from storage", - exec: (prep: VmOpIgnore, - run: sloadOp, - post: VmOpIgnore)), + exec: sloadOp), + (opCode: Sload, ## 0x54, sload for Berlin and later forks: VmOpBerlinAndLater, name: "sloadEIP2929", info: "EIP2929: sload for Berlin and later", - exec: (prep: VmOpIgnore, - run: sloadEIP2929Op, - post: VmOpIgnore)), + exec: sloadEIP2929Op), + (opCode: Sstore, ## 0x55, Save word forks: VmOpAllForks - VmOpConstantinopleAndLater, name: "sstore", info: "Save word to storage", - exec: (prep: VmOpIgnore, - run: sstoreOp, - post: VmOpIgnore)), + exec: sstoreOp), + (opCode: Sstore, ## 0x55, sstore for Constantinople and later forks: VmOpConstantinopleAndLater - VmOpPetersburgAndLater, name: "sstoreEIP1283", info: "EIP1283: sstore for Constantinople and later", - exec: (prep: VmOpIgnore, - run: sstoreEIP1283Op, - post: VmOpIgnore)), + exec: sstoreEIP1283Op), + (opCode: Sstore, ## 0x55, sstore for Petersburg and later forks: VmOpPetersburgAndLater - VmOpIstanbulAndLater, name: "sstore", info: "sstore for Constantinople and later", - exec: (prep: VmOpIgnore, - run: sstoreOp, - post: VmOpIgnore)), + exec: sstoreOp), + (opCode: Sstore, ## 0x55, sstore for Istanbul and later forks: VmOpIstanbulAndLater - VmOpBerlinAndLater, name: "sstoreEIP2200", info: "EIP2200: sstore for Istanbul and later", - exec: (prep: VmOpIgnore, - run: sstoreEIP2200Op, - post: VmOpIgnore)), + exec: sstoreEIP2200Op), + (opCode: Sstore, ## 0x55, sstore for Berlin and later forks: VmOpBerlinAndLater, name: "sstoreEIP2929", info: "EIP2929: sstore for Istanbul and later", - exec: (prep: VmOpIgnore, - run: sstoreEIP2929Op, - post: VmOpIgnore)), + exec: sstoreEIP2929Op), + (opCode: Jump, ## 0x56, Jump forks: VmOpAllForks, name: "jump", info: "Alter the program counter", - exec: (prep: VmOpIgnore, - run: jumpOp, - post: VmOpIgnore)), + exec: jumpOp), + (opCode: JumpI, ## 0x57, Conditional jump forks: VmOpAllForks, name: "jumpI", info: "Conditionally alter the program counter", - exec: (prep: VmOpIgnore, - run: jumpIOp, - post: VmOpIgnore)), + exec: jumpIOp), + (opCode: Pc, ## 0x58, Program counter prior to instruction forks: VmOpAllForks, name: "pc", info: "Get the value of the program counter prior to the increment "& "corresponding to this instruction", - exec: (prep: VmOpIgnore, - run: pcOp, - post: VmOpIgnore)), + exec: pcOp), + (opCode: Msize, ## 0x59, Memory size forks: VmOpAllForks, name: "msize", info: "Get the size of active memory in bytes", - exec: (prep: VmOpIgnore, - run: msizeOp, - post: VmOpIgnore)), + exec: msizeOp), + (opCode: Gas, ## 0x5a, Get available gas forks: VmOpAllForks, name: "gas", info: "Get the amount of available gas, including the corresponding "& "reduction for the cost of this instruction", - exec: (prep: VmOpIgnore, - run: gasOp, - post: VmOpIgnore)), + exec: gasOp), + (opCode: JumpDest, ## 0x5b, Mark jump target. This operation has no effect ## on machine state during execution forks: VmOpAllForks, name: "jumpDest", info: "Mark a valid destination for jumps", - exec: (prep: VmOpIgnore, - run: jumpDestOp, - post: VmOpIgnore)), + exec: jumpDestOp), + (opCode: Tload, ## 0x5c, Load word from transient storage. forks: VmOpCancunAndLater, name: "tLoad", info: "Load word from transient storage", - exec: (prep: VmOpIgnore, - run: tloadOp, - post: VmOpIgnore)), + exec: tloadOp), + (opCode: Tstore, ## 0x5d, Save word to transient storage. forks: VmOpCancunAndLater, name: "tStore", info: "Save word to transient storage", - exec: (prep: VmOpIgnore, - run: tstoreOp, - post: VmOpIgnore)), + exec: tstoreOp), + (opCode: Mcopy, ## 0x5e, Copy memory forks: VmOpCancunAndLater, name: "MCopy", info: "Copy memory", - exec: (prep: VmOpIgnore, - run: mCopyOp, - post: VmOpIgnore))] + exec: mCopyOp)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_push.nim b/nimbus/evm/interpreter/op_handlers/oph_push.nim index 1416191b5..05acb400b 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_push.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_push.nim @@ -76,9 +76,7 @@ const forks: VmOpShanghaiAndLater, name: "Push0", info: "Push 0 on the stack", - exec: (prep: VmOpIgnore, - run: push0Op, - post: VmOpIgnore))] + exec: push0Op)] # ------------------------------------------------------------------------------ # End diff --git a/nimbus/evm/interpreter/op_handlers/oph_sysops.nim b/nimbus/evm/interpreter/op_handlers/oph_sysops.nim index 3b2693fcd..d5159605f 100644 --- a/nimbus/evm/interpreter/op_handlers/oph_sysops.nim +++ b/nimbus/evm/interpreter/op_handlers/oph_sysops.nim @@ -164,58 +164,50 @@ const forks: VmOpAllForks, name: "returnOp", info: "Halt execution returning output data", - exec: (prep: VmOpIgnore, - run: returnOp, - post: VmOpIgnore)), + exec: returnOp), + (opCode: Revert, ## 0xfd, Halt and revert state changes forks: VmOpByzantiumAndLater, name: "revert", info: "Halt execution reverting state changes but returning data " & "and remaining gas", - exec: (prep: VmOpIgnore, - run: revertOp, - post: VmOpIgnore)), + exec: revertOp), + (opCode: Invalid, ## 0xfe, invalid instruction. forks: VmOpAllForks, name: "invalidInstruction", info: "Designated invalid instruction", - exec: (prep: VmOpIgnore, - run: invalidOp, - post: VmOpIgnore)), + exec: invalidOp), + (opCode: SelfDestruct, ## 0xff, Halt execution, prep for later deletion forks: VmOpAllForks - VmOpTangerineAndLater, name: "selfDestruct", info: "Halt execution and register account for later deletion", - exec: (prep: VmOpIgnore, - run: selfDestructOp, - post: VmOpIgnore)), + exec: selfDestructOp), + (opCode: SelfDestruct, ## 0xff, EIP150: self destruct, Tangerine forks: VmOpTangerineAndLater - VmOpSpuriousAndLater, name: "selfDestructEIP150", info: "EIP150: Halt execution and register account for later deletion", - exec: (prep: VmOpIgnore, - run: selfDestructEIP150Op, - post: VmOpIgnore)), + exec: selfDestructEIP150Op), + (opCode: SelfDestruct, ## 0xff, EIP161: self destruct, Spurious and later forks: VmOpSpuriousAndLater - VmOpBerlinAndLater, name: "selfDestructEIP161", info: "EIP161: Halt execution and register account for later deletion", - exec: (prep: VmOpIgnore, - run: selfDestructEIP161Op, - post: VmOpIgnore)), + exec: selfDestructEIP161Op), + (opCode: SelfDestruct, ## 0xff, EIP2929: self destruct, Berlin and later forks: VmOpBerlinAndLater, name: "selfDestructEIP2929", info: "EIP2929: Halt execution and register account for later deletion", - exec: (prep: VmOpIgnore, - run: selfDestructEIP2929Op, - post: VmOpIgnore))] + exec: selfDestructEIP2929Op)] # ------------------------------------------------------------------------------ # End