diff --git a/eth/p2p/kademlia.nim b/eth/p2p/kademlia.nim index b92f486..04bfbac 100644 --- a/eth/p2p/kademlia.nim +++ b/eth/p2p/kademlia.nim @@ -236,12 +236,9 @@ proc newKademliaProtocol*[Wire](thisNode: Node, result.new() result.thisNode = thisNode result.wire = wire - result.pongFutures = initTable[seq[byte], Future[bool]]() - result.pingFutures = initTable[Node, Future[bool]]() - result.neighboursCallbacks = initTable[Node, proc(n: seq[Node])]() result.routing.init(thisNode) -proc bond(k: KademliaProtocol, n: Node): Future[bool] {.async.} +proc bond(k: KademliaProtocol, n: Node): Future[bool] {.async, gcsafe.} proc updateRoutingTable(k: KademliaProtocol, n: Node) {.gcsafe.} = ## Update the routing table entry for the given node. diff --git a/tests/p2p/p2p_test_helper.nim b/tests/p2p/p2p_test_helper.nim index e75e64c..7bddcb1 100644 --- a/tests/p2p/p2p_test_helper.nim +++ b/tests/p2p/p2p_test_helper.nim @@ -35,6 +35,13 @@ template asyncTest*(name, body: untyped) = proc scenario {.async.} = body waitFor scenario() +template procSuite*(name, body: untyped) = + proc suitePayload = + suite name: + body + + suitePayload() + proc packData*(payload: openArray[byte], pk: PrivateKey): seq[byte] = let payloadSeq = @payload diff --git a/tests/p2p/test_discovery.nim b/tests/p2p/test_discovery.nim index 7b603c7..1a68b19 100644 --- a/tests/p2p/test_discovery.nim +++ b/tests/p2p/test_discovery.nim @@ -34,7 +34,7 @@ proc test() {.async.} = for i in 0 ..< nodeKeys.len: nodeAddrs.add(localAddress(20302 + i)) var nodes = await all(zip(nodeKeys, nodeAddrs).mapIt( - startDiscoveryNode(it.a, it.b, @[bootENode])) + startDiscoveryNode(it[0], it[1], @[bootENode])) ) nodes.add(bootNode) diff --git a/tests/p2p/test_discoveryv5.nim b/tests/p2p/test_discoveryv5.nim index 96516c2..507942f 100644 --- a/tests/p2p/test_discoveryv5.nim +++ b/tests/p2p/test_discoveryv5.nim @@ -48,7 +48,7 @@ suite "Discovery v5 Tests": for i in 0 ..< nodeKeys.len: nodeAddrs.add(localAddress(20302 + i)) var nodes = zip(nodeKeys, nodeAddrs).mapIt( - initDiscoveryNode(it.a, it.b, @[bootNode.localNode.record])) + initDiscoveryNode(it[0], it[1], @[bootNode.localNode.record])) nodes.add(bootNode) for node in nodes: diff --git a/tests/p2p/test_shh_connect.nim b/tests/p2p/test_shh_connect.nim index 602acaa..c090333 100644 --- a/tests/p2p/test_shh_connect.nim +++ b/tests/p2p/test_shh_connect.nim @@ -19,7 +19,7 @@ proc resetMessageQueues(nodes: varargs[EthereumNode]) = let safeTTL = 5'u32 let waitInterval = messageInterval + 150.milliseconds -suite "Whisper connections": +procSuite "Whisper connections": var node1 = setupTestNode(Whisper) var node2 = setupTestNode(Whisper) node2.startListening() diff --git a/tests/p2p/test_waku_bridge.nim b/tests/p2p/test_waku_bridge.nim index cb7d654..c83d2d7 100644 --- a/tests/p2p/test_waku_bridge.nim +++ b/tests/p2p/test_waku_bridge.nim @@ -17,7 +17,7 @@ import let safeTTL = 5'u32 let waitInterval = waku.messageInterval + 150.milliseconds -suite "Waku - Whisper bridge tests": +procSuite "Waku - Whisper bridge tests": # Waku Whisper node has both capabilities, listens to Whisper and Waku and # relays traffic between the two. var diff --git a/tests/p2p/test_waku_connect.nim b/tests/p2p/test_waku_connect.nim index fae4cf4..5c59c7b 100644 --- a/tests/p2p/test_waku_connect.nim +++ b/tests/p2p/test_waku_connect.nim @@ -19,7 +19,7 @@ const # check on a condition until true or return a future containing false # if timeout expires first -proc eventually(timeout: int, condition: proc(): bool): Future[bool] = +proc eventually(timeout: int, condition: proc(): bool {.gcsafe.}): Future[bool] = let wrappedCondition = proc(): Future[bool] {.async.} = let f = newFuture[bool]() while not condition(): diff --git a/tests/p2p/test_waku_mail.nim b/tests/p2p/test_waku_mail.nim index 9c3840c..f8b7e6f 100644 --- a/tests/p2p/test_waku_mail.nim +++ b/tests/p2p/test_waku_mail.nim @@ -11,7 +11,7 @@ proc waitForConnected(node: EthereumNode) {.async.} = while node.peerPool.connectedNodes.len == 0: await sleepAsync(chronos.milliseconds(1)) -suite "Waku Mail Client": +procSuite "Waku Mail Client": var client = setupTestNode(Waku) var simpleServer = setupTestNode(Waku) diff --git a/tests/trie/test_storage_backends.nim b/tests/trie/test_storage_backends.nim index a13661d..4f62026 100644 --- a/tests/trie/test_storage_backends.nim +++ b/tests/trie/test_storage_backends.nim @@ -53,7 +53,7 @@ template backendTests(DB) = keyA notin db keyB in db - check db.get(keyA) == @[] + check db.get(keyA).len == 0 check db.get(keyB) == value1 db.del(keyA)