From 481c6cf4edd9bc71da8284e5b3489e7d46d3c5b5 Mon Sep 17 00:00:00 2001 From: Yuriy Glukhov Date: Tue, 5 Feb 2019 20:15:50 +0100 Subject: [PATCH] Use nim-eth (#224) --- Makefile | 8 +------- nimbus.nimble | 14 ++++---------- nimbus/block_types.nim | 2 +- nimbus/config.nim | 2 +- nimbus/constants.nim | 2 +- nimbus/db/capturedb.nim | 2 +- nimbus/db/db_chain.nim | 2 +- nimbus/db/select_backend.nim | 6 +++--- nimbus/db/state_db.nim | 2 +- nimbus/db/storage_types.nim | 2 +- nimbus/genesis.nim | 4 ++-- nimbus/nimbus.nim | 11 ++++++----- nimbus/p2p/chain.nim | 4 ++-- nimbus/p2p/executor.nim | 8 ++++---- nimbus/rpc/common.nim | 2 +- nimbus/rpc/debug.nim | 2 +- nimbus/rpc/hexstrings.nim | 2 +- nimbus/rpc/p2p.nim | 2 +- nimbus/rpc/rpc_types.nim | 4 ++-- nimbus/rpc/rpc_utils.nim | 2 +- nimbus/rpc/whisper.nim | 2 +- nimbus/tracer.nim | 4 ++-- nimbus/transaction.nim | 2 +- nimbus/utils.nim | 2 +- nimbus/utils/addresses.nim | 2 +- nimbus/utils/header.nim | 4 ++-- nimbus/utils/keccak.nim | 2 +- nimbus/validation.nim | 2 +- nimbus/vm/code_stream.nim | 2 +- nimbus/vm/computation.nim | 4 ++-- nimbus/vm/interpreter/gas_costs.nim | 2 +- nimbus/vm/interpreter/gas_meter.nim | 2 +- nimbus/vm/interpreter/opcodes_impl.nim | 2 +- .../vm/interpreter/utils/macros_procs_opcodes.nim | 2 +- nimbus/vm/interpreter/utils/utils_numeric.nim | 2 +- nimbus/vm/memory.nim | 2 +- nimbus/vm/message.nim | 2 +- nimbus/vm/precompiles.nim | 2 +- nimbus/vm/stack.nim | 2 +- nimbus/vm/transaction_tracer.nim | 4 ++-- nimbus/vm_state.nim | 2 +- nimbus/vm_state_transactions.nim | 2 +- nimbus/vm_types.nim | 2 +- premix/debug.nim | 2 +- premix/downloader.nim | 2 +- premix/dumper.nim | 4 ++-- premix/hunter.nim | 4 ++-- premix/parser.nim | 4 ++-- premix/persist.nim | 6 +++--- premix/premix.nim | 2 +- premix/premixcore.nim | 2 +- premix/prestate.nim | 4 ++-- tests/macro_assembler.nim | 4 ++-- tests/persistBlockTestGen.nim | 4 ++-- tests/rpcclient/ethcallsigs.nim | 4 ++-- tests/test_gas_meter.nim | 2 +- tests/test_generalstate_json.nim | 3 +-- tests/test_genesis.nim | 2 +- tests/test_helpers.nim | 2 +- tests/test_memory.nim | 2 +- tests/test_op_custom.nim | 2 +- tests/test_op_env.nim | 2 +- tests/test_op_misc.nim | 2 +- tests/test_opcode.nim | 4 ++-- tests/test_persistblock_json.nim | 2 +- tests/test_precompiles.nim | 2 +- tests/test_rpc.nim | 4 ++-- tests/test_stack.nim | 2 +- tests/test_tracer_json.nim | 2 +- tests/test_vm_json.nim | 2 +- tests/tracerTestGen.nim | 4 ++-- 71 files changed, 103 insertions(+), 115 deletions(-) diff --git a/Makefile b/Makefile index b17cd19e6..76bfae7e6 100644 --- a/Makefile +++ b/Makefile @@ -38,12 +38,10 @@ GITHUB_REPOS := \ status-im/nim-chronicles \ cheatfate/nimcrypto \ status-im/nim-ranges \ - status-im/nim-rlp \ status-im/nim-stint \ status-im/nim-rocksdb \ - status-im/nim-eth-trie \ + status-im/nim-eth \ status-im/nim-byteutils \ - status-im/nim-eth-common \ status-im/nim-http-utils \ status-im/nim-asyncdispatch2 \ status-im/nim-json-rpc \ @@ -54,10 +52,6 @@ GITHUB_REPOS := \ zah/nim-package-visible-types \ status-im/nim-secp256k1 \ jangko/snappy \ - status-im/nim-eth-keys \ - status-im/nim-eth-p2p \ - status-im/nim-eth-keyfile \ - status-im/nim-eth-bloom \ status-im/nim-bncurve \ status-im/nim-confutils \ status-im/nim-beacon-chain diff --git a/nimbus.nimble b/nimbus.nimble index be50a9d2f..a936c8f12 100644 --- a/nimbus.nimble +++ b/nimbus.nimble @@ -9,21 +9,15 @@ skipDirs = @["tests", "examples"] # we can't have the result of a custom task in the "bin" var - https://github.com/nim-lang/nimble/issues/542 # bin = @["build/nimbus"] -requires "nim >= 0.18.1", +requires "nim >= 0.19", "chronicles", "nimcrypto", - "rlp", "stint", - "rocksdb", - "eth_trie", - "eth_common", "json_rpc", "asyncdispatch2", - "eth_p2p", - "eth_keyfile", - "eth_keys", - "eth_bloom", - "bncurve" + "bncurve", + "https://github.com/status-im/nim-eth", + "std_shims" proc buildBinary(name: string, srcDir = ".", lang = "c") = if not dirExists "build": mkDir "build" diff --git a/nimbus/block_types.nim b/nimbus/block_types.nim index f7d298b00..aff748449 100644 --- a/nimbus/block_types.nim +++ b/nimbus/block_types.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - eth_common, + eth/common, ./constants type diff --git a/nimbus/config.nim b/nimbus/config.nim index ed256ef36..35f4fb224 100644 --- a/nimbus/config.nim +++ b/nimbus/config.nim @@ -9,7 +9,7 @@ import parseopt, strutils, macros, os, times, - asyncdispatch2, eth_keys, eth_p2p, eth_common, chronicles, nimcrypto/hash, + asyncdispatch2, eth/[keys, common, p2p], chronicles, nimcrypto/hash, ./db/select_backend, ./vm/interpreter/vm_forks diff --git a/nimbus/constants.nim b/nimbus/constants.nim index 675e5de0c..f97175fc6 100644 --- a/nimbus/constants.nim +++ b/nimbus/constants.nim @@ -1,5 +1,5 @@ import - math, strutils, eth_common, nimcrypto/hash + math, strutils, eth/common, nimcrypto/hash proc default(t: typedesc): t = discard diff --git a/nimbus/db/capturedb.nim b/nimbus/db/capturedb.nim index 6801717c0..37d22165d 100644 --- a/nimbus/db/capturedb.nim +++ b/nimbus/db/capturedb.nim @@ -1,4 +1,4 @@ -import eth_trie/db, ranges +import eth/trie/db, ranges type CaptureFlags* {.pure.} = enum diff --git a/nimbus/db/db_chain.nim b/nimbus/db/db_chain.nim index 1aef5cd5e..e2097c04a 100644 --- a/nimbus/db/db_chain.nim +++ b/nimbus/db/db_chain.nim @@ -7,7 +7,7 @@ import tables, sequtils, algorithm, - rlp, ranges, state_db, nimcrypto, eth_trie/[hexary, db], eth_common, byteutils, chronicles, + ranges, state_db, nimcrypto, eth/trie/[hexary, db], eth/[common, rlp], byteutils, chronicles, ../errors, ../block_types, ../utils/header, ../constants, ./storage_types type diff --git a/nimbus/db/select_backend.nim b/nimbus/db/select_backend.nim index 8574ef2a4..f873c718e 100644 --- a/nimbus/db/select_backend.nim +++ b/nimbus/db/select_backend.nim @@ -10,10 +10,10 @@ const dbBackend = parseEnum[DbBackend](nimbus_db_backend) when dbBackend == sqlite: - import eth_trie/backends/sqlite_backend as database_backend + import eth/trie/backends/sqlite_backend as database_backend elif dbBackend == rocksdb: - import eth_trie/backends/rocksdb_backend as database_backend + import eth/trie/backends/rocksdb_backend as database_backend elif dbBackend == lmdb: - import eth_trie/backends/lmdb_backend as database_backend + import eth/trie/backends/lmdb_backend as database_backend export database_backend diff --git a/nimbus/db/state_db.nim b/nimbus/db/state_db.nim index 2f7af710f..a1c446327 100644 --- a/nimbus/db/state_db.nim +++ b/nimbus/db/state_db.nim @@ -7,7 +7,7 @@ import sequtils, strformat, tables, - chronicles, eth_common, nimcrypto, rlp, eth_trie/[hexary, db], + chronicles, eth/[common, rlp], nimcrypto, eth/trie/[hexary, db], ../constants, ../errors, ../validation, storage_types diff --git a/nimbus/db/storage_types.nim b/nimbus/db/storage_types.nim index 1ab046159..b7a8bb171 100644 --- a/nimbus/db/storage_types.nim +++ b/nimbus/db/storage_types.nim @@ -1,5 +1,5 @@ import - hashes, eth_common + hashes, eth/common type DBKeyKind* = enum diff --git a/nimbus/genesis.nim b/nimbus/genesis.nim index 3988d4698..623a82328 100644 --- a/nimbus/genesis.nim +++ b/nimbus/genesis.nim @@ -1,7 +1,7 @@ import times, tables, - eth_common, stint, byteutils, rlp, ranges, block_types, nimcrypto, - chronicles, eth_trie, eth_trie/db, + eth/[common, rlp, trie], stint, byteutils, ranges, block_types, nimcrypto, + chronicles, eth/trie/db, db/[db_chain, state_db], genesis_alloc, config, constants type diff --git a/nimbus/nimbus.nim b/nimbus/nimbus.nim index 5f7902daa..c71ed1e89 100644 --- a/nimbus/nimbus.nim +++ b/nimbus/nimbus.nim @@ -8,12 +8,13 @@ # those terms. import - os, strutils, net, eth_common, db/[storage_types, db_chain, select_backend], - asyncdispatch2, json_rpc/rpcserver, eth_keys, chronicles, - eth_p2p, eth_p2p/rlpx_protocols/[eth_protocol, les_protocol], - eth_p2p/blockchain_sync, + os, strutils, net, eth/keys, db/[storage_types, db_chain, select_backend], + eth/common as eth_common, eth/p2p as eth_p2p, + asyncdispatch2, json_rpc/rpcserver, chronicles, + eth/p2p/rlpx_protocols/[eth_protocol, les_protocol], + eth/p2p/blockchain_sync, config, genesis, rpc/[common, p2p, debug, whisper], p2p/chain, - eth_trie/db + eth/trie/db ## TODO: ## * No IPv6 support diff --git a/nimbus/p2p/chain.nim b/nimbus/p2p/chain.nim index 9ff32f655..7742e57fd 100644 --- a/nimbus/p2p/chain.nim +++ b/nimbus/p2p/chain.nim @@ -1,6 +1,6 @@ -import ../db/[db_chain, state_db], eth_common, chronicles, ../vm_state, ../vm_types, ../transaction, ranges, +import ../db/[db_chain, state_db], eth/common, chronicles, ../vm_state, ../vm_types, ../transaction, ranges, ../vm/[computation, interpreter_dispatch, message], ../constants, stint, nimcrypto, - ../vm_state_transactions, sugar, ../utils, eth_trie/db, ../tracer, ./executor + ../vm_state_transactions, sugar, ../utils, eth/trie/db, ../tracer, ./executor type Chain* = ref object of AbstractChainDB diff --git a/nimbus/p2p/executor.nim b/nimbus/p2p/executor.nim index a4f668566..d2bea1102 100644 --- a/nimbus/p2p/executor.nim +++ b/nimbus/p2p/executor.nim @@ -1,5 +1,5 @@ import options, - eth_common, ranges, chronicles, eth_bloom, nimcrypto, + eth/[common, bloom], ranges, chronicles, nimcrypto, ../db/[db_chain, state_db], ../utils, ../constants, ../transaction, ../vm_state, ../vm_types, ../vm_state_transactions, @@ -111,9 +111,9 @@ proc processTransaction*(t: Transaction, sender: EthAddress, vmState: BaseVMStat type # TODO: these types need to be removed - # once eth_bloom and eth_common sync'ed - Bloom = eth_common.BloomFilter - LogsBloom = eth_bloom.BloomFilter + # once eth/bloom and eth/common sync'ed + Bloom = common.BloomFilter + LogsBloom = bloom.BloomFilter # TODO: move these three receipt procs below somewhere else more appropriate func logsBloom(logs: openArray[Log]): LogsBloom = diff --git a/nimbus/rpc/common.nim b/nimbus/rpc/common.nim index ab5819e3e..e85272b9f 100644 --- a/nimbus/rpc/common.nim +++ b/nimbus/rpc/common.nim @@ -9,7 +9,7 @@ import strutils, - nimcrypto, eth_common, stint, json_rpc/server, + nimcrypto, eth/common as eth_common, stint, json_rpc/server, ../vm_state, ../db/[db_chain, state_db], ../constants, ../config, hexstrings proc setupCommonRPC*(server: RpcServer) = diff --git a/nimbus/rpc/debug.nim b/nimbus/rpc/debug.nim index 13d443e7b..ef2fd7769 100644 --- a/nimbus/rpc/debug.nim +++ b/nimbus/rpc/debug.nim @@ -9,7 +9,7 @@ import strutils, json, options, - json_rpc/rpcserver, rpc_utils, eth_common, + json_rpc/rpcserver, rpc_utils, eth/common, hexstrings, ../tracer, ../vm_state, ../vm_types, ../db/[db_chain, storage_types] diff --git a/nimbus/rpc/hexstrings.nim b/nimbus/rpc/hexstrings.nim index 58a21f251..781a00750 100644 --- a/nimbus/rpc/hexstrings.nim +++ b/nimbus/rpc/hexstrings.nim @@ -22,7 +22,7 @@ * ref BloomFilter ]# -import eth_common/eth_types, stint, byteutils, nimcrypto +import eth/common/eth_types, stint, byteutils, nimcrypto type HexQuantityStr* = distinct string diff --git a/nimbus/rpc/p2p.nim b/nimbus/rpc/p2p.nim index 8dfac45c5..b2a5842c7 100644 --- a/nimbus/rpc/p2p.nim +++ b/nimbus/rpc/p2p.nim @@ -10,7 +10,7 @@ import strutils, times, options, nimcrypto, json_rpc/rpcserver, hexstrings, stint, byteutils, ranges/typedranges, - eth_common, eth_p2p, eth_keys, eth_trie/db, rlp, + eth/[common, keys, rlp, p2p], eth/trie/db, ../utils/header, ../transaction, ../config, ../vm_state, ../constants, ../vm_types, ../vm_state_transactions, ../utils/addresses, ../db/[db_chain, state_db, storage_types], diff --git a/nimbus/rpc/rpc_types.nim b/nimbus/rpc/rpc_types.nim index f298a0ca4..83301be8d 100644 --- a/nimbus/rpc/rpc_types.nim +++ b/nimbus/rpc/rpc_types.nim @@ -1,4 +1,4 @@ -import eth_common, hexstrings, options +import eth/common, hexstrings, options #[ Notes: @@ -38,7 +38,7 @@ type data*: Option[EthHashStr] # (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI. ## A block object, or null when no block was found - ## Note that this includes slightly different information from eth_common.BlockHeader + ## Note that this includes slightly different information from eth/common.BlockHeader BlockObject* = object # Returned to user number*: Option[BlockNumber] # the block number. null when its pending block. diff --git a/nimbus/rpc/rpc_utils.nim b/nimbus/rpc/rpc_utils.nim index 046e25c77..fa56bc29b 100644 --- a/nimbus/rpc/rpc_utils.nim +++ b/nimbus/rpc/rpc_utils.nim @@ -7,7 +7,7 @@ # This file may not be copied, modified, or distributed except according to # those terms. -import hexstrings, nimcrypto, eth_common, byteutils, +import hexstrings, nimcrypto, eth/common, byteutils, ../db/[db_chain, state_db, storage_types], strutils, ../constants, stint diff --git a/nimbus/rpc/whisper.nim b/nimbus/rpc/whisper.nim index fd2a3d709..b398d5983 100644 --- a/nimbus/rpc/whisper.nim +++ b/nimbus/rpc/whisper.nim @@ -1,4 +1,4 @@ -import json_rpc/rpcserver, rpc_types, stint, hexstrings, eth_common +import json_rpc/rpcserver, rpc_types, stint, hexstrings, eth/common proc setupWhisperRPC*(rpcsrv: RpcServer) = rpcsrv.rpc("shh_version") do() -> string: diff --git a/nimbus/tracer.nim b/nimbus/tracer.nim index a3f50c832..82515480a 100644 --- a/nimbus/tracer.nim +++ b/nimbus/tracer.nim @@ -1,7 +1,7 @@ import - db/[db_chain, state_db, capturedb], eth_common, utils, json, + db/[db_chain, state_db, capturedb], eth/common, utils, json, constants, vm_state, vm_types, transaction, p2p/executor, - eth_trie/db, nimcrypto, strutils, ranges, ./utils/addresses, + eth/trie/db, nimcrypto, strutils, ranges, ./utils/addresses, chronicles, rpc/hexstrings, launcher proc getParentHeader(self: BaseChainDB, header: BlockHeader): BlockHeader = diff --git a/nimbus/transaction.nim b/nimbus/transaction.nim index 423663d38..bc349ea30 100644 --- a/nimbus/transaction.nim +++ b/nimbus/transaction.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - constants, errors, eth_common, eth_keys, nimcrypto, rlp + constants, errors, eth/[common, rlp, keys], nimcrypto proc initTransaction*(nonce: AccountNonce, gasPrice, gasLimit: GasInt, to: EthAddress, value: UInt256, payload: Blob, V: byte, R, S: UInt256, isContractCreation = false): Transaction = diff --git a/nimbus/utils.nim b/nimbus/utils.nim index 5fa9d191e..8421f3335 100644 --- a/nimbus/utils.nim +++ b/nimbus/utils.nim @@ -1,4 +1,4 @@ -import eth_trie/db, eth_trie, rlp, eth_common +import eth/trie/db, eth/[trie, rlp, common] proc calcRootHash[T](items: openArray[T]): Hash256 = var tr = initHexaryTrie(newMemoryDB()) diff --git a/nimbus/utils/addresses.nim b/nimbus/utils/addresses.nim index 519a28548..6bbb72433 100644 --- a/nimbus/utils/addresses.nim +++ b/nimbus/utils/addresses.nim @@ -1,4 +1,4 @@ -import nimcrypto, eth_common, rlp +import nimcrypto, eth/[common, rlp] func generateAddress*(address: EthAddress, nonce: AccountNonce): EthAddress = result[0..19] = keccak256.digest(rlp.encodeList(address, nonce)).data.toOpenArray(12, 31) diff --git a/nimbus/utils/header.nim b/nimbus/utils/header.nim index e1265c86a..ce4f5315f 100644 --- a/nimbus/utils/header.nim +++ b/nimbus/utils/header.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. -import eth_common, ../constants, strformat, times, ../validation, rlp +import eth/[common, rlp], ../constants, strformat, times, ../validation export BlockHeader @@ -94,6 +94,6 @@ proc generateHeaderFromParentHeader*( import nimcrypto # TODO: required otherwise -# eth_common/rlp_serialization.nim(18, 12) template/generic instantiation from here +# eth/common/rlp_serialization.nim(18, 12) template/generic instantiation from here # nimcrypto/hash.nim(46, 6) Error: attempting to call undeclared routine: 'init' proc hash*(b: BlockHeader): Hash256 {.inline.} = rlpHash(b) diff --git a/nimbus/utils/keccak.nim b/nimbus/utils/keccak.nim index dff9dd22e..ae96c0658 100644 --- a/nimbus/utils/keccak.nim +++ b/nimbus/utils/keccak.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - nimcrypto, strutils, eth_common + nimcrypto, strutils, eth/common proc keccak*(value: openarray[byte]): Hash256 {.inline.} = keccak256.digest value diff --git a/nimbus/validation.nim b/nimbus/validation.nim index 50c49e0d1..31585770e 100644 --- a/nimbus/validation.nim +++ b/nimbus/validation.nim @@ -7,7 +7,7 @@ import strformat, - errors, constants, eth_common + errors, constants, eth/common proc validateGte*(value: Int256 | int, minimum: int, title: string = "Value") = if value.i256 < minimum.i256: diff --git a/nimbus/vm/code_stream.nim b/nimbus/vm/code_stream.nim index eebbf9d72..53921f655 100644 --- a/nimbus/vm/code_stream.nim +++ b/nimbus/vm/code_stream.nim @@ -7,7 +7,7 @@ import chronicles, strformat, strutils, sequtils, parseutils, sets, macros, - eth_common, + eth/common, ../constants, ./interpreter/opcode_values logScope: diff --git a/nimbus/vm/computation.nim b/nimbus/vm/computation.nim index ea7cfdfe3..cbb0f04bc 100644 --- a/nimbus/vm/computation.nim +++ b/nimbus/vm/computation.nim @@ -7,11 +7,11 @@ import chronicles, strformat, strutils, sequtils, macros, terminal, math, tables, options, - eth_common, + eth/[common, keys], ../constants, ../errors, ../validation, ../vm_state, ../vm_types, ./interpreter/[opcode_values, gas_meter, gas_costs, vm_forks], ./code_stream, ./memory, ./message, ./stack, ../db/[state_db, db_chain], - ../utils/header, byteutils, ranges, eth_keys, precompiles, + ../utils/header, byteutils, ranges, precompiles, transaction_tracer logScope: diff --git a/nimbus/vm/interpreter/gas_costs.nim b/nimbus/vm/interpreter/gas_costs.nim index 6182904a9..8e0a688cc 100644 --- a/nimbus/vm/interpreter/gas_costs.nim +++ b/nimbus/vm/interpreter/gas_costs.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - math, eth_common/eth_types, + math, eth/common/eth_types, ./utils/[macros_gen_opcodes, utils_numeric], ./opcode_values, ./vm_forks diff --git a/nimbus/vm/interpreter/gas_meter.nim b/nimbus/vm/interpreter/gas_meter.nim index 0e2f49de6..e97a40cd4 100644 --- a/nimbus/vm/interpreter/gas_meter.nim +++ b/nimbus/vm/interpreter/gas_meter.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - chronicles, strformat, eth_common, # GasInt + chronicles, strformat, eth/common, # GasInt ../../errors, ../../vm_types logScope: diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 257d524e4..67751d224 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -7,7 +7,7 @@ import strformat, times, ranges, sequtils, - chronicles, stint, nimcrypto, ranges/typedranges, eth_common, + chronicles, stint, nimcrypto, ranges/typedranges, eth/common, ./utils/[macros_procs_opcodes, utils_numeric], ./gas_meter, ./gas_costs, ./opcode_values, ./vm_forks, ../memory, ../message, ../stack, ../code_stream, ../computation, diff --git a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim index d247d1e16..a76e60c49 100644 --- a/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim +++ b/nimbus/vm/interpreter/utils/macros_procs_opcodes.nim @@ -9,7 +9,7 @@ # Macros to facilitate opcode procs creation import - macros, strformat, stint, eth_common, + macros, strformat, stint, eth/common, ../../computation, ../../stack, ../../code_stream, ../../../constants, ../../../vm_types, ../../memory, ../../../errors, ../../message, ../../interpreter/[gas_meter, opcode_values], diff --git a/nimbus/vm/interpreter/utils/utils_numeric.nim b/nimbus/vm/interpreter/utils/utils_numeric.nim index 9b93223bf..2b2725f34 100644 --- a/nimbus/vm/interpreter/utils/utils_numeric.nim +++ b/nimbus/vm/interpreter/utils/utils_numeric.nim @@ -7,7 +7,7 @@ import strformat, strutils, sequtils, endians, macros, - eth_common/eth_types, rlp, + eth/common/eth_types, eth/rlp, ../../../constants # some methods based on py-evm utils/numeric diff --git a/nimbus/vm/memory.nim b/nimbus/vm/memory.nim index d40d18a1a..5f1f9f6d8 100644 --- a/nimbus/vm/memory.nim +++ b/nimbus/vm/memory.nim @@ -7,7 +7,7 @@ import sequtils, - chronicles, eth_common/eth_types, + chronicles, eth/common/eth_types, ../constants, ../errors, ../validation, ./interpreter/utils/utils_numeric diff --git a/nimbus/vm/message.nim b/nimbus/vm/message.nim index 9d2733029..295e65c80 100644 --- a/nimbus/vm/message.nim +++ b/nimbus/vm/message.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - eth_common, + eth/common, ../constants, ../validation, ../vm_types, chronicles logScope: diff --git a/nimbus/vm/precompiles.nim b/nimbus/vm/precompiles.nim index 90a2a1109..37953fcbe 100644 --- a/nimbus/vm/precompiles.nim +++ b/nimbus/vm/precompiles.nim @@ -1,6 +1,6 @@ import ../vm_types, interpreter/[gas_meter, gas_costs, utils/utils_numeric], - ../errors, stint, eth_keys, eth_common, chronicles, tables, macros, + ../errors, stint, eth/[keys, common], chronicles, tables, macros, message, math, nimcrypto, bncurve/[fields, groups] type diff --git a/nimbus/vm/stack.nim b/nimbus/vm/stack.nim index 9ea76a1ab..cd99be543 100644 --- a/nimbus/vm/stack.nim +++ b/nimbus/vm/stack.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - chronicles, strformat, strutils, sequtils, macros, rlp, eth_common, nimcrypto, + chronicles, strformat, strutils, sequtils, macros, eth/[rlp, common], nimcrypto, ../errors, ../validation, ./interpreter/utils/utils_numeric, ../constants logScope: diff --git a/nimbus/vm/transaction_tracer.nim b/nimbus/vm/transaction_tracer.nim index 201041528..b843bcc14 100644 --- a/nimbus/vm/transaction_tracer.nim +++ b/nimbus/vm/transaction_tracer.nim @@ -1,8 +1,8 @@ import json, strutils, sets, - chronicles, nimcrypto, eth_common, stint, + chronicles, nimcrypto, eth/common, stint, ../vm_types, memory, stack, ../db/[db_chain, state_db], - eth_trie/hexary, ./message, ranges/typedranges, + eth/trie/hexary, ./message, ranges/typedranges, ./interpreter/opcode_values logScope: diff --git a/nimbus/vm_state.nim b/nimbus/vm_state.nim index c031bf3fe..822abb1dc 100644 --- a/nimbus/vm_state.nim +++ b/nimbus/vm_state.nim @@ -7,7 +7,7 @@ import macros, strformat, tables, sets, - eth_common, eth_trie/db, + eth/common, eth/trie/db, ./constants, ./errors, ./transaction, ./db/[db_chain, state_db], ./utils/header, json, vm_types, vm/transaction_tracer diff --git a/nimbus/vm_state_transactions.nim b/nimbus/vm_state_transactions.nim index 7a35d41de..4ec4a0c5c 100644 --- a/nimbus/vm_state_transactions.nim +++ b/nimbus/vm_state_transactions.nim @@ -7,7 +7,7 @@ import ranges/typedranges, sequtils, strformat, tables, options, - eth_common, chronicles, + eth/common, chronicles, ./constants, ./errors, ./vm/computation, ./transaction, ./vm_types, ./vm_state, ./block_types, ./db/[db_chain, state_db], ./utils/header, ./vm/interpreter, ./vm/interpreter/gas_costs, ./utils/addresses diff --git a/nimbus/vm_types.nim b/nimbus/vm_types.nim index 145910139..06516e651 100644 --- a/nimbus/vm_types.nim +++ b/nimbus/vm_types.nim @@ -6,7 +6,7 @@ # at your option. This file may not be copied, modified, or distributed except according to those terms. import - tables, eth_common, options, + tables, eth/common, options, ./constants, json, sets, ./vm/[memory, stack, code_stream], ./vm/interpreter/[gas_costs, opcode_values, vm_forks], # TODO - will be hidden at a lower layer diff --git a/premix/debug.nim b/premix/debug.nim index 3e5b6f49d..1540f9bec 100644 --- a/premix/debug.nim +++ b/premix/debug.nim @@ -1,5 +1,5 @@ import - json, os, stint, eth_trie/db, byteutils, eth_common, + json, os, stint, eth/trie/db, byteutils, eth/common, ../nimbus/db/[db_chain], chronicles, ../nimbus/vm_state, ../nimbus/p2p/executor, premixcore, prestate, ../nimbus/tracer diff --git a/premix/downloader.nim b/premix/downloader.nim index c28e2fcaf..ffebace6f 100644 --- a/premix/downloader.nim +++ b/premix/downloader.nim @@ -1,6 +1,6 @@ import json_rpc/[rpcclient], json, parser, httputils, strutils, - eth_common, chronicles, ../nimbus/[utils], rlp, nimcrypto + eth/[common, rlp], chronicles, ../nimbus/[utils], nimcrypto logScope: topics = "downloader" diff --git a/premix/dumper.nim b/premix/dumper.nim index 9f20b693c..aa8b58081 100644 --- a/premix/dumper.nim +++ b/premix/dumper.nim @@ -4,9 +4,9 @@ # import - configuration, stint, eth_common, + configuration, stint, eth/common, ../nimbus/db/[storage_types, db_chain, select_backend, capturedb], - eth_trie/[hexary, db, defs], ../nimbus/p2p/executor, + eth/trie/[hexary, db, trie_defs], ../nimbus/p2p/executor, ../nimbus/[tracer, vm_state] proc dumpDebug(chainDB: BaseChainDB, blockNumber: Uint256) = diff --git a/premix/hunter.nim b/premix/hunter.nim index eb0fd13cc..ec42e8762 100644 --- a/premix/hunter.nim +++ b/premix/hunter.nim @@ -1,8 +1,8 @@ import json, downloader, stint, strutils, byteutils, parser, nimcrypto, - chronicles, ../nimbus/tracer, eth_trie/[defs, db], ../nimbus/vm_state, + chronicles, ../nimbus/tracer, eth/trie/[trie_defs, db], ../nimbus/vm_state, ../nimbus/db/[db_chain, state_db], ../nimbus/p2p/executor, premixcore, - eth_common, configuration + eth/common, configuration const emptyCodeHash = blankStringHash diff --git a/premix/parser.nim b/premix/parser.nim index 60b074e49..94e8f668b 100644 --- a/premix/parser.nim +++ b/premix/parser.nim @@ -1,7 +1,7 @@ import json, strutils, times, options, os, - rlp, httputils, nimcrypto, chronicles, - stint, eth_common, byteutils + eth/[rlp, common], httputils, nimcrypto, chronicles, + stint, byteutils import ../nimbus/[transaction, rpc/hexstrings] diff --git a/premix/persist.nim b/premix/persist.nim index af91295d6..e74b18e7c 100644 --- a/premix/persist.nim +++ b/premix/persist.nim @@ -1,12 +1,12 @@ # use this module to quickly populate db with data from geth/parity import - eth_common, stint, byteutils, nimcrypto, - chronicles, rlp, downloader, configuration, + eth/[common, rlp], stint, byteutils, nimcrypto, + chronicles, downloader, configuration, ../nimbus/errors import - eth_trie/[hexary, db, defs], + eth/trie/[hexary, db, trie_defs], ../nimbus/db/[storage_types, db_chain, select_backend], ../nimbus/[genesis, utils], ../nimbus/p2p/chain diff --git a/premix/premix.nim b/premix/premix.nim index 9a0d51547..455230479 100644 --- a/premix/premix.nim +++ b/premix/premix.nim @@ -1,7 +1,7 @@ import json, downloader, stint, strutils, os, ../nimbus/tracer, chronicles, prestate, - js_tracer, eth_common, byteutils, parser, + js_tracer, eth/common, byteutils, parser, nimcrypto, premixcore proc generateGethData(thisBlock: Block, blockNumber: Uint256, accounts: JsonNode): JsonNode = diff --git a/premix/premixcore.nim b/premix/premixcore.nim index a1a5518b5..f018c2499 100644 --- a/premix/premixcore.nim +++ b/premix/premixcore.nim @@ -1,6 +1,6 @@ import json, strutils, os, - stint, chronicles, eth_common, + stint, chronicles, eth/common, ../nimbus/tracer, ../nimbus/launcher, ./js_tracer, ./parser, ./downloader diff --git a/premix/prestate.nim b/premix/prestate.nim index a0d738e21..30c446c3e 100644 --- a/premix/prestate.nim +++ b/premix/prestate.nim @@ -1,6 +1,6 @@ import - json, downloader, stint, eth_trie/db, byteutils, - ../nimbus/db/[db_chain, storage_types], rlp, eth_common, + json, downloader, stint, eth/trie/db, byteutils, + ../nimbus/db/[db_chain, storage_types], eth/[rlp, common], ../nimbus/p2p/chain, ../nimbus/tracer proc generatePrestate*(nimbus, geth: JsonNode, blockNumber: Uint256, parent, header: BlockHeader, body: BlockBody) = diff --git a/tests/macro_assembler.nim b/tests/macro_assembler.nim index 9ba5575c8..222497dac 100644 --- a/tests/macro_assembler.nim +++ b/tests/macro_assembler.nim @@ -1,11 +1,11 @@ import macros, macrocache, strutils, unittest, - byteutils, chronicles, ranges, eth_common, + byteutils, chronicles, ranges, eth/common, ../nimbus/vm/interpreter/opcode_values, std_shims/macros_shim import - options, json, os, eth_trie/[db, hexary], + options, json, os, eth/trie/[db, hexary], ../nimbus/[vm_state, tracer, vm_types, transaction], ../nimbus/db/[db_chain, state_db], ../nimbus/vm_state_transactions, diff --git a/tests/persistBlockTestGen.nim b/tests/persistBlockTestGen.nim index fd2075cf7..0c800397d 100644 --- a/tests/persistBlockTestGen.nim +++ b/tests/persistBlockTestGen.nim @@ -1,6 +1,6 @@ import - json, os, eth_common, stint, chronicles, byteutils, nimcrypto, rlp, - eth_trie/[db], ../nimbus/db/[db_chain, capturedb, storage_types, select_backend], + json, os, eth/common, stint, chronicles, byteutils, nimcrypto, rlp, + eth/trie/db, ../nimbus/db/[db_chain, capturedb, storage_types, select_backend], ../nimbus/[tracer, vm_types, config], ../nimbus/p2p/chain diff --git a/tests/rpcclient/ethcallsigs.nim b/tests/rpcclient/ethcallsigs.nim index a5ad0edf0..a34ed9fbb 100644 --- a/tests/rpcclient/ethcallsigs.nim +++ b/tests/rpcclient/ethcallsigs.nim @@ -10,7 +10,7 @@ ## then a procedure body is generated to marshal native Nim parameters to json and visa versa. import json, - stint, eth_common, + stint, eth/common, ../../nimbus/rpc/hexstrings, ../../nimbus/rpc/rpc_types proc web3_clientVersion(): string @@ -39,7 +39,7 @@ proc eth_sign(data:EthAddressStr, message: HexDataStr): HexDataStr proc eth_call(call: EthCall, quantityTag: string): string proc eth_estimateGas(call: EthCall, quantityTag: string): GasInt -# TODO: Use eth_common types +# TODO: Use eth/common types #[proc eth_sendTransaction(obj: EthSend): UInt256 proc eth_getBlockByHash(data: array[32, byte], fullTransactions: bool): BlockObject diff --git a/tests/test_gas_meter.nim b/tests/test_gas_meter.nim index 74f580dbf..f6eabca1e 100644 --- a/tests/test_gas_meter.nim +++ b/tests/test_gas_meter.nim @@ -7,7 +7,7 @@ import unittest, macros, strformat, - eth_common/eth_types, + eth/common/eth_types, ../nimbus/[vm_types, errors, vm/interpreter] # TODO: quicktest diff --git a/tests/test_generalstate_json.nim b/tests/test_generalstate_json.nim index c4df095b0..9eebdc8b9 100644 --- a/tests/test_generalstate_json.nim +++ b/tests/test_generalstate_json.nim @@ -8,8 +8,7 @@ import unittest, strformat, strutils, tables, json, ospaths, times, byteutils, ranges/typedranges, nimcrypto/[keccak, hash], options, - rlp, eth_trie/db, eth_common, - eth_keys, chronicles, + eth/[rlp, common, keys], eth/trie/db, chronicles, ./test_helpers, ../nimbus/[constants, errors], ../nimbus/[vm_state, vm_types, vm_state_transactions], diff --git a/tests/test_genesis.nim b/tests/test_genesis.nim index fedeb1249..460ee8d9a 100644 --- a/tests/test_genesis.nim +++ b/tests/test_genesis.nim @@ -1,4 +1,4 @@ -import unittest, ../nimbus/[genesis, config], eth_common, nimcrypto/hash +import unittest, ../nimbus/[genesis, config], eth/common, nimcrypto/hash suite "Genesis": test "Correct mainnet hash": diff --git a/tests/test_helpers.nim b/tests/test_helpers.nim index 87cb9df66..2cf8bd537 100644 --- a/tests/test_helpers.nim +++ b/tests/test_helpers.nim @@ -7,7 +7,7 @@ import os, macros, json, strformat, strutils, parseutils, ospaths, tables, - byteutils, eth_common, eth_keys, ranges/typedranges, + byteutils, eth/[common, keys], ranges/typedranges, ../nimbus/[vm_state, constants], ../nimbus/db/[db_chain, state_db], ../nimbus/transaction, diff --git a/tests/test_memory.nim b/tests/test_memory.nim index e25637305..5186ef50f 100644 --- a/tests/test_memory.nim +++ b/tests/test_memory.nim @@ -7,7 +7,7 @@ import unittest, sequtils, - eth_common/eth_types, + eth/common/eth_types, ../nimbus/[constants, errors, vm/memory] proc memory32: Memory = diff --git a/tests/test_op_custom.nim b/tests/test_op_custom.nim index 21dd001b9..3f5a8fe16 100644 --- a/tests/test_op_custom.nim +++ b/tests/test_op_custom.nim @@ -1,6 +1,6 @@ import macro_assembler, unittest, macros, strutils, - byteutils, eth_common, ../nimbus/db/state_db, + byteutils, eth/common, ../nimbus/db/state_db, ../nimbus/db/db_chain, ranges suite "Custom Opcodes Test": diff --git a/tests/test_op_env.nim b/tests/test_op_env.nim index 7e4284de5..6a1cd3571 100644 --- a/tests/test_op_env.nim +++ b/tests/test_op_env.nim @@ -1,6 +1,6 @@ import macro_assembler, unittest, macros, strutils, - byteutils, eth_common, ../nimbus/db/state_db, + byteutils, eth/common, ../nimbus/db/state_db, ../nimbus/db/db_chain, ranges suite "Environmental Information Opcodes": diff --git a/tests/test_op_misc.nim b/tests/test_op_misc.nim index 0131205b9..0b9136eb0 100644 --- a/tests/test_op_misc.nim +++ b/tests/test_op_misc.nim @@ -1,6 +1,6 @@ import macro_assembler, unittest, macros, strutils, - byteutils, eth_common, ../nimbus/db/state_db, + byteutils, eth/common, ../nimbus/db/state_db, ../nimbus/db/db_chain, ranges suite "Misc Opcodes": diff --git a/tests/test_opcode.nim b/tests/test_opcode.nim index 8963086ce..bd31cf08d 100644 --- a/tests/test_opcode.nim +++ b/tests/test_opcode.nim @@ -7,14 +7,14 @@ import unittest, tables, parseutils, byteutils, - eth_trie/db, eth_common/eth_types, + eth/trie/db, eth/common/eth_types, ../nimbus/[constants, vm_types, vm_state], ../nimbus/vm/interpreter, ../nimbus/utils/header, ../nimbus/db/[db_chain, state_db], ./test_helpers -from eth_common import GasInt +from eth/common import GasInt proc testCode(code: string, initialGas: GasInt, blockNum: UInt256): BaseComputation = let header = BlockHeader(blockNumber: blockNum) diff --git a/tests/test_persistblock_json.nim b/tests/test_persistblock_json.nim index 31938050d..5da2308a9 100644 --- a/tests/test_persistblock_json.nim +++ b/tests/test_persistblock_json.nim @@ -7,7 +7,7 @@ import unittest, json, os, tables, strformat, strutils, - eth_common, byteutils, eth_trie/db, rlp, + eth/[common, rlp], byteutils, eth/trie/db, ./test_helpers, ../nimbus/db/[db_chain, storage_types], ../nimbus/[tracer, vm_types], ../nimbus/p2p/chain diff --git a/tests/test_precompiles.nim b/tests/test_precompiles.nim index 2ed291f09..a41000bd8 100644 --- a/tests/test_precompiles.nim +++ b/tests/test_precompiles.nim @@ -7,7 +7,7 @@ import unittest, ../nimbus/vm/precompiles, json, byteutils, test_helpers, ospaths, tables, - strformat, strutils, eth_trie/db, eth_common, ../nimbus/db/[db_chain, state_db], + strformat, strutils, eth/trie/db, eth/common, ../nimbus/db/[db_chain, state_db], ../nimbus/[constants, vm_types, vm_state], ../nimbus/vm/[computation, message], macros proc initAddress(i: byte): EthAddress = result[19] = i diff --git a/tests/test_rpc.nim b/tests/test_rpc.nim index cb9bcf1e3..f9270ca17 100644 --- a/tests/test_rpc.nim +++ b/tests/test_rpc.nim @@ -7,12 +7,12 @@ import unittest, json, strformat, options, - nimcrypto, rlp, eth_trie/db, eth_p2p, eth_keys, + nimcrypto, eth/[rlp, keys], eth/trie/db, eth/p2p as eth_p2p, json_rpc/[rpcserver, rpcclient], ../nimbus/rpc/[common, p2p, hexstrings, rpc_types], ../nimbus/constants, ../nimbus/[vm_state, config], - ../nimbus/db/[state_db, db_chain, storage_types], eth_common, byteutils, + ../nimbus/db/[state_db, db_chain, storage_types], eth/common as eth_common, byteutils, ../nimbus/p2p/chain, ../nimbus/genesis, ./rpcclient/test_hexstrings diff --git a/tests/test_stack.nim b/tests/test_stack.nim index 008e7d0e7..6a0e463ff 100644 --- a/tests/test_stack.nim +++ b/tests/test_stack.nim @@ -7,7 +7,7 @@ import unittest, - eth_common/eth_types, + eth/common/eth_types, ../nimbus/[constants, errors, vm/interpreter] diff --git a/tests/test_tracer_json.nim b/tests/test_tracer_json.nim index 9d1ab9673..cbb93a92e 100644 --- a/tests/test_tracer_json.nim +++ b/tests/test_tracer_json.nim @@ -7,7 +7,7 @@ import unittest, json, os, tables, strformat, strutils, - eth_common, byteutils, eth_trie/db, + eth/common, byteutils, eth/trie/db, ./test_helpers, ../nimbus/db/db_chain, ../nimbus/[tracer, vm_types] proc testFixture(node: JsonNode, testStatusIMPL: var TestStatus) diff --git a/tests/test_vm_json.nim b/tests/test_vm_json.nim index 32a67df43..ca49b7e99 100644 --- a/tests/test_vm_json.nim +++ b/tests/test_vm_json.nim @@ -8,7 +8,7 @@ import unittest, strformat, strutils, sequtils, tables, json, ospaths, times, byteutils, ranges/typedranges, nimcrypto/[keccak, hash], - rlp, eth_trie/db, eth_common, + eth/[rlp, common], eth/trie/db, ./test_helpers, ../nimbus/[constants, errors], ../nimbus/[vm_state, vm_types], diff --git a/tests/tracerTestGen.nim b/tests/tracerTestGen.nim index 7867a6f38..7bacb79c6 100644 --- a/tests/tracerTestGen.nim +++ b/tests/tracerTestGen.nim @@ -1,6 +1,6 @@ import - json, os, eth_common, stint, chronicles, byteutils, nimcrypto, - eth_trie/[db], ../nimbus/db/[db_chain, capturedb, select_backend], + json, os, eth/common, stint, chronicles, byteutils, nimcrypto, + eth/trie/db, ../nimbus/db/[db_chain, capturedb, select_backend], ../nimbus/[tracer, vm_types, config] proc dumpTest(chainDB: BaseChainDB, blockNumber: int) =