chore: move networkmonitor and wakucanary to apps directory

This commit is contained in:
Lorenzo Delgado 2023-04-27 16:25:31 +02:00 committed by GitHub
parent ce92fc1aed
commit 209579b0a7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 48 additions and 686 deletions

View File

@ -166,7 +166,7 @@ testcommon: | build deps
#############
## Waku v2 ##
#############
.PHONY: testwaku2 wakunode2 testwakunode2 example2 sim2 scripts2 wakubridge testbridge chat2 chat2bridge
.PHONY: testwaku2 wakunode2 testwakunode2 example2 wakubridge testbridge chat2 chat2bridge
testwaku2: | build deps librln
echo -e $(BUILD_MSG) "build/$@" && \
@ -184,16 +184,6 @@ example2: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims
# TODO: Remove unused target
sim2: | build deps wakunode2
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim sim2 $(NIM_PARAMS) waku.nims
# TODO: Remove unused target
scripts2: | build deps wakunode2
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim scripts2 $(NIM_PARAMS) waku.nims
wakubridge: | build deps
echo -e $(BUILD_MSG) "build/$@" && \
$(ENV_SCRIPT) nim bridge $(NIM_PARAMS) waku.nims

View File

@ -1,8 +0,0 @@
# Description
Collection of scripts and utilities for checking, monitoring, and simulating waku networks.
# Tools
* [networkmonitor](./networkmonitor) - Metrics generation tool for Waku networks.
* [wakucanary](./wakucanary) - Tool for checking availability of waku peers.

View File

@ -1,26 +0,0 @@
import
os, strutils, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
libp2p/protobuf/minprotobuf,
libp2p/[peerinfo, multiaddress],
eth/common as eth_common, eth/keys,
system,
options
import
../../waku/v2/waku_node,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/waku_filter,
../../waku/v2/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = sourceDir / "../jsonrpc/jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
var node = newRpcHttpClient()
waitfor node.connect("localhost", Port(8545))
var res = waitfor node.get_waku_v2_debug_v1_info()
echo "Waku info res: ", res

View File

@ -1,40 +0,0 @@
import
os, strutils, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
stew/byteutils,
libp2p/protobuf/minprotobuf,
eth/common as eth_common, eth/keys,
system,
options
import
../../waku/v2/waku_node,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/waku_filter,
../../waku/v2/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = sourceDir / "../jsonrpc/jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
if paramCount() < 1:
echo "Please provide rpcPort as argument."
quit(1)
let rpcPort = Port(parseInt(paramStr(1)))
echo "Please enter your message:"
let raw_input = readLine(stdin)
let input = fmt"{raw_input}"
echo "Input is:", input
var node = newRpcHttpClient()
waitfor node.connect("localhost", rpcPort)
let pubSubTopic = "/waku/2/default-waku/proto"
let contentTopic = ContentTopic("/waku/2/default-content/proto")
let relayMessage = WakuRelayMessage(payload: input.toBytes(), contentTopic: some(contentTopic))
var res = waitfor node.post_waku_v2_relay_v1_message(pubSubTopic, relayMessage)
echo "Waku publish response: ", res

View File

@ -1,43 +0,0 @@
import
os, strutils, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
libp2p/protobuf/minprotobuf,
libp2p/[peerinfo, multiaddress],
eth/common as eth_common, eth/keys,
system,
options
import
../../waku/v2/waku_node,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/waku_filter,
../../waku/v2/waku_store/rpc,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = sourceDir / "../jsonrpc/jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
if paramCount() < 1:
echo "Please provide rpcPort as argument."
quit(1)
let rpcPort = Port(parseInt(paramStr(1)))
echo "Please enter your pubsub topic:"
let raw_pubsub = readLine(stdin)
let pubsubTopic = fmt"{raw_pubsub}"
echo "PubSubTopic is:", pubsubTopic
echo "Please enter your content topic:"
let raw_input = readLine(stdin)
let input = fmt"{raw_input}"
echo "Content topic is:", input
var node = newRpcHttpClient()
waitfor node.connect("localhost", rpcPort)
var res = waitfor node.get_waku_v2_store_v1_messages(some(pubsubTopic), some(@[HistoryContentFilterRPC(contentTopic: ContentTopic(input))]), none(StorePagingOptions))
echo "Waku query response: ", res

