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:
- nimble test
- nimble build_dcli
deploy: off

View File

@ -270,3 +270,4 @@ jobs:
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
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 build_dcli

View File

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

View File

@ -24,9 +24,16 @@ proc runTest(path: string, release: bool = true, chronosStrict = true) =
let chronosMode =
if chronosStrict: "-d:chronosStrictException" else: ""
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
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":
runTest("tests/keyfile/all_tests")
@ -88,3 +95,6 @@ task test_discv5_full, "Run discovery v5 and its dependencies tests":
test_keys_task()
test_rlp_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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,6 @@
import
eth/[common, rlp, keys], nimcrypto/keccak
nimcrypto/keccak,
".."/[common, rlp, keys]
proc initTransaction*(nonce: AccountNonce, gasPrice, gasLimit: GasInt, to: EthAddress,
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
# 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):
import posix
import std/posix
export metrics

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,8 @@
import
std/[tables, options, hashes, net],
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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,9 @@
import
tables, chronos, eth/p2p, eth/p2p/peer_pool,
eth/p2p/rlpx_protocols/bzz_protocol, ./p2p_test_helper
std/tables,
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
# Fixed enode string for now

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,9 +7,10 @@
# distribution, for details about the copyright.
#
import unittest
import eth/keys, nimcrypto/[utils, keccak]
import eth/p2p/auth
import
std/unittest,
nimcrypto/[utils, keccak],
../../eth/keys, ../../eth/p2p/auth
# This was generated by `print` actual auth message generated by
# 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.
#
import unittest
import eth/keys, nimcrypto/[utils, sysrand, keccak]
import eth/p2p/[auth, rlpxcrypt]
import
std/unittest,
nimcrypto/[utils, sysrand, keccak],
../../eth/keys, ../../eth/p2p/[auth, rlpxcrypt]
const data = [
("initiator_private_key",

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
import
std/[unittest, options, sequtils],
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()

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -2,7 +2,8 @@
import
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
suite "Routing Table Tests":

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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