Update submodules (#814)

This commit is contained in:
Hanno Cornelius 2022-01-14 10:25:01 +01:00 committed by GitHub
parent c422866a49
commit 3e9ca25abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
32 changed files with 133 additions and 119 deletions

View File

@ -44,7 +44,7 @@ procSuite "ENR utils":
let let
enrIp = ValidIpAddress.init("127.0.0.1") enrIp = ValidIpAddress.init("127.0.0.1")
enrTcpPort, enrUdpPort = Port(60000) enrTcpPort, enrUdpPort = Port(60000)
enrKey = PrivateKey.random(Secp256k1, rng[])[] enrKey = wakuenr.crypto.PrivateKey.random(Secp256k1, rng[])[]
wakuFlags = initWakuFlags(false, true, false, true) wakuFlags = initWakuFlags(false, true, false, true)
multiaddrs = @[MultiAddress.init("/ip4/127.0.0.1/tcp/442/ws")[], multiaddrs = @[MultiAddress.init("/ip4/127.0.0.1/tcp/442/ws")[],
MultiAddress.init("/ip4/127.0.0.1/tcp/443/wss")[]] MultiAddress.init("/ip4/127.0.0.1/tcp/443/wss")[]]
@ -65,8 +65,8 @@ procSuite "ENR utils":
# Check Waku ENR fields # Check Waku ENR fields
let let
decodedFlags = record.get(WAKU_ENR_FIELD, seq[byte]) decodedFlags = record.get(WAKU_ENR_FIELD, seq[byte])[]
decodedAddrs = record.get(MULTIADDR_ENR_FIELD, seq[byte]).toMultiAddresses() decodedAddrs = record.get(MULTIADDR_ENR_FIELD, seq[byte])[].toMultiAddresses()
check: check:
decodedFlags == @[wakuFlags.byte] decodedFlags == @[wakuFlags.byte]
decodedAddrs.contains(MultiAddress.init("/ip4/127.0.0.1/tcp/442/ws")[]) decodedAddrs.contains(MultiAddress.init("/ip4/127.0.0.1/tcp/442/ws")[])
@ -77,7 +77,7 @@ procSuite "ENR utils":
let let
enrIp = ValidIpAddress.init("127.0.0.1") enrIp = ValidIpAddress.init("127.0.0.1")
enrTcpPort, enrUdpPort = Port(60000) enrTcpPort, enrUdpPort = Port(60000)
enrKey = PrivateKey.random(Secp256k1, rng[])[] enrKey = wakuenr.crypto.PrivateKey.random(Secp256k1, rng[])[]
multiaddrs = @[MultiAddress.init("/ip4/127.0.0.1/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr31iDQpSN5Qa882BCjjwgrD")[]] multiaddrs = @[MultiAddress.init("/ip4/127.0.0.1/tcp/443/wss/p2p/16Uiu2HAm4v86W3bmT1BiH6oSPzcsSr31iDQpSN5Qa882BCjjwgrD")[]]
let let
@ -88,7 +88,7 @@ procSuite "ENR utils":
# Check Waku ENR fields # Check Waku ENR fields
let let
decodedAddrs = record.get(MULTIADDR_ENR_FIELD, seq[byte]).toMultiAddresses() decodedAddrs = record.get(MULTIADDR_ENR_FIELD, seq[byte])[].toMultiAddresses()
check decodedAddrs.contains(MultiAddress.init("/ip4/127.0.0.1/tcp/443/wss")[]) # Peer Id has been stripped check decodedAddrs.contains(MultiAddress.init("/ip4/127.0.0.1/tcp/443/wss")[]) # Peer Id has been stripped
@ -121,7 +121,7 @@ procSuite "ENR utils":
# Check Waku ENR fields # Check Waku ENR fields
let let
decodedAddrs = enrRecord.get(MULTIADDR_ENR_FIELD, seq[byte]).toMultiAddresses() decodedAddrs = enrRecord.get(MULTIADDR_ENR_FIELD, seq[byte])[].toMultiAddresses()
for knownMultiaddr in knownMultiaddrs: for knownMultiaddr in knownMultiaddrs:
check decodedAddrs.contains(knownMultiaddr) check decodedAddrs.contains(knownMultiaddr)

View File

@ -2,6 +2,7 @@
import import
std/[options, sets, tables, os, strutils, sequtils, times], std/[options, sets, tables, os, strutils, sequtils, times],
chronicles,
testutils/unittests, stew/shims/net as stewNet, testutils/unittests, stew/shims/net as stewNet,
json_rpc/[rpcserver, rpcclient], json_rpc/[rpcserver, rpcclient],
eth/[keys, rlp], eth/common/eth_types, eth/[keys, rlp], eth/common/eth_types,
@ -58,15 +59,16 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
let response = await client.get_waku_v2_debug_v1_info() let response = await client.get_waku_v2_debug_v1_info()
check: check:
response.listenAddresses == @[$node.switch.peerInfo.addrs[^1] & "/p2p/" & $node.switch.peerInfo.peerId] response.listenAddresses == @[$node.switch.peerInfo.addrs[^1] & "/p2p/" & $node.switch.peerInfo.peerId]
server.stop() await server.stop()
server.close() await server.closeWait()
waitfor node.stop() waitfor node.stop()
asyncTest "Relay API: publish and subscribe/unsubscribe": asyncTest "Relay API: publish and subscribe/unsubscribe":
@ -84,7 +86,7 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
check: check:
# At this stage the node is only subscribed to the default topic # At this stage the node is only subscribed to the default topic
@ -114,8 +116,9 @@ procSuite "Waku v2 JSON-RPC API":
PubSub(node.wakuRelay).topics.len == 1 PubSub(node.wakuRelay).topics.len == 1
response == true response == true
server.stop() await server.stop()
server.close() await server.closeWait()
waitfor node.stop() waitfor node.stop()
asyncTest "Relay API: get latest messages": asyncTest "Relay API: get latest messages":
@ -156,7 +159,7 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
# First see if we can retrieve messages published on the default topic (node is already subscribed) # First see if we can retrieve messages published on the default topic (node is already subscribed)
await node2.publish(defaultTopic, message1) await node2.publish(defaultTopic, message1)
@ -202,8 +205,9 @@ procSuite "Waku v2 JSON-RPC API":
check: check:
messages.len == 0 messages.len == 0
server.stop() await server.stop()
server.close() await server.closeWait()
await node1.stop() await node1.stop()
await node2.stop() await node2.stop()
await node3.stop() await node3.stop()
@ -230,7 +234,7 @@ procSuite "Waku v2 JSON-RPC API":
node.mountStore(persistMessages = true) node.mountStore(persistMessages = true)
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard waitFor listenSwitch.start() waitFor listenSwitch.start()
node.wakuStore.setPeer(listenSwitch.peerInfo.toRemotePeerInfo()) node.wakuStore.setPeer(listenSwitch.peerInfo.toRemotePeerInfo())
@ -254,15 +258,16 @@ procSuite "Waku v2 JSON-RPC API":
waitFor node.wakuStore.handleMessage(defaultTopic, wakuMsg) waitFor node.wakuStore.handleMessage(defaultTopic, wakuMsg)
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
let response = await client.get_waku_v2_store_v1_messages(some(defaultTopic), some(@[HistoryContentFilter(contentTopic: defaultContentTopic)]), some(0.float64), some(9.float64), some(StorePagingOptions())) let response = await client.get_waku_v2_store_v1_messages(some(defaultTopic), some(@[HistoryContentFilter(contentTopic: defaultContentTopic)]), some(0.float64), some(9.float64), some(StorePagingOptions()))
check: check:
response.messages.len() == 8 response.messages.len() == 8
response.pagingOptions.isSome() response.pagingOptions.isSome()
server.stop() await server.stop()
server.close() await server.closeWait()
waitfor node.stop() waitfor node.stop()
asyncTest "Filter API: subscribe/unsubscribe": asyncTest "Filter API: subscribe/unsubscribe":
@ -282,7 +287,7 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
check: check:
# Light node has not yet subscribed to any filters # Light node has not yet subscribed to any filters
@ -307,8 +312,9 @@ procSuite "Waku v2 JSON-RPC API":
node.filters.len() == 0 node.filters.len() == 0
response == true response == true
server.stop() await server.stop()
server.close() await server.closeWait()
waitfor node.stop() waitfor node.stop()
asyncTest "Filter API: get latest messages": asyncTest "Filter API: get latest messages":
@ -326,7 +332,7 @@ procSuite "Waku v2 JSON-RPC API":
node.mountFilter() node.mountFilter()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
# First ensure subscription exists # First ensure subscription exists
@ -384,8 +390,9 @@ procSuite "Waku v2 JSON-RPC API":
response[0].payload == @[byte 2] response[0].payload == @[byte 2]
response[maxSize - 1].payload == @[byte (maxSize + 1)] response[maxSize - 1].payload == @[byte (maxSize + 1)]
server.stop() await server.stop()
server.close() await server.closeWait()
waitfor node.stop() waitfor node.stop()
asyncTest "Admin API: connect to ad-hoc peers": asyncTest "Admin API: connect to ad-hoc peers":
@ -419,7 +426,7 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
# Connect to nodes 2 and 3 using the Admin API # Connect to nodes 2 and 3 using the Admin API
let postRes = await client.post_waku_v2_admin_v1_peers(@[constructMultiaddrStr(peerInfo2), let postRes = await client.post_waku_v2_admin_v1_peers(@[constructMultiaddrStr(peerInfo2),
@ -440,8 +447,9 @@ procSuite "Waku v2 JSON-RPC API":
getRes.anyIt(it.protocol == WakuRelayCodec and getRes.anyIt(it.protocol == WakuRelayCodec and
it.multiaddr == constructMultiaddrStr(peerInfo3)) it.multiaddr == constructMultiaddrStr(peerInfo3))
server.stop() await server.stop()
server.close() await server.closeWait()
await allFutures([node1.stop(), node2.stop(), node3.stop()]) await allFutures([node1.stop(), node2.stop(), node3.stop()])
asyncTest "Admin API: get managed peer information": asyncTest "Admin API: get managed peer information":
@ -479,7 +487,7 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
let response = await client.get_waku_v2_admin_v1_peers() let response = await client.get_waku_v2_admin_v1_peers()
@ -492,8 +500,9 @@ procSuite "Waku v2 JSON-RPC API":
response.anyIt(it.protocol == WakuRelayCodec and response.anyIt(it.protocol == WakuRelayCodec and
it.multiaddr == constructMultiaddrStr(peerInfo3)) it.multiaddr == constructMultiaddrStr(peerInfo3))
server.stop() await server.stop()
server.close() await server.closeWait()
await allFutures([node1.stop(), node2.stop(), node3.stop()]) await allFutures([node1.stop(), node2.stop(), node3.stop()])
asyncTest "Admin API: get unmanaged peer information": asyncTest "Admin API: get unmanaged peer information":
@ -514,7 +523,7 @@ procSuite "Waku v2 JSON-RPC API":
server.start() server.start()
let client = newRpcHttpClient() let client = newRpcHttpClient()
await client.connect("127.0.0.1", rpcPort) await client.connect("127.0.0.1", rpcPort, false)
node.mountFilter() node.mountFilter()
node.mountSwap() node.mountSwap()
@ -548,8 +557,9 @@ procSuite "Waku v2 JSON-RPC API":
# Check store peer # Check store peer
(response.filterIt(it.protocol == WakuStoreCodec)[0]).multiaddr == constructMultiaddrStr(storePeer) (response.filterIt(it.protocol == WakuStoreCodec)[0]).multiaddr == constructMultiaddrStr(storePeer)
server.stop() await server.stop()
server.close() await server.closeWait()
waitfor node.stop() waitfor node.stop()
asyncTest "Private API: generate asymmetric keys and encrypt/decrypt communication": asyncTest "Private API: generate asymmetric keys and encrypt/decrypt communication":
@ -595,10 +605,10 @@ procSuite "Waku v2 JSON-RPC API":
server3.start() server3.start()
let client1 = newRpcHttpClient() let client1 = newRpcHttpClient()
await client1.connect("127.0.0.1", rpcPort1) await client1.connect("127.0.0.1", rpcPort1, false)
let client3 = newRpcHttpClient() let client3 = newRpcHttpClient()
await client3.connect("127.0.0.1", rpcPort3) await client3.connect("127.0.0.1", rpcPort3, false)
# Let's get a keypair for node3 # Let's get a keypair for node3
@ -634,10 +644,11 @@ procSuite "Waku v2 JSON-RPC API":
check: check:
messages.len == 0 messages.len == 0
server1.stop() await server1.stop()
server1.close() await server1.closeWait()
server3.stop() await server3.stop()
server3.close() await server3.closeWait()
await node1.stop() await node1.stop()
await node2.stop() await node2.stop()
await node3.stop() await node3.stop()
@ -685,10 +696,10 @@ procSuite "Waku v2 JSON-RPC API":
server3.start() server3.start()
let client1 = newRpcHttpClient() let client1 = newRpcHttpClient()
await client1.connect("127.0.0.1", rpcPort1) await client1.connect("127.0.0.1", rpcPort1, false)
let client3 = newRpcHttpClient() let client3 = newRpcHttpClient()
await client3.connect("127.0.0.1", rpcPort3) await client3.connect("127.0.0.1", rpcPort3, false)
# Let's get a symkey for node3 # Let's get a symkey for node3
@ -724,10 +735,11 @@ procSuite "Waku v2 JSON-RPC API":
check: check:
messages.len == 0 messages.len == 0
server1.stop() await server1.stop()
server1.close() await server1.closeWait()
server3.stop() await server3.stop()
server3.close() await server3.closeWait()
await node1.stop() await node1.stop()
await node2.stop() await node2.stop()
await node3.stop() await node3.stop()

View File

@ -24,10 +24,10 @@ procSuite "Waku Filter":
post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic) post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
var responseRequestIdFuture = newFuture[string]() var responseRequestIdFuture = newFuture[string]()
proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} = proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} =
@ -69,10 +69,10 @@ procSuite "Waku Filter":
post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic) post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
var responseCompletionFuture = newFuture[bool]() var responseCompletionFuture = newFuture[bool]()
proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} = proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} =
@ -128,7 +128,7 @@ procSuite "Waku Filter":
contentTopic = ContentTopic("/waku/2/default-content/proto") contentTopic = ContentTopic("/waku/2/default-content/proto")
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var responseRequestIdFuture = newFuture[string]() var responseRequestIdFuture = newFuture[string]()
proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} = proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} =
@ -155,10 +155,10 @@ procSuite "Waku Filter":
post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic) post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
var responseCompletionFuture = newFuture[bool]() var responseCompletionFuture = newFuture[bool]()
proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} = proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} =
@ -213,16 +213,16 @@ procSuite "Waku Filter":
const defaultTopic = "/waku/2/default-waku/proto" const defaultTopic = "/waku/2/default-waku/proto"
let let
key = PrivateKey.random(ECDSA, rng[]).get() dialKey = PrivateKey.random(ECDSA, rng[]).get()
peer = PeerInfo.new(key) listenKey = PrivateKey.random(ECDSA, rng[]).get()
contentTopic = ContentTopic("/waku/2/default-content/proto") contentTopic = ContentTopic("/waku/2/default-content/proto")
post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic) post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch(privKey = some(dialKey), addrs = MultiAddress.init("/ip4/127.0.0.1/tcp/65000").tryGet())
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(listenKey))
discard await listenSwitch.start() await listenSwitch.start()
var responseCompletionFuture = newFuture[bool]() var responseCompletionFuture = newFuture[bool]()
proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} = proc handle(requestId: string, msg: MessagePush) {.gcsafe, closure.} =
@ -258,7 +258,7 @@ procSuite "Waku Filter":
responseCompletionFuture = newFuture[bool]() responseCompletionFuture = newFuture[bool]()
# Stop switch to test unsubscribe # Stop switch to test unsubscribe
discard dialSwitch.stop() await dialSwitch.stop()
await sleepAsync(1.seconds) await sleepAsync(1.seconds)
@ -268,8 +268,11 @@ procSuite "Waku Filter":
check: check:
proto2.failedPeers.len() == 1 proto2.failedPeers.len() == 1
discard dialSwitch.start() # Start switch with same key as before
dialSwitch.mount(proto) var dialSwitch2 = newStandardSwitch(some(dialKey), addrs = MultiAddress.init("/ip4/127.0.0.1/tcp/65000").tryGet())
await dialSwitch2.start()
dialSwitch2.mount(proto)
#Second failure should remove the subscription #Second failure should remove the subscription
await proto2.handleMessage(defaultTopic, post) await proto2.handleMessage(defaultTopic, post)
@ -280,5 +283,5 @@ procSuite "Waku Filter":
check: check:
proto2.failedPeers.len() == 0 proto2.failedPeers.len() == 0
discard dialSwitch.stop() await dialSwitch2.stop()
discard listenSwitch.stop() await listenSwitch.stop()