View File

@ -1,36 +0,0 @@
import
os, strutils, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
libp2p/protobuf/minprotobuf,
eth/common as eth_common, eth/keys,
system,
options
import
../../waku/v2/waku_node,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/waku_filter,
../../waku/v2/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = sourceDir / "../jsonrpc/jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
if paramCount() < 1:
echo "Please provide rpcPort as argument."
quit(1)
let rpcPort = Port(parseInt(paramStr(1)))
var client = newRpcHttpClient()
waitfor client.connect("localhost", rpcPort)
echo "Subscribing"
# Subscribe to waku topic
var res = waitFor client.post_waku_v2_relay_v1_subscriptions(@["/waku/2/default-waku/proto"])
echo res

View File

@ -1,39 +0,0 @@
import
os, strutils, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand,
libp2p/protobuf/minprotobuf,
libp2p/[peerinfo, multiaddress],
eth/common as eth_common, eth/keys,
system,
options
import
../../waku/v2/waku_node,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/waku_filter,
../../waku/v2/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = sourceDir / "../jsonrpc/jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
if paramCount() < 1:
echo "Please provide rpcPort as argument."
quit(1)
let rpcPort = Port(parseInt(paramStr(1)))
echo "Please enter your topic:"
let raw_input = readLine(stdin)
let input = fmt"{raw_input}"
echo "Input is:", input
var node = newRpcHttpClient()
waitfor node.connect("localhost", rpcPort)
let pubSubTopic = "/waku/2/default-waku/proto"
let contentTopic = ContentTopic("/waku/2/default-content/proto")
var res = waitfor node.post_waku_v2_filter_v1_subscription(@[ContentFilter(topics: @[contentTopic])], some(pubSubTopic))
echo "Waku query response: ", res

View File

