remove relative paths ./ and ../ from import section

why:
  relative paths make sources inherently non-relocatable

details:
  import base is set to the nimbus directoy, so importing ./stack
  from file interpreter.nim becomes vm/stack etc.

caveat:
   a file named nimbus/strformat.nim would clash with strformat (but
   not with std/strformat)
This commit is contained in:
Jordan Hrycaj 2021-03-30 17:20:43 +01:00
parent 6d2b7ad6da
commit a3db0f41d8
No known key found for this signature in database
GPG Key ID: 4101B9BC5A0DB080
18 changed files with 42 additions and 42 deletions

1
nim.cfg Normal file
View File

@ -0,0 +1 @@
path = nimbus

View File

@ -8,7 +8,7 @@
import import
chronicles, strformat, strutils, sequtils, parseutils, sets, macros, chronicles, strformat, strutils, sequtils, parseutils, sets, macros,
eth/common, eth/common,
./interpreter/opcode_values vm/interpreter/opcode_values
logScope: logScope:
topics = "vm code_stream" topics = "vm code_stream"

View File

@ -8,11 +8,11 @@
import import
chronicles, strformat, macros, options, times, chronicles, strformat, macros, options, times,
sets, eth/[common, keys], sets, eth/[common, keys],
../constants, ../errors, ../vm_state, ../vm_types, constants, errors, vm_state, vm_types,
./interpreter/[opcode_values, gas_meter, gas_costs, vm_forks], vm/interpreter/[opcode_values, gas_meter, gas_costs, vm_forks],
./code_stream, ./memory, ./message, ./stack, ../db/[accounts_cache, db_chain], vm/code_stream, vm/memory, vm/message, vm/stack, db/[accounts_cache, db_chain],
../utils/header, precompiles, utils/header, precompiles,
transaction_tracer, ../utils transaction_tracer, utils
when defined(chronicles_log_level): when defined(chronicles_log_level):
import stew/byteutils import stew/byteutils

View File

@ -5,7 +5,7 @@
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) # * 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. # 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 type
# we are not using EVMC original signature here # we are not using EVMC original signature here

View File

@ -6,11 +6,10 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms. # at your option. This file may not be copied, modified, or distributed except according to those terms.
import import
./interpreter/[opcode_values, gas_meter], vm/interpreter/[opcode_values, gas_meter, vm_forks]
./interpreter/vm_forks
import # Used in vm_types. Beware of recursive dependencies import # Used in vm_types. Beware of recursive dependencies
./code_stream, ./computation, ./stack, ./message vm/[code_stream, computation, stack, message]
export export
opcode_values, gas_meter, opcode_values, gas_meter,

View File

@ -7,8 +7,8 @@
import import
math, eth/common/eth_types, math, eth/common/eth_types,
./utils/[macros_gen_opcodes, utils_numeric], vm/interpreter/utils/[macros_gen_opcodes, utils_numeric],
./opcode_values, ./vm_forks, ../../errors vm/interpreter/[opcode_values, vm_forks], errors
when defined(evmc_enabled): when defined(evmc_enabled):
import evmc/evmc import evmc/evmc

View File

@ -7,7 +7,7 @@
import import
chronicles, strformat, eth/common, # GasInt chronicles, strformat, eth/common, # GasInt
../../errors, ../../vm_types errors, vm_types
logScope: logScope:
topics = "vm gas" topics = "vm gas"

View File

@ -5,7 +5,7 @@
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) # * 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. # 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: fill_enum_holes:
type type

View File

@ -7,15 +7,15 @@
import import
strformat, times, sets, sequtils, options, strformat, times, sets, sequtils, options,
chronicles, stint, nimcrypto, stew/ranges/[ptr_arith], eth/common, chronicles, stint, nimcrypto, stew/ranges/ptr_arith, eth/common,
./utils/[macros_procs_opcodes, utils_numeric], vm/interpreter/utils/[macros_procs_opcodes, utils_numeric],
./gas_meter, ./gas_costs, ./opcode_values, ./vm_forks, vm/interpreter/[gas_meter, gas_costs, opcode_values, vm_forks],
../memory, ../stack, ../code_stream, ../computation, vm/[memory, stack, code_stream, computation],
../../vm_state, ../../errors, ../../constants, ../../vm_types, vm_state, errors, constants, vm_types,
../../db/[db_chain, accounts_cache] db/[db_chain, accounts_cache]
when defined(evmc_enabled): when defined(evmc_enabled):
import ../evmc_api, ../evmc_helpers, evmc/evmc import vm/evmc_api, vm/evmc_helpers, evmc/evmc
logScope: logScope:
topics = "opcode impl" topics = "opcode impl"

