mirror of
https://github.com/waku-org/nwaku.git
synced 2025-01-15 01:14:56 +00:00
385daf16be
* on_chain/group_manager: use .async: (raises:[Exception]). * bump nim-dnsdisc * update nim-chronos to the latest state * chat2.nim: catch any possible exception when stopping * chat2bridge.nim: make it to compile after vendor bump * ValidIpAddress (deprecated) -> IpAddress * vendor/nim-libp2p additional bump * libwaku: adapt to vendor bump * testlib/wakunode.nim: adapt to vendor bump (ValidIpAddress -> IpAddress) * waku_node: avoid throwing any exception from stop*(node: WakuNode) * test_confutils_envvar.nim: ValidIpAddress -> IpAddress * test_jsonrpc_store: capture exception * test_rln*: handling exceptions * adaptation to make test_rln_* to work properly * signature enhancement of group_manager methods
54 lines
1.5 KiB
Nim
54 lines
1.5 KiB
Nim
{.used.}
|
|
|
|
import
|
|
std/[options, sequtils, tables],
|
|
testutils/unittests,
|
|
chronos,
|
|
chronicles,
|
|
stew/shims/net,
|
|
libp2p/switch,
|
|
libp2p/peerId,
|
|
libp2p/crypto/crypto,
|
|
libp2p/multistream,
|
|
libp2p/muxers/muxer,
|
|
eth/keys,
|
|
eth/p2p/discoveryv5/enr
|
|
import
|
|
../../waku/waku_node,
|
|
../../waku/waku_core/topics,
|
|
../../waku/node/peer_manager,
|
|
../../waku/waku_discv5,
|
|
../../waku/waku_metadata,
|
|
./testlib/wakucore,
|
|
./testlib/wakunode
|
|
|
|
|
|
procSuite "Waku Metadata Protocol":
|
|
asyncTest "request() returns the supported metadata of the peer":
|
|
let clusterId = 10.uint32
|
|
let
|
|
node1 = newTestWakuNode(generateSecp256k1Key(), parseIpAddress("0.0.0.0"), Port(0), clusterId = clusterId)
|
|
node2 = newTestWakuNode(generateSecp256k1Key(), parseIpAddress("0.0.0.0"), Port(0), clusterId = clusterId)
|
|
|
|
# Start nodes
|
|
await allFutures([node1.start(), node2.start()])
|
|
|
|
node1.topicSubscriptionQueue.emit((kind: PubsubSub, topic: "/waku/2/rs/10/7"))
|
|
node1.topicSubscriptionQueue.emit((kind: PubsubSub, topic: "/waku/2/rs/10/6"))
|
|
|
|
# Create connection
|
|
let connOpt = await node2.peerManager.dialPeer(node1.switch.peerInfo.toRemotePeerInfo(), WakuMetadataCodec)
|
|
require:
|
|
connOpt.isSome
|
|
|
|
# Request metadata
|
|
let response1 = await node2.wakuMetadata.request(connOpt.get())
|
|
|
|
# Check the response or dont even continue
|
|
require:
|
|
response1.isOk
|
|
|
|
check:
|
|
response1.get().clusterId.get() == clusterId
|
|
response1.get().shards == @[uint32(6), uint32(7)]
|
|
|