2021-04-12 17:13:30 +00:00
|
|
|
# Nimbus
|
2024-06-02 11:00:27 +00:00
|
|
|
# Copyright (c) 2018-2024 Status Research & Development GmbH
|
2021-04-12 17:13:30 +00: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.
|
|
|
|
|
2021-04-13 17:12:47 +00:00
|
|
|
## EVM Opcodes, Definitions
|
|
|
|
## ========================
|
2021-04-12 17:13:30 +00:00
|
|
|
##
|
|
|
|
|
|
|
|
import
|
2021-04-26 12:03:20 +00:00
|
|
|
../../types,
|
2022-12-02 04:35:41 +00:00
|
|
|
../../../common/evmforks,
|
2023-01-31 12:38:08 +00:00
|
|
|
../op_codes
|
2021-04-12 17:13:30 +00:00
|
|
|
|
|
|
|
type
|
2021-04-20 12:07:01 +00:00
|
|
|
Vm2Ctx* = tuple
|
|
|
|
cpt: Computation ## computation text
|
2021-04-12 17:13:30 +00:00
|
|
|
|
|
|
|
Vm2OpFn* = ## general op handler, return codes are passed
|
|
|
|
## back via argument descriptor ``k``
|
2024-06-02 11:00:27 +00:00
|
|
|
proc(k: var Vm2Ctx) {.nimcall, gcsafe, raises: [CatchableError].}
|
2021-04-12 17:13:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
Vm2OpHanders* = tuple ## three step op code execution, typically
|
|
|
|
## only the ``run`` entry is activated
|
|
|
|
prep: Vm2OpFn
|
|
|
|
run: Vm2OpFn
|
|
|
|
post: Vm2OpFn
|
|
|
|
|
|
|
|
|
|
|
|
Vm2OpExec* = tuple ## op code handler entry
|
|
|
|
opCode: Op ## index back-reference
|
2022-12-02 04:35:41 +00:00
|
|
|
forks: set[EVMFork] ## forks applicable for this operation
|
2021-04-19 09:15:35 +00:00
|
|
|
name: string ## handler name
|
|
|
|
info: string ## handter info, explainer
|
2021-04-12 17:13:30 +00:00
|
|
|
exec: Vm2OpHanders
|
|
|
|
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Public
|
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
const
|
|
|
|
vm2OpIgnore*: Vm2OpFn = ## No operation, placeholder function
|
2021-04-20 12:07:01 +00:00
|
|
|
proc(k: var Vm2Ctx) = discard
|
2021-04-12 17:13:30 +00:00
|
|
|
|
|
|
|
# similar to: toSeq(Fork).mapIt({it}).foldl(a+b)
|
|
|
|
Vm2OpAllForks* =
|
2022-12-02 04:35:41 +00:00
|
|
|
{EVMFork.low .. EVMFork.high}
|
2021-04-12 17:13:30 +00:00
|
|
|
|
|
|
|
Vm2OpHomesteadAndLater* = ## Set of all fork symbols
|
|
|
|
Vm2OpAllForks - {FkFrontier}
|
|
|
|
|
|
|
|
Vm2OpTangerineAndLater* = ## Set of fork symbols starting from Homestead
|
|
|
|
Vm2OpHomesteadAndLater - {FkHomestead}
|
|
|
|
|
|
|
|
Vm2OpSpuriousAndLater* = ## ditto ...
|
|
|
|
Vm2OpTangerineAndLater - {FkTangerine}
|
|
|
|
|
|
|
|
Vm2OpByzantiumAndLater* =
|
|
|
|
Vm2OpSpuriousAndLater - {FkSpurious}
|
|
|
|
|
|
|
|
Vm2OpConstantinopleAndLater* =
|
|
|
|
Vm2OpByzantiumAndLater - {FkByzantium}
|
|
|
|
|
|
|
|
Vm2OpPetersburgAndLater* =
|
|
|
|
Vm2OpConstantinopleAndLater - {FkConstantinople}
|
|
|
|
|
|
|
|
Vm2OpIstanbulAndLater* =
|
|
|
|
Vm2OpPetersburgAndLater - {FkPetersburg}
|
|
|
|
|
|
|
|
Vm2OpBerlinAndLater* =
|
|
|
|
Vm2OpIstanbulAndLater - {FkIstanbul}
|
|
|
|
|
2021-06-28 02:01:18 +00:00
|
|
|
Vm2OpLondonAndLater* =
|
|
|
|
Vm2OpBerlinAndLater - {FkBerlin}
|
|
|
|
|
2023-01-04 13:11:33 +00:00
|
|
|
Vm2OpParisAndLater* =
|
|
|
|
Vm2OpLondonAndLater - {FkLondon}
|
|
|
|
|
|
|
|
Vm2OpShanghaiAndLater* =
|
|
|
|
Vm2OpParisAndLater - {FkParis}
|
|
|
|
|
2023-06-24 13:56:44 +00:00
|
|
|
Vm2OpCancunAndLater* =
|
2023-03-21 13:27:12 +00:00
|
|
|
Vm2OpShanghaiAndLater - {FkShanghai}
|
|
|
|
|
2021-04-12 17:13:30 +00:00
|
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# End
|
|
|
|
# ------------------------------------------------------------------------------
|