diff --git a/beacon_chain/rpc/rest_nimbus_api.nim b/beacon_chain/rpc/rest_nimbus_api.nim index 9e7f884e9f..4f89ac5e74 100644 --- a/beacon_chain/rpc/rest_nimbus_api.nim +++ b/beacon_chain/rpc/rest_nimbus_api.nim @@ -80,10 +80,10 @@ type proc toInfo(node: BeaconNode, peerId: PeerId): RestPeerInfo = RestPeerInfo( peerId: $peerId, - addrs: node.network.switch.peerStore.addressBook.get(peerId).toSeq().mapIt($it), - protocols: node.network.switch.peerStore.protoBook.get(peerId).toSeq(), - protoVersion: node.network.switch.peerStore.protoVersionBook.get(peerId), - agentVersion: node.network.switch.peerStore.agentBook.get(peerId) + addrs: node.network.switch.peerStore[AddressBook][peerId].mapIt($it), + protocols: node.network.switch.peerStore[ProtoBook][peerId], + protoVersion: node.network.switch.peerStore[ProtoVersionBook][peerId], + agentVersion: node.network.switch.peerStore[AgentBook][peerId] ) proc toNode(v: PubSubPeer, backoff: Moment): RestPubSubPeer = diff --git a/beacon_chain/rpc/rest_node_api.nim b/beacon_chain/rpc/rest_node_api.nim index ce8f946ab4..aa4032acee 100644 --- a/beacon_chain/rpc/rest_node_api.nim +++ b/beacon_chain/rpc/rest_node_api.nim @@ -90,7 +90,7 @@ proc getLastSeenAddress(node: BeaconNode, id: PeerId): string = # TODO (cheatfate): We need to provide filter here, which will be able to # filter such multiaddresses like `/ip4/0.0.0.0` or local addresses or # addresses with peer ids. - let addrs = node.network.switch.peerStore.addressBook.get(id).toSeq() + let addrs = node.network.switch.peerStore[AddressBook][id] if len(addrs) > 0: $addrs[len(addrs) - 1] else: @@ -200,8 +200,8 @@ proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) = state: peer.connectionState.toString(), direction: peer.direction.toString(), # Fields `agent` and `proto` are not part of specification - agent: node.network.switch.peerStore.agentBook.get(peer.peerId), - proto: node.network.switch.peerStore.protoVersionBook.get(peer.peerId) + agent: node.network.switch.peerStore[AgentBook][peer.peerId], + proto: node.network.switch.peerStore[ProtoVersionBook][peer.peerId] ) res.add(peer) return RestApiResponse.jsonResponseWMeta(res, (count: uint64(len(res)))) @@ -242,8 +242,8 @@ proc installNodeApiHandlers*(router: var RestRouter, node: BeaconNode) = last_seen_p2p_address: getLastSeenAddress(node, peer.peerId), state: peer.connectionState.toString(), direction: peer.direction.toString(), - agent: node.network.switch.peerStore.agentBook.get(peer.peerId), # Fields `agent` and `proto` are not - proto: node.network.switch.peerStore.protoVersionBook.get(peer.peerId) # part of specification + agent: node.network.switch.peerStore[AgentBook][peer.peerId], # Fields `agent` and `proto` are not + proto: node.network.switch.peerStore[ProtoVersionBook][peer.peerId] # part of specification ) ) diff --git a/beacon_chain/sync/sync_manager.nim b/beacon_chain/sync/sync_manager.nim index 1707cd3b8e..2dafb52554 100644 --- a/beacon_chain/sync/sync_manager.nim +++ b/beacon_chain/sync/sync_manager.nim @@ -167,9 +167,9 @@ proc getBlocks*[A, B](man: SyncManager[A, B], peer: A, try: let res = if peer.useSyncV2(): - await beaconBlocksByRange_v2(peer, req.slot, req.count, 1) + await beaconBlocksByRange_v2(peer, req.slot, req.count, 1'u64) else: - (await beaconBlocksByRange(peer, req.slot, req.count, 1)).map( + (await beaconBlocksByRange(peer, req.slot, req.count, 1'u64)).map( proc(blcks: seq[phase0.SignedBeaconBlock]): auto = blcks.mapIt(newClone(ForkedSignedBeaconBlock.init(it)))) diff --git a/beacon_chain/sync/sync_queue.nim b/beacon_chain/sync/sync_queue.nim index 108eebd566..473f9fa69c 100644 --- a/beacon_chain/sync/sync_queue.nim +++ b/beacon_chain/sync/sync_queue.nim @@ -7,7 +7,7 @@ {.push raises: [Defect].} -import std/[options, heapqueue, tables, strutils, sequtils, math, algorithm] +import std/[options, heapqueue, tables, strutils, sequtils, math] import stew/[results, base10], chronos, chronicles import ../spec/datatypes/[base, phase0, altair], @@ -134,8 +134,8 @@ proc checkResponse*[T](req: SyncRequest[T], inc(dindex) else: return false - slot = slot + 1 - rindex = rindex + 1'u64 + slot += 1'u64 + rindex += 1'u64 if dindex == len(data): return true diff --git a/tests/all_tests.nim b/tests/all_tests.nim index 71b5226f34..e511d49fc4 100644 --- a/tests/all_tests.nim +++ b/tests/all_tests.nim @@ -8,7 +8,6 @@ # All tests except scenarios, which as compiled separately for mainnet and minimal import - chronicles, ./testutil import # Unit test diff --git a/tests/consensus_spec/altair/all_altair_fixtures.nim b/tests/consensus_spec/altair/all_altair_fixtures.nim index 88bfb9e65c..2262b81f36 100644 --- a/tests/consensus_spec/altair/all_altair_fixtures.nim +++ b/tests/consensus_spec/altair/all_altair_fixtures.nim @@ -7,9 +7,6 @@ {.used.} -import - chronicles - import ./test_fixture_fork, ./test_fixture_merkle_single_proof, diff --git a/tests/consensus_spec/altair/test_fixture_rewards.nim b/tests/consensus_spec/altair/test_fixture_rewards.nim index 2d2af6c5a1..e381fb78dc 100644 --- a/tests/consensus_spec/altair/test_fixture_rewards.nim +++ b/tests/consensus_spec/altair/test_fixture_rewards.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2020-2021 Status Research & Development GmbH +# Copyright (c) 2020-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -9,9 +9,7 @@ import # Standard library - os, - # Utilities - stew/results, + std/os, # Beacon chain internals ../../beacon_chain/spec/[beaconstate, validator, helpers, state_transition_epoch], ../../beacon_chain/spec/datatypes/altair, diff --git a/tests/consensus_spec/altair/test_fixture_sanity_slots.nim b/tests/consensus_spec/altair/test_fixture_sanity_slots.nim index 170dde2c48..10b9862de2 100644 --- a/tests/consensus_spec/altair/test_fixture_sanity_slots.nim +++ b/tests/consensus_spec/altair/test_fixture_sanity_slots.nim @@ -8,7 +8,6 @@ {.used.} import - chronicles, # Standard library os, strutils, # Beacon chain internals diff --git a/tests/consensus_spec/altair/test_fixture_transition.nim b/tests/consensus_spec/altair/test_fixture_transition.nim index 37e9ea53c0..fe771dd4af 100644 --- a/tests/consensus_spec/altair/test_fixture_transition.nim +++ b/tests/consensus_spec/altair/test_fixture_transition.nim @@ -12,7 +12,6 @@ import # Standard library os, sequtils, # Status internal - chronicles, faststreams, streams, # Beacon chain internals ../../../beacon_chain/spec/[state_transition, forks, helpers], diff --git a/tests/consensus_spec/bellatrix/test_fixture_rewards.nim b/tests/consensus_spec/bellatrix/test_fixture_rewards.nim index 5261ecbd09..219826813e 100644 --- a/tests/consensus_spec/bellatrix/test_fixture_rewards.nim +++ b/tests/consensus_spec/bellatrix/test_fixture_rewards.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2020-2021 Status Research & Development GmbH +# Copyright (c) 2020-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -9,9 +9,7 @@ import # Standard library - os, - # Utilities - stew/results, + std/os, # Beacon chain internals ../../beacon_chain/spec/[beaconstate, validator, helpers, state_transition_epoch], ../../beacon_chain/spec/datatypes/[altair, bellatrix], diff --git a/tests/consensus_spec/bellatrix/test_fixture_transition.nim b/tests/consensus_spec/bellatrix/test_fixture_transition.nim index 152745e4de..3c40514872 100644 --- a/tests/consensus_spec/bellatrix/test_fixture_transition.nim +++ b/tests/consensus_spec/bellatrix/test_fixture_transition.nim @@ -12,7 +12,6 @@ import # Standard library std/[os, sequtils, strutils], # Status internal - chronicles, faststreams, streams, # Beacon chain internals ../../../beacon_chain/spec/[state_transition, forks, helpers], diff --git a/tests/consensus_spec/phase0/test_fixture_rewards.nim b/tests/consensus_spec/phase0/test_fixture_rewards.nim index 9239a97b9c..e2a4a683ee 100644 --- a/tests/consensus_spec/phase0/test_fixture_rewards.nim +++ b/tests/consensus_spec/phase0/test_fixture_rewards.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2020-2021 Status Research & Development GmbH +# Copyright (c) 2020-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -9,9 +9,7 @@ import # Standard library - os, - # Utilities - stew/results, + std/os, # Beacon chain internals ../../beacon_chain/spec/[validator, helpers, state_transition_epoch], ../../beacon_chain/spec/datatypes/phase0, diff --git a/tests/slashing_protection/test_fixtures.nim b/tests/slashing_protection/test_fixtures.nim index 94f6b5bae1..abb019d0ae 100644 --- a/tests/slashing_protection/test_fixtures.nim +++ b/tests/slashing_protection/test_fixtures.nim @@ -1,5 +1,5 @@ # Nimbus -# Copyright (c) 2018-2021 Status Research & Development GmbH +# Copyright (c) 2018-2022 Status Research & Development GmbH # Licensed under either of # * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or https://www.apache.org/licenses/LICENSE-2.0) # * MIT license ([LICENSE-MIT](LICENSE-MIT) or https://opensource.org/licenses/MIT) @@ -9,10 +9,9 @@ import # Standard library - std/[os], + std/os, # Status lib stew/[results, byteutils], - nimcrypto/utils, chronicles, # Internal ../../beacon_chain/validators/[slashing_protection, slashing_protection_v2], @@ -264,4 +263,4 @@ suite "Slashing Interchange tests " & preset(): # rather than also checking the actual signing_root skip() else: - runTest(path) \ No newline at end of file + runTest(path) diff --git a/tests/spec_epoch_processing/justification_finalization_helpers.nim b/tests/spec_epoch_processing/justification_finalization_helpers.nim index fdb6a6a6f2..b9d49f69de 100644 --- a/tests/spec_epoch_processing/justification_finalization_helpers.nim +++ b/tests/spec_epoch_processing/justification_finalization_helpers.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2021 Status Research & Development GmbH +# Copyright (c) 2018-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -7,7 +7,7 @@ import # Standard library - strformat, tables, + std/strformat, # Specs ../../beacon_chain/spec/datatypes/phase0, ../../beacon_chain/spec/[beaconstate, validator, helpers], diff --git a/tests/test_block_dag.nim b/tests/test_block_dag.nim index cf31aba4c4..7f32b4a74f 100644 --- a/tests/test_block_dag.nim +++ b/tests/test_block_dag.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2021 Status Research & Development GmbH +# Copyright (c) 2018-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -8,7 +8,6 @@ {.used.} import - chronicles, unittest2, ../beacon_chain/consensus_object_pools/block_dag diff --git a/tests/test_block_processor.nim b/tests/test_block_processor.nim index 3e8e0a208f..0cf842e8c2 100644 --- a/tests/test_block_processor.nim +++ b/tests/test_block_processor.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2018-2021 Status Research & Development GmbH +# Copyright (c) 2018-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -8,7 +8,7 @@ {.used.} import - chronicles, chronos, + chronos, std/[options, sequtils], unittest2, eth/keys, taskpools, diff --git a/tests/test_block_quarantine.nim b/tests/test_block_quarantine.nim index 9998fa45b5..8fb0ccb212 100644 --- a/tests/test_block_quarantine.nim +++ b/tests/test_block_quarantine.nim @@ -8,7 +8,6 @@ {.used.} import - chronicles, unittest2, ../beacon_chain/spec/forks, ../beacon_chain/spec/datatypes/phase0, diff --git a/tests/test_blockchain_dag.nim b/tests/test_blockchain_dag.nim index 3af755cee0..440a106074 100644 --- a/tests/test_blockchain_dag.nim +++ b/tests/test_blockchain_dag.nim @@ -8,9 +8,7 @@ {.used.} import - chronicles, unittest2, - stew/assign2, eth/keys, taskpools, ../beacon_chain/spec/datatypes/base, ../beacon_chain/spec/[beaconstate, forks, helpers, signatures, state_transition], diff --git a/tests/test_engine_authentication.nim b/tests/test_engine_authentication.nim index 857285e32c..81df1c7bcd 100644 --- a/tests/test_engine_authentication.nim +++ b/tests/test_engine_authentication.nim @@ -8,7 +8,7 @@ {.used.} import - std/[json, options, sequtils], + std/[json, sequtils], unittest2, ../beacon_chain/spec/engine_authentication diff --git a/tests/test_exit_pool.nim b/tests/test_exit_pool.nim index 0aa2e18450..58acac40c8 100644 --- a/tests/test_exit_pool.nim +++ b/tests/test_exit_pool.nim @@ -1,5 +1,5 @@ # beacon_chain -# Copyright (c) 2020 Status Research & Development GmbH +# Copyright (c) 2020-2022 Status Research & Development GmbH # Licensed and distributed under either of # * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). @@ -7,8 +7,7 @@ {.used.} -import chronicles, chronos -import eth/keys +import chronos import ../beacon_chain/spec/[datatypes/base, forks, presets] import ../beacon_chain/consensus_object_pools/[ block_quarantine, blockchain_dag, exit_pool] diff --git a/tests/test_gossip_validation.nim b/tests/test_gossip_validation.nim index e3367594da..ad7810a893 100644 --- a/tests/test_gossip_validation.nim +++ b/tests/test_gossip_validation.nim @@ -12,12 +12,12 @@ import std/sequtils, # Status lib unittest2, - chronicles, chronos, + chronos, eth/keys, taskpools, # Internal ../beacon_chain/[beacon_clock], ../beacon_chain/gossip_processing/[gossip_validation, batch_validation], - ../beacon_chain/fork_choice/[fork_choice_types, fork_choice], + ../beacon_chain/fork_choice/fork_choice, ../beacon_chain/consensus_object_pools/[ block_quarantine, blockchain_dag, block_clearance, attestation_pool, sync_committee_msg_pool], diff --git a/tests/test_key_splitting.nim b/tests/test_key_splitting.nim index fe169f802b..622cca9478 100644 --- a/tests/test_key_splitting.nim +++ b/tests/test_key_splitting.nim @@ -1,7 +1,14 @@ +# beacon_chain +# Copyright (c) 2022 Status Research & Development GmbH +# Licensed and distributed under either of +# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT). +# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). +# at your option. This file may not be copied, modified, or distributed except according to those terms. + {.used.} import - std/[json, typetraits, sequtils], + std/[typetraits, sequtils], unittest2, eth/keys, stew/byteutils, ../beacon_chain/spec/[crypto, keystore], ./testutil diff --git a/tests/test_keymanager_api.nim b/tests/test_keymanager_api.nim index 5ba0e95d6e..bd43ed701c 100644 --- a/tests/test_keymanager_api.nim +++ b/tests/test_keymanager_api.nim @@ -11,7 +11,7 @@ import std/[typetraits, os, options, json, sequtils, uri, algorithm], testutils/unittests, chronicles, stint, json_serialization, confutils, chronos, eth/keys, blscurve, libp2p/crypto/crypto as lcrypto, - stew/[byteutils, io2], stew/shims/net, nimcrypto/utils, + stew/[byteutils, io2], stew/shims/net, ../beacon_chain/spec/[crypto, keystore, eth2_merkleization], ../beacon_chain/spec/datatypes/base, diff --git a/tests/test_keystore.nim b/tests/test_keystore.nim index adbe7de693..893a9e7eeb 100644 --- a/tests/test_keystore.nim +++ b/tests/test_keystore.nim @@ -12,7 +12,6 @@ import unittest2, stew/byteutils, blscurve, eth/keys, json_serialization, libp2p/crypto/crypto as lcrypto, - nimcrypto/utils as ncrutils, ../beacon_chain/spec/[crypto, keystore], ./testutil diff --git a/tests/test_keystore_management.nim b/tests/test_keystore_management.nim index ae51946f42..317fe4d7fe 100644 --- a/tests/test_keystore_management.nim +++ b/tests/test_keystore_management.nim @@ -10,11 +10,10 @@ import std/[os, options, json, typetraits, uri, algorithm], unittest2, chronos, chronicles, stint, json_serialization, - blscurve, eth/keys, nimcrypto/utils, + blscurve, eth/keys, libp2p/crypto/crypto as lcrypto, stew/[io2, byteutils], ../beacon_chain/filepath, - ../beacon_chain/networking/network_metadata, ../beacon_chain/spec/eth2_merkleization, ../beacon_chain/spec/datatypes/base, ../beacon_chain/spec/[crypto, keystore], diff --git a/tests/test_light_client.nim b/tests/test_light_client.nim index 59c27fd80c..54d46ff465 100644 --- a/tests/test_light_client.nim +++ b/tests/test_light_client.nim @@ -12,7 +12,7 @@ import # Status libraries - chronicles, eth/keys, stew/objects, taskpools, + eth/keys, stew/objects, taskpools, # Beacon chain internals ../beacon_chain/consensus_object_pools/ [block_clearance, block_quarantine, blockchain_dag], diff --git a/tests/test_remote_keystore.nim b/tests/test_remote_keystore.nim index 40744d668e..d26129c101 100644 --- a/tests/test_remote_keystore.nim +++ b/tests/test_remote_keystore.nim @@ -8,10 +8,9 @@ {.used.} import - std/[json, typetraits], + std/typetraits, unittest2, json_serialization, - blscurve, eth/keys, libp2p/crypto/crypto as lcrypto, - nimcrypto/utils as ncrutils, + blscurve, ../beacon_chain/spec/[crypto, keystore], ./testutil diff --git a/tests/teststateutil.nim b/tests/teststateutil.nim index 3c9904126c..cf7c0dae13 100644 --- a/tests/teststateutil.nim +++ b/tests/teststateutil.nim @@ -8,7 +8,7 @@ {.push raises: [Defect].} import - options, stew/endians2, + std/options, ./mocking/mock_deposits, ./helpers/math_helpers, ../beacon_chain/spec/[ diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index cba3ca3c3e..718374d890 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit cba3ca3c3e7bb0ffa8d91aa7c3115a90eb17712a +Subproject commit 718374d890f3997b56bee61cb5971eb367f05b59