2021-04-13 18:12:47 +01:00
|
|
|
|
# Nimbus
|
2024-02-20 14:16:12 +07:00
|
|
|
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
2021-04-13 18:12:47 +01:00
|
|
|
|
# Licensed under either of
|
|
|
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
|
|
|
# http://opensource.org/licenses/MIT)
|
|
|
|
|
# at your option. This file may not be copied, modified, or distributed except
|
|
|
|
|
# according to those terms.
|
|
|
|
|
|
|
|
|
|
## EVM Opcode Handlers: Environmental Information
|
|
|
|
|
## ==============================================
|
|
|
|
|
##
|
|
|
|
|
|
2024-05-22 21:01:19 +00:00
|
|
|
|
{.push raises: [].}
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
import
|
2024-06-07 15:24:32 +07:00
|
|
|
|
../../evm_errors,
|
2021-04-21 18:04:54 +01:00
|
|
|
|
../../code_stream,
|
2021-04-26 17:00:46 +01:00
|
|
|
|
../../computation,
|
2021-04-22 17:05:58 +01:00
|
|
|
|
../../memory,
|
2021-04-21 18:04:54 +01:00
|
|
|
|
../../stack,
|
|
|
|
|
../gas_costs,
|
|
|
|
|
../op_codes,
|
2021-04-13 18:12:47 +01:00
|
|
|
|
./oph_defs,
|
2021-04-15 17:42:19 +01:00
|
|
|
|
./oph_helpers,
|
2021-04-21 18:04:54 +01:00
|
|
|
|
eth/common,
|
2024-07-18 18:59:53 +07:00
|
|
|
|
stew/assign2,
|
2024-06-07 15:24:32 +07:00
|
|
|
|
stint
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2022-09-28 13:09:33 +07:00
|
|
|
|
when not defined(evmc_enabled):
|
|
|
|
|
import ../../state
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
# Private, op handlers implementation
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc addressOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x30, Get address of currently executing account.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.msg.contractAddress
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# ------------------
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc balanceOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x31, Get balance of the given account.
|
2024-07-18 18:59:53 +07:00
|
|
|
|
template balance256(address): auto =
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.getBalance(address)
|
|
|
|
|
cpt.stack.unaryAddress(balance256)
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc balanceEIP2929Op(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x31, EIP292: Get balance of the given account for Berlin and later
|
2024-07-18 18:59:53 +07:00
|
|
|
|
template balanceEIP2929(address): auto =
|
2024-07-19 08:44:01 +07:00
|
|
|
|
let gasCost = cpt.gasEip2929AccountCheck(address)
|
|
|
|
|
? cpt.opcodeGasCost(Balance, gasCost, reason = "Balance EIP2929")
|
|
|
|
|
cpt.getBalance(address)
|
|
|
|
|
cpt.stack.unaryAddress(balanceEIP2929)
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# ------------------
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc originOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x32, Get execution origination address.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.getOrigin()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc callerOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x33, Get caller address.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.msg.sender
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc callValueOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x34, Get deposited value by the instruction/transaction
|
|
|
|
|
## responsible for this execution
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.msg.value
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc callDataLoadOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x35, Get input data of current environment
|
2024-07-19 08:44:01 +07:00
|
|
|
|
? cpt.stack.lsCheck(1)
|
|
|
|
|
let start = cpt.stack.lsPeekMemRef(^1)
|
2024-06-07 15:24:32 +07:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
if start >= cpt.msg.data.len:
|
|
|
|
|
cpt.stack.lsTop 0
|
2024-07-18 18:59:53 +07:00
|
|
|
|
return ok()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# If the data does not take 32 bytes, pad with zeros
|
|
|
|
|
let
|
2024-07-19 08:44:01 +07:00
|
|
|
|
endRange = min(cpt.msg.data.len - 1, start + 31)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
presentBytes = endRange - start
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# We rely on value being initialized with 0 by default
|
|
|
|
|
var value: array[32, byte]
|
2024-07-19 08:44:01 +07:00
|
|
|
|
assign(value.toOpenArray(0, presentBytes), cpt.msg.data.toOpenArray(start, endRange))
|
|
|
|
|
cpt.stack.lsTop value
|
2024-07-18 18:59:53 +07:00
|
|
|
|
ok()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc callDataSizeOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x36, Get size of input data in current environment.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.msg.data.len.u256
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc callDataCopyOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x37, Copy input data in current environment to memory.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
? cpt.stack.lsCheck(3)
|
2024-07-18 18:59:53 +07:00
|
|
|
|
let
|
|
|
|
|
memPos = cpt.stack.lsPeekMemRef(^1)
|
|
|
|
|
copyPos = cpt.stack.lsPeekMemRef(^2)
|
|
|
|
|
len = cpt.stack.lsPeekMemRef(^3)
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.stack.lsShrink(3)
|
|
|
|
|
? cpt.opcodeGasCost(CallDataCopy,
|
|
|
|
|
cpt.gasCosts[CallDataCopy].m_handler(cpt.memory.len, memPos, len),
|
2024-06-17 18:13:38 +02:00
|
|
|
|
reason = "CallDataCopy fee")
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.memory.writePadded(cpt.msg.data, memPos, copyPos, len)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
ok()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc codeSizeOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x38, Get size of code running in current environment.
|
|
|
|
|
cpt.stack.push cpt.code.len
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc codeCopyOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x39, Copy code running in current environment to memory.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
? cpt.stack.lsCheck(3)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
let
|
2024-07-18 18:59:53 +07:00
|
|
|
|
memPos = cpt.stack.lsPeekMemRef(^1)
|
|
|
|
|
copyPos = cpt.stack.lsPeekMemRef(^2)
|
|
|
|
|
len = cpt.stack.lsPeekMemRef(^3)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.stack.lsShrink(3)
|
2024-07-13 20:42:49 +02:00
|
|
|
|
? cpt.opcodeGasCost(CodeCopy,
|
2024-06-17 18:13:38 +02:00
|
|
|
|
cpt.gasCosts[CodeCopy].m_handler(cpt.memory.len, memPos, len),
|
|
|
|
|
reason = "CodeCopy fee")
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
cpt.memory.writePadded(cpt.code.bytes, memPos, copyPos, len)
|
|
|
|
|
ok()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc gasPriceOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3A, Get price of gas in current environment.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.getGasPrice()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# -----------
|
2024-06-07 15:24:32 +07:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc extCodeSizeOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3b, Get size of an account's code
|
2024-07-18 18:59:53 +07:00
|
|
|
|
template ecs256(address): auto =
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.getCodeSize(address)
|
|
|
|
|
cpt.stack.unaryAddress(ecs256)
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc extCodeSizeEIP2929Op(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3b, Get size of an account's code
|
2024-07-18 18:59:53 +07:00
|
|
|
|
template ecsEIP2929(address): auto =
|
2024-07-19 08:44:01 +07:00
|
|
|
|
let gasCost = cpt.gasEip2929AccountCheck(address)
|
|
|
|
|
? cpt.opcodeGasCost(ExtCodeSize, gasCost, reason = "ExtCodeSize EIP2929")
|
|
|
|
|
cpt.getCodeSize(address)
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.unaryAddress(ecsEIP2929)
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# -----------
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc extCodeCopyOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3c, Copy an account's code to memory.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
? cpt.stack.lsCheck(4)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
let
|
2024-07-18 18:59:53 +07:00
|
|
|
|
address = cpt.stack.lsPeekAddress(^1)
|
|
|
|
|
memPos = cpt.stack.lsPeekMemRef(^2)
|
|
|
|
|
codePos = cpt.stack.lsPeekMemRef(^3)
|
|
|
|
|
len = cpt.stack.lsPeekMemRef(^4)
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.stack.lsShrink(4)
|
2024-07-13 20:42:49 +02:00
|
|
|
|
? cpt.opcodeGasCost(ExtCodeCopy,
|
2024-06-17 18:13:38 +02:00
|
|
|
|
cpt.gasCosts[ExtCodeCopy].m_handler(cpt.memory.len, memPos, len),
|
|
|
|
|
reason = "ExtCodeCopy fee")
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-21 09:44:10 +02:00
|
|
|
|
let code = cpt.getCode(address)
|
|
|
|
|
cpt.memory.writePadded(code.bytes, memPos, codePos, len)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
ok()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc extCodeCopyEIP2929Op(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3c, Copy an account's code to memory.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
? cpt.stack.lsCheck(4)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
let
|
2024-07-18 18:59:53 +07:00
|
|
|
|
address = cpt.stack.lsPeekAddress(^1)
|
|
|
|
|
memPos = cpt.stack.lsPeekMemRef(^2)
|
|
|
|
|
codePos = cpt.stack.lsPeekMemRef(^3)
|
|
|
|
|
len = cpt.stack.lsPeekMemRef(^4)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
gasCost = cpt.gasCosts[ExtCodeCopy].m_handler(cpt.memory.len, memPos, len) +
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.gasEip2929AccountCheck(address)
|
|
|
|
|
|
|
|
|
|
cpt.stack.lsShrink(4)
|
2024-07-13 20:42:49 +02:00
|
|
|
|
? cpt.opcodeGasCost(ExtCodeCopy, gasCost, reason = "ExtCodeCopy EIP2929")
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-06-21 09:44:10 +02:00
|
|
|
|
let code = cpt.getCode(address)
|
|
|
|
|
cpt.memory.writePadded(code.bytes(), memPos, codePos, len)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
ok()
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# -----------
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc returnDataSizeOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3d, Get size of output data from the previous call from the
|
|
|
|
|
## current environment.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.stack.push cpt.returnData.len
|
2024-06-17 18:13:38 +02:00
|
|
|
|
|
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc returnDataCopyOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3e, Copy output data from the previous call to memory.
|
2024-07-19 08:44:01 +07:00
|
|
|
|
? cpt.stack.lsCheck(3)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
let
|
2024-07-18 18:59:53 +07:00
|
|
|
|
memPos = cpt.stack.lsPeekMemRef(^1)
|
|
|
|
|
copyPos = cpt.stack.lsPeekMemRef(^2)
|
|
|
|
|
len = cpt.stack.lsPeekMemRef(^3)
|
|
|
|
|
gasCost = cpt.gasCosts[ReturnDataCopy].m_handler(
|
|
|
|
|
cpt.memory.len, memPos, len)
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.stack.lsShrink(3)
|
|
|
|
|
? cpt.opcodeGasCost(ReturnDataCopy, gasCost, reason = "returnDataCopy fee")
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-18 18:59:53 +07:00
|
|
|
|
if copyPos + len > cpt.returnData.len:
|
2024-06-17 18:13:38 +02:00
|
|
|
|
return err(opErr(OutOfBounds))
|
2024-07-18 18:59:53 +07:00
|
|
|
|
cpt.memory.writePadded(cpt.returnData, memPos, copyPos, len)
|
2024-06-17 18:13:38 +02:00
|
|
|
|
ok()
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-06-17 18:13:38 +02:00
|
|
|
|
# ---------------
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc extCodeHashOp(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3f, Returns the keccak256 hash of a contract’s code
|
2024-07-18 18:59:53 +07:00
|
|
|
|
template ech256(address): auto =
|
2024-07-19 08:44:01 +07:00
|
|
|
|
cpt.getCodeHash(address)
|
|
|
|
|
cpt.stack.unaryAddress(ech256)
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2024-07-19 08:44:01 +07:00
|
|
|
|
proc extCodeHashEIP2929Op(cpt: VmCpt): EvmResultVoid =
|
2024-06-17 18:13:38 +02:00
|
|
|
|
## 0x3f, EIP2929: Returns the keccak256 hash of a contract’s code
|
2024-07-18 18:59:53 +07:00
|
|
|
|
template echEIP2929(address): auto =
|
2024-07-19 08:44:01 +07:00
|
|
|
|
let gasCost = cpt.gasEip2929AccountCheck(address)
|
|
|
|
|
? cpt.opcodeGasCost(ExtCodeHash, gasCost, reason = "ExtCodeHash EIP2929")
|
|
|
|
|
cpt.getCodeHash(address)
|
|
|
|
|
cpt.stack.unaryAddress(echEIP2929)
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
# Public, op exec table entries
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
const
|
2024-06-15 23:18:53 +07:00
|
|
|
|
VmOpExecEnvInfo*: seq[VmOpExec] = @[
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: Address, ## 0x20, Address
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "address",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get address of currently executing account",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: VmOpFn addressOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: Balance, ## 0x31, Balance
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "balance",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get balance of the given account",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: balanceOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
(opCode: Balance, ## 0x31, Balance for Berlin and later
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "balanceEIP2929",
|
2021-04-15 17:42:19 +01:00
|
|
|
|
info: "EIP2929: Get balance of the given account",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: balanceEIP2929Op),
|
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
(opCode: Origin, ## 0x32, Origination address
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "origin",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get execution origination address",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: originOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: Caller, ## 0x33, Caller address
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "caller",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get caller address",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: callerOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: CallValue, ## 0x34, Execution deposited value
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "callValue",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get deposited value by the instruction/transaction " &
|
|
|
|
|
"responsible for this execution",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: callValueOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: CallDataLoad, ## 0x35, Input data
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "callDataLoad",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get input data of current environment",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: callDataLoadOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: CallDataSize, ## 0x36, Size of input data
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "callDataSize",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get size of input data in current environment",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: callDataSizeOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: CallDataCopy, ## 0x37, Copy input data to memory.
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "callDataCopy",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Copy input data in current environment to memory",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: callDataCopyOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: CodeSize, ## 0x38, Size of code
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "codeSize",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get size of code running in current environment",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: codeSizeOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: CodeCopy, ## 0x39, Copy code to memory.
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "codeCopy",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Copy code running in current environment to memory",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: codeCopyOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: GasPrice, ## 0x3a, Gas price
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "gasPrice",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get price of gas in current environment",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: gasPriceOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: ExtCodeSize, ## 0x3b, Account code size
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "extCodeSize",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get size of an account's code",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: extCodeSizeOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
(opCode: ExtCodeSize, ## 0x3b, Account code size for Berlin and later
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "extCodeSizeEIP2929",
|
2021-04-15 17:42:19 +01:00
|
|
|
|
info: "EIP2929: Get size of an account's code",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: extCodeSizeEIP2929Op),
|
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
(opCode: ExtCodeCopy, ## 0x3c, Account code copy to memory.
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpAllForks - VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "extCodeCopy",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Copy an account's code to memory",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: extCodeCopyOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
(opCode: ExtCodeCopy, ## 0x3c, Account Code-copy for Berlin and later
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "extCodeCopyEIP2929",
|
2021-04-15 17:42:19 +01:00
|
|
|
|
info: "EIP2929: Copy an account's code to memory",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: extCodeCopyEIP2929Op),
|
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
(opCode: ReturnDataSize, ## 0x3d, Previous call output data size
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpByzantiumAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "returnDataSize",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Get size of output data from the previous call " &
|
|
|
|
|
"from the current environment",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: returnDataSizeOp),
|
|
|
|
|
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
(opCode: ReturnDataCopy, ## 0x3e, Previous call output data copy to memory
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpByzantiumAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "returnDataCopy",
|
2021-04-13 18:12:47 +01:00
|
|
|
|
info: "Copy output data from the previous call to memory",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: returnDataCopyOp),
|
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
|
|
|
|
(opCode: ExtCodeHash, ## 0x3f, Contract hash
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpConstantinopleAndLater - VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "extCodeHash",
|
2021-04-15 17:42:19 +01:00
|
|
|
|
info: "Returns the keccak256 hash of a contract’s code",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: extCodeHashOp),
|
|
|
|
|
|
2021-04-15 17:42:19 +01:00
|
|
|
|
|
|
|
|
|
(opCode: ExtCodeHash, ## 0x3f, Contract hash for berlin and later
|
2024-06-15 23:18:53 +07:00
|
|
|
|
forks: VmOpBerlinAndLater,
|
2021-04-19 10:15:35 +01:00
|
|
|
|
name: "extCodeHashEIP2929",
|
2021-04-15 17:42:19 +01:00
|
|
|
|
info: "EIP2929: Returns the keccak256 hash of a contract’s code",
|
2024-06-24 12:58:15 +07:00
|
|
|
|
exec: extCodeHashEIP2929Op)]
|
2021-04-13 18:12:47 +01:00
|
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
# End
|
|
|
|
|
# ------------------------------------------------------------------------------
|