diff --git a/hello_gossipsub/Makefile b/hello_gossipsub/Makefile index eaa4647..d635bae 100644 --- a/hello_gossipsub/Makefile +++ b/hello_gossipsub/Makefile @@ -2,3 +2,6 @@ all: start_network start_network: src/start_network.nim nim c -o:build/start_network src/start_network.nim + +quicksim: src/quicksim.nim + nim c -o:build/quicksim src/quicksim.nim diff --git a/hello_gossipsub/src/quicksim.nim b/hello_gossipsub/src/quicksim.nim new file mode 100644 index 0000000..734b14d --- /dev/null +++ b/hello_gossipsub/src/quicksim.nim @@ -0,0 +1,78 @@ +import + os, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand, + eth/common as eth_common, eth/keys, eth/p2p/rlpx_protocols/waku_protocol, + ../vendor/nimbus/nimbus/rpc/[hexstrings, rpc_types, waku], + options as what # TODO: Huh? Redefinition? + +from os import DirSep +from strutils import rsplit +template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0] + +#const sigWakuPath = &"{sourceDir}{DirSep}rpc{DirSep}wakucallsigs.nim" +# XXX: Hardcoded +const sigWakuPath = &"{sourceDir}/../{DirSep}vendor/nimbus/waku/rpc/wakucallsigs.nim" +createRpcSigs(RpcHttpClient, sigWakuPath) + +const topicAmount = 100 + +let + trafficNode = newRpcHttpClient() + lightNode = newRpcHttpClient() + lightNode2 = newRpcHttpClient() + +waitFor lightNode.connect("localhost", Port(8545)) +waitFor lightNode2.connect("localhost", Port(8546)) +waitFor trafficNode.connect("localhost", Port(8548)) + +proc generateTopics(amount = topicAmount): seq[waku_protocol.Topic] = + var topic: waku_protocol.Topic + for i in 0..