re-named some v2*.nim sources to its original name *.nim (without the v2)
why: the v2 prefix of the file name was used as a visual aid when comparing vm2 against vm sources details: all renamed v2*.nim sources compile locally with the -d:kludge:1 flag set or without (some work with either) only sources not renamed yet: v2state_transactions.nim
This commit is contained in:
parent
bca6e791aa
commit
ff6921eb1a
|
@ -12,9 +12,9 @@ import
|
|||
../constants,
|
||||
../db/accounts_cache,
|
||||
./interpreter/op_codes,
|
||||
./state,
|
||||
./transaction_tracer,
|
||||
./v2state,
|
||||
./v2types,
|
||||
./types,
|
||||
chronicles,
|
||||
eth/[common, keys],
|
||||
options,
|
||||
|
|
|
@ -14,9 +14,9 @@ import
|
|||
../constants,
|
||||
./compu_helper,
|
||||
./interpreter/[op_codes, gas_meter, gas_costs, forks_list],
|
||||
./code_stream, ./memory_defs, ./v2message, ./stack, ./v2types, ./v2state,
|
||||
./code_stream, ./memory, ./message, ./stack, ./types, ./state,
|
||||
../db/accounts_cache,
|
||||
./v2precompiles,
|
||||
./precompiles,
|
||||
./transaction_tracer, ../utils
|
||||
|
||||
logScope:
|
|
@ -8,8 +8,6 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
# see vm_internals
|
||||
|
||||
|
@ -26,7 +24,7 @@ export
|
|||
|
||||
|
||||
import
|
||||
./v2message as vmm
|
||||
./message as vmm
|
||||
export
|
||||
vmm.isCreate
|
||||
|
||||
|
@ -60,7 +58,7 @@ export
|
|||
xmc.tracingEnabled
|
||||
|
||||
import
|
||||
./v2computation as vmc
|
||||
./computation as vmc
|
||||
export
|
||||
vmc.commit,
|
||||
vmc.dispose,
|
|
@ -16,9 +16,9 @@
|
|||
##
|
||||
## Assumptions on the naming of the fork list:
|
||||
## * each symbol start with the prefix "Fk"
|
||||
## * the the first word of the prettified text representaion is the same
|
||||
## text as the one following the "Fk" symbol name (irrespective of
|
||||
## character case.)
|
||||
## * the first word of the prettified text representaion is the same
|
||||
## text as the one following the "Fk" in the symbol name (irrespective
|
||||
## of character case.)
|
||||
|
||||
import
|
||||
strutils
|
||||
|
@ -37,7 +37,7 @@ type
|
|||
|
||||
proc toSymbolName*(fork: Fork): string =
|
||||
## Given a `fork` argument, print the symbol name so that it can be used
|
||||
## im macro staements.
|
||||
## in a macro statement.
|
||||
"Fk" & ($fork).split(' ')[0]
|
||||
|
||||
# End
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import
|
||||
math, eth/common/eth_types,
|
||||
./utils/[macros_gen_opcodes, v2utils_numeric],
|
||||
./utils/[macros_gen_opcodes, utils_numeric],
|
||||
./op_codes, ./forks_list, ../../errors
|
||||
|
||||
# Gas Fee Schedule
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import
|
||||
chronicles, strformat, eth/common, # GasInt
|
||||
../../errors, ../v2types
|
||||
../../errors, ../types
|
||||
|
||||
logScope:
|
||||
topics = "vm gas"
|
||||
|
|
|
@ -211,7 +211,7 @@ type
|
|||
|
||||
proc toSymbolName*(op: Op): string =
|
||||
## Given an `op` argument, print the symbol name so that it can be used
|
||||
## im macro staements.
|
||||
## in a macro statement.
|
||||
$op
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -16,11 +16,11 @@ import
|
|||
../../../constants,
|
||||
../../compu_helper,
|
||||
../../stack,
|
||||
../../v2types,
|
||||
../../types,
|
||||
../op_codes,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
./oph_defs,
|
||||
chronicles,
|
||||
eth/common,
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
import
|
||||
../../compu_helper,
|
||||
../../stack,
|
||||
../../v2state,
|
||||
../../state,
|
||||
../op_codes,
|
||||
./oph_defs,
|
||||
eth/common,
|
||||
|
|
|
@ -19,10 +19,10 @@ const
|
|||
import
|
||||
../../../errors,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../../memory,
|
||||
../forks_list,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
chronicles,
|
||||
eth/common/eth_types,
|
||||
stint
|
||||
|
@ -37,9 +37,9 @@ when not breakCircularDependency:
|
|||
../../../constants,
|
||||
../../../db/accounts_cache,
|
||||
../../compu_helper,
|
||||
../../v2computation,
|
||||
../../v2state,
|
||||
../../v2types,
|
||||
../../computation,
|
||||
../../state,
|
||||
../../types,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
eth/common
|
||||
|
|
|
@ -19,10 +19,10 @@ const
|
|||
import
|
||||
../../../errors,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../../memory,
|
||||
../forks_list,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
chronicles,
|
||||
eth/common/eth_types,
|
||||
stint,
|
||||
|
@ -36,9 +36,9 @@ when not breakCircularDependency:
|
|||
import
|
||||
../../../constants,
|
||||
../../compu_helper,
|
||||
../../v2computation,
|
||||
../../v2state,
|
||||
../../v2types,
|
||||
../../computation,
|
||||
../../state,
|
||||
../../types,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
./oph_defs,
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
## ========================
|
||||
##
|
||||
|
||||
# Including v2types.nim needed unless included (not imported) into
|
||||
# Including types.nim needed unless included (not imported) into
|
||||
# oph_defs_kludge.nim
|
||||
#
|
||||
# Note that the nim compiler will distinguish <Vm2Ctx> tuples defined
|
||||
|
@ -21,7 +21,7 @@
|
|||
#
|
||||
when not declared(Computation):
|
||||
import
|
||||
../../v2types
|
||||
../../types
|
||||
|
||||
import
|
||||
../forks_list,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
import
|
||||
../forks_list,
|
||||
../op_codes,
|
||||
../../memory_defs,
|
||||
../../memory,
|
||||
../../stack_defs,
|
||||
eth/common/eth_types
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ import
|
|||
../../../errors,
|
||||
../../code_stream,
|
||||
../../compu_helper,
|
||||
../../memory,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../../v2state,
|
||||
../../state,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
./oph_defs,
|
||||
./oph_helpers,
|
||||
eth/common,
|
||||
|
|
|
@ -16,12 +16,12 @@ import
|
|||
../../../constants,
|
||||
../../../errors,
|
||||
../../compu_helper,
|
||||
../../memory,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
./oph_defs,
|
||||
eth/common,
|
||||
nimcrypto,
|
||||
|
|
|
@ -12,14 +12,14 @@
|
|||
## ==============================================
|
||||
##
|
||||
|
||||
# Including v2types.nim and others unless included (not imported) into
|
||||
# Including types.nim and others unless included (not imported) into
|
||||
# oph_helpes_kludge.nim
|
||||
#
|
||||
when not declared(consumeGas):
|
||||
import
|
||||
../../../db/accounts_cache,
|
||||
../../v2state,
|
||||
../../v2types,
|
||||
../../state,
|
||||
../../types,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
./oph_defs,
|
||||
|
|
|
@ -30,7 +30,7 @@ const
|
|||
WarmStorageReadCost* = 3
|
||||
MaxCallDepth* = 42
|
||||
|
||||
# function stubs from v2state.nim
|
||||
# function stubs from state.nim
|
||||
template mutateStateDB*(vmState: BaseVMState, body: untyped) =
|
||||
block:
|
||||
var db {.inject.} = vmState.accountDb
|
||||
|
@ -41,7 +41,7 @@ proc gasCosts*(c: Computation): array[Op,int] = result
|
|||
proc getBalance*[T](c: Computation, address: T): Uint256 = result
|
||||
proc accountExists*(c: Computation, address: EthAddress): bool = result
|
||||
|
||||
# function stubs from v2computation.nim (to satisfy compiler logic)
|
||||
# function stubs from computation.nim (to satisfy compiler logic)
|
||||
func shouldBurnGas*(c: Computation): bool = result
|
||||
proc newComputation*[A,B](v:A, m:B, salt = 0.u256): Computation = new result
|
||||
proc isSuccess*(c: Computation): bool = result
|
||||
|
|
|
@ -16,13 +16,13 @@ import
|
|||
../../../constants,
|
||||
../../../errors,
|
||||
../../compu_helper,
|
||||
../../memory,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../../v2types,
|
||||
../../types,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
./oph_defs,
|
||||
./oph_helpers,
|
||||
eth/common,
|
||||
|
|
|
@ -17,14 +17,14 @@ import
|
|||
../../../errors,
|
||||
../../code_stream,
|
||||
../../compu_helper,
|
||||
../../memory,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../../v2state,
|
||||
../../v2types,
|
||||
../../state,
|
||||
../../types,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
./oph_defs,
|
||||
./oph_helpers,
|
||||
eth/common,
|
||||
|
|
|
@ -16,15 +16,15 @@ import
|
|||
../../../db/accounts_cache,
|
||||
../../../errors,
|
||||
../../compu_helper,
|
||||
../../memory,
|
||||
../../stack,
|
||||
../../v2memory,
|
||||
../../v2state,
|
||||
../../v2types,
|
||||
../../state,
|
||||
../../types,
|
||||
../forks_list,
|
||||
../gas_costs,
|
||||
../gas_meter,
|
||||
../op_codes,
|
||||
../utils/v2utils_numeric,
|
||||
../utils/utils_numeric,
|
||||
./oph_defs,
|
||||
./oph_helpers,
|
||||
eth/common,
|
||||
|
|
|
@ -5,11 +5,7 @@
|
|||
# * 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.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
import
|
||||
macros,
|
||||
stew/endians2, stew/ranges/ptr_arith,
|
||||
eth/common/eth_types,
|
||||
../../../constants
|
|
@ -14,6 +14,10 @@ const
|
|||
lowMemoryCompileTime {.used.} = lowmem > 0
|
||||
|
||||
# debugging flag
|
||||
noisy {.intdefine.}: int = 0
|
||||
isNoisy {.used.} = noisy > 0
|
||||
|
||||
# needed for compiling locally
|
||||
kludge {.intdefine.}: int = 0
|
||||
breakCircularDependency {.used.} = kludge > 0
|
||||
|
||||
|
@ -22,7 +26,7 @@ import
|
|||
./interpreter/[forks_list, gas_costs, gas_meter,
|
||||
op_codes, op_handlers, op_handlers/oph_defs],
|
||||
./code_stream,
|
||||
./v2types,
|
||||
./types,
|
||||
chronicles,
|
||||
macros
|
||||
|
||||
|
@ -117,7 +121,7 @@ proc toCaseStmt(forkArg, opArg, k: NimNode): NimNode =
|
|||
newIdentNode(op.toSymbolName),
|
||||
branchStmt)
|
||||
|
||||
when breakCircularDependency:
|
||||
when breakCircularDependency and isNoisy:
|
||||
echo ">>> ", result.repr
|
||||
|
||||
|
||||
|
|
|
@ -5,17 +5,15 @@
|
|||
# * 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.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
import
|
||||
sequtils,
|
||||
chronicles, eth/common/eth_types,
|
||||
../errors, ../validation, ./memory_defs,
|
||||
./interpreter/utils/v2utils_numeric
|
||||
../errors, ../validation,
|
||||
./interpreter/utils/utils_numeric
|
||||
|
||||
export
|
||||
Memory
|
||||
type
|
||||
Memory* = ref object
|
||||
bytes*: seq[byte]
|
||||
|
||||
logScope:
|
||||
topics = "vm memory"
|
|
@ -8,8 +8,7 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
type
|
||||
Memory* = ref object
|
||||
bytes*: seq[byte]
|
||||
import ./types
|
||||
|
||||
# End
|
||||
proc isCreate*(message: Message): bool =
|
||||
message.kind in {evmcCreate, evmcCreate2}
|
|
@ -8,12 +8,9 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
import
|
||||
./v2types,
|
||||
./interpreter/[gas_meter, gas_costs, utils/v2utils_numeric, forks_list],
|
||||
./types,
|
||||
./interpreter/[gas_meter, gas_costs, utils/utils_numeric, forks_list],
|
||||
../errors, stint, eth/[keys, common], chronicles, tables, macros,
|
||||
math, nimcrypto, bncurve/[fields, groups], ./blake2b_f, ./blscurve
|
||||
|
|
@ -8,15 +8,12 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
import
|
||||
macros, strformat, tables, sets, options,
|
||||
eth/[common, keys, rlp], nimcrypto/keccak,
|
||||
./interpreter/forks_list, ../errors,
|
||||
../constants, ../db/[db_chain, accounts_cache],
|
||||
../utils, json, ./transaction_tracer, ./v2types,
|
||||
../utils, json, ./transaction_tracer, ./types,
|
||||
../config, ../../stateless/[witness_from_tree, witness_types]
|
||||
|
||||
proc newAccessLogs*: AccessLogs =
|
|
@ -1,7 +1,7 @@
|
|||
import
|
||||
json, strutils, sets, hashes,
|
||||
chronicles, nimcrypto, eth/common, stint,
|
||||
./v2types, ./v2memory, ./stack, ../db/accounts_cache,
|
||||
./types, ./memory, ./stack, ../db/accounts_cache,
|
||||
eth/trie/hexary,
|
||||
./interpreter/op_codes
|
||||
|
||||
|
|
|
@ -8,13 +8,10 @@
|
|||
# at your option. This file may not be copied, modified, or distributed except
|
||||
# according to those terms.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
import
|
||||
tables, eth/common,
|
||||
options, json, sets,
|
||||
./stack_defs, ./memory_defs, ./code_stream,
|
||||
./stack_defs, ./memory, ./code_stream,
|
||||
./interpreter/[gas_costs, op_codes, forks_list],
|
||||
# TODO - will be hidden at a lower layer
|
||||
../db/[db_chain, accounts_cache]
|
|
@ -1,14 +0,0 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# 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.
|
||||
|
||||
when defined(evmc_enabled):
|
||||
{.fatal: "Flags \"evmc_enabled\" and \"vm2_enabled\" are mutually exclusive"}
|
||||
|
||||
import ./v2types
|
||||
|
||||
proc isCreate*(message: Message): bool =
|
||||
message.kind in {evmcCreate, evmcCreate2}
|
|
@ -13,7 +13,7 @@ import
|
|||
eth/common, chronicles, ../db/accounts_cache,
|
||||
../config, ./interpreter/gas_costs,
|
||||
../transaction,
|
||||
./v2computation, ./v2interpreter, ./v2state, ./v2types
|
||||
./computation, ./interpreter, ./state, ./types
|
||||
|
||||
proc setupTxContext*(vmState: BaseVMState, origin: EthAddress, gasPrice: GasInt, forkOverride=none(Fork)) =
|
||||
## this proc will be called each time a new transaction
|
||||
|
|
|
@ -44,7 +44,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
else:
|
||||
import
|
||||
./vm2/compu_helper as xmc,
|
||||
./vm2/v2computation as vmc
|
||||
./vm2/computation as vmc
|
||||
|
||||
export
|
||||
xmc.accountExists,
|
||||
|
|
|
@ -15,7 +15,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
./vm/memory as vmm
|
||||
else:
|
||||
import
|
||||
./vm2/v2memory as vmm
|
||||
./vm2/memory as vmm
|
||||
|
||||
export
|
||||
vmm.Memory,
|
||||
|
@ -35,7 +35,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
./vm/interpreter/utils/utils_numeric as vmn
|
||||
else:
|
||||
import
|
||||
./vm2/interpreter/utils/v2utils_numeric as vmn
|
||||
./vm2/interpreter/utils/utils_numeric as vmn
|
||||
|
||||
|
||||
export
|
||||
|
@ -59,7 +59,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
./vm/interpreter as vmi
|
||||
else:
|
||||
import
|
||||
./vm2/v2interpreter as vmi
|
||||
./vm2/interpreter as vmi
|
||||
|
||||
export
|
||||
vmi
|
||||
|
|
|
@ -11,12 +11,13 @@
|
|||
# Should be considered part of another header file (e.g. vm_misc) once the
|
||||
# circular computation.nim include/import dependency is solved. The problem is
|
||||
# with vm_types.nim (included by message.nim) which includes computation.nim.
|
||||
|
||||
when defined(evmc_enabled) or not defined(vm2_enabled):
|
||||
import
|
||||
./vm/message as vmm
|
||||
else:
|
||||
import
|
||||
./vm2/v2message as vmm
|
||||
./vm2/message as vmm
|
||||
|
||||
export
|
||||
vmm.isCreate
|
||||
|
|
|
@ -13,7 +13,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
./vm/precompiles as vmp
|
||||
else:
|
||||
import
|
||||
./vm2/v2precompiles as vmp
|
||||
./vm2/precompiles as vmp
|
||||
|
||||
export
|
||||
vmp.PrecompileAddresses,
|
||||
|
|
|
@ -17,7 +17,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
else:
|
||||
import
|
||||
./vm2/v2state_transactions as vmx,
|
||||
./vm2/v2state as vms
|
||||
./vm2/state as vms
|
||||
export
|
||||
vmx.setupTxContext
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ when defined(evmc_enabled) or not defined(vm2_enabled):
|
|||
./vm/types as vmt
|
||||
else:
|
||||
import
|
||||
./vm2/v2types as vmt
|
||||
./vm2/types as vmt
|
||||
|
||||
export
|
||||
vmt.AccessLogs,
|
||||
|
|
Loading…
Reference in New Issue