@ -1,147 +0,0 @@
import
std/[os, strutils, times, options], #options as what # TODO: Huh? Redefinition?
chronicles,
eth/common as eth_common,
eth/keys,
json_rpc/[rpcclient, rpcserver],
libp2p/protobuf/minprotobuf
import
../../waku/v2/waku_filter/rpc,
../../waku/v2/waku_store/rpc,
../../waku/v2/waku_core,
../../waku/v2/waku_node,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/[jsonrpc_types,jsonrpc_utils]
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
const sigWakuPath = sourceDir / ".." / ".." / "waku" / "v2" / "node" / "jsonrpc" / "jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
const topicAmount = 10 #100
proc message(i: int): ProtoBuffer =
let value = "hello " & $(i)
var result = initProtoBuffer()
result.write(1, value)
result.finish()
proc handler(topic: string, data: seq[byte]) {.async, gcsafe.} =
debug "Hit handler", topic=topic, data=data
# Scenario xx1 - 16 full nodes
#########################################
let amount = 16
var nodes: seq[RPCHttpClient]
for i in 0..<amount:
var node = newRpcHttpClient()
nodes.add(node)
waitFor nodes[i].connect("localhost", Port(8547+i), false)
var res = waitFor nodes[i].post_waku_v2_relay_v1_subscriptions(@[DefaultPubsubTopic])
os.sleep(2000)
# # TODO: Show plaintext message in log
# for i in 0..<topicAmount:
# os.sleep(50)
# # TODO: This would then publish on a subtopic here
# var s = "hello " & $2
# var res3 = waitFor nodes[0].wakuPublish(DefaultPbsubTopic, s)
# Scenario xx3 - same as xx1 but publish from multiple nodes
# To compare FloodSub and GossipSub factor
for i in 0..<topicAmount:
os.sleep(50)
# TODO: This would then publish on a subtopic here
var res3 = waitFor nodes[0].post_waku_v2_relay_v1_message(DefaultPubsubTopic, WakuRelayMessage(payload: message(0).buffer, contentTopic: some(DefaultContentTopic), timestamp: some(getNanosecondTime(epochTime()))))
res3 = waitFor nodes[1].post_waku_v2_relay_v1_message(DefaultPubsubTopic, WakuRelayMessage(payload: message(1).buffer, contentTopic: some(DefaultContentTopic), timestamp: some(getNanosecondTime(epochTime()))))
res3 = waitFor nodes[2].post_waku_v2_relay_v1_message(DefaultPubsubTopic, WakuRelayMessage(payload: message(2).buffer, contentTopic: some(DefaultContentTopic), timestamp: some(getNanosecondTime(epochTime()))))
res3 = waitFor nodes[3].post_waku_v2_relay_v1_message(DefaultPubsubTopic, WakuRelayMessage(payload: message(3).buffer, contentTopic: some(DefaultContentTopic), timestamp: some(getNanosecondTime(epochTime()))))
res3 = waitFor nodes[4].post_waku_v2_relay_v1_message(DefaultPubsubTopic, WakuRelayMessage(payload: message(4).buffer, contentTopic: some(DefaultContentTopic), timestamp: some(getNanosecondTime(epochTime()))))
# Scenario xx2 - 14 full nodes, two edge nodes
# Assume one full topic
#########################################
#let nodea = newRpcHttpClient()
#let nodeb = newRpcHttpClient()
#
#waitFor nodea.connect("localhost", Port(8545))
#waitFor nodeb.connect("localhost", Port(8546))
#
#let version = waitFor nodea.wakuVersion()
#info "Version is", version
#
#let res1 = waitFor nodea.wakuSubscribe(DefaultPbsubTopic)
#let res2 = waitFor nodeb.wakuSubscribe(DefaultPbsubTopic)
#
#let amount = 14
#var nodes: seq[RPCHttpClient]
#for i in 0..<amount:
# var node = newRpcHttpClient()
# nodes.add(node)
# waitFor nodes[i].connect("localhost", Port(8547+i))
# var res = waitFor nodes[i].wakuSubscribe(DefaultPbsubTopic)
#
#os.sleep(2000)
#
## TODO: Show plaintext message in log
#for i in 0..<topicAmount:
# os.sleep(50)
# # TODO: This would then publish on a subtopic here
# var s = "hello " & $2
# var res3 = waitFor nodea.wakuPublish(DefaultPbsubTopic, s)
# Misc old scenarios
#########################################
# All full nodes connected etc
#
# let node1 = newRpcHttpClient()
# let node2 = newRpcHttpClient()
# let node3 = newRpcHttpClient()
# let node4 = newRpcHttpClient()
# let node5 = newRpcHttpClient()
# let node6 = newRpcHttpClient()
# waitFor node1.connect("localhost", Port(8547))
# waitFor node2.connect("localhost", Port(8548))
# waitFor node3.connect("localhost", Port(8549))
# waitFor node4.connect("localhost", Port(8550))
# waitFor node5.connect("localhost", Port(8551))
# waitFor node6.connect("localhost", Port(8552))
# let version = waitFor node6.wakuVersion()
# info "Version is", version
# # TODO: Implement handler logic
# # All subscribing to foobar topic
# let res2 = waitFor node2.wakuSubscribe("foobar")
# let res3 = waitFor node3.wakuSubscribe("foobar")
# let res4 = waitFor node4.wakuSubscribe("foobar")
# let res5 = waitFor node5.wakuSubscribe("foobar")
# let res6 = waitFor node6.wakuSubscribe("foobar")
# os.sleep(2000)
# # info "Posting envelopes on all subscribed topics"
# for i in 0..<topicAmount:
# os.sleep(50)
# let res2 = waitFor node1.wakuPublish("foobar", "hello world")
# os.sleep(2000)
# for i in 0..<topicAmount:
# os.sleep(50)
# let res2 = waitFor node1.wakuPublish("foobar", "hello world2")
# Node 00 and 05 also subscribe
# XXX I confirm this works. As in - with this we have A-B
# Now to tweak it!
# let node0 = newRpcHttpClient()
# let node5 = newRpcHttpClient()
# waitFor node0.connect("localhost", Port(8547))
# waitFor node5.connect("localhost", Port(8552))
# let res4 = waitFor node0.wakuSubscribe("foobar")
# let res5 = waitFor node5.wakuSubscribe("foobar")

