Add build_dcli target and add it to CI (#344)

* Add build_dcli target and add it to CI

* Fix local imports for dcli

* And use local imports for all other files too

* Use local imports in tests and rlpx protocols
This commit is contained in:
Kim De Mey 2021-04-06 13:33:24 +02:00 committed by GitHub
parent e4b4b7f4af
commit 762415319c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
113 changed files with 325 additions and 236 deletions

View File

@ -76,6 +76,7 @@ build_script:
test_script: test_script:
- nimble test - nimble test
- nimble build_dcli
deploy: off deploy: off

View File

@ -270,3 +270,4 @@ jobs:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
nimble install -y --depsOnly nimble install -y --depsOnly
env TEST_LANG="${{ matrix.target.TEST_LANG }}" PLATFORM="$PLATFORM" nimble test env TEST_LANG="${{ matrix.target.TEST_LANG }}" PLATFORM="$PLATFORM" nimble test
env TEST_LANG="${{ matrix.target.TEST_LANG }}" PLATFORM="$PLATFORM" nimble build_dcli

View File

@ -46,3 +46,4 @@ install:
script: script:
- nimble install -y --depsOnly - nimble install -y --depsOnly
- nimble test - nimble test
- nimble build_dcli

View File

@ -24,9 +24,16 @@ proc runTest(path: string, release: bool = true, chronosStrict = true) =
let chronosMode = let chronosMode =
if chronosStrict: "-d:chronosStrictException" else: "" if chronosStrict: "-d:chronosStrictException" else: ""
exec "nim c -r " & releaseMode & " " & chronosMode & exec "nim c -r " & releaseMode & " " & chronosMode &
" -d:chronicles_log_level=ERROR --verbosity:0 --hints:off " & path " -d:chronicles_log_level=error --verbosity:0 --hints:off " & path
rmFile path rmFile path
proc buildBinary(path: string) =
echo "\nBuilding: ", path
exec "nim c -d:release -d:chronosStrictException " &
"-d:chronicles_log_level=trace --verbosity:0 --hints:off --threads:on " &
"--warning[CaseTransition]:off --warning[ObservableStores]:off " &
path
task test_keyfile, "Run keyfile tests": task test_keyfile, "Run keyfile tests":
runTest("tests/keyfile/all_tests") runTest("tests/keyfile/all_tests")
@ -88,3 +95,6 @@ task test_discv5_full, "Run discovery v5 and its dependencies tests":
test_keys_task() test_keys_task()
test_rlp_task() test_rlp_task()
test_discv5_task() test_discv5_task()
task build_dcli, "Build dcli":
buildBinary("eth/p2p/discoveryv5/dcli")

View File

@ -1,2 +1,2 @@
import common / [eth_types, utils] import ./common/[eth_types, utils]
export eth_types, utils export eth_types, utils

View File

@ -1,7 +1,7 @@
import import
strutils, std/[strutils, options, times],
stew/[endians2, byteutils], options, times, chronicles, stew/[endians2, byteutils], chronicles, stint, nimcrypto/[keccak, hash],
stint, nimcrypto/[keccak, hash], eth/rlp, eth/trie/[trie_defs, db] ../rlp, ../trie/[trie_defs, db]
export export
stint, read, append, KeccakHash stint, read, append, KeccakHash

View File

@ -1,6 +1,7 @@
import import
times, net, std/[times, net],
json_serialization, nimcrypto/[hash, utils], eth_types json_serialization, nimcrypto/[hash, utils],
./eth_types
export export
json_serialization json_serialization

View File

@ -1,6 +1,6 @@
import import
eth/trie/[trie_defs, db, hexary], eth/rlp, ../trie/[trie_defs, db, hexary], ../rlp,
eth_types ./eth_types
proc getAccount*(db: TrieDatabaseRef, proc getAccount*(db: TrieDatabaseRef,
rootHash: KeccakHash, rootHash: KeccakHash,

View File

@ -1,5 +1,6 @@
import import
eth/[common, rlp, keys], nimcrypto/keccak nimcrypto/keccak,
".."/[common, rlp, keys]
proc initTransaction*(nonce: AccountNonce, gasPrice, gasLimit: GasInt, to: EthAddress, proc initTransaction*(nonce: AccountNonce, gasPrice, gasLimit: GasInt, to: EthAddress,
value: UInt256, payload: Blob, V: byte, R, S: UInt256, isContractCreation = false): Transaction = value: UInt256, payload: Blob, V: byte, R, S: UInt256, isContractCreation = false): Transaction =

View File

@ -6,9 +6,13 @@
# This file may not be copied, modified, or distributed except according to # This file may not be copied, modified, or distributed except according to
# those terms. # those terms.
import nimcrypto/hash, hashes, stew/byteutils, eth_types, metrics, os import
std/[hashes, os],
nimcrypto/hash, stew/byteutils, metrics,
./eth_types
when defined(posix): when defined(posix):
import posix import std/posix
export metrics export metrics

View File

@ -11,8 +11,8 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import import
stew/results, std/[tables, hashes, sets],
tables, hashes, sets stew/results
export results export results

View File

@ -1,6 +1,9 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import os, rocksdb, ./kvstore, stew/results import
std/os,
rocksdb, stew/results,
./kvstore
export results export results

View File

@ -7,5 +7,5 @@
# Apache License, version 2.0, (LICENSE-APACHEv2) # Apache License, version 2.0, (LICENSE-APACHEv2)
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import keyfile/uuid, keyfile/keyfile import ./keyfile/[uuid, keyfile]
export uuid, keyfile export uuid, keyfile

View File

@ -9,8 +9,12 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import nimcrypto/[bcmode, hmac, rijndael, pbkdf2, sha2, sysrand, utils, keccak, scrypt], import
eth/keys, json, uuid, strutils, stew/results std/[strutils, json],
nimcrypto/[bcmode, hmac, rijndael, pbkdf2, sha2, sysrand, utils, keccak, scrypt],
stew/results,
../keys,
./uuid
export results export results

View File

@ -15,9 +15,9 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import import
secp256k1, bearssl, std/strformat,
nimcrypto/hash, nimcrypto/keccak, secp256k1, bearssl, stew/[byteutils, objects, results],
stew/[byteutils, objects, results], strformat nimcrypto/[hash, keccak]
from nimcrypto/utils import burnMem from nimcrypto/utils import burnMem

View File

@ -10,7 +10,7 @@ import
std/[options, os, strutils, times], std/[options, os, strutils, times],
stew/results, nat_traversal/[miniupnpc, natpmp], stew/results, nat_traversal/[miniupnpc, natpmp],
chronicles, json_serialization/std/net, chronos, chronicles, json_serialization/std/net, chronos,
eth/common/utils, ./utils as netutils ../common/utils, ./utils as netutils
type type
NatStrategy* = enum NatStrategy* = enum

View File

@ -9,11 +9,10 @@
# #
import import
tables, algorithm, random, bearssl, std/[tables, algorithm, random],
chronos, chronos/timer, chronicles, bearssl, chronos, chronos/timer, chronicles,
eth/keys, eth/common/eth_types, ./keys, ./common/eth_types, ./p2p/private/p2p_types,
eth/p2p/[kademlia, discovery, enode, peer_pool, rlpx], ./p2p/[kademlia, discovery, enode, peer_pool, rlpx]
eth/p2p/private/p2p_types
export export
p2p_types, rlpx, enode, kademlia p2p_types, rlpx, enode, kademlia

View File

@ -12,9 +12,11 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import eth/[keys, rlp], nimcrypto/[rijndael, keccak, utils], bearssl import
import ecies nimcrypto/[rijndael, keccak, utils], bearssl,
import stew/[byteutils, endians2, objects, results] stew/[byteutils, endians2, objects, results],
".."/[keys, rlp],
./ecies
export results export results

View File

@ -1,8 +1,8 @@
import import
sets, options, random, hashes, std/[sets, options, random, hashes],
chronos, chronicles, eth/common/eth_types, chronos, chronicles,
private/p2p_types, rlpx, peer_pool, rlpx_protocols/eth_protocol, ../common/eth_types, ../p2p,
../p2p ./private/p2p_types, ./rlpx_protocols/eth_protocol, "."/[rlpx, peer_pool]
const const
minPeersToStartSync* = 2 # Wait for consensus of at least this minPeersToStartSync* = 2 # Wait for consensus of at least this

View File

@ -9,11 +9,11 @@
# #
import import
times, std/times,
chronos, stint, nimcrypto/keccak, chronicles, bearssl, chronos, stint, nimcrypto/keccak, chronicles, bearssl,
eth/[keys, rlp], stew/[objects, results],
kademlia, enode, ".."/[keys, rlp],
stew/[objects, results] "."/[kademlia, enode]
export export
Node, results Node, results

View File

@ -3,7 +3,7 @@ import
confutils, confutils/std/net, chronicles, chronicles/topics_registry, confutils, confutils/std/net, chronicles, chronicles/topics_registry,
chronos, metrics, metrics/chronos_httpserver, stew/byteutils, chronos, metrics, metrics/chronos_httpserver, stew/byteutils,
../../keys, ../../net/nat, ../../keys, ../../net/nat,
./enr, ./node, ./protocol "."/[enr, node, protocol]
type type
DiscoveryCmd* = enum DiscoveryCmd* = enum

View File

@ -6,7 +6,8 @@
import import
std/[tables, options, hashes, net], std/[tables, options, hashes, net],
nimcrypto, stint, chronicles, bearssl, stew/[results, byteutils], nimcrypto, stint, chronicles, bearssl, stew/[results, byteutils],
eth/[rlp, keys], messages, node, enr, hkdf, sessions ".."/../[rlp, keys],
"."/[messages, node, enr, hkdf, sessions]
from stew/objects import checkedEnumAssign from stew/objects import checkedEnumAssign

View File

@ -4,7 +4,7 @@
import import
std/[strutils, macros, algorithm, options], std/[strutils, macros, algorithm, options],
stew/shims/net, stew/base64, nimcrypto, stew/shims/net, stew/base64, nimcrypto,
eth/[rlp, keys] ".."/../[rlp, keys]
export options export options

View File

@ -5,7 +5,7 @@
import import
std/[hashes, net], std/[hashes, net],
stew/arrayops, stew/arrayops,
eth/rlp, enr ../../rlp, ./enr
{.push raises: [Defect].} {.push raises: [Defect].}

View File

@ -1,7 +1,7 @@
import import
std/hashes, std/hashes,
nimcrypto, stint, chronos, stew/shims/net, chronicles, nimcrypto, stint, chronos, stew/shims/net, chronicles,
eth/keys, enr ../../keys, ./enr
export stint export stint

View File

@ -76,8 +76,8 @@ import
std/[tables, sets, options, math, sequtils, algorithm], std/[tables, sets, options, math, sequtils, algorithm],
stew/shims/net as stewNet, json_serialization/std/net, stew/shims/net as stewNet, json_serialization/std/net,
stew/endians2, chronicles, chronos, stint, bearssl, metrics, stew/endians2, chronicles, chronos, stint, bearssl, metrics,
eth/[rlp, keys, async_utils], ".."/../[rlp, keys, async_utils],
messages, encoding, node, routing_table, enr, random2, sessions, ip_vote "."/[messages, encoding, node, routing_table, enr, random2, sessions, ip_vote]
import nimcrypto except toHex import nimcrypto except toHex

View File

@ -2,7 +2,7 @@ import
std/[algorithm, times, sequtils, bitops, sets, options], std/[algorithm, times, sequtils, bitops, sets, options],
stint, chronicles, metrics, bearssl, chronos, stew/shims/net as stewNet, stint, chronicles, metrics, bearssl, chronos, stew/shims/net as stewNet,
../../net/utils, ../../net/utils,
node, random2, enr "."/[node, random2, enr]
export options export options

View File

@ -12,9 +12,10 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import bearssl import
import eth/keys, nimcrypto/[rijndael, bcmode, hash, hmac, sha2, utils] bearssl, stew/[results, endians2],
import stew/[results, endians2] nimcrypto/[rijndael, bcmode, hash, hmac, sha2, utils],
../keys
export results export results

View File

@ -10,8 +10,9 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import uri, strutils, net import
import eth/keys std/[uri, strutils, net],
../keys
export keys export keys

View File

@ -9,9 +9,10 @@
# #
import import
tables, hashes, times, algorithm, sets, sequtils, bearssl, random, std/[tables, hashes, times, algorithm, sets, sequtils, random],
chronos, eth/keys, chronicles, stint, nimcrypto/keccak, chronos, bearssl, chronicles, stint, nimcrypto/keccak,
enode ../keys,
./enode
export sets # TODO: This should not be needed, but compilation fails otherwise export sets # TODO: This should not be needed, but compilation fails otherwise

View File

@ -1,7 +1,8 @@
import import
macros, deques, algorithm, std/[macros, deques, algorithm],
chronos, eth/[keys, rlp], eth/common/eth_types, chronos,
private/p2p_types, rlpx, ../p2p ".."/[keys, rlp, p2p], ../common/eth_types,
./private/p2p_types, ./rlpx
type type
Action = proc (p: Peer, data: Rlp): Future[void] {.gcsafe.} Action = proc (p: Peer, data: Rlp): Future[void] {.gcsafe.}

View File

@ -1,5 +1,5 @@
import import
options, sequtils, std/[options, sequtils],
stew/shims/macros, chronos, faststreams/outputs stew/shims/macros, chronos, faststreams/outputs
type type

View File

@ -2,7 +2,7 @@ const tracingEnabled = defined(p2pdump)
when tracingEnabled: when tracingEnabled:
import import
typetraits, std/typetraits,
json_serialization, chronicles #, chronicles_tail/configuration json_serialization, chronicles #, chronicles_tail/configuration
export export

View File

@ -2,9 +2,10 @@
# on the given network. # on the given network.
import import
os, tables, times, random, sequtils, options, std/[os, tables, times, random, sequtils, options],
chronos, chronicles, eth/[rlp, keys, common], chronos, chronicles,
private/p2p_types, discovery, kademlia, rlpx ".."/[rlp, keys, common],
./private/p2p_types, "."/[discovery, kademlia, rlpx]
const const
lookupInterval = 5 lookupInterval = 5

View File

@ -1,7 +1,8 @@
import import
deques, tables, bearssl, std/[deques, tables],
eth/[rlp, keys], chronos, eth/common/eth_types, bearssl, chronos,
../enode, ../kademlia, ../discovery, ../rlpxcrypt ".."/../[rlp, keys], ".."/../common/eth_types,
".."/[enode, kademlia, discovery, rlpxcrypt]
const const
useSnappy* = defined(useSnappy) useSnappy* = defined(useSnappy)

View File

@ -1,7 +1,8 @@
import import
tables, algorithm, deques, hashes, options, typetraits, std/[tables, algorithm, deques, hashes, options, typetraits],
stew/shims/macros, chronicles, nimcrypto, chronos, eth/[rlp, common, keys, async_utils], stew/shims/macros, chronicles, nimcrypto, chronos,
private/p2p_types, kademlia, auth, rlpxcrypt, enode, p2p_protocol_dsl ".."/[rlp, common, keys, async_utils],
./private/p2p_types, "."/[kademlia, auth, rlpxcrypt, enode, p2p_protocol_dsl]
when useSnappy: when useSnappy:
import snappy import snappy

View File

@ -1,5 +1,6 @@
import import
chronos, chronicles, eth/p2p chronos, chronicles,
../../p2p
# Limited bzz protocol that allows for doing a handshake with a peer running # Limited bzz protocol that allows for doing a handshake with a peer running
# ethersphere/swarm client rev. c535b271536d0dee5bd97c2541ca32a42f272d4f # ethersphere/swarm client rev. c535b271536d0dee5bd97c2541ca32a42f272d4f

View File

@ -12,8 +12,9 @@
## https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol ## https://github.com/ethereum/wiki/wiki/Ethereum-Wire-Protocol
import import
chronos, stint, chronicles, eth/rlp, eth/common/eth_types, chronos, stint, chronicles,
../rlpx, ../private/p2p_types, ../blockchain_utils, ../../p2p ../../rlp, ../../common/eth_types, ../../p2p,
../rlpx, ../private/p2p_types, ../blockchain_utils
type type
NewBlockHashesAnnounce* = object NewBlockHashesAnnounce* = object

View File

@ -1,7 +1,9 @@
import import
tables, sets, std/[tables, sets],
chronicles, chronos, eth/rlp, eth/common/eth_types, chronicles, chronos,
../../rlpx, ../../private/p2p_types, private/les_types ../../../rlp, ../../..//common/eth_types,
../../rlpx, ../../private/p2p_types,
./private/les_types
const const
maxSamples = 100000 maxSamples = 100000

View File

@ -1,6 +1,6 @@
import import
hashes, tables, sets, std/[hashes, tables, sets],
eth/common/eth_types ../../../../common/eth_types
type type
AnnounceType* = enum AnnounceType* = enum

View File

@ -9,11 +9,11 @@
# #
import import
times, tables, options, sets, hashes, strutils, stew/shims/macros, std/[times, tables, options, sets, hashes, strutils],
chronicles, chronos, nimcrypto/[keccak, hash], stew/shims/macros, chronicles, chronos, nimcrypto/[keccak, hash],
eth/[rlp, keys], eth/common/eth_types, ../../[rlp, keys], ../../common/eth_types,
../rlpx, ../kademlia, ../private/p2p_types, ../blockchain_utils, ../[rlpx, kademlia, blockchain_utils], ../private/p2p_types,
les/private/les_types, les/flow_control ./les/private/les_types, ./les/flow_control
export export
les_types les_types

View File

@ -9,10 +9,10 @@
# #
import import
algorithm, bitops, math, options, tables, times, strutils, hashes, std/[algorithm, bitops, math, options, tables, times, strutils, hashes],
chronicles, stew/[byteutils, endians2], metrics, bearssl, chronicles, stew/[byteutils, endians2], metrics, bearssl,
nimcrypto/[bcmode, hash, keccak, rijndael], nimcrypto/[bcmode, hash, keccak, rijndael],
eth/[keys, rlp, p2p], eth/p2p/ecies ".."/../../[keys, rlp, p2p], ../../ecies
logScope: logScope:
topics = "whisper_types" topics = "whisper_types"

View File

@ -33,8 +33,10 @@
## else there will be no peers to send and receive messages from. ## else there will be no peers to send and receive messages from.
import import
options, tables, times, chronos, chronicles, metrics, std/[options, tables, times],
eth/[keys, async_utils, p2p], whisper/whisper_types chronos, chronicles, metrics,
".."/../[keys, async_utils, p2p],
./whisper/whisper_types
export export
whisper_types whisper_types

View File

@ -12,7 +12,8 @@
{.push raises: [Defect].} {.push raises: [Defect].}
import nimcrypto, stew/results import
nimcrypto, stew/results
from auth import ConnectionSecret from auth import ConnectionSecret
export results export results

View File

@ -1,4 +1,6 @@
import times, chronos import
std/times,
chronos
type type
FullNodeSyncer* = ref object FullNodeSyncer* = ref object

View File

@ -3,9 +3,10 @@
## https://ethereum.github.io/yellowpaper/paper.pdf ## https://ethereum.github.io/yellowpaper/paper.pdf
import import
macros, strutils, stew/byteutils, std/[macros, strutils],
rlp/[writer, object_serialization], stew/byteutils,
rlp/priv/defs ./rlp/[writer, object_serialization],
./rlp/priv/defs
export export
writer, object_serialization writer, object_serialization

View File

@ -1,4 +1,6 @@
import os, ../../rlp import
std/os,
../../rlp
if paramCount() > 0: if paramCount() > 0:
echo rlpFromHex(paramStr(1)).inspect echo rlpFromHex(paramStr(1)).inspect

View File

@ -1,5 +1,6 @@
import import
stew/bitseqs, ../rlp stew/bitseqs,
../rlp
type type
Bytes = seq[byte] Bytes = seq[byte]

View File

@ -1,4 +1,4 @@
import macros import std/macros
template rlpIgnore* {.pragma.} template rlpIgnore* {.pragma.}
## Specifies that a certain field should be ignored for the purposes ## Specifies that a certain field should be ignored for the purposes

View File

@ -1,5 +1,6 @@
import import
std/options, ../rlp std/options,
../rlp
proc read*[T](rlp: var Rlp, O: type Option[T]): O {.inline.} = proc read*[T](rlp: var Rlp, O: type Option[T]): O {.inline.} =
mixin read mixin read
@ -14,4 +15,3 @@ proc append*(writer: var RlpWriter, value: Option) =
export export
options, rlp options, rlp

View File

@ -1,6 +1,6 @@
import import
macros, std/macros,
object_serialization, priv/defs ./object_serialization, ./priv/defs
type type
RlpWriter* = object RlpWriter* = object

View File

@ -1,5 +1,5 @@
import import
trie/[hexary, sparse_binary] ./trie/[hexary, sparse_binary]
export export
hexary, sparse_binary hexary, sparse_binary

View File

@ -1,7 +1,7 @@
import import
sequtils, std/sequtils,
stew/ranges/ptr_arith, trie_defs, stew/ranges/ptr_arith,
./trie_bitseq "."/[trie_defs, trie_bitseq]
type type
TrieNodeKind* = enum TrieNodeKind* = enum

View File

@ -1,6 +1,5 @@
import import
./trie_bitseq, "."/[trie_bitseq, trie_defs, db, binaries, trie_utils]
./trie_defs, ./db, ./binaries, ./trie_utils
export export
trie_utils trie_utils

View File

@ -1,5 +1,5 @@
import import
./trie_defs, ./binary, ./binaries, ./db, ./trie_utils, ./trie_bitseq "."/[trie_defs, binary, binaries, db, trie_utils, trie_bitseq]
type type
DB = TrieDatabaseRef DB = TrieDatabaseRef

View File

@ -1,7 +1,7 @@
import import
tables, hashes, sets, std/[tables, hashes, sets],
nimcrypto/[hash, keccak], nimcrypto/[hash, keccak],
trie_defs, db_tracing "."/[trie_defs, db_tracing]
type type
MemDBRec = object MemDBRec = object

View File

@ -1,7 +1,8 @@
import import
tables, std/tables,
nimcrypto/[keccak, hash], eth/rlp, nimcrypto/[keccak, hash],
trie_defs, nibbles, db ../rlp,
"."/[trie_defs, nibbles, db]
type type
TrieNodeKey = object TrieNodeKey = object

View File

@ -1,6 +1,5 @@
import import
./trie_bitseq, "."/[trie_bitseq, trie_defs, trie_utils, db, sparse_proofs]
./trie_defs, ./trie_utils, ./db, ./sparse_proofs
export export
trie_utils, trie_bitseq, trie_utils, trie_bitseq,

View File

@ -1,5 +1,5 @@
import import
./trie_bitseq, ./trie_defs, /trie_utils "."/[trie_bitseq, trie_defs, trie_utils]
const const
treeHeight* = 160 treeHeight* = 160

View File

@ -1,5 +1,6 @@
import import
eth/rlp, nimcrypto/hash nimcrypto/hash,
../rlp
type type
KeccakHash* = MDigest[256] KeccakHash* = MDigest[256]

View File

@ -1,7 +1,7 @@
import import
stew/byteutils, stew/byteutils,
nimcrypto/[hash, keccak], nimcrypto/[hash, keccak],
trie_defs ./trie_defs
template checkValidHashZ*(x: untyped) = template checkValidHashZ*(x: untyped) =
when x.type isnot KeccakHash: when x.type isnot KeccakHash:

View File

@ -1,4 +1,4 @@
import import
test_kvstore_rocksdb, ./test_kvstore_rocksdb,
test_kvstore_sqlite3, ./test_kvstore_sqlite3,
test_kvstore ./test_kvstore

View File

@ -1,7 +1,7 @@
{.used.} {.used.}
import import
unittest, std/unittest,
../../eth/db/kvstore ../../eth/db/kvstore
const const

View File

@ -1,8 +1,8 @@
{.used.} {.used.}
import import
os, chronicles, std/[os, unittest],
unittest, chronicles,
../../eth/db/[kvstore, kvstore_rocksdb], ../../eth/db/[kvstore, kvstore_rocksdb],
./test_kvstore ./test_kvstore

View File

@ -1,7 +1,7 @@
{.used.} {.used.}
import import
os, std/os,
testutils/unittests, testutils/unittests,
../../eth/db/[kvstore, kvstore_sqlite3], ../../eth/db/[kvstore, kvstore_sqlite3],
./test_kvstore ./test_kvstore

View File

@ -9,7 +9,9 @@
{.used.} {.used.}
import eth/keys, eth/keyfile/[keyfile], json, os, unittest import
std/[json, os, unittest],
../../eth/keys, ../../eth/keyfile/[keyfile]
# Test vectors copied from # Test vectors copied from
# https://github.com/ethereum/tests/blob/develop/KeyStoreTests/basic_tests.json # https://github.com/ethereum/tests/blob/develop/KeyStoreTests/basic_tests.json

View File

@ -9,7 +9,9 @@
{.used.} {.used.}
import eth/keyfile/uuid, unittest import
unittest,
../../eth/keyfile/uuid
suite "Cross-platform UUID test suite": suite "Cross-platform UUID test suite":
test "Platform UUID check": test "Platform UUID check":

View File

@ -7,8 +7,9 @@
# #
# 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 eth/keys, #../src/private/conversion_bytes, import
./config ../../eth/keys, #../src/private/conversion_bytes,
./config
import unittest import unittest

View File

@ -9,12 +9,12 @@
{.used.} {.used.}
import unittest import
import eth/keys, bearssl std/unittest,
import nimcrypto/hash, nimcrypto/keccak, nimcrypto/utils nimcrypto/hash, nimcrypto/keccak, nimcrypto/utils, bearssl, stew/byteutils,
from strutils import toLowerAscii ../../eth/keys
import stew/byteutils from strutils import toLowerAscii
proc compare(x: openarray[byte], y: openarray[byte]): bool = proc compare(x: openarray[byte], y: openarray[byte]): bool =
result = len(x) == len(y) result = len(x) == len(y)

View File

@ -9,8 +9,9 @@
{.used.} {.used.}
import eth/keys, import
./config ../../eth/keys,
./config
import unittest import unittest

View File

@ -1,8 +1,8 @@
import import
test_enr, ./test_enr,
test_hkdf, ./test_hkdf,
test_lru, ./test_lru,
test_ip_vote, ./test_ip_vote,
test_routing_table, ./test_routing_table,
test_discoveryv5_encoding, ./test_discoveryv5_encoding,
test_discoveryv5 ./test_discoveryv5

View File

@ -1,6 +1,9 @@
import import
tables, chronos, eth/p2p, eth/p2p/peer_pool, std/tables,
eth/p2p/rlpx_protocols/bzz_protocol, ./p2p_test_helper chronos,
../../eth/p2p, ../../eth/p2p/peer_pool,
../../eth/p2p/rlpx_protocols/bzz_protocol,
./p2p_test_helper
# Basic bzz test to test handshake with ethersphere/swarm node # Basic bzz test to test handshake with ethersphere/swarm node
# Fixed enode string for now # Fixed enode string for now

View File

@ -8,8 +8,10 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
options, unittest, chronos, eth/[rlp, keys, p2p], std/[options, unittest],
eth/p2p/mock_peers, eth/p2p/rlpx_protocols/[whisper_protocol] chronos,
../../eth/[rlp, keys, p2p],
../../eth/p2p/mock_peers, ../../eth/p2p/rlpx_protocols/[whisper_protocol]
proc localAddress(port: int): Address = proc localAddress(port: int): Address =
let port = Port(port) let port = Port(port)

View File

@ -1,8 +1,8 @@
import import
stew/shims/net, bearssl, chronos, stew/shims/net, bearssl, chronos,
eth/keys, ../../eth/keys,
eth/p2p/discoveryv5/[enr, node, routing_table], ../../eth/p2p/discoveryv5/[enr, node, routing_table],
eth/p2p/discoveryv5/protocol as discv5_protocol ../../eth/p2p/discoveryv5/protocol as discv5_protocol
export net export net

View File

@ -1,5 +1,5 @@
import import
eth/p2p/rlpx_protocols/les/flow_control ../../../eth/p2p/rlpx_protocols/les/flow_control
flow_control.tests() flow_control.tests()

View File

@ -1,6 +1,7 @@
import import
unittest, chronos, nimcrypto, strutils, bearssl, std/[unittest, strutils],
eth/[keys, p2p], eth/p2p/[discovery, enode] chronos, nimcrypto, bearssl,
../../eth/[keys, p2p], ../../eth/p2p/[discovery, enode]
var nextPort = 30303 var nextPort = 30303

View File

@ -8,9 +8,10 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
sequtils, options, strutils, parseopt, chronos, std/[sequtils, options, strutils, parseopt],
eth/[keys, rlp, p2p], eth/p2p/rlpx_protocols/[whisper_protocol], chronos,
eth/p2p/[discovery, enode, peer_pool, bootnodes, whispernodes] ../../eth/[keys, rlp, p2p], eth/p2p/rlpx_protocols/[whisper_protocol],
../../eth/p2p/[discovery, enode, peer_pool, bootnodes, whispernodes]
const const
DefaultListeningPort = 30303 DefaultListeningPort = 30303

View File

@ -7,9 +7,10 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
import unittest import
import eth/keys, nimcrypto/[utils, keccak] std/unittest,
import eth/p2p/auth nimcrypto/[utils, keccak],
../../eth/keys, ../../eth/p2p/auth
# This was generated by `print` actual auth message generated by # This was generated by `print` actual auth message generated by
# https://github.com/ethereum/py-evm/blob/master/tests/p2p/test_auth.py # https://github.com/ethereum/py-evm/blob/master/tests/p2p/test_auth.py

View File

@ -7,9 +7,10 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
import unittest import
import eth/keys, nimcrypto/[utils, sysrand, keccak] std/unittest,
import eth/p2p/[auth, rlpxcrypt] nimcrypto/[utils, sysrand, keccak],
../../eth/keys, ../../eth/p2p/[auth, rlpxcrypt]
const data = [ const data = [
("initiator_private_key", ("initiator_private_key",

View File

@ -8,8 +8,9 @@
# #
import import
sequtils, unittest, chronos, stew/byteutils, std/[sequtils, unittest],
eth/[keys, rlp], eth/p2p/[discovery, kademlia, enode], chronos, stew/byteutils,
../../eth/[keys, rlp], ../../eth/p2p/[discovery, kademlia, enode],
./p2p_test_helper ./p2p_test_helper
proc nodeIdInNodes(id: NodeId, nodes: openarray[Node]): bool = proc nodeIdInNodes(id: NodeId, nodes: openarray[Node]): bool =

View File

@ -2,10 +2,10 @@
import import
std/tables, std/tables,
chronos, chronicles, stint, testutils/unittests, chronos, chronicles, stint, testutils/unittests, stew/shims/net, bearssl,
stew/shims/net, eth/keys, bearssl, ../../eth/keys,
eth/p2p/discoveryv5/[enr, node, routing_table, encoding, sessions, messages], ../../eth/p2p/discoveryv5/[enr, node, routing_table, encoding, sessions, messages],
eth/p2p/discoveryv5/protocol as discv5_protocol, ../../eth/p2p/discoveryv5/protocol as discv5_protocol,
./discv5_test_helper ./discv5_test_helper
procSuite "Discovery v5 Tests": procSuite "Discovery v5 Tests":

View File

@ -3,8 +3,8 @@
import import
std/[unittest, options, sequtils, tables], std/[unittest, options, sequtils, tables],
stint, stew/byteutils, stew/shims/net, stint, stew/byteutils, stew/shims/net,
eth/keys, ../../eth/keys,
eth/p2p/discoveryv5/[messages, encoding, enr, node, sessions] ../../eth/p2p/discoveryv5/[messages, encoding, enr, node, sessions]
let rng = newRng() let rng = newRng()

View File

@ -7,9 +7,10 @@
# distribution, for details about the copyright. # distribution, for details about the copyright.
# #
import unittest import
import eth/keys, nimcrypto/[utils, sha2, hmac, rijndael] std/unittest,
import eth/p2p/ecies nimcrypto/[utils, sha2, hmac, rijndael],
../../eth/keys, ../../eth/p2p/ecies
proc compare[A, B](x: openarray[A], y: openarray[B], s: int = 0): bool = proc compare[A, B](x: openarray[A], y: openarray[B], s: int = 0): bool =
result = true result = true

View File

@ -7,8 +7,9 @@
# Apache License, version 2.0, (LICENSE-APACHEv2) # Apache License, version 2.0, (LICENSE-APACHEv2)
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import unittest, net, options import
import eth/p2p/enode std/[unittest, net, options],
../../eth/p2p/enode
suite "ENode": suite "ENode":
test "Go-Ethereum tests": test "Go-Ethereum tests":

View File

@ -3,7 +3,7 @@
import import
std/[unittest, options, sequtils], std/[unittest, options, sequtils],
nimcrypto/utils, stew/shims/net, nimcrypto/utils, stew/shims/net,
eth/p2p/enode, eth/p2p/discoveryv5/enr, eth/[keys, rlp] ../../eth/p2p/discoveryv5/enr, ../../eth/[keys, rlp]
let rng = newRng() let rng = newRng()

View File

@ -3,7 +3,7 @@
import import
std/unittest, std/unittest,
nimcrypto, stew/byteutils, nimcrypto, stew/byteutils,
eth/p2p/discoveryv5/hkdf ../../eth/p2p/discoveryv5/hkdf
proc hextToBytes(s: string): seq[byte] = proc hextToBytes(s: string): seq[byte] =
if s.len != 0: return hexToSeqByte(s) if s.len != 0: return hexToSeqByte(s)

View File

@ -2,8 +2,8 @@
import import
std/unittest, std/unittest,
eth/keys, stew/shims/net, stew/shims/net,
eth/p2p/discoveryv5/[node, ip_vote] ../../eth/keys, ../../eth/p2p/discoveryv5/[node, ip_vote]
suite "IP vote": suite "IP vote":
let rng = newRng() let rng = newRng()

View File

@ -2,7 +2,7 @@
import import
std/[unittest, options], std/[unittest, options],
eth/p2p/discoveryv5/lru ../../eth/p2p/discoveryv5/lru
suite "LRUCache": suite "LRUCache":
const const

View File

@ -8,8 +8,9 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
tables, chronos, testutils/unittests, std/tables,
eth/p2p, chronos, testutils/unittests,
../../eth/p2p,
./p2p_test_helper ./p2p_test_helper
type type

View File

@ -1,7 +1,8 @@
import import
json, os, stew/byteutils, unittest, chronos, std/[json, os, unittest],
eth/p2p, eth/p2p/rlpx_protocols/[whisper_protocol, eth_protocol], chronos, stew/byteutils,
../p2p/p2p_test_helper ../../eth/p2p, ../../eth/p2p/rlpx_protocols/[whisper_protocol, eth_protocol],
./p2p_test_helper
let rng = newRng() let rng = newRng()

View File

@ -2,7 +2,8 @@
import import
std/unittest, std/unittest,
bearssl, eth/keys, eth/p2p/discoveryv5/[routing_table, node, enr], bearssl,
../../eth/keys, ../../eth/p2p/discoveryv5/[routing_table, node, enr],
./discv5_test_helper ./discv5_test_helper
suite "Routing Table Tests": suite "Routing Table Tests":

View File

@ -8,8 +8,10 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
sequtils, options, unittest, tables, nimcrypto/hash, std/[sequtils, options, unittest, tables],
eth/[keys, rlp], eth/p2p/rlpx_protocols/whisper/whisper_types as whisper nimcrypto/hash,
../../eth/[keys, rlp],
../../eth/p2p/rlpx_protocols/whisper/whisper_types as whisper
let rng = newRng() let rng = newRng()

View File

@ -8,8 +8,8 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
sequtils, options, unittest, times, std/[sequtils, options, unittest, times],
eth/p2p/rlpx_protocols/whisper_protocol as whisper ../../eth/p2p/rlpx_protocols/whisper_protocol as whisper
suite "Whisper envelope validation": suite "Whisper envelope validation":
test "should validate and allow envelope according to config": test "should validate and allow envelope according to config":

View File

@ -8,8 +8,10 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
sequtils, options, tables, chronos, testutils/unittests, bearssl, std/[sequtils, options, tables],
eth/[keys, p2p], eth/p2p/rlpx_protocols/whisper_protocol, eth/p2p/peer_pool, chronos, testutils/unittests, bearssl,
../../eth/[keys, p2p], ../../eth/p2p/peer_pool,
../../eth/p2p/rlpx_protocols/whisper_protocol,
./p2p_test_helper ./p2p_test_helper
proc resetMessageQueues(nodes: varargs[EthereumNode]) = proc resetMessageQueues(nodes: varargs[EthereumNode]) =

View File

@ -8,9 +8,9 @@
# MIT license (LICENSE-MIT) # MIT license (LICENSE-MIT)
import import
sequtils, strformat, options, testutils/unittests, std/[sequtils, strformat, options],
chronicles, chronos, eth/[rlp, keys, p2p], testutils/unittests, chronicles, chronos,
eth/p2p/mock_peers ../../eth/[rlp, keys, p2p], ../../eth/p2p/mock_peers
const const
clientId = "nim-eth-p2p/0.0.1" clientId = "nim-eth-p2p/0.0.1"

View File

@ -1,8 +1,9 @@
{.used.} {.used.}
import import
math, unittest, strutils, stew/byteutils, std/[math, unittest, strutils],
eth/rlp stew/byteutils,
../../eth/rlp
proc q(s: string): string = "\"" & s & "\"" proc q(s: string): string = "\"" & s & "\""
proc i(s: string): string = s.replace(" ").replace("\n") proc i(s: string): string = s.replace(" ").replace("\n")

View File

@ -1,6 +1,8 @@
{.used.} {.used.}
import unittest, eth/common, eth/rlp import
std/unittest,
../../eth/[common, rlp]
proc `==`(a, b: HashOrStatus): bool = proc `==`(a, b: HashOrStatus): bool =
result = a.isHash == b.isHash result = a.isHash == b.isHash

View File

@ -1,8 +1,8 @@
{.used.} {.used.}
import import
os, strutils, strformat, std/[os, strutils, strformat],
util/json_testing ./util/json_testing
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0] template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]

View File

@ -1,7 +1,9 @@
{.used.} {.used.}
import import
unittest, times, eth/rlp, stew/byteutils std/[unittest, times],
stew/byteutils,
../../eth/rlp
type type
Transaction = object Transaction = object

View File

@ -1,5 +1,7 @@
import import
json, stew/byteutils, unittest, eth/rlp std/[json, unittest],
stew/byteutils,
../../../eth/rlp
proc append(output: var RlpWriter, js: JsonNode) = proc append(output: var RlpWriter, js: JsonNode) =
case js.kind case js.kind

Some files were not shown because too many files have changed in this diff Show More