View File

@ -25,10 +25,10 @@ procSuite "Waku Light Push":
post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic) post = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
var responseRequestIdFuture = newFuture[string]() var responseRequestIdFuture = newFuture[string]()
var completionFut = newFuture[bool]() var completionFut = newFuture[bool]()

View File

@ -26,10 +26,10 @@ procSuite "Waku Store":
msg2 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: ContentTopic("2")) msg2 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: ContentTopic("2"))
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -66,10 +66,10 @@ procSuite "Waku Store":
msg3 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: topic3) msg3 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: topic3)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -109,10 +109,10 @@ procSuite "Waku Store":
msg3 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic3) msg3 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: contentTopic3)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -153,10 +153,10 @@ procSuite "Waku Store":
msg3 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: defaultContentTopic) msg3 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: defaultContentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -194,10 +194,10 @@ procSuite "Waku Store":
msg3 = WakuMessage(payload: @[byte 7, 8, 9,], contentTopic: defaultContentTopic) msg3 = WakuMessage(payload: @[byte 7, 8, 9,], contentTopic: defaultContentTopic)
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -240,10 +240,10 @@ procSuite "Waku Store":
msg2 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: ContentTopic("2")) msg2 = WakuMessage(payload: @[byte 1, 2, 3], contentTopic: ContentTopic("2"))
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng(), store) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng(), store)
@ -275,7 +275,7 @@ procSuite "Waku Store":
key2 = PrivateKey.random(ECDSA, rng[]).get() key2 = PrivateKey.random(ECDSA, rng[]).get()
var listenSwitch2 = newStandardSwitch(some(key2)) var listenSwitch2 = newStandardSwitch(some(key2))
discard await listenSwitch2.start() await listenSwitch2.start()
proto2.setPeer(listenSwitch2.peerInfo.toRemotePeerInfo()) proto2.setPeer(listenSwitch2.peerInfo.toRemotePeerInfo())
@ -310,10 +310,10 @@ procSuite "Waku Store":
WakuMessage(payload: @[byte 9],contentTopic: ContentTopic("2"))] WakuMessage(payload: @[byte 9],contentTopic: ContentTopic("2"))]
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let let
proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -359,10 +359,10 @@ procSuite "Waku Store":
WakuMessage(payload: @[byte 9],contentTopic: ContentTopic("2"))] WakuMessage(payload: @[byte 9],contentTopic: ContentTopic("2"))]
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) let proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -406,10 +406,10 @@ procSuite "Waku Store":
WakuMessage(payload: @[byte 9], contentTopic: ContentTopic("2"))] WakuMessage(payload: @[byte 9], contentTopic: ContentTopic("2"))]
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) let proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -547,11 +547,11 @@ procSuite "Waku Store":
WakuMessage(payload: @[byte 9],contentTopic: ContentTopic("1"),timestamp: float(9))] WakuMessage(payload: @[byte 9],contentTopic: ContentTopic("1"),timestamp: float(9))]
var dialSwitch = newStandardSwitch() var dialSwitch = newStandardSwitch()
discard await dialSwitch.start() await dialSwitch.start()
# to be connected to # to be connected to
var listenSwitch = newStandardSwitch(some(key)) var listenSwitch = newStandardSwitch(some(key))
discard await listenSwitch.start() await listenSwitch.start()
let proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng()) let proto = WakuStore.init(PeerManager.new(dialSwitch), crypto.newRng())
@ -631,7 +631,7 @@ procSuite "Waku Store":
asyncTest "resume message history": asyncTest "resume message history":
# starts a new node # starts a new node
var dialSwitch2 = newStandardSwitch() var dialSwitch2 = newStandardSwitch()
discard await dialSwitch2.start() await dialSwitch2.start()
let proto2 = WakuStore.init(PeerManager.new(dialSwitch2), crypto.newRng()) let proto2 = WakuStore.init(PeerManager.new(dialSwitch2), crypto.newRng())
proto2.setPeer(listenSwitch.peerInfo.toRemotePeerInfo()) proto2.setPeer(listenSwitch.peerInfo.toRemotePeerInfo())
@ -685,7 +685,7 @@ procSuite "Waku Store":
# starts a new node # starts a new node
var dialSwitch3 = newStandardSwitch() var dialSwitch3 = newStandardSwitch()
discard await dialSwitch3.start() await dialSwitch3.start()
let proto3 = WakuStore.init(PeerManager.new(dialSwitch3), crypto.newRng()) let proto3 = WakuStore.init(PeerManager.new(dialSwitch3), crypto.newRng())
let successResult = await proto3.resume(some(@[offListenSwitch.peerInfo.toRemotePeerInfo(), let successResult = await proto3.resume(some(@[offListenSwitch.peerInfo.toRemotePeerInfo(),

@ -1 +1 @@
Subproject commit 536cc6b7933e5f86590bb27083c0ffeab31255f9 Subproject commit fbb76f8af8a33ab818184a7d4406d9fee20993be

2
vendor/news vendored

@ -1 +1 @@
Subproject commit b888b22585c6bda0cd7d3f4ee2d75f743b9dd5b1 Subproject commit fadc54f4683869fe9c97fe59e122daa2607abc8e

2
vendor/nim-bearssl vendored

@ -1 +1 @@
Subproject commit dc62f4fccd2d40c884009ae8f2b14bb6a86a55cf Subproject commit ba80e2a0d7ae8aab666cee013e38ff8d33a3e5e7

@ -1 +1 @@
Subproject commit 9aabb5a028defc961fecb263ac9a3c5bba263ea2 Subproject commit 1682096306ddba8185dcfac360a8c3f952d721e4

2
vendor/nim-chronos vendored

@ -1 +1 @@
Subproject commit 661eae5732c54c40158679af9c7a34ed1245e647 Subproject commit 17fed89c99beac5a92d3668d0d3e9b0e4ac13936

@ -1 +1 @@
Subproject commit 7176de4ddb3a628a5c3abfcd430010bf0229deb1 Subproject commit 0435e67832b6bb8dfdf0ddb102903e9d820206d2

2
vendor/nim-dnsdisc vendored

@ -1 +1 @@
Subproject commit 2d448241fdb8f8e806089ef4dc978d0eff211117 Subproject commit d39f300a74bcf5e623bcd4d75ff5ab49e5b81fab

2
vendor/nim-eth vendored

@ -1 +1 @@
Subproject commit d4cc42241df92fc661fb9cdfe08048715db793cd Subproject commit 26ab9b078e610b0eb685e8d98a1f34d9bfabb053

@ -1 +1 @@
Subproject commit 1b561a9e71b6bdad1c1cdff753418906037e9d09 Subproject commit 371e60b17ca6c15aa35a6c42568f32a90ce7ade7

@ -1 +1 @@
Subproject commit 689da19e9e9cfff4ced85e2b25c6b2b5598ed079 Subproject commit ad6f82e4b7d504ea9b8222c9c01aa1d24ebd4dc8

2
vendor/nim-json-rpc vendored

@ -1 +1 @@
Subproject commit 2307dbec579ceaf60aa3afd5f338ecfba127f104 Subproject commit 5a281760803907f4989cacf109b516381dfbbe11

@ -1 +1 @@
Subproject commit 297496d703a43cbbe00323abe7f0b7f8e320ff33 Subproject commit 4b8f487d2dfdd941df7408ceaa70b174cce02180

2
vendor/nim-libp2p vendored

@ -1 +1 @@
Subproject commit e1d96a0f4d7620b3ebb16396c26a14306ddd3ddd Subproject commit e72d03bc78d3bc896ae5912ab45e2ecd53849aa5

2
vendor/nim-metrics vendored

@ -1 +1 @@
Subproject commit b4c6a51ee75b102a9e36b8b8f2a02760d38219d8 Subproject commit 71e0f0e354e1f4c59e3dc92153989c8b723c3440

@ -1 +1 @@
Subproject commit d790c42206fab4b8008eaa91181ca8c8c68a0105 Subproject commit e092373a5cbe1fa25abfc62e0f2a5f138dc3fb13

@ -1 +1 @@
Subproject commit fcd0eadadde0ee000a63df8ab21dc4e9f015a790 Subproject commit 37bc0db558d85711967acb16e9bb822b06911d46

2
vendor/nim-stew vendored

@ -1 +1 @@
Subproject commit b002c1fad025c6b5fe1f6af1fbb7502dc3173beb Subproject commit 6ad35b876fb6ebe0dfee0f697af173acc47906ee

2
vendor/nim-stint vendored

@ -1 +1 @@
Subproject commit 036c71d06a6b22f8f967ba9d54afd2189c3872ca Subproject commit e17113fb31bc90780ce89ab5de0f4a60d40d3aa1

@ -1 +1 @@
Subproject commit 6d76fc5e51ce6580289e872558a3b858775e310f Subproject commit 1f66448152a03e45ebb556c00300e13565cd8adf

@ -1 +1 @@
Subproject commit f1d70dbb8c7b5e2474b0bd5ac52f42c8c4318fd2 Subproject commit 4e2893eacb916c7678fdc4935ff7420f13bf3a9c

2
vendor/nim-web3 vendored

@ -1 +1 @@
Subproject commit d101f395e942ced1de71c0a22c8ac8f83fb71e8b Subproject commit 980461c982b284cb511b9f544e25187c527516f3

2
vendor/nim-websock vendored

@ -1 +1 @@
Subproject commit 1abf5f2f91ae3e8483c2acbb108dea521879c6e2 Subproject commit 73edde4417f7b45003113b7a34212c3ccd95b9fd

2
vendor/nim-zlib vendored

@ -1 +1 @@
Subproject commit 6bbc67d09e624d69052d62b2353878f491186942 Subproject commit d4e716d071eba1b5e0ffdf7949d983959e2b95dd

@ -1 +1 @@
Subproject commit 9d6b4b6e98515af8248127f51889c24308006096 Subproject commit 25a4c270330026442e09f6cddfb7a944da7cfa4b

View File

@ -18,9 +18,9 @@ let
lightNode = newRpcHttpClient() lightNode = newRpcHttpClient()
lightNode2 = newRpcHttpClient() lightNode2 = newRpcHttpClient()
waitFor lightNode.connect("localhost", Port(8545)) waitFor lightNode.connect("localhost", Port(8545), false)
waitFor lightNode2.connect("localhost", Port(8546)) waitFor lightNode2.connect("localhost", Port(8546), false)
waitFor trafficNode.connect("localhost", Port(8548)) waitFor trafficNode.connect("localhost", Port(8548), false)
proc generateTopics(amount = topicAmount): seq[waku_protocol.Topic] = proc generateTopics(amount = topicAmount): seq[waku_protocol.Topic] =
var topic: waku_protocol.Topic var topic: waku_protocol.Topic

View File

@ -46,7 +46,7 @@ var nodes: seq[RPCHttpClient]
for i in 0..<amount: for i in 0..<amount:
var node = newRpcHttpClient() var node = newRpcHttpClient()
nodes.add(node) nodes.add(node)
waitFor nodes[i].connect("localhost", Port(8547+i)) waitFor nodes[i].connect("localhost", Port(8547+i), false)
var res = waitFor nodes[i].post_waku_v2_relay_v1_subscriptions(@[defaultTopic]) var res = waitFor nodes[i].post_waku_v2_relay_v1_subscriptions(@[defaultTopic])
os.sleep(2000) os.sleep(2000)

View File

@ -84,7 +84,6 @@ type
wakuLightPush*: WakuLightPush wakuLightPush*: WakuLightPush
enr*: enr.Record enr*: enr.Record
libp2pPing*: Ping libp2pPing*: Ping
libp2pTransportLoops*: seq[Future[void]]
filters*: Filters filters*: Filters
rng*: ref BrHmacDrbgContext rng*: ref BrHmacDrbgContext
wakuDiscv5*: WakuDiscoveryV5 wakuDiscv5*: WakuDiscoveryV5
@ -857,7 +856,7 @@ proc start*(node: WakuNode) {.async.} =
## ##
## Status: Implemented. ## Status: Implemented.
node.libp2pTransportLoops = await node.switch.start() await node.switch.start()
# TODO Get this from WakuNode obj # TODO Get this from WakuNode obj
let peerInfo = node.switch.peerInfo let peerInfo = node.switch.peerInfo