View File

@ -1,278 +0,0 @@
import
strformat, os, osproc, net, strformat, chronicles, confutils, json,
eth/p2p/discoveryv5/enr,
eth/keys,
stew/shims/net as stewNet,
libp2p/multiaddress,
libp2p/crypto/crypto,
libp2p/crypto/secp,
libp2p/peerinfo
# Fix ambiguous call error
import strutils except fromHex
const
# Scenarios without discv5
# defaults ="--log-level:TRACE --metrics-logging --metrics-server --rpc"
# # Scenarios using discv5
defaults ="--log-level:TRACE --metrics-logging --metrics-server --rpc --discv5-discovery --discv5-table-ip-limit=1024 --discv5-bucket-ip-limit=16 --discv5-bits-per-hop=1"
wakuNodeBin = "build" / "wakunode2"
metricsDir = "metrics"
portOffset = 2
discv5ExtIpAddr = "127.0.0.1" # Scenarios using discv5
type
NodeInfo* = object
cmd: string
master: bool
address: string
shift: int
label: string
enrUri: string # Scenarios using discv5
Topology = enum
Star,
FullMesh,
BootstrapFleet # comprising one full-mesh core (fleet) and satellites (full nodes) using the fleet as bootstrap nodes
WakuNetworkConf* = object
topology* {.
desc: "Set the network topology."
defaultValue: FullMesh
name: "topology" .}: Topology
amount* {.
desc: "Amount of relay nodes to be started."
defaultValue: 16
name: "amount" .}: int
numFleetNodes* {.
desc: "Number of Fleetnodes."
defaultValue: 3
name: "numFleetNodes" .}: int
proc debugPrintEnrURI(enrUri: string) =
var r: Record
if not fromURI(r, enrUri):
echo "could not read ENR URI"
echo "ENR content: ", r
# NOTE: Don't distinguish between node types here a la full node, light node etc
proc initNodeCmd(shift: int, staticNodes: seq[string] = @[], master = false, label: string, discv5BootStrapEnrs: seq[string] = @[]): NodeInfo =
let
rng = crypto.newRng()
key = SkPrivateKey.random(rng[])
hkey = key.getBytes().toHex()
rkey = SkPrivateKey.init(fromHex(hkey))[] #assumes ok
privKey = crypto.PrivateKey(scheme: Secp256k1, skkey: rkey)
#privKey = PrivateKey.random(Secp256k1)
pubkey = privKey.getPublicKey()[] #assumes ok
keyPair = crypto.KeyPair(seckey: privKey, pubkey: pubkey)
peerInfo = PeerInfo.new(privKey)
port = 60000 + shift
discv5Port = 9000 + shift
#DefaultAddr = "/ip4/127.0.0.1/tcp/55505"
address = "/ip4/127.0.0.1/tcp/" & $port
hostAddress = MultiAddress.init(address).tryGet()
info "Address", address
# TODO: Need to port shift
peerInfo.listenAddrs.add(hostAddress)
let id = $peerInfo.peerId
info "PeerInfo", id = id, addrs = peerInfo.listenAddrs
let listenStr = $peerInfo.listenAddrs[0] & "/p2p/" & id
result.cmd = wakuNodeBin & " " & defaults & " "
result.cmd &= "--nodekey:" & hkey & " "
result.cmd &= "--ports-shift:" & $shift & " "
if staticNodes.len > 0:
for staticNode in staticNodes:
result.cmd &= "--staticnode:" & staticNode & " "
# Scenarios using discv5
result.cmd &= "--nat:extip:" & discv5ExtIpAddr & " "
if discv5BootStrapEnrs.len > 0:
for enr in discv5BootStrapEnrs:
result.cmd &= "--discv5-bootstrap-node:" & enr & " "
result.shift = shift
result.label = label
result.master = master
result.address = listenStr
# Scenarios using discv5
# We have to manually build the ENR which the node ran with the currently build node command will generate,
# because we need to know it before the node starts in order to be able to provide it as bootstrap information.
# Note: the ENR built here is not exactly the same as we don't integrate the waku2 key in this test scenario.
let enr = enr.Record.init(1,
keys.PrivateKey.fromHex(hkey).expect("could not convert priv key from hex"),
some(stewNet.ValidIpAddress.init(discv5ExtIpAddr)),
some(Port(discv5Port)), # tcp-port
some(Port(discv5Port))) # udp-port
.expect("Record within size limits")
result.enrUri = "enr:" & enr.toBase64
info "Node command created.", cmd=result.cmd, address = result.address
# # Scenarios without discv5
# proc starNetwork(amount: int): seq[NodeInfo] =
# let masterNode = initNodeCmd(portOffset, master = true, label = "master node")
# result.add(masterNode)
# for i in 1..<amount:
# result.add(initNodeCmd(portOffset + i, @[masterNode.address], label = "full node"))
# Scenarios using discv5
proc starNetwork(amount: int): seq[NodeInfo] =
let masterNode = initNodeCmd(portOffset, master = true, label = "master node")
let bootstrapEnrList = @[masterNode.enrUri]
result.add(masterNode)
for i in 1..<amount:
result.add(initNodeCmd(portOffset + i, label = "full node", discv5BootStrapEnrs = bootstrapEnrList)) # no waku bootstrap nodes; get bootstrap waku nodes via discv5
# Scenarios using discv5
proc bootstrapFleetNetwork(amount: int, numFleetNodes: int): seq[NodeInfo] =
debug "number of fleet nodes", numFleetNodes
debug "number of satellite nodes", amount
var bootstrapEnrList: seq[string] = @[] # bootstrap for discv5
var bootstrapNodeList: seq[string] = @[] # bootstrap for waku relay
for i in 0..<numFleetNodes:
for fleetNode in result:
bootstrapEnrList.add(fleetNode.enrUri)
bootstrapNodeList.add(fleetNode.address)
result.add(initNodeCmd(portOffset + i, staticNodes = bootstrapNodeList, label = "fleet node", discv5BootStrapEnrs = bootstrapEnrList))
for i in 0..<amount:
result.add(initNodeCmd(portOffset + numFleetNodes + i, label = "full node", discv5BootStrapEnrs = bootstrapEnrList)) # no waku bootstrap nodes; get bootstrap waku nodes via discv5
# Scenarios without discv5
proc fullMeshNetwork(amount: int): seq[NodeInfo] =
debug "amount", amount
for i in 0..<amount:
var staticnodes: seq[string]
for item in result:
staticnodes.add(item.address)
result.add(initNodeCmd(portOffset + i, staticnodes, label = "full node"))
proc generatePrometheusConfig(nodes: seq[NodeInfo], outputFile: string) =
var config = """
global:
scrape_interval: 1s
scrape_configs:
- job_name: "wakusim"
static_configs:"""
var count = 0
for node in nodes:
let port = 8008 + node.shift
config &= &"""
- targets: ['127.0.0.1:{port}']
labels:
node: '{count}'"""
count += 1
var (path, file) = splitPath(outputFile)
createDir(path)
writeFile(outputFile, config)
proc proccessGrafanaDashboard(nodes: int, inputFile: string,
outputFile: string) =
# from https://github.com/status-im/nim-beacon-chain/blob/master/tests/simulation/process_dashboard.nim
var
inputData = parseFile(inputFile)
panels = inputData["panels"].copy()
numPanels = len(panels)
gridHeight = 0
outputData = inputData
for panel in panels:
if panel["gridPos"]["x"].getInt() == 0:
gridHeight += panel["gridPos"]["h"].getInt()
outputData["panels"] = %* []
for nodeNum in 0 .. (nodes - 1):
var
nodePanels = panels.copy()
panelIndex = 0
for panel in nodePanels.mitems:
panel["title"] = %* replace(panel["title"].getStr(), "#0", "#" & $nodeNum)
panel["id"] = %* (panelIndex + (nodeNum * numPanels))
panel["gridPos"]["y"] = %* (panel["gridPos"]["y"].getInt() + (nodeNum * gridHeight))
var targets = panel["targets"]
for target in targets.mitems:
target["expr"] = %* replace(target["expr"].getStr(), "{node=\"0\"}", "{node=\"" & $nodeNum & "\"}")
outputData["panels"].add(panel)
panelIndex.inc()
outputData["uid"] = %* (outputData["uid"].getStr() & "a")
outputData["title"] = %* (outputData["title"].getStr() & " (all nodes)")
writeFile(outputFile, pretty(outputData))
when isMainModule:
let conf = WakuNetworkConf.load()
# TODO: WakuNetworkConf
var nodes: seq[NodeInfo]
let topology = conf.topology
# Scenario xx2 14
let amount = conf.amount
let numFleetNodes = conf.numFleetNodes
case topology:
of Star:
nodes = starNetwork(amount)
of FullMesh:
nodes = fullMeshNetwork(amount)
of BootstrapFleet:
nodes = bootstrapFleetNetwork(amount, numFleetNodes)
# var staticnodes: seq[string]
# for i in 0..<amount:
# # TODO: could also select nodes randomly
# staticnodes.add(nodes[i].address)
# Scenario xx1 - 16 full nodes, one app topic, full mesh, gossip
# Scenario xx2 - 14 full nodes, two edge nodes, one app topic, full mesh, gossip
# NOTE: Only connecting to one node here
#var nodesubseta: seq[string]
#var nodesubsetb: seq[string]
#nodesubseta.add(staticnodes[0])
#nodesubsetb.add(staticnodes[amount-1])
## XXX: Let's turn them into normal nodes
#nodes.add(initNodeCmd(0, nodesubseta, label = "edge node (A)"))
#nodes.add(initNodeCmd(1, nodesubsetb, label = "edge node (B)"))
var commandStr = "multitail -s 2 -M 0 -x \"Waku Simulation\""
var count = 0
var sleepDuration = 0
for node in nodes:
if topology in {Star}: #DiscoveryBased
sleepDuration = if node.master: 0
else: 1
commandStr &= &" -cT ansi -t 'node #{count} {node.label}' -l 'sleep {sleepDuration}; {node.cmd}; echo [node execution completed]; while true; do sleep 100; done'"
if topology == FullMesh:
sleepDuration += 1
count += 1
generatePrometheusConfig(nodes, metricsDir / "prometheus" / "prometheus.yml")
proccessGrafanaDashboard(nodes.len,
metricsDir / "waku-grafana-dashboard.json",
metricsDir / "waku-sim-all-nodes-grafana-dashboard.json")
let errorCode = execCmd(commandStr)
if errorCode != 0:
error "launch command failed", command=commandStr