View File

@ -10,13 +10,12 @@
import import
macros, strformat, stint, eth/common, macros, strformat, stint, eth/common,
../../computation, ../../stack, ../../code_stream, vm/[computation, stack, code_stream, memory],
../../../vm_types, ../../memory, vm_types, errors, vm/interpreter/[gas_meter, opcode_values],
../../../errors, ../../interpreter/[gas_meter, opcode_values], vm/interpreter/utils/utils_numeric
../../interpreter/utils/utils_numeric
when defined(evmc_enabled): when defined(evmc_enabled):
import ../../evmc_api, evmc/evmc import vm/evmc_api, evmc/evmc
proc pop(tree: var NimNode): NimNode = proc pop(tree: var NimNode): NimNode =
## Returns the last value of a NimNode and remove it ## Returns the last value of a NimNode and remove it

View File

@ -9,7 +9,7 @@ import
macros, macros,
stew/endians2, stew/ranges/ptr_arith, stew/endians2, stew/ranges/ptr_arith,
eth/common/eth_types, eth/common/eth_types,
../../../constants constants
type type
# cannot use range for unknown reason # cannot use range for unknown reason

View File

@ -8,8 +8,8 @@
import import
tables, macros, tables, macros,
chronicles, chronicles,
./interpreter/[opcode_values, opcodes_impl, vm_forks, gas_costs, gas_meter, utils/macros_gen_opcodes], vm/interpreter/[opcode_values, opcodes_impl, vm_forks, gas_costs, gas_meter, utils/macros_gen_opcodes],
./code_stream, ../vm_types, ../errors, precompiles, ./stack, vm/code_stream, vm_types, errors, precompiles, vm/stack,
terminal # Those are only needed for logging terminal # Those are only needed for logging
logScope: logScope:

View File

@ -8,8 +8,8 @@
import import
sequtils, sequtils,
chronicles, eth/common/eth_types, chronicles, eth/common/eth_types,
../errors, ../validation, errors, validation,
./interpreter/utils/utils_numeric vm/interpreter/utils/utils_numeric
logScope: logScope:
topics = "vm memory" topics = "vm memory"

View File

@ -5,7 +5,7 @@
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT) # * 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. # 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 = proc isCreate*(message: Message): bool =
message.kind in {evmcCreate, evmcCreate2} message.kind in {evmcCreate, evmcCreate2}

View File

@ -1,7 +1,8 @@
import import
../vm_types, interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks], vm_types,
../errors, stint, eth/[keys, common], chronicles, tables, macros, vm/interpreter/[gas_meter, gas_costs, utils/utils_numeric, vm_forks],
math, nimcrypto, bncurve/[fields, groups], blake2b_f, ./blscurve errors, stint, eth/[keys, common], chronicles, tables, macros,
math, nimcrypto, bncurve/[fields, groups], vm/blake2b_f, vm/blscurve
type type
PrecompileAddresses* = enum PrecompileAddresses* = enum

View File

@ -7,7 +7,7 @@
import import
chronicles, strformat, strutils, sequtils, macros, eth/common, nimcrypto, chronicles, strformat, strutils, sequtils, macros, eth/common, nimcrypto,
../errors, ../validation errors, validation
logScope: logScope:
topics = "vm stack" topics = "vm stack"

View File

@ -1,9 +1,9 @@
import import
json, strutils, sets, hashes, json, strutils, sets, hashes,
chronicles, nimcrypto, eth/common, stint, chronicles, nimcrypto, eth/common, stint,
../vm_types, memory, stack, ../db/accounts_cache, vm_types, memory, vm/stack, db/accounts_cache,
eth/trie/hexary, eth/trie/hexary,
./interpreter/opcode_values vm/interpreter/opcode_values
logScope: logScope:
topics = "vm opcode" topics = "vm opcode"

View File

@ -8,9 +8,9 @@
import import
tables, eth/common, tables, eth/common,
options, json, sets, options, json, sets,
./vm/[memory, stack, code_stream], vm/[memory, stack, code_stream],
./vm/interpreter/[gas_costs, opcode_values, vm_forks], # TODO - will be hidden at a lower layer vm/interpreter/[gas_costs, opcode_values, vm_forks], # TODO - will be hidden at a lower layer
./db/[db_chain, accounts_cache] db/[db_chain, accounts_cache]
when defined(evmc_enabled): when defined(evmc_enabled):
import ./vm/evmc_api import ./vm/evmc_api