diff --git a/nim.cfg b/nim.cfg new file mode 100644 index 000000000..f96c5702c --- /dev/null +++ b/nim.cfg @@ -0,0 +1 @@ +path = nimbus diff --git a/nimbus/vm/code_stream.nim b/nimbus/vm/code_stream.nim index 9f2ce84e6..f63d09e17 100644 --- a/nimbus/vm/code_stream.nim +++ b/nimbus/vm/code_stream.nim @@ -8,7 +8,7 @@ import chronicles, strformat, strutils, sequtils, parseutils, sets, macros, eth/common, - ./interpreter/opcode_values + vm/interpreter/opcode_values logScope: topics = "vm code_stream" diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index 764829a81..7e5b08938 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -8,11 +8,11 @@ import chronicles, strformat, macros, options, times, sets, eth/[common, keys], - ../constants, ../errors, ../vm_state, ../vm_types, - ./interpreter/[opcode_values, gas_meter, gas_costs, vm_forks], - ./code_stream, ./memory, ./message, ./stack, ../db/[accounts_cache, db_chain], - ../utils/header, precompiles, - transaction_tracer, ../utils + constants, errors, vm_state, vm_types, + vm/interpreter/[opcode_values, gas_meter, gas_costs, vm_forks], + vm/code_stream, vm/memory, vm/message, vm/stack, db/[accounts_cache, db_chain], + utils/header, precompiles, + transaction_tracer, utils when defined(chronicles_log_level): import stew/byteutils diff --git a/nimbus/vm/evmc_api.nim b/nimbus/vm/evmc_api.nim index 17f2cf479..1383f6234 100644 --- a/nimbus/vm/evmc_api.nim +++ b/nimbus/vm/evmc_api.nim @@ -5,7 +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. -import evmc/evmc, evmc_helpers, eth/common, ../constants +import evmc/evmc, vm/evmc_helpers, eth/common, constants type # we are not using EVMC original signature here diff --git a/nimbus/vm/interpreter.nim b/nimbus/vm/interpreter.nim index 61675d077..6461449f9 100644 --- a/nimbus/vm/interpreter.nim +++ b/nimbus/vm/interpreter.nim @@ -6,11 +6,10 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - ./interpreter/[opcode_values, gas_meter], - ./interpreter/vm_forks + vm/interpreter/[opcode_values, gas_meter, vm_forks] import # Used in vm_types. Beware of recursive dependencies - ./code_stream, ./computation, ./stack, ./message + vm/[code_stream, computation, stack, message] export opcode_values, gas_meter, diff --git a/nimbus/vm/interpreter/gas_costs.nim b/nimbus/vm/interpreter/gas_costs.nim index 1d37ee466..f3ef8941d 100644 --- a/nimbus/vm/interpreter/gas_costs.nim +++ b/nimbus/vm/interpreter/gas_costs.nim @@ -7,8 +7,8 @@ import math, eth/common/eth_types, - ./utils/[macros_gen_opcodes, utils_numeric], - ./opcode_values, ./vm_forks, ../../errors + vm/interpreter/utils/[macros_gen_opcodes, utils_numeric], + vm/interpreter/[opcode_values, vm_forks], errors when defined(evmc_enabled): import evmc/evmc diff --git a/nimbus/vm/interpreter/gas_meter.nim b/nimbus/vm/interpreter/gas_meter.nim index 7191c040c..7eb2064db 100644 --- a/nimbus/vm/interpreter/gas_meter.nim +++ b/nimbus/vm/interpreter/gas_meter.nim @@ -7,7 +7,7 @@ import chronicles, strformat, eth/common, # GasInt - ../../errors, ../../vm_types + errors, vm_types logScope: topics = "vm gas" diff --git a/nimbus/vm/interpreter/opcode_values.nim b/nimbus/vm/interpreter/opcode_values.nim index 5b6aa0e22..8b771d3c2 100644 --- a/nimbus/vm/interpreter/opcode_values.nim +++ b/nimbus/vm/interpreter/opcode_values.nim @@ -5,7 +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. -import ./utils/macros_gen_opcodes +import vm/interpreter/utils/macros_gen_opcodes fill_enum_holes: type diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 1413209eb..10e580772 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -7,15 +7,15 @@ import strformat, times, sets, sequtils, options, - chronicles, stint, nimcrypto, stew/ranges/[ptr_arith], eth/common, - ./utils/[macros_procs_opcodes, utils_numeric], - ./gas_meter, ./gas_costs, ./opcode_values, ./vm_forks, - ../memory, ../stack, ../code_stream, ../computation, - ../../vm_state, ../../errors, ../../constants, ../../vm_types, - ../../db/[db_chain, accounts_cache] + chronicles, stint, nimcrypto, stew/ranges/ptr_arith, eth/common, + vm/interpreter/utils/[macros_procs_opcodes, utils_numeric], + vm/interpreter/[gas_meter, gas_costs, opcode_values, vm_forks], + vm/[memory, stack, code_stream, computation], + vm_state, errors, constants, vm_types, + db/[db_chain, accounts_cache] when defined(evmc_enabled): - import ../evmc_api, ../evmc_helpers, evmc/evmc + import vm/evmc_api, vm/evmc_helpers, evmc/evmc logScope: topics = "opcode impl" diff --git a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim index d339c078c..8d5bfd7cb 100644 --- a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim +++ b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim @@ -10,13 +10,12 @@ import macros, strformat, stint, eth/common, - ../../computation, ../../stack, ../../code_stream, - ../../../vm_types, ../../memory, - ../../../errors, ../../interpreter/[gas_meter, opcode_values], - ../../interpreter/utils/utils_numeric + vm/[computation, stack, code_stream, memory], + vm_types, errors, vm/interpreter/[gas_meter, opcode_values], + vm/interpreter/utils/utils_numeric when defined(evmc_enabled): - import ../../evmc_api, evmc/evmc + import vm/evmc_api, evmc/evmc proc pop(tree: var NimNode): NimNode = ## Returns the last value of a NimNode and remove it diff --git a/nimbus/vm/interpreter/utils/utils_numeric.nim b/nimbus/vm/interpreter/utils/utils_numeric.nim index 1d9dad522..1da53d68d 100644 --- a/nimbus/vm/interpreter/utils/utils_numeric.nim +++ b/nimbus/vm/interpreter/utils/utils_numeric.nim @@ -9,7 +9,7 @@ import macros, stew/endians2, stew/ranges/ptr_arith, eth/common/eth_types, - ../../../constants + constants type # cannot use range for unknown reason @@ -118,4 +118,4 @@ func toInt*(x: EthAddress): int = type T = uint32 const len = sizeof(T) fromBytesBE(T, makeOpenArray(x[x.len-len].unsafeAddr, len)).int - \ No newline at end of file + diff --git a/nimbus/vm/interpreter_dispatch.nim b/nimbus/vm/interpreter_dispatch.nim index d7d0bd97e..d2a5b5b25 100644 --- a/nimbus/vm/interpreter_dispatch.nim +++ b/nimbus/vm/interpreter_dispatch.nim @@ -8,8 +8,8 @@ import tables, macros, chronicles, - ./interpreter/[opcode_values, opcodes_impl, vm_forks, gas_costs, gas_meter, utils/macros_gen_opcodes], - ./code_stream, ../vm_types, ../errors, precompiles, ./stack, + vm/interpreter/[opcode_values, opcodes_impl, vm_forks, gas_costs, gas_meter, utils/macros_gen_opcodes], + vm/code_stream, vm_types, errors, precompiles, vm/stack, terminal # Those are only needed for logging logScope: diff --git a/nimbus/vm/memory.nim b/nimbus/vm/memory.nim index fab766fbe..1d1e55a93 100644 --- a/nimbus/vm/memory.nim +++ b/nimbus/vm/memory.nim @@ -8,8 +8,8 @@ import sequtils, chronicles, eth/common/eth_types, - ../errors, ../validation, - ./interpreter/utils/utils_numeric + errors, validation, + vm/interpreter/utils/utils_numeric logScope: topics = "vm memory" diff --git a/nimbus/vm/message.nim b/nimbus/vm/message.nim index 5478a9ea6..934579c89 100644 --- a/nimbus/vm/message.nim +++ b/nimbus/vm/message.nim @@ -5,7 +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. -import ../vm_types +import vm_types proc isCreate*(message: Message): bool = message.kind in {evmcCreate, evmcCreate2} diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index 544f74f66..5ce84caba 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -1,7 +1,8 @@ import - ../vm_types, interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks], - ../errors, stint, eth/[keys, common], chronicles, tables, macros, - math, nimcrypto, bncurve/[fields, groups], blake2b_f, ./blscurve + vm_types, + vm/interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks], + errors, stint, eth/[keys, common], chronicles, tables, macros, + math, nimcrypto, bncurve/[fields, groups], vm/blake2b_f, vm/blscurve type PrecompileAddresses* = enum diff --git a/nimbus/vm/stack.nim b/nimbus/vm/stack.nim index 5026f01cc..7ae85b65f 100644 --- a/nimbus/vm/stack.nim +++ b/nimbus/vm/stack.nim @@ -7,7 +7,7 @@ import chronicles, strformat, strutils, sequtils, macros, eth/common, nimcrypto, - ../errors, ../validation + errors, validation logScope: topics = "vm stack" diff --git a/nimbus/vm/transaction_tracer.nim b/nimbus/vm/transaction_tracer.nim index a813d21a6..924e453dc 100644 --- a/nimbus/vm/transaction_tracer.nim +++ b/nimbus/vm/transaction_tracer.nim @@ -1,9 +1,9 @@ import json, strutils, sets, hashes, chronicles, nimcrypto, eth/common, stint, - ../vm_types, memory, stack, ../db/accounts_cache, + vm_types, memory, vm/stack, db/accounts_cache, eth/trie/hexary, - ./interpreter/opcode_values + vm/interpreter/opcode_values logScope: topics = "vm opcode" diff --git a/nimbus/vm_types.nim b/nimbus/vm_types.nim index 747f4da21..bb1125192 100644 --- a/nimbus/vm_types.nim +++ b/nimbus/vm_types.nim @@ -8,9 +8,9 @@ import tables, eth/common, options, json, sets, - ./vm/[memory, stack, code_stream], - ./vm/interpreter/[gas_costs, opcode_values, vm_forks], # TODO - will be hidden at a lower layer - ./db/[db_chain, accounts_cache] + vm/[memory, stack, code_stream], + vm/interpreter/[gas_costs, opcode_values, vm_forks], # TODO - will be hidden at a lower layer + db/[db_chain, accounts_cache] when defined(evmc_enabled): import ./vm/evmc_api