View File

@ -47,7 +47,53 @@ task testcommon, "Build & run common tests":
test "all_tests_common", "-d:chronicles_log_level=WARN -d:chronosStrictException"
### Whisper & Waku v1 tasks
### Waku v2 tasks
task wakunode2, "Build Waku v2 cli node":
let name = "wakunode2"
buildBinary name, "apps/wakunode2/", "-d:chronicles_log_level=TRACE"
task bridge, "Build Waku v1 - v2 bridge":
let name = "wakubridge"
buildBinary name, "apps/wakubridge/", "-d:chronicles_log_level=TRACE"
task wakucanary, "Build waku-canary tool":
let name = "wakucanary"
buildBinary name, "apps/wakucanary/", "-d:chronicles_log_level=TRACE"
task networkmonitor, "Build network monitor tool":
let name = "networkmonitor"
buildBinary name, "apps/networkmonitor/", "-d:chronicles_log_level=TRACE"
task test2, "Build & run Waku v2 tests":
test "all_tests_v2"
task testwakunode2, "Build & run wakunode2 app tests":
test "all_tests_wakunode2"
task testbridge, "Build & run wakubridge tests":
test "all_tests_wakubridge"
task example2, "Build Waku v2 example":
buildBinary "publisher", "examples/v2/"
buildBinary "subscriber", "examples/v2/"
task chat2, "Build example Waku v2 chat usage":
# NOTE For debugging, set debug level. For chat usage we want minimal log
# output to STDOUT. Can be fixed by redirecting logs to file (e.g.)
#buildBinary name, "examples/v2/", "-d:chronicles_log_level=WARN"
let name = "chat2"
buildBinary name, "apps/chat2/", "-d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[file] -d:ssl"
task chat2bridge, "Build chat2bridge":
let name = "chat2bridge"
buildBinary name, "apps/chat2bridge/", "-d:chronicles_log_level=TRACE"
### Legacy: Whisper & Waku v1 tasks
task testwhisper, "Build & run Whisper tests":
test "all_tests_whisper", "-d:chronicles_log_level=WARN -d:chronosStrictException"
@ -67,60 +113,3 @@ task example1, "Build Waku v1 example":
task test1, "Build & run Waku v1 tests":
test "all_tests_v1", "-d:chronicles_log_level=WARN -d:chronosStrictException"
### Waku v2 tasks
task wakunode2, "Build Waku v2 cli node":
let name = "wakunode2"
buildBinary name, "apps/wakunode2/", "-d:chronicles_log_level=TRACE"
task bridge, "Build Waku v1 - v2 bridge":
let name = "wakubridge"
buildBinary name, "apps/wakubridge/", "-d:chronicles_log_level=TRACE"
task testwakunode2, "Build & run wakunode2 app tests":
test "all_tests_wakunode2"
task testbridge, "Build & run wakubridge tests":
test "all_tests_wakubridge"
task test2, "Build & run Waku v2 tests":
test "all_tests_v2"
task sim2, "Build Waku v2 simulation tools":
buildBinary "quicksim2", "tools/simulation/", "-d:chronicles_log_level=DEBUG"
buildBinary "start_network2", "tools/simulation/", "-d:chronicles_log_level=TRACE"
task example2, "Build Waku v2 example":
buildBinary "publisher", "examples/v2/"
buildBinary "subscriber", "examples/v2/"
task scripts2, "Build Waku v2 scripts":
buildBinary "rpc_publish", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_subscribe", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_subscribe_filter", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_query", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_info", "tools/scripts/", "-d:chronicles_log_level=DEBUG"
task chat2, "Build example Waku v2 chat usage":
# NOTE For debugging, set debug level. For chat usage we want minimal log
# output to STDOUT. Can be fixed by redirecting logs to file (e.g.)
#buildBinary name, "examples/v2/", "-d:chronicles_log_level=WARN"
let name = "chat2"
buildBinary name, "apps/chat2/", "-d:chronicles_log_level=TRACE -d:chronicles_sinks=textlines[file] -d:ssl"
task chat2bridge, "Build chat2bridge":
let name = "chat2bridge"
buildBinary name, "apps/chat2bridge/", "-d:chronicles_log_level=TRACE"
### Waku Tooling
task wakucanary, "Build waku-canary tool":
let name = "wakucanary"
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=TRACE"
task networkmonitor, "Build network monitor tool":
let name = "networkmonitor"
buildBinary name, "tools/networkmonitor/", "-d:chronicles_log_level=TRACE"