chore: move apps and tools to their own directory

This commit is contained in:
Lorenzo Delgado 2022-10-12 14:41:25 -05:00 committed by GitHub
parent a2a5a6ef01
commit 5fbc537cbf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
18 changed files with 113 additions and 100 deletions

View File

@ -21,16 +21,17 @@ import libp2p/[switch, # manage transports, a single entry poi
protocols/secure/secio, # define the protocol of secure input / output, allows encrypted communication that uses public keys to validate signed messages instead of a certificate authority like in TLS
nameresolving/dnsresolver,# define DNS resolution
muxers/muxer] # define an interface for stream multiplexing, allowing peers to offer many protocols over a single connection
import ../../waku/v2/protocol/waku_message,
../../waku/v2/protocol/waku_lightpush,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v2/node/[wakunode2, waku_payload],
../../waku/v2/node/dnsdisc/waku_dnsdisc,
../../waku/v2/node/peer_manager/peer_manager,
../../waku/v2/utils/[peers, time],
../../waku/common/utils/nat,
./config_chat2
import
../../waku/v2/protocol/waku_message,
../../waku/v2/protocol/waku_lightpush,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v2/node/[wakunode2, waku_payload],
../../waku/v2/node/dnsdisc/waku_dnsdisc,
../../waku/v2/node/peer_manager/peer_manager,
../../waku/v2/utils/[peers, time],
../../waku/common/utils/nat,
./config_chat2
when defined(rln) or defined(rlnzerokit):
import

View File

@ -5,8 +5,9 @@ import
libp2p/crypto/crypto,
libp2p/crypto/secp,
nimcrypto/utils,
eth/keys,
../../waku/v2/protocol/waku_message
eth/keys
import
../../../waku/v2/protocol/waku_message
type
Fleet* = enum

View File

@ -7,14 +7,14 @@ import
stew/[byteutils, endians2],
stew/shims/net as stewNet, json_rpc/rpcserver,
# Matterbridge client imports
../../../waku/common/utils/matterbridge_client,
../../waku/common/utils/matterbridge_client,
# Waku v2 imports
libp2p/crypto/crypto,
libp2p/errors,
../../../waku/v2/protocol/waku_message,
../../../waku/v2/node/wakunode2,
# Chat 2 imports
../chat2,
../chat2/chat2,
# Common cli config
./config_chat2bridge

View File

@ -12,15 +12,15 @@ import
eth/[keys, p2p], eth/common/utils,
eth/p2p/[enode, peer_pool],
eth/p2p/discoveryv5/random2,
../v1/protocol/waku_protocol,
../../waku/v1/protocol/waku_protocol,
# Waku v2 imports
libp2p/crypto/crypto,
libp2p/nameresolving/nameresolver,
../v2/utils/namespacing,
../v2/utils/time,
../v2/protocol/waku_message,
../v2/node/wakunode2,
../v2/node/peer_manager/peer_manager,
../../waku/v2/utils/namespacing,
../../waku/v2/utils/time,
../../waku/v2/protocol/waku_message,
../../waku/v2/node/wakunode2,
../../waku/v2/node/peer_manager/peer_manager,
# Common cli config
./config_bridge
@ -322,15 +322,15 @@ proc stop*(bridge: WakuBridge) {.async.} =
when isMainModule:
import
libp2p/nameresolving/dnsresolver,
./utils/nat,
../whisper/whispernodes,
../v1/node/rpc/wakusim,
../v1/node/rpc/waku,
../v1/node/rpc/key_storage,
../v2/node/jsonrpc/[debug_api,
filter_api,
relay_api,
store_api]
../../waku/common/utils/nat,
../../waku/whisper/whispernodes,
../../waku/v1/node/rpc/wakusim,
../../waku/v1/node/rpc/waku,
../../waku/v1/node/rpc/key_storage,
../../waku/v2/node/jsonrpc/[debug_api,
filter_api,
relay_api,
store_api]
proc startV2Rpc(node: WakuNode, rpcServer: RpcHttpServer, conf: WakuNodeConf) =
installDebugApiHandlers(node, rpcServer)

View File

@ -12,14 +12,13 @@ import
libp2p/protocols/pubsub/rpc/messages,
libp2p/protocols/pubsub/pubsub,
eth/p2p,
eth/keys,
../../waku/common/wakubridge,
eth/keys
import
../../waku/v1/protocol/waku_protocol,
../../waku/v2/protocol/waku_message,
../../waku/v2/protocol/waku_store,
../../waku/v2/protocol/waku_filter,
../../waku/v2/node/[wakunode2, waku_payload],
../../waku/v2/utils/peers,
../../apps/wakubridge/wakubridge,
../test_helpers
procSuite "WakuBridge":
@ -139,12 +138,12 @@ procSuite "WakuBridge":
v2Node.subscribe(DefaultBridgeTopic, relayHandler)
await sleepAsync(2000.millis)
await sleepAsync(250.millis)
# Test bridging from V2 to V1
await v2Node.publish(DefaultBridgeTopic, message)
await sleepAsync(2000.millis)
await sleepAsync(250.millis)
check:
# v1Node received message published by v2Node
@ -173,7 +172,7 @@ procSuite "WakuBridge":
await v2Node.publish(DefaultBridgeTopic, message)
await sleepAsync(2000.millis)
await sleepAsync(250.millis)
check:
# v1Node did not receive duplicate of previous message
@ -211,7 +210,7 @@ procSuite "WakuBridge":
# When
waitFor v1Bridge.start()
await sleepAsync(2000.millis) # Give peers some time to connect
await sleepAsync(250.millis) # Give peers some time to connect
# Then
check:
@ -228,7 +227,7 @@ procSuite "WakuBridge":
# When
discard v1Bridge.maintenanceLoop() # Forces one more run of the maintenance loop
await sleepAsync(2000.millis) # Give peers some time to connect
await sleepAsync(250.millis) # Give peers some time to connect
# Then
check:

View File

@ -4,13 +4,14 @@ import
libp2p/[peerinfo, multiaddress],
eth/common as eth_common, eth/keys,
system,
options,
../wakunode2,
../waku_payload,
../jsonrpc/jsonrpc_types,
../../protocol/waku_filter,
../../protocol/waku_store,
../../../v1/node/rpc/hexstrings
options
import
../../waku/v2/node/wakunode2,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]

View File

@ -4,13 +4,14 @@ import
libp2p/protobuf/minprotobuf,
eth/common as eth_common, eth/keys,
system,
options,
../wakunode2,
../waku_payload,
../jsonrpc/jsonrpc_types,
../../protocol/waku_filter,
../../protocol/waku_store,
../../../v1/node/rpc/hexstrings
options
import
../../waku/v2/node/wakunode2,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]

View File

@ -4,13 +4,15 @@ import
libp2p/[peerinfo, multiaddress],
eth/common as eth_common, eth/keys,
system,
options,
../wakunode2,
../waku_payload,
../jsonrpc/jsonrpc_types,
../../protocol/waku_filter,
../../protocol/waku_store,
../../../v1/node/rpc/hexstrings
options
import
../../waku/v2/node/wakunode2,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]

View File

@ -3,13 +3,16 @@ import
libp2p/protobuf/minprotobuf,
eth/common as eth_common, eth/keys,
system,
options,
../wakunode2,
../waku_payload,
../jsonrpc/jsonrpc_types,
../../protocol/waku_filter,
../../protocol/waku_store,
../../../v1/node/rpc/hexstrings
options
import
../../waku/v2/node/wakunode2,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]

View File

@ -4,13 +4,14 @@ import
libp2p/[peerinfo, multiaddress],
eth/common as eth_common, eth/keys,
system,
options,
../wakunode2,
../waku_payload,
../jsonrpc/jsonrpc_types,
../../protocol/waku_filter,
../../protocol/waku_store,
../../../v1/node/rpc/hexstrings
options
import
../../waku/v2/node/wakunode2,
../../waku/v2/node/waku_payload,
../../waku/v2/node/jsonrpc/jsonrpc_types,
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v1/node/rpc/hexstrings
from strutils import rsplit
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]

View File

@ -6,19 +6,19 @@ import
json_rpc/[rpcclient, rpcserver],
libp2p/protobuf/minprotobuf
import
../protocol/waku_filter,
../protocol/waku_store,
../protocol/waku_message,
../utils/time,
./wakunode2,
./waku_payload,
./jsonrpc/[jsonrpc_types,jsonrpc_utils]
../../waku/v2/protocol/waku_filter,
../../waku/v2/protocol/waku_store,
../../waku/v2/protocol/waku_message,
../../waku/v2/utils/time,
../../waku/v2/node/wakunode2,
../../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 / "jsonrpc" / "jsonrpc_callsigs.nim"
const sigWakuPath = sourceDir / ".." / ".." / "waku" / "v2" / "node" / "jsonrpc" / "jsonrpc_callsigs.nim"
createRpcSigs(RpcHttpClient, sigWakuPath)
const defaultTopic = "/waku/2/default-waku/proto"

View File

@ -64,42 +64,46 @@ task test1, "Build & run Waku v1 tests":
### Waku v2 tasks
task wakunode2, "Build Waku v2 (experimental) cli node":
buildBinary "wakunode2", "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
let name = "wakunode2"
buildBinary name, "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
task bridge, "Build Waku v1 - v2 bridge":
let name = "wakubridge"
buildBinary name, "apps/wakubridge/", "-d:chronicles_log_level=DEBUG"
task test2, "Build & run Waku v2 tests":
test "all_tests_v2"
task sim2, "Build Waku v2 simulation tools":
buildBinary "quicksim2", "waku/v2/node/", "-d:chronicles_log_level=DEBUG"
buildBinary "start_network2", "waku/v2/node/", "-d:chronicles_log_level=TRACE"
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":
let name = "basic2"
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG"
task test2, "Build & run Waku v2 tests":
test "all_tests_v2"
task scripts2, "Build Waku v2 scripts":
buildBinary "rpc_publish", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_subscribe", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_subscribe_filter", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_query", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
buildBinary "rpc_info", "waku/v2/node/scripts/", "-d:chronicles_log_level=DEBUG"
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":
let name = "chat2"
# 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"
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG -d:chronicles_sinks=textlines[file] -d:ssl"
task bridge, "Build Waku v1 - v2 bridge":
buildBinary "wakubridge", "waku/common/", "-d:chronicles_log_level=DEBUG"
let name = "chat2"
buildBinary name, "apps/chat2/", "-d:chronicles_log_level=DEBUG -d:chronicles_sinks=textlines[file] -d:ssl"
task chat2bridge, "Build chat2-matterbridge":
task chat2bridge, "Build chat2bridge":
let name = "chat2bridge"
buildBinary name, "apps/chat2bridge/", "-d:chronicles_log_level=DEBUG"
buildBinary name, "examples/v2/matterbridge/", "-d:chronicles_log_level=DEBUG"
### Waku Tooling
task wakucanary, "Build waku-canary tool":
let name = "wakucanary"
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=DEBUG -d:chronicles_runtime_filtering:on"
buildBinary name, "tools/wakucanary/", "-d:chronicles_log_level=DEBUG -d:chronicles_runtime_filtering:on"

Binary file not shown.

View File

@ -17,7 +17,7 @@ import
waku_rln_relay_metrics,
../../utils/time,
../../node/[wakunode2_types,config],
../../../../../examples/v2/config_chat2,
../../../../../apps/chat2/config_chat2,
../waku_message
logScope: