diff --git a/nimbus/config.nim b/nimbus/config.nim index c993461ab..b9deac5a1 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -12,7 +12,7 @@ import chronos, eth/[keys, common, p2p, net/nat], chronicles, nimcrypto/hash, eth/p2p/bootnodes, eth/p2p/rlpx_protocols/whisper_protocol, ./db/select_backend, eth/keys, - ./vm_forks + ./vm_types2 const NimbusName* = "Nimbus" diff --git a/nimbus/p2p/chain.nim b/nimbus/p2p/chain.nim index c292dba7c..0591b5c10 100644 --- a/nimbus/p2p/chain.nim +++ b/nimbus/p2p/chain.nim @@ -1,5 +1,5 @@ import ../db/db_chain, eth/common, chronicles, ../vm_state, ../vm_types, - ../vm_computation, ../vm_message, ./vm_forks, stint, nimcrypto, + ../vm_computation, ../vm_message, ./vm_types2, stint, nimcrypto, ../utils, eth/trie/db, ./executor, ../config, ../genesis, ../utils, stew/endians2 diff --git a/nimbus/p2p/executor.nim b/nimbus/p2p/executor.nim index 4ca0f38fa..dee6e1762 100644 --- a/nimbus/p2p/executor.nim +++ b/nimbus/p2p/executor.nim @@ -4,7 +4,7 @@ import options, sets, ../utils, ../constants, ../transaction, ../vm_state, ../vm_types, ../vm_state_transactions, ../vm_computation, ../vm_message, ../vm_precompiles, - ./vm_forks, + ./vm_types2, ./dao, ../config proc processTransaction*(tx: Transaction, sender: EthAddress, vmState: BaseVMState, fork: Fork): GasInt = diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index 693d7227f..197b18078 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -15,7 +15,7 @@ import ../transaction, ../config, ../vm_state, ../constants, ../vm_types, ../utils, ../db/[db_chain, state_db], rpc_types, rpc_utils, ../vm_message, ../vm_computation, - ../vm_forks + ../vm_types2 #[ Note: diff --git a/nimbus/rpc/rpc_utils.nim b/nimbus/rpc/rpc_utils.nim index 4af27bce1..9030c7b6c 100644 --- a/nimbus/rpc/rpc_utils.nim +++ b/nimbus/rpc/rpc_utils.nim @@ -10,7 +10,7 @@ import hexstrings, eth/[common, rlp, keys, trie/db], stew/byteutils, nimcrypto, ../db/[db_chain, accounts_cache], strutils, algorithm, options, times, json, ../constants, stint, hexstrings, rpc_types, ../config, - ../vm_state_transactions, ../vm_state, ../vm_types, ../vm_forks, + ../vm_state_transactions, ../vm_state, ../vm_types, ../vm_types2, ../vm_computation, ../p2p/executor, ../utils, ../transaction type diff --git a/nimbus/tracer.nim b/nimbus/tracer.nim index bf6096699..2f8732fdc 100644 --- a/nimbus/tracer.nim +++ b/nimbus/tracer.nim @@ -3,7 +3,7 @@ import constants, vm_state, vm_types, transaction, p2p/executor, eth/trie/db, nimcrypto, strutils, chronicles, rpc/hexstrings, launcher, - ./vm_forks, ./config + ./vm_types2, ./config when defined(geth): import db/geth_db diff --git a/nimbus/transaction.nim b/nimbus/transaction.nim index 5a4bd07d8..82361628f 100644 --- a/nimbus/transaction.nim +++ b/nimbus/transaction.nim @@ -7,7 +7,7 @@ import ./constants, ./errors, eth/[common, keys], ./utils, - ./vm_forks, ./vm_gas_costs + ./vm_types2, ./vm_gas_costs import eth/common/transaction as common_transaction export common_transaction diff --git a/nimbus/vm/interpreter.nim b/nimbus/vm/interpreter.nim index 3845dfcb6..3d85fe597 100644 --- a/nimbus/vm/interpreter.nim +++ b/nimbus/vm/interpreter.nim @@ -28,6 +28,7 @@ import export vmm.isCreate +# Used in vm_types. Beware of recursive dependencies # see vm_computation import @@ -77,8 +78,6 @@ export vmc.writeContract -# Used in vm_types. Beware of recursive dependencies - import vm/interpreter/gas_meter as gmt export diff --git a/nimbus/vm_forks.nim b/nimbus/vm_forks.nim deleted file mode 100644 index 4c43d866e..000000000 --- a/nimbus/vm_forks.nim +++ /dev/null @@ -1,19 +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. - -# This should really go into vm_types once the circular computation.nim -# include/import dependency is solved -import - ./vm/interpreter/vm_forks as vmf - -export - vmf.Fork - -# End diff --git a/nimbus/vm_message.nim b/nimbus/vm_message.nim index edb4fac3a..3e3931d81 100644 --- a/nimbus/vm_message.nim +++ b/nimbus/vm_message.nim @@ -8,7 +8,9 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. -# Should be considered part of another header file (e.h. vm_misc) +# 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. import ./vm/message as vmm diff --git a/nimbus/vm_opcode_values.nim b/nimbus/vm_types2.nim similarity index 65% rename from nimbus/vm_opcode_values.nim rename to nimbus/vm_types2.nim index 2f784abea..b4ab5e4d7 100644 --- a/nimbus/vm_opcode_values.nim +++ b/nimbus/vm_types2.nim @@ -8,12 +8,17 @@ # at your option. This file may not be copied, modified, or distributed except # according to those terms. -# At the moment, this header file interface is only used for testing, so it -# might be worth merging it into a vm_internals.nim (or so) header file. +# The following should really go into vm_types once the circular computation.nim +# include/import dependency is solved. The problem is with vm_types.nim which +# includes computation.nim. +import + ./vm/interpreter/vm_forks as vmf +export + vmf.Fork + import ./vm/interpreter/opcode_values as vmo - export vmo.Op - + # End diff --git a/tests/macro_assembler.nim b/tests/macro_assembler.nim index 7a0de30c4..e89e8b6f7 100644 --- a/tests/macro_assembler.nim +++ b/tests/macro_assembler.nim @@ -1,17 +1,16 @@ import macrocache, strutils, unittest2, stew/byteutils, chronicles, eth/common, - ../nimbus/vm_opcode_values, stew/shims/macros, ../nimbus/config import options, json, os, eth/trie/[db, hexary], ../nimbus/[transaction, utils], ../nimbus/db/[db_chain, accounts_cache], - ../nimbus/[vm_computation, vm_state_transactions, vm_forks, + ../nimbus/[vm_computation, vm_state_transactions, vm_types2, vm_message, vm_memory, vm_state, vm_types] -export vm_opcode_values, byteutils +export vm_types2, byteutils {.experimental: "dynamicBindSym".} # backported from Nim 0.19.9 diff --git a/tests/test_blockchain_json.nim b/tests/test_blockchain_json.nim index 120d372b8..e0131dbbc 100644 --- a/tests/test_blockchain_json.nim +++ b/tests/test_blockchain_json.nim @@ -12,7 +12,7 @@ import ethash, stew/endians2, nimcrypto, ./test_helpers, ./test_allowed_to_fail, ../premix/parser, test_config, - ../nimbus/[vm_state, utils, vm_types, errors, transaction, constants, vm_forks], + ../nimbus/[vm_state, utils, vm_types, errors, transaction, constants, vm_types2], ../nimbus/db/[db_chain, accounts_cache], ../nimbus/utils/header, ../nimbus/p2p/[executor, dao], diff --git a/tests/test_config.nim b/tests/test_config.nim index da9ac3ff3..72514f64f 100644 --- a/tests/test_config.nim +++ b/tests/test_config.nim @@ -1,6 +1,6 @@ import parseopt, strutils, - ../nimbus/vm_forks + ../nimbus/vm_types2 type ConfigStatus* = enum diff --git a/tests/test_difficulty.nim b/tests/test_difficulty.nim index 089d03a4c..b63cc68ac 100644 --- a/tests/test_difficulty.nim +++ b/tests/test_difficulty.nim @@ -1,7 +1,7 @@ import unittest2, strutils, tables, os, json, ../nimbus/utils/difficulty, stint, times, eth/common, test_helpers, stew/byteutils, - ../nimbus/constants, ../nimbus/vm_forks, + ../nimbus/constants, ../nimbus/vm_types2, ../nimbus/config type diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index cca6905c6..a236efebd 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -10,7 +10,7 @@ import stew/byteutils, net, eth/[common, keys, rlp, p2p], unittest2, testutils/markdown_reports, ../nimbus/[config, transaction, utils, errors], - ../nimbus/vm_forks, + ../nimbus/vm_types2, ../nimbus/db/accounts_cache, ../nimbus/random_keys diff --git a/tests/test_precompiles.nim b/tests/test_precompiles.nim index 9ba4b5e0e..fe01cea4c 100644 --- a/tests/test_precompiles.nim +++ b/tests/test_precompiles.nim @@ -8,7 +8,7 @@ import unittest2, ../nimbus/vm_precompiles, json, stew/byteutils, test_helpers, os, tables, strformat, strutils, eth/trie/db, eth/common, ../nimbus/db/db_chain, - ../nimbus/[vm_computation, vm_types, vm_state, vm_forks], macros, + ../nimbus/[vm_computation, vm_types, vm_state, vm_types2], macros, test_allowed_to_fail proc initAddress(i: byte): EthAddress = result[19] = i