mirror of https://github.com/waku-org/nwaku.git
Cleanup warnings in v1 and split test target in Makefile (#211)
* Cleanup warnings in v1 and split test target in Makefile * Remove protocol2 target and get chat2 build in CI
This commit is contained in:
parent
a599141666
commit
daeb736335
35
Makefile
35
Makefile
|
@ -46,7 +46,7 @@ GIT_SUBMODULE_UPDATE := git submodule update --init --recursive
|
||||||
else # "variables.mk" was included. Business as usual until the end of this file.
|
else # "variables.mk" was included. Business as usual until the end of this file.
|
||||||
|
|
||||||
# default target, because it's the first one that doesn't start with '.'
|
# default target, because it's the first one that doesn't start with '.'
|
||||||
all: | wakunode1 sim1 example1 wakunode2 sim2 example2
|
all: | wakunode1 sim1 example1 wakunode2 sim2 example2 chat2
|
||||||
|
|
||||||
# must be included after the default target
|
# must be included after the default target
|
||||||
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
-include $(BUILD_SYSTEM_DIR)/makefiles/targets.mk
|
||||||
|
@ -69,6 +69,8 @@ update: | update-common
|
||||||
$(MAKE) waku.nims $(HANDLE_OUTPUT)
|
$(MAKE) waku.nims $(HANDLE_OUTPUT)
|
||||||
|
|
||||||
# a phony target, because teaching `make` how to do conditional recompilation of Nim projects is too complicated
|
# a phony target, because teaching `make` how to do conditional recompilation of Nim projects is too complicated
|
||||||
|
|
||||||
|
# Waku v1 targets
|
||||||
wakunode1: | build deps
|
wakunode1: | build deps
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim wakunode1 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim wakunode1 $(NIM_PARAMS) waku.nims
|
||||||
|
@ -81,10 +83,11 @@ example1: | build deps
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim example1 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim example1 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
example2: | build deps
|
test1: | build deps
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim test1 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
|
# Waku v2 targets
|
||||||
wakunode2: | build deps
|
wakunode2: | build deps
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim wakunode2 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim wakunode2 $(NIM_PARAMS) waku.nims
|
||||||
|
@ -93,22 +96,25 @@ sim2: | build deps wakunode2
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim sim2 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim sim2 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
|
example2: | build deps
|
||||||
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
|
$(ENV_SCRIPT) nim example2 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
|
test2: | build deps
|
||||||
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
|
$(ENV_SCRIPT) nim test2 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
scripts2: | build deps wakunode2
|
scripts2: | build deps wakunode2
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim scripts2 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim scripts2 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
protocol2:
|
chat2: | build deps
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
|
||||||
$(ENV_SCRIPT) nim protocol2 $(NIM_PARAMS) waku.nims
|
|
||||||
|
|
||||||
test2:
|
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
|
||||||
$(ENV_SCRIPT) nim test2 $(NIM_PARAMS) waku.nims
|
|
||||||
|
|
||||||
chat2:
|
|
||||||
echo -e $(BUILD_MSG) "build/$@" && \
|
echo -e $(BUILD_MSG) "build/$@" && \
|
||||||
$(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims
|
$(ENV_SCRIPT) nim chat2 $(NIM_PARAMS) waku.nims
|
||||||
|
|
||||||
|
# Builds and run the test suite (Waku v1 + v2)
|
||||||
|
test: | test1 test2
|
||||||
|
|
||||||
# symlink
|
# symlink
|
||||||
waku.nims:
|
waku.nims:
|
||||||
ln -s waku.nimble $@
|
ln -s waku.nimble $@
|
||||||
|
@ -130,11 +136,6 @@ docker-image:
|
||||||
docker-push:
|
docker-push:
|
||||||
docker push $(DOCKER_IMAGE_NAME)
|
docker push $(DOCKER_IMAGE_NAME)
|
||||||
|
|
||||||
# builds and runs the test suite
|
|
||||||
test: | build deps
|
|
||||||
$(ENV_SCRIPT) nim test $(NIM_PARAMS) waku.nims
|
|
||||||
$(ENV_SCRIPT) nim test2 $(NIM_PARAMS) waku.nims
|
|
||||||
|
|
||||||
# usual cleaning
|
# usual cleaning
|
||||||
clean: | clean-common
|
clean: | clean-common
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
|
|
@ -7,10 +7,8 @@ import confutils, chronicles, chronos, stew/shims/net as stewNet,
|
||||||
import libp2p/[switch, # manage transports, a single entry point for dialing and listening
|
import libp2p/[switch, # manage transports, a single entry point for dialing and listening
|
||||||
multistream, # tag stream with short header to identify it
|
multistream, # tag stream with short header to identify it
|
||||||
crypto/crypto, # cryptographic functions
|
crypto/crypto, # cryptographic functions
|
||||||
errors, # error handling utilities
|
|
||||||
protocols/identify, # identify the peer info of a peer
|
protocols/identify, # identify the peer info of a peer
|
||||||
stream/connection, # create and close stream read / write connections
|
stream/connection, # create and close stream read / write connections
|
||||||
transports/transport, # listen and dial to other peers using p2p protocol
|
|
||||||
transports/tcptransport, # listen and dial to other peers using client-server protocol
|
transports/tcptransport, # listen and dial to other peers using client-server protocol
|
||||||
multiaddress, # encode different addressing schemes. For example, /ip4/7.7.7.7/tcp/6543 means it is using IPv4 protocol and TCP
|
multiaddress, # encode different addressing schemes. For example, /ip4/7.7.7.7/tcp/6543 means it is using IPv4 protocol and TCP
|
||||||
peerinfo, # manage the information of a peer, such as peer ID and public / private key
|
peerinfo, # manage the information of a peer, such as peer ID and public / private key
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
unittest, options, os, stew/byteutils, strutils,
|
std/[unittest, options, os, strutils],
|
||||||
json_rpc/[rpcserver, rpcclient],
|
stew/byteutils, json_rpc/[rpcserver, rpcclient],
|
||||||
eth/common as eth_common, eth/[rlp, keys, p2p],
|
eth/common as eth_common, eth/[rlp, keys, p2p],
|
||||||
../../waku/protocol/v1/waku_protocol,
|
../../waku/protocol/v1/waku_protocol,
|
||||||
../../waku/node/v1/rpc/[hexstrings, rpc_types, waku, key_storage]
|
../../waku/node/v1/rpc/[hexstrings, rpc_types, waku, key_storage]
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||||
# MIT license (LICENSE-MIT)
|
# MIT license (LICENSE-MIT)
|
||||||
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
sequtils, unittest, tables, chronos, eth/p2p, eth/p2p/peer_pool,
|
std/[sequtils, unittest, tables],
|
||||||
|
chronos, eth/p2p, eth/p2p/peer_pool,
|
||||||
eth/p2p/rlpx_protocols/whisper_protocol as whisper,
|
eth/p2p/rlpx_protocols/whisper_protocol as whisper,
|
||||||
../../waku/protocol/v1/waku_protocol as waku,
|
../../waku/protocol/v1/waku_protocol as waku,
|
||||||
../../waku/protocol/v1/waku_bridge,
|
../../waku/protocol/v1/waku_bridge,
|
||||||
|
|
|
@ -6,9 +6,10 @@
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||||
# MIT license (LICENSE-MIT)
|
# MIT license (LICENSE-MIT)
|
||||||
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
sequtils, options, unittest, times,
|
std/[sequtils, options, unittest, times],
|
||||||
../../waku/protocol/v1/waku_protocol
|
../../waku/protocol/v1/waku_protocol
|
||||||
|
|
||||||
suite "Waku envelope validation":
|
suite "Waku envelope validation":
|
||||||
|
|
|
@ -6,9 +6,11 @@
|
||||||
# Licensed under either of
|
# Licensed under either of
|
||||||
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
# Apache License, version 2.0, (LICENSE-APACHEv2)
|
||||||
# MIT license (LICENSE-MIT)
|
# MIT license (LICENSE-MIT)
|
||||||
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
sequtils, tables, unittest, chronos, eth/[keys, p2p], eth/p2p/peer_pool,
|
std/[sequtils, tables, unittest],
|
||||||
|
chronos, eth/[keys, p2p], eth/p2p/peer_pool,
|
||||||
../../waku/protocol/v1/waku_protocol,
|
../../waku/protocol/v1/waku_protocol,
|
||||||
../test_helpers
|
../test_helpers
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
|
{.used.}
|
||||||
|
|
||||||
import
|
import
|
||||||
unittest, chronos, tables, sequtils, times,
|
std/[unittest, tables, sequtils, times],
|
||||||
eth/[p2p, async_utils], eth/p2p/peer_pool,
|
chronos, eth/[p2p, async_utils], eth/p2p/peer_pool,
|
||||||
../../waku/protocol/v1/[waku_protocol, waku_mail],
|
../../waku/protocol/v1/[waku_protocol, waku_mail],
|
||||||
../test_helpers
|
../test_helpers
|
||||||
|
|
||||||
|
|
33
waku.nimble
33
waku.nimble
|
@ -20,7 +20,7 @@ requires "nim >= 1.2.0",
|
||||||
"stew",
|
"stew",
|
||||||
"stint",
|
"stint",
|
||||||
"metrics",
|
"metrics",
|
||||||
"libp2p" # For wakunode v2
|
"libp2p" # Only for Waku v2
|
||||||
|
|
||||||
### Helper functions
|
### Helper functions
|
||||||
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
proc buildBinary(name: string, srcDir = "./", params = "", lang = "c") =
|
||||||
|
@ -40,13 +40,7 @@ proc test(name: string, lang = "c") =
|
||||||
#buildBinary name, "tests/", "-d:chronicles_log_level=ERROR"
|
#buildBinary name, "tests/", "-d:chronicles_log_level=ERROR"
|
||||||
exec "build/" & name
|
exec "build/" & name
|
||||||
|
|
||||||
### Tasks
|
### Waku v1 tasks
|
||||||
task test, "Run waku v1 tests":
|
|
||||||
test "all_tests"
|
|
||||||
|
|
||||||
task test2, "Run waku v2 tests":
|
|
||||||
test "all_tests_v2"
|
|
||||||
|
|
||||||
task wakunode1, "Build Waku v1 cli node":
|
task wakunode1, "Build Waku v1 cli node":
|
||||||
buildBinary "wakunode", "waku/node/v1/", "-d:chronicles_log_level=TRACE"
|
buildBinary "wakunode", "waku/node/v1/", "-d:chronicles_log_level=TRACE"
|
||||||
|
|
||||||
|
@ -57,28 +51,31 @@ task sim1, "Build Waku v1 simulation tools":
|
||||||
task example1, "Build Waku v1 example":
|
task example1, "Build Waku v1 example":
|
||||||
buildBinary "example", "examples/v1/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "example", "examples/v1/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
# TODO Also build Waku store and filter protocols here
|
task test1, "Build & run Waku v1 tests":
|
||||||
task protocol2, "Build the experimental Waku protocol":
|
test "all_tests_v1"
|
||||||
buildBinary "waku_relay", "waku/protocol/v2/", "-d:chronicles_log_level=TRACE"
|
|
||||||
|
|
||||||
task wakunode2, "Build Experimental Waku cli":
|
### Waku v2 tasks
|
||||||
|
task wakunode2, "Build Waku v2 (experimental) cli node":
|
||||||
buildBinary "wakunode2", "waku/node/v2/", "-d:chronicles_log_level=TRACE"
|
buildBinary "wakunode2", "waku/node/v2/", "-d:chronicles_log_level=TRACE"
|
||||||
|
|
||||||
task sim2, "Build Experimental Waku simulation tools":
|
task sim2, "Build Waku v2 simulation tools":
|
||||||
buildBinary "quicksim2", "waku/node/v2/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "quicksim2", "waku/node/v2/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "start_network2", "waku/node/v2/", "-d:chronicles_log_level=TRACE"
|
buildBinary "start_network2", "waku/node/v2/", "-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":
|
task scripts2, "Build Waku v2 scripts":
|
||||||
buildBinary "rpc_publish", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_publish", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_subscribe", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_subscribe", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_query", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_query", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
||||||
buildBinary "rpc_info", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
buildBinary "rpc_info", "waku/node/v2/rpc/", "-d:chronicles_log_level=DEBUG"
|
||||||
|
|
||||||
task example2, "Build example Waku usage":
|
task chat2, "Build example Waku v2 chat usage":
|
||||||
let name = "basic2"
|
|
||||||
buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG"
|
|
||||||
|
|
||||||
task chat2, "Build example Waku chat usage":
|
|
||||||
let name = "chat2"
|
let name = "chat2"
|
||||||
# NOTE For debugging, set debug level. For chat usage we want minimal log
|
# 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.)
|
# output to STDOUT. Can be fixed by redirecting logs to file (e.g.)
|
||||||
|
|
|
@ -153,7 +153,7 @@ proc parseCmdArg*(T: type KeyPair, p: TaintedString): T =
|
||||||
try:
|
try:
|
||||||
let privkey = PrivateKey.fromHex(string(p)).tryGet()
|
let privkey = PrivateKey.fromHex(string(p)).tryGet()
|
||||||
result = privkey.toKeyPair()
|
result = privkey.toKeyPair()
|
||||||
except CatchableError as e:
|
except CatchableError:
|
||||||
raise newException(ConfigurationError, "Invalid private key")
|
raise newException(ConfigurationError, "Invalid private key")
|
||||||
|
|
||||||
proc completeCmdArg*(T: type KeyPair, val: TaintedString): seq[string] =
|
proc completeCmdArg*(T: type KeyPair, val: TaintedString): seq[string] =
|
||||||
|
@ -162,7 +162,7 @@ proc completeCmdArg*(T: type KeyPair, val: TaintedString): seq[string] =
|
||||||
proc parseCmdArg*(T: type IpAddress, p: TaintedString): T =
|
proc parseCmdArg*(T: type IpAddress, p: TaintedString): T =
|
||||||
try:
|
try:
|
||||||
result = parseIpAddress(p)
|
result = parseIpAddress(p)
|
||||||
except CatchableError as e:
|
except CatchableError:
|
||||||
raise newException(ConfigurationError, "Invalid IP address")
|
raise newException(ConfigurationError, "Invalid IP address")
|
||||||
|
|
||||||
proc completeCmdArg*(T: type IpAddress, val: TaintedString): seq[string] =
|
proc completeCmdArg*(T: type IpAddress, val: TaintedString): seq[string] =
|
||||||
|
|
|
@ -4,7 +4,6 @@ import
|
||||||
../../../protocol/v1/waku_protocol
|
../../../protocol/v1/waku_protocol
|
||||||
|
|
||||||
proc generateTraffic(node: EthereumNode, amount = 100) {.async.} =
|
proc generateTraffic(node: EthereumNode, amount = 100) {.async.} =
|
||||||
var topicNumber = 0'u32
|
|
||||||
let payload = @[byte 0]
|
let payload = @[byte 0]
|
||||||
for i in 0..<amount:
|
for i in 0..<amount:
|
||||||
discard waku_protocol.postMessage(node, ttl = 10,
|
discard waku_protocol.postMessage(node, ttl = 10,
|
||||||
|
|
Loading…
Reference in New Issue