diff --git a/README.md b/README.md index a902d4f16..48defce5a 100644 --- a/README.md +++ b/README.md @@ -1,165 +1,56 @@ # nim-waku -## Waku v1 -### Introduction -The nim-waku repository holds a Nim implementation of the [Waku v1 protocol](https://specs.vac.dev/waku/waku.html) and a cli application `wakunode` that allows you to run a Waku enabled node from command line. -The Waku v1 specification is still in draft and thus this implementation will -change accordingly. For supported specification details see [here](#spec-support). +## Introduction -Additionally the original Whisper (EIP-627) protocol can also be enabled as can -an experimental Whisper - Waku bridging option. +The nim-waku repository implements Waku v1 and v2, and provides tools related to it. -The underlying transport protocol is [rlpx + devp2p](https://github.com/ethereum/devp2p/blob/master/rlpx.md) and the [nim-eth](https://github.com/status-im/nim-eth) implementation is used. +- A Nim implementation of the [Waku v1 protocol](https://specs.vac.dev/waku/waku.html). +- A Nim implementation of the [Waku v2 protocol](https://specs.vac.dev/specs/waku/v2/waku-v2.html). +- CLI applications `wakunode` and `wakunode2` that allows you to run a Waku v1 or v2 node. +- Examples of Waku v1 and v2 usage. +- Various tests of above. -This repository is also a place for experimenting with possible future versions -of Waku such as replacing the transport protocol with libp2p, see also [Waku v2 protocol](#waku-v2) +For more details on Waku v1 and v2, see their respective home folders: -### How to Build & Run +- [Waku v1](waku/v1/README.md) +- [Waku v2](waku/v2/README.md) -#### Prerequisites +## How to Build & Run + +These instructions are generic and apply to both Waku v1 and v2. For more +detailed instructions, see Waku v1 and v2 home above. + +### Prerequisites * GNU Make, Bash and the usual POSIX utilities. Git 2.9.4 or newer. * PCRE More information on the installation of these can be found [here](https://github.com/status-im/nimbus#prerequisites). -#### Wakunode +### Wakunode ```bash # The first `make` invocation will update all Git submodules. # You'll run `make update` after each `git pull`, in the future, to keep those submodules up to date. -make wakunode1 +make wakunode1 wakunode2 # See available command line options ./build/wakunode --help +./build/wakunode2 --help # Connect the client directly with the Status test fleet ./build/wakunode --log-level:debug --discovery:off --fleet:test --log-metrics +# TODO Equivalent for v2 ``` -#### Waku v1 Protocol Test Suite +### Waku Protocol Test Suite ```bash -# Run all the Waku v1 tests -make test1 +# Run all the Waku v1 and v2 tests +make test ``` -You can also run a specific test (and alter compile options as you want): -```bash -# Get a shell with the right environment variables set -./env.sh bash -# Run a specific test -nim c -r ./tests/v1/test_waku_connect.nim -``` +### Examples -#### Waku v1 Protocol Example -There is a more basic example, more limited in features and configuration than -the `wakunode`, located in `examples/v1/example.nim`. - -More information on how to run this example can be found it its -[readme](examples/v1/README.md). - -#### Waku Quick Simulation -One can set up several nodes, get them connected and then instruct them via the -JSON-RPC interface. This can be done via e.g. web3.js, nim-web3 (needs to be -updated) or simply curl your way out. - -The JSON-RPC interface is currently the same as the one of Whisper. The only -difference is the addition of broadcasting the topics interest when a filter -with a certain set of topics is subcribed. - -The quick simulation uses this approach, `start_network` launches a set of -`wakunode`s, and `quicksim` instructs the nodes through RPC calls. - -Example of how to build and run: -```bash -# Build wakunode + quicksim with metrics enabled -make NIMFLAGS="-d:insecure" sim1 - -# Start the simulation nodes, this currently requires multitail to be installed -./build/start_network --topology:FullMesh --amount:6 --test-node-peers:2 -# In another shell run -./build/quicksim -``` - -The `start_network` tool will also provide a `prometheus.yml` with targets -set to all simulation nodes that are started. This way you can easily start -prometheus with this config, e.g.: - -```bash -cd ./metrics/prometheus -prometheus -``` - -A Grafana dashboard containing the example dashboard for each simulation node -is also generated and can be imported in case you have Grafana running. -This dashboard can be found at `./metrics/waku-sim-all-nodes-grafana-dashboard.json` - -To read more details about metrics, see [next](#using-metrics) section. - -### Using Metrics - -Metrics are available for valid envelopes and dropped envelopes. - -To compile in an HTTP endpoint for accessing the metrics we need to provide the -`insecure` flag: -```bash -make NIMFLAGS="-d:insecure" wakunode1 -./build/wakunode --metrics-server -``` - -Ensure your Prometheus config `prometheus.yml` contains the targets you care about, e.g.: - -``` -scrape_configs: - - job_name: "waku" - static_configs: - - targets: ['localhost:8008', 'localhost:8009', 'localhost:8010'] -``` - -For visualisation, similar steps can be used as is written down for Nimbus -[here](https://github.com/status-im/nimbus#metric-visualisation). - -There is a similar example dashboard that includes visualisation of the -envelopes available at `metrics/waku-grafana-dashboard.json`. - -### Spec support - -*This section last updated April 21, 2020* - -This client of Waku is spec compliant with [Waku spec v1.0.0](https://specs.vac.dev/waku/waku.html). - -It doesn't yet implement the following recommended features: -- No support for rate limiting -- No support for DNS discovery to find Waku nodes -- It doesn't disconnect a peer if it receives a message before a Status message -- No support for negotiation with peer supporting multiple versions via Devp2p capabilities in `Hello` packet - -Additionally it makes the following choices: -- It doesn't send message confirmations -- It has partial support for accounting: - - Accounting of total resource usage and total circulated envelopes is done through metrics But no accounting is done for individual peers. - -## Waku v2 - -Waku v2 is under active development but is currently in an early alpha state. -See `waku/node/v2/` and `waku/protocol/v2/` directory for more details on the current -state. - -Here's a post outlining the [current plan for Waku -v2](https://vac.dev/waku-v2-plan), and here's the current roadmap and progress -https://github.com/vacp2p/research/issues/40 - -## Docker Image -You can create a Docker image using: -```bash -make docker-image -docker run --rm -it statusteam/nim-waku:latest --help -``` - -Default, the target will be a docker image with `wakunode`, which is the Waku v1 node. -You can change this to `wakunode2`, the Waku v2 node like this: -```bash -make docker-image MAKE_TARGET=wakunode2 -docker run --rm -it statusteam/nim-waku:latest --help -``` +Examples can be found in the examples folder. For Waku v2, there is a fully +featured chat example. diff --git a/examples/v1/example.nim b/examples/v1/example.nim index dfe45d2d5..7a90d4526 100644 --- a/examples/v1/example.nim +++ b/examples/v1/example.nim @@ -1,9 +1,9 @@ import confutils, chronicles, chronos, stew/byteutils, stew/shims/net as stewNet, eth/[keys, p2p], - ../../waku/protocol/v1/waku_protocol, - ../../waku/node/v1/waku_helpers, - ../../waku/node/common, + ../../waku/v1/protocol/waku_protocol, + ../../waku/v1/node/waku_helpers, + ../../waku/common/utils/nat, ./config_example ## This is a simple Waku v1 example to show the Waku v1 API usage. diff --git a/examples/v2/basic2.nim b/examples/v2/basic2.nim index 50872f6b8..40fed54dc 100644 --- a/examples/v2/basic2.nim +++ b/examples/v2/basic2.nim @@ -8,8 +8,10 @@ import libp2p/crypto/[crypto,secp], eth/keys, json_rpc/[rpcclient, rpcserver], - ../../waku/node/v2/[config, wakunode2, waku_types], - ../../waku/node/common + ../../waku/v2/node/[config, wakunode2], + ../../waku/common/utils/nat, + ../../waku/v2/waku_types + type Topic* = waku_types.Topic diff --git a/examples/v2/chat2.nim b/examples/v2/chat2.nim index ab45ec8e4..3ff99b762 100644 --- a/examples/v2/chat2.nim +++ b/examples/v2/chat2.nim @@ -19,9 +19,10 @@ 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 muxers/muxer, # define an interface for stream multiplexing, allowing peers to offer many protocols over a single connection muxers/mplex/mplex] # define some contants and message types for stream multiplexing -import ../../waku/node/v2/[config, wakunode2, waku_types, waku_payload], - ../../waku/protocol/v2/[waku_relay, waku_store, waku_filter], - ../../waku/node/common +import ../../waku/v2/node/[config, wakunode2, waku_payload], + ../../waku/v2/protocol/[waku_relay, waku_store, waku_filter], + ../../waku/common/utils/nat, + ../../waku/v2/waku_types const Help = """ Commands: /[?|help|connect|disconnect|exit] diff --git a/tests/v1/test_rpc_waku.nim b/tests/v1/test_rpc_waku.nim index 072831967..02584582e 100644 --- a/tests/v1/test_rpc_waku.nim +++ b/tests/v1/test_rpc_waku.nim @@ -4,13 +4,13 @@ import std/[unittest, options, os, strutils], stew/byteutils, json_rpc/[rpcserver, rpcclient], eth/common as eth_common, eth/[rlp, keys, p2p], - ../../waku/protocol/v1/waku_protocol, - ../../waku/node/v1/rpc/[hexstrings, rpc_types, waku, key_storage] + ../../waku/v1/protocol/waku_protocol, + ../../waku/v1/node/rpc/[hexstrings, rpc_types, waku, key_storage] template sourceDir*: string = currentSourcePath.rsplit(DirSep, 1)[0] ## Generate client convenience marshalling wrappers from forward declarations ## For testing, ethcallsigs needs to be kept in sync with ../waku/node/v1/rpc/waku -const sigPath = sourceDir / ParDir / ParDir / "waku" / "node" / "v1" / "rpc" / "wakucallsigs.nim" +const sigPath = sourceDir / ParDir / ParDir / "waku" / "v1" / "node" / "rpc" / "wakucallsigs.nim" createRpcSigs(RpcSocketClient, sigPath) proc setupNode(capabilities: varargs[ProtocolInfo, `protocolInfo`], diff --git a/tests/v1/test_waku_bridge.nim b/tests/v1/test_waku_bridge.nim index f935e9962..0defd56db 100644 --- a/tests/v1/test_waku_bridge.nim +++ b/tests/v1/test_waku_bridge.nim @@ -12,8 +12,8 @@ import std/[sequtils, unittest, tables], chronos, eth/p2p, eth/p2p/peer_pool, eth/p2p/rlpx_protocols/whisper_protocol as whisper, - ../../waku/protocol/v1/waku_protocol as waku, - ../../waku/protocol/v1/waku_bridge, + ../../waku/v1/protocol/waku_protocol as waku, + ../../waku/v1/protocol/waku_bridge, ../test_helpers let safeTTL = 5'u32 diff --git a/tests/v1/test_waku_config.nim b/tests/v1/test_waku_config.nim index 0bc3010f0..b75baa144 100644 --- a/tests/v1/test_waku_config.nim +++ b/tests/v1/test_waku_config.nim @@ -10,7 +10,7 @@ import std/[sequtils, options, unittest, times], - ../../waku/protocol/v1/waku_protocol + ../../waku/v1/protocol/waku_protocol suite "Waku envelope validation": test "should validate and allow envelope according to config": diff --git a/tests/v1/test_waku_connect.nim b/tests/v1/test_waku_connect.nim index 583627552..e045da5cc 100644 --- a/tests/v1/test_waku_connect.nim +++ b/tests/v1/test_waku_connect.nim @@ -11,7 +11,7 @@ import std/[sequtils, tables, unittest], chronos, eth/[keys, p2p], eth/p2p/peer_pool, - ../../waku/protocol/v1/waku_protocol, + ../../waku/v1/protocol/waku_protocol, ../test_helpers const diff --git a/tests/v1/test_waku_mail.nim b/tests/v1/test_waku_mail.nim index 80e12ad20..3df1d23cc 100644 --- a/tests/v1/test_waku_mail.nim +++ b/tests/v1/test_waku_mail.nim @@ -3,7 +3,7 @@ import std/[unittest, tables, sequtils, times], chronos, eth/[p2p, async_utils], eth/p2p/peer_pool, - ../../waku/protocol/v1/[waku_protocol, waku_mail], + ../../waku/v1/protocol/[waku_protocol, waku_mail], ../test_helpers const diff --git a/tests/v2/test_message_store.nim b/tests/v2/test_message_store.nim index 95dc1bf0e..741c40f3c 100644 --- a/tests/v2/test_message_store.nim +++ b/tests/v2/test_message_store.nim @@ -2,8 +2,9 @@ import std/[unittest, options, tables, sets], chronos, chronicles, - ../../waku/node/v2/[waku_types, message_store], - ../test_helpers, ./utils + ../../waku/v2/node/message_store, + ../test_helpers, ./utils, + ../../waku/v2/waku_types suite "Message Store": test "set and get works": diff --git a/tests/v2/test_rpc_waku.nim b/tests/v2/test_rpc_waku.nim index f055bce01..0de1df90b 100644 --- a/tests/v2/test_rpc_waku.nim +++ b/tests/v2/test_rpc_waku.nim @@ -5,13 +5,15 @@ import stew/shims/net as stewNet, json_rpc/[rpcserver, rpcclient], libp2p/crypto/crypto, - ../../waku/node/v2/[waku_types, wakunode2], - ../../waku/node/v2/rpc/wakurpc, - ../../waku/protocol/v2/waku_relay, + ../../waku/v2/node/wakunode2, + ../../waku/v2/node/rpc/wakurpc, + ../../waku/v2/protocol/waku_relay, + ../../waku/v2/waku_types, ../test_helpers + template sourceDir*: string = currentSourcePath.rsplit(DirSep, 1)[0] -const sigPath = sourceDir / ParDir / ParDir / "waku" / "node" / "v2" / "rpc" / "wakucallsigs.nim" +const sigPath = sourceDir / ParDir / ParDir / "waku" / "v2" / "node" / "rpc" / "wakucallsigs.nim" createRpcSigs(RpcHttpClient, sigPath) suite "Waku v2 Remote Procedure Calls": diff --git a/tests/v2/test_waku.nim b/tests/v2/test_waku.nim index 3e592ad49..c60c1e4c7 100644 --- a/tests/v2/test_waku.nim +++ b/tests/v2/test_waku.nim @@ -17,7 +17,7 @@ import utils, libp2p/stream/[bufferstream, connection], libp2p/crypto/crypto, libp2p/protocols/pubsub/floodsub -import ../../waku/protocol/v2/waku_relay +import ../../waku/v2/protocol/waku_relay import ../test_helpers diff --git a/tests/v2/test_waku_filter.nim b/tests/v2/test_waku_filter.nim index 1212fb59e..01ac7a9b2 100644 --- a/tests/v2/test_waku_filter.nim +++ b/tests/v2/test_waku_filter.nim @@ -10,8 +10,8 @@ import libp2p/multistream, libp2p/transports/transport, libp2p/transports/tcptransport, - ../../waku/protocol/v2/[waku_relay, waku_filter, message_notifier], - ../../waku/node/v2/waku_types, + ../../waku/v2/protocol/[waku_relay, waku_filter, message_notifier], + ../../waku/v2/waku_types, ../test_helpers, ./utils procSuite "Waku Filter": diff --git a/tests/v2/test_waku_pagination.nim b/tests/v2/test_waku_pagination.nim index 9cc7a522e..e99d0cbda 100644 --- a/tests/v2/test_waku_pagination.nim +++ b/tests/v2/test_waku_pagination.nim @@ -2,8 +2,8 @@ import std/[unittest,algorithm,options], nimcrypto/sha2, - ../../waku/node/v2/waku_types, - ../../waku/protocol/v2/waku_store, + ../../waku/v2/waku_types, + ../../waku/v2/protocol/waku_store, ../test_helpers diff --git a/tests/v2/test_waku_payload.nim b/tests/v2/test_waku_payload.nim index a3e9b40b3..ac2666cc9 100644 --- a/tests/v2/test_waku_payload.nim +++ b/tests/v2/test_waku_payload.nim @@ -2,7 +2,7 @@ import std/unittest, - ../../waku/node/v2/waku_payload, + ../../waku/v2/node/waku_payload, ../test_helpers procSuite "Waku Payload": diff --git a/tests/v2/test_waku_store.nim b/tests/v2/test_waku_store.nim index 1aa2c0412..840972362 100644 --- a/tests/v2/test_waku_store.nim +++ b/tests/v2/test_waku_store.nim @@ -11,9 +11,10 @@ import libp2p/multistream, libp2p/transports/transport, libp2p/transports/tcptransport, - ../../waku/protocol/v2/[waku_store, message_notifier], - ../../waku/node/v2/[waku_types, message_store], - ../test_helpers, ./utils + ../../waku/v2/protocol/[waku_store, message_notifier], + ../../waku/v2/node/message_store, + ../test_helpers, ./utils, + ../../waku/v2/waku_types procSuite "Waku Store": diff --git a/tests/v2/test_waku_swap.nim b/tests/v2/test_waku_swap.nim index f0f5d17eb..9a0b05b0a 100644 --- a/tests/v2/test_waku_swap.nim +++ b/tests/v2/test_waku_swap.nim @@ -1,8 +1,8 @@ import std/[unittest, options, tables, sets], chronos, chronicles, - ../../waku/protocol/v2/waku_swap, - ../../waku/node/v2/waku_types, + ../../waku/v2/protocol/waku_swap, + ../../waku/v2/waku_types, ../test_helpers, ./utils procSuite "Waku SWAP Accounting": diff --git a/tests/v2/test_wakunode.nim b/tests/v2/test_wakunode.nim index 8e6dfd431..611efb70c 100644 --- a/tests/v2/test_wakunode.nim +++ b/tests/v2/test_wakunode.nim @@ -7,9 +7,10 @@ import libp2p/crypto/secp, libp2p/switch, eth/keys, - ../../waku/protocol/v2/[waku_relay, waku_store, waku_filter, message_notifier], - ../../waku/node/v2/[wakunode2, waku_types], - ../test_helpers + ../../waku/v2/protocol/[waku_relay, waku_store, waku_filter, message_notifier], + ../../waku/v2/node/wakunode2, + ../test_helpers, + ../../waku/v2/waku_types procSuite "WakuNode": let rng = keys.newRng() diff --git a/tests/v2/utils.nim b/tests/v2/utils.nim index 916330f21..9ec2740e3 100644 --- a/tests/v2/utils.nim +++ b/tests/v2/utils.nim @@ -10,8 +10,8 @@ import libp2p/[standard_setup, protocols/pubsub/floodsub, protocols/pubsub/gossipsub, protocols/secure/secure] -import ../../waku/protocol/v2/waku_relay, - ../../waku/node/v2/waku_types +import ../../waku/v2/protocol/waku_relay, + ../../waku/v2/waku_types export standard_setup diff --git a/waku.nimble b/waku.nimble index c20c4e012..8b045ed6e 100644 --- a/waku.nimble +++ b/waku.nimble @@ -42,11 +42,11 @@ proc test(name: string, lang = "c") = ### Waku v1 tasks task wakunode1, "Build Waku v1 cli node": - buildBinary "wakunode", "waku/node/v1/", "-d:chronicles_log_level=TRACE" + buildBinary "wakunode", "waku/v1/node/", "-d:chronicles_log_level=TRACE" task sim1, "Build Waku v1 simulation tools": - buildBinary "quicksim", "waku/node/v1/", "-d:chronicles_log_level=INFO" - buildBinary "start_network", "waku/node/v1/", "-d:chronicles_log_level=DEBUG" + buildBinary "quicksim", "waku/v1/node/", "-d:chronicles_log_level=INFO" + buildBinary "start_network", "waku/v1/node/", "-d:chronicles_log_level=DEBUG" task example1, "Build Waku v1 example": buildBinary "example", "examples/v1/", "-d:chronicles_log_level=DEBUG" @@ -56,11 +56,11 @@ task test1, "Build & run Waku v1 tests": ### Waku v2 tasks task wakunode2, "Build Waku v2 (experimental) cli node": - buildBinary "wakunode2", "waku/node/v2/", "-d:chronicles_log_level=TRACE" + buildBinary "wakunode2", "waku/v2/node/", "-d:chronicles_log_level=TRACE" task sim2, "Build Waku v2 simulation tools": - buildBinary "quicksim2", "waku/node/v2/", "-d:chronicles_log_level=DEBUG" - buildBinary "start_network2", "waku/node/v2/", "-d:chronicles_log_level=TRACE" + buildBinary "quicksim2", "waku/v2/node/", "-d:chronicles_log_level=DEBUG" + buildBinary "start_network2", "waku/v2/node/", "-d:chronicles_log_level=TRACE" task example2, "Build Waku v2 example": let name = "basic2" @@ -70,11 +70,11 @@ task test2, "Build & run Waku v2 tests": test "all_tests_v2" task scripts2, "Build Waku v2 scripts": - 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_filter", "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_publish", "waku/v2/node/rpc/", "-d:chronicles_log_level=DEBUG" + buildBinary "rpc_subscribe", "waku/v2/node/rpc/", "-d:chronicles_log_level=DEBUG" + buildBinary "rpc_subscribe_filter", "waku/v2/node/rpc/", "-d:chronicles_log_level=DEBUG" + buildBinary "rpc_query", "waku/v2/node/rpc/", "-d:chronicles_log_level=DEBUG" + buildBinary "rpc_info", "waku/v2/node/rpc/", "-d:chronicles_log_level=DEBUG" task chat2, "Build example Waku v2 chat usage": let name = "chat2" @@ -84,4 +84,4 @@ task chat2, "Build example Waku v2 chat usage": buildBinary name, "examples/v2/", "-d:chronicles_log_level=DEBUG" task bridge, "Build Waku v1 - v2 bridge": - buildBinary "wakubridge", "waku/node/", "-d:chronicles_log_level=DEBUG" + buildBinary "wakubridge", "waku/common/", "-d:chronicles_log_level=DEBUG" diff --git a/waku/common/README.md b/waku/common/README.md new file mode 100644 index 000000000..c2f8d09a2 --- /dev/null +++ b/waku/common/README.md @@ -0,0 +1,7 @@ +# Common + +This folder contains (a) modules that use both Waku v1 and Waku v2. and (b) utilities that are useful for both Waku v1 and v2. + +Examples include: +- Bridge between v1 and v2 +- NAT traversal diff --git a/waku/node/config_bridge.nim b/waku/common/config_bridge.nim similarity index 100% rename from waku/node/config_bridge.nim rename to waku/common/config_bridge.nim diff --git a/waku/node/common.nim b/waku/common/utils/nat.nim similarity index 100% rename from waku/node/common.nim rename to waku/common/utils/nat.nim diff --git a/waku/node/wakubridge.nim b/waku/common/wakubridge.nim similarity index 96% rename from waku/node/wakubridge.nim rename to waku/common/wakubridge.nim index 5bd4e2cca..a6884d068 100644 --- a/waku/node/wakubridge.nim +++ b/waku/common/wakubridge.nim @@ -5,12 +5,14 @@ import # Waku v1 imports eth/[keys, p2p], eth/common/utils, eth/p2p/[enode, whispernodes], - ../protocol/v1/waku_protocol, ./common, - ./v1/rpc/[waku, wakusim, key_storage], ./v1/waku_helpers, + ../v1/protocol/waku_protocol, + ./utils/nat, + ../v1/node/rpc/[waku, wakusim, key_storage], + ../v1/node/waku_helpers, # Waku v2 imports libp2p/crypto/crypto, - ./v2/wakunode2, - ./v2/rpc/wakurpc, + ../v2/node/wakunode2, + ../v2/node/rpc/wakurpc, # Common cli config ./config_bridge diff --git a/waku/node/README.md b/waku/node/README.md deleted file mode 100644 index d752eb10e..000000000 --- a/waku/node/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Waku Node - -This folder contains Waku node implementations and simulations. - -Currently, -- v1 contains the implementation according to Waku specification v1. -- v2 is experimental development with Waku build on top of libp2p. - -## Run simulation - -To get metrics server, etc. - -`make NIMFLAGS="-d:insecure" wakusim2` diff --git a/waku/node/v2/README.md b/waku/node/v2/README.md deleted file mode 100644 index 0fcc27fb4..000000000 --- a/waku/node/v2/README.md +++ /dev/null @@ -1,5 +0,0 @@ -# Waku node v2 - -Status: pre-alpha - -Right now a hacky PoC for running on libp2p. diff --git a/waku/protocol/README.md b/waku/protocol/README.md deleted file mode 100644 index fa1828b36..000000000 --- a/waku/protocol/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Waku Protocol - -This folder contains supported versions of the Waku protocol. - -Currently, -- v1 contains the implementation according to Waku specification v1. -- v2 is experimental development with Waku build on top of libp2p. diff --git a/waku/v1/README.md b/waku/v1/README.md new file mode 100644 index 000000000..b7f3c10e0 --- /dev/null +++ b/waku/v1/README.md @@ -0,0 +1,156 @@ +# Waku v1 + +This folder contains code related to Waku v1, both as a node and as a protocol. + +## Introduction + +This is a Nim implementation of the Nim implementation of the [Waku v1 protocol](https://specs.vac.dev/waku/waku.html) and a cli application `wakunode` that allows you to run a Waku enabled node from command line. + +For supported specification details see [here](#spec-support). + +Additionally the original Whisper (EIP-627) protocol can also be enabled as can +an experimental Whisper - Waku bridging option. + +The underlying transport protocol is [rlpx + devp2p](https://github.com/ethereum/devp2p/blob/master/rlpx.md) and the [nim-eth](https://github.com/status-im/nim-eth) implementation is used. + +## How to Build & Run + +All of the below commands should be executed at the root level, i.e. `cd ../..`. + +### Prerequisites + +* GNU Make, Bash and the usual POSIX utilities. Git 2.9.4 or newer. +* PCRE + +More information on the installation of these can be found [here](https://github.com/status-im/nimbus#prerequisites). + +### Wakunode + +```bash +# The first `make` invocation will update all Git submodules. +# You'll run `make update` after each `git pull`, in the future, to keep those submodules up to date. +make wakunode1 + +# See available command line options +./build/wakunode --help + +# Connect the client directly with the Status test fleet +./build/wakunode --log-level:debug --discovery:off --fleet:test --log-metrics +``` + +### Waku v1 Protocol Test Suite + +```bash +# Run all the Waku v1 tests +make test1 +``` + +You can also run a specific test (and alter compile options as you want): + +```bash +# Get a shell with the right environment variables set +./env.sh bash +# Run a specific test +nim c -r ./tests/v1/test_waku_connect.nim +``` + +### Waku v1 Protocol Example + +There is a more basic example, more limited in features and configuration than +the `wakunode`, located in `examples/v1/example.nim`. + +More information on how to run this example can be found it its +[readme](../../examples/v1/README.md). + +### Waku Quick Simulation + +One can set up several nodes, get them connected and then instruct them via the +JSON-RPC interface. This can be done via e.g. web3.js, nim-web3 (needs to be +updated) or simply curl your way out. + +The JSON-RPC interface is currently the same as the one of Whisper. The only +difference is the addition of broadcasting the topics interest when a filter +with a certain set of topics is subcribed. + +The quick simulation uses this approach, `start_network` launches a set of +`wakunode`s, and `quicksim` instructs the nodes through RPC calls. + +Example of how to build and run: +```bash +# Build wakunode + quicksim with metrics enabled +make NIMFLAGS="-d:insecure" sim1 + +# Start the simulation nodes, this currently requires multitail to be installed +./build/start_network --topology:FullMesh --amount:6 --test-node-peers:2 +# In another shell run +./build/quicksim +``` + +The `start_network` tool will also provide a `prometheus.yml` with targets +set to all simulation nodes that are started. This way you can easily start +prometheus with this config, e.g.: + +```bash +cd ./metrics/prometheus +prometheus +``` + +A Grafana dashboard containing the example dashboard for each simulation node +is also generated and can be imported in case you have Grafana running. +This dashboard can be found at `./metrics/waku-sim-all-nodes-grafana-dashboard.json` + +To read more details about metrics, see [next](#using-metrics) section. + +## Using Metrics + +Metrics are available for valid envelopes and dropped envelopes. + +To compile in an HTTP endpoint for accessing the metrics we need to provide the +`insecure` flag: +```bash +make NIMFLAGS="-d:insecure" wakunode1 +./build/wakunode --metrics-server +``` + +Ensure your Prometheus config `prometheus.yml` contains the targets you care about, e.g.: + +``` +scrape_configs: + - job_name: "waku" + static_configs: + - targets: ['localhost:8008', 'localhost:8009', 'localhost:8010'] +``` + +For visualisation, similar steps can be used as is written down for Nimbus +[here](https://github.com/status-im/nimbus#metric-visualisation). + +There is a similar example dashboard that includes visualisation of the +envelopes available at `metrics/waku-grafana-dashboard.json`. + +## Spec support + +*This section last updated April 21, 2020* + +This client of Waku is spec compliant with [Waku spec v1.0.0](https://specs.vac.dev/waku/waku.html). + +It doesn't yet implement the following recommended features: +- No support for rate limiting +- No support for DNS discovery to find Waku nodes +- It doesn't disconnect a peer if it receives a message before a Status message +- No support for negotiation with peer supporting multiple versions via Devp2p capabilities in `Hello` packet + +Additionally it makes the following choices: +- It doesn't send message confirmations +- It has partial support for accounting: + - Accounting of total resource usage and total circulated envelopes is done through metrics But no accounting is done for individual peers. + +## Docker Image + +You can create a Docker image using: + +```bash +make docker-image +docker run --rm -it statusteam/nim-waku:latest --help +``` + +The target will be a docker image with `wakunode`, which is the Waku v1 node. diff --git a/waku/v1/node/README.md b/waku/v1/node/README.md new file mode 100644 index 000000000..74d040f45 --- /dev/null +++ b/waku/v1/node/README.md @@ -0,0 +1,3 @@ +# Waku Node v1 + +This folder contains code related to running a `wakunode` process. The main entrypoint is the `wakunode` file. diff --git a/waku/node/v1/config.nim b/waku/v1/node/config.nim similarity index 100% rename from waku/node/v1/config.nim rename to waku/v1/node/config.nim diff --git a/waku/node/v1/nim.cfg b/waku/v1/node/nim.cfg similarity index 100% rename from waku/node/v1/nim.cfg rename to waku/v1/node/nim.cfg diff --git a/waku/node/v1/quicksim.nim b/waku/v1/node/quicksim.nim similarity index 97% rename from waku/node/v1/quicksim.nim rename to waku/v1/node/quicksim.nim index 49eae4c65..ee1d24039 100644 --- a/waku/node/v1/quicksim.nim +++ b/waku/v1/node/quicksim.nim @@ -1,7 +1,7 @@ import os, strformat, chronicles, json_rpc/[rpcclient, rpcserver], nimcrypto/sysrand, eth/common as eth_common, eth/keys, - ../../protocol/v1/waku_protocol, ./rpc/[hexstrings, rpc_types], + ../protocol/waku_protocol, ./rpc/[hexstrings, rpc_types], options as what # TODO: Huh? Redefinition? from os import DirSep diff --git a/waku/node/v1/rpc/hexstrings.nim b/waku/v1/node/rpc/hexstrings.nim similarity index 99% rename from waku/node/v1/rpc/hexstrings.nim rename to waku/v1/node/rpc/hexstrings.nim index c015ec5a3..bc12e6833 100644 --- a/waku/node/v1/rpc/hexstrings.nim +++ b/waku/v1/node/rpc/hexstrings.nim @@ -26,7 +26,7 @@ import stint, stew/byteutils, eth/[keys, rlp], eth/common/eth_types, - ../../../protocol/v1/waku_protocol + ../../protocol/waku_protocol type HexDataStr* = distinct string diff --git a/waku/node/v1/rpc/key_storage.nim b/waku/v1/node/rpc/key_storage.nim similarity index 100% rename from waku/node/v1/rpc/key_storage.nim rename to waku/v1/node/rpc/key_storage.nim diff --git a/waku/node/v1/rpc/rpc_types.nim b/waku/v1/node/rpc/rpc_types.nim similarity index 98% rename from waku/node/v1/rpc/rpc_types.nim rename to waku/v1/node/rpc/rpc_types.nim index 582a9cb1b..245e150ae 100644 --- a/waku/node/v1/rpc/rpc_types.nim +++ b/waku/v1/node/rpc/rpc_types.nim @@ -1,6 +1,6 @@ import hexstrings, options, eth/[keys, rlp], - ../../../protocol/v1/waku_protocol + ../../protocol/waku_protocol #[ Notes: diff --git a/waku/node/v1/rpc/waku.nim b/waku/v1/node/rpc/waku.nim similarity index 99% rename from waku/node/v1/rpc/waku.nim rename to waku/v1/node/rpc/waku.nim index de4d78fdb..ebf94d754 100644 --- a/waku/node/v1/rpc/waku.nim +++ b/waku/v1/node/rpc/waku.nim @@ -3,7 +3,7 @@ import eth/[common, rlp, keys, p2p], nimcrypto/[sysrand, hmac, sha2, pbkdf2], rpc_types, hexstrings, key_storage, - ../../../protocol/v1/waku_protocol + ../../protocol/waku_protocol from stew/byteutils import hexToSeqByte, hexToByteArray diff --git a/waku/node/v1/rpc/wakucallsigs.nim b/waku/v1/node/rpc/wakucallsigs.nim similarity index 100% rename from waku/node/v1/rpc/wakucallsigs.nim rename to waku/v1/node/rpc/wakucallsigs.nim diff --git a/waku/node/v1/rpc/wakusim.nim b/waku/v1/node/rpc/wakusim.nim similarity index 96% rename from waku/node/v1/rpc/wakusim.nim rename to waku/v1/node/rpc/wakusim.nim index 255115e7b..03a4635a1 100644 --- a/waku/node/v1/rpc/wakusim.nim +++ b/waku/v1/node/rpc/wakusim.nim @@ -1,7 +1,7 @@ import json_rpc/rpcserver, stew/endians2, nimcrypto/sysrand, eth/[p2p, async_utils], - ../../../protocol/v1/waku_protocol + ../../protocol/waku_protocol proc generateTraffic(node: EthereumNode, amount = 100) {.async.} = let payload = @[byte 0] diff --git a/waku/node/v1/start_network.nim b/waku/v1/node/start_network.nim similarity index 100% rename from waku/node/v1/start_network.nim rename to waku/v1/node/start_network.nim diff --git a/waku/node/v1/waku_helpers.nim b/waku/v1/node/waku_helpers.nim similarity index 100% rename from waku/node/v1/waku_helpers.nim rename to waku/v1/node/waku_helpers.nim diff --git a/waku/node/v1/wakunode.nim b/waku/v1/node/wakunode.nim similarity index 98% rename from waku/node/v1/wakunode.nim rename to waku/v1/node/wakunode.nim index a16dc5559..b084b71e2 100644 --- a/waku/node/v1/wakunode.nim +++ b/waku/v1/node/wakunode.nim @@ -4,7 +4,8 @@ import eth/[keys, p2p], eth/common/utils, eth/p2p/[discovery, enode, peer_pool, bootnodes, whispernodes], eth/p2p/rlpx_protocols/whisper_protocol, - ../../protocol/v1/[waku_protocol, waku_bridge], ../common, + ../protocol/[waku_protocol, waku_bridge], + ../../common/utils/nat, ./rpc/[waku, wakusim, key_storage], ./waku_helpers, ./config const clientId = "Nimbus waku node" diff --git a/waku/v1/protocol/README.md b/waku/v1/protocol/README.md new file mode 100644 index 000000000..9d88dbe5b --- /dev/null +++ b/waku/v1/protocol/README.md @@ -0,0 +1,3 @@ +# Waku v1 protocol + +This folder contains implementations of [Waku v1 protocols](https://specs.vac.dev/specs/waku/v1/waku-1.html). diff --git a/waku/protocol/v1/waku_bridge.nim b/waku/v1/protocol/waku_bridge.nim similarity index 100% rename from waku/protocol/v1/waku_bridge.nim rename to waku/v1/protocol/waku_bridge.nim diff --git a/waku/protocol/v1/waku_mail.nim b/waku/v1/protocol/waku_mail.nim similarity index 100% rename from waku/protocol/v1/waku_mail.nim rename to waku/v1/protocol/waku_mail.nim diff --git a/waku/protocol/v1/waku_protocol.nim b/waku/v1/protocol/waku_protocol.nim similarity index 100% rename from waku/protocol/v1/waku_protocol.nim rename to waku/v1/protocol/waku_protocol.nim diff --git a/waku/v2/README.md b/waku/v2/README.md new file mode 100644 index 000000000..2e5112aa8 --- /dev/null +++ b/waku/v2/README.md @@ -0,0 +1,139 @@ +# Waku v2 + +This folder contains code related to Waku v1, both as a node and as a protocol. + +## Introduction + +This is an implementation in Nim of Waku v2, which is currently in draft/beta stage. + +See [spec](https://specs.vac.dev/specs/waku/v2/waku-v2.html). + +## How to Build & Run + +### Prerequisites + +* GNU Make, Bash and the usual POSIX utilities. Git 2.9.4 or newer. +* PCRE + +More information on the installation of these can be found [here](https://github.com/status-im/nimbus#prerequisites). + +### Wakunode + +```bash +# The first `make` invocation will update all Git submodules. +# You'll run `make update` after each `git pull`, in the future, to keep those submodules up to date. +make wakunode2 + +# See available command line options +./build/wakunode2 --help + +# Connect the client directly with the Status test fleet +# TODO NYI +#./build/wakunode2 --log-level:debug --discovery:off --fleet:test --log-metrics +``` + +### Waku v2 Protocol Test Suite + +```bash +# Run all the Waku v2 tests +make test2 +``` + +You can also run a specific test (and alter compile options as you want): +```bash +# Get a shell with the right environment variables set +./env.sh bash +# Run a specific test +nim c -r ./tests/v2/test_waku_filter.nim +``` + +### Waku v2 Protocol Example + +There is a more basic example, more limited in features and configuration than +the `wakunode1`, located in `examples/v2/basic2.nim`. + +There is also a more full featured example in `examples/v2/chat2.nim`. + +### Waku Quick Simulation + +*NOTE: This section might be slightly out of date as it was written for Waku v1.* + +One can set up several nodes, get them connected and then instruct them via the +JSON-RPC interface. This can be done via e.g. web3.js, nim-web3 (needs to be +updated) or simply curl your way out. + +The JSON-RPC interface is currently the same as the one of Whisper. The only +difference is the addition of broadcasting the topics interest when a filter +with a certain set of topics is subcribed. + +The quick simulation uses this approach, `start_network` launches a set of +`wakunode`s, and `quicksim` instructs the nodes through RPC calls. + +Example of how to build and run: +```bash +# Build wakunode + quicksim with metrics enabled +make NIMFLAGS="-d:insecure" wakusim2 + +# Start the simulation nodes, this currently requires multitail to be installed +# TODO Partial support for Waku v2 +./build/start_network2 --topology:FullMesh --amount:6 --test-node-peers:2 +# In another shell run +./build/quicksim2 +``` + +The `start_network2` tool will also provide a `prometheus.yml` with targets +set to all simulation nodes that are started. This way you can easily start +prometheus with this config, e.g.: + +```bash +cd ./metrics/prometheus +prometheus +``` + +A Grafana dashboard containing the example dashboard for each simulation node +is also generated and can be imported in case you have Grafana running. +This dashboard can be found at `./metrics/waku-sim-all-nodes-grafana-dashboard.json` + +To read more details about metrics, see [next](#using-metrics) section. + +## Using Metrics + +Metrics are available for valid envelopes and dropped envelopes. + +To compile in an HTTP endpoint for accessing the metrics we need to provide the +`insecure` flag: +```bash +make NIMFLAGS="-d:insecure" wakunode2 +./build/wakunode2 --metrics-server +``` + +Ensure your Prometheus config `prometheus.yml` contains the targets you care about, e.g.: + +``` +scrape_configs: + - job_name: "waku" + static_configs: + - targets: ['localhost:8008', 'localhost:8009', 'localhost:8010'] +``` + +For visualisation, similar steps can be used as is written down for Nimbus +[here](https://github.com/status-im/nimbus#metric-visualisation). + +There is a similar example dashboard that includes visualisation of the +envelopes available at `metrics/waku-grafana-dashboard.json`. + +## Spec support + +*This section last updated November 16, 2020* + +All Waku v2 specs, except for bridge, are currently in draft. + +## Docker Image + +By default, the target will be a docker image with `wakunode`, which is the Waku v1 node. +You can change this to `wakunode2`, the Waku v2 node like this: + +```bash +make docker-image MAKE_TARGET=wakunode2 +docker run --rm -it statusteam/nim-waku:latest --help +``` diff --git a/waku/v2/node/README.md b/waku/v2/node/README.md new file mode 100644 index 000000000..3d7b1cccc --- /dev/null +++ b/waku/v2/node/README.md @@ -0,0 +1,5 @@ +# Waku Node v2 + +This folder contains code related to running a `wakunode2` process. The main entrypoint is the `wakunode2` file. + +See `../../docs/api/v2/node.md` for more details on the the Nim Node API. diff --git a/waku/node/v2/config.nim b/waku/v2/node/config.nim similarity index 100% rename from waku/node/v2/config.nim rename to waku/v2/node/config.nim diff --git a/waku/node/v2/message_store.nim b/waku/v2/node/message_store.nim similarity index 99% rename from waku/node/v2/message_store.nim rename to waku/v2/node/message_store.nim index 6ad646b5f..c359d72cb 100644 --- a/waku/node/v2/message_store.nim +++ b/waku/v2/node/message_store.nim @@ -1,13 +1,13 @@ import os, sqlite3_abi, - waku_types, chronos, chronicles, metrics, stew/results, libp2p/crypto/crypto, libp2p/protocols/protocol, libp2p/protobuf/minprotobuf, libp2p/stream/connection, - stew/results, metrics + stew/results, metrics, + ../waku_types {.push raises: [Defect].} diff --git a/waku/node/v2/nim.cfg b/waku/v2/node/nim.cfg similarity index 100% rename from waku/node/v2/nim.cfg rename to waku/v2/node/nim.cfg diff --git a/waku/node/v2/quicksim2.nim b/waku/v2/node/quicksim2.nim similarity index 100% rename from waku/node/v2/quicksim2.nim rename to waku/v2/node/quicksim2.nim diff --git a/waku/node/v2/rpc/rpc_info.nim b/waku/v2/node/rpc/rpc_info.nim similarity index 100% rename from waku/node/v2/rpc/rpc_info.nim rename to waku/v2/node/rpc/rpc_info.nim diff --git a/waku/node/v2/rpc/rpc_publish.nim b/waku/v2/node/rpc/rpc_publish.nim similarity index 100% rename from waku/node/v2/rpc/rpc_publish.nim rename to waku/v2/node/rpc/rpc_publish.nim diff --git a/waku/node/v2/rpc/rpc_query.nim b/waku/v2/node/rpc/rpc_query.nim similarity index 100% rename from waku/node/v2/rpc/rpc_query.nim rename to waku/v2/node/rpc/rpc_query.nim diff --git a/waku/node/v2/rpc/rpc_subscribe.nim b/waku/v2/node/rpc/rpc_subscribe.nim similarity index 100% rename from waku/node/v2/rpc/rpc_subscribe.nim rename to waku/v2/node/rpc/rpc_subscribe.nim diff --git a/waku/node/v2/rpc/rpc_subscribe_filter.nim b/waku/v2/node/rpc/rpc_subscribe_filter.nim similarity index 100% rename from waku/node/v2/rpc/rpc_subscribe_filter.nim rename to waku/v2/node/rpc/rpc_subscribe_filter.nim diff --git a/waku/node/v2/rpc/wakucallsigs.nim b/waku/v2/node/rpc/wakucallsigs.nim similarity index 100% rename from waku/node/v2/rpc/wakucallsigs.nim rename to waku/v2/node/rpc/wakucallsigs.nim diff --git a/waku/node/v2/rpc/wakurpc.nim b/waku/v2/node/rpc/wakurpc.nim similarity index 98% rename from waku/node/v2/rpc/wakurpc.nim rename to waku/v2/node/rpc/wakurpc.nim index 2e453c6ac..ef34e7e67 100644 --- a/waku/node/v2/rpc/wakurpc.nim +++ b/waku/v2/node/rpc/wakurpc.nim @@ -3,8 +3,9 @@ import json_rpc/rpcserver, nimcrypto/[sysrand, hmac, sha2], eth/[common, rlp, keys, p2p], - ../../../protocol/v2/waku_relay, - ../waku_types, ../wakunode2 + ../../protocol/waku_relay, + ../../waku_types, + ../wakunode2 proc setupWakuRPC*(node: WakuNode, rpcsrv: RpcServer) = diff --git a/waku/node/v2/start_network2.nim b/waku/v2/node/start_network2.nim similarity index 100% rename from waku/node/v2/start_network2.nim rename to waku/v2/node/start_network2.nim diff --git a/waku/node/v2/waku_payload.nim b/waku/v2/node/waku_payload.nim similarity index 99% rename from waku/node/v2/waku_payload.nim rename to waku/v2/node/waku_payload.nim index 28527a4fd..ac0821d29 100644 --- a/waku/node/v2/waku_payload.nim +++ b/waku/v2/node/waku_payload.nim @@ -2,7 +2,7 @@ import std/options, eth/keys, eth/p2p/rlpx_protocols/whisper/whisper_types, - ./waku_types + ../waku_types export whisper_types, waku_types, keys, options diff --git a/waku/node/v2/wakunode2.nim b/waku/v2/node/wakunode2.nim similarity index 98% rename from waku/node/v2/wakunode2.nim rename to waku/v2/node/wakunode2.nim index 023942f50..8fe5c143d 100644 --- a/waku/node/v2/wakunode2.nim +++ b/waku/v2/node/wakunode2.nim @@ -10,8 +10,9 @@ import libp2p/protocols/pubsub/pubsub, libp2p/peerinfo, libp2p/standard_setup, - ../../protocol/v2/[waku_relay, waku_store, waku_filter, waku_swap, message_notifier], - ./waku_types, ./message_store + ../protocol/[waku_relay, waku_store, waku_filter, waku_swap, message_notifier], + ../waku_types, + ./message_store export waku_types @@ -349,7 +350,8 @@ proc connectToNodes*(n: WakuNode, nodes: seq[PeerInfo]) {.async.} = when isMainModule: import confutils, json_rpc/rpcserver, metrics, - ./config, ./rpc/wakurpc, ../common + ./config, ./rpc/wakurpc, + ../../common/utils/nat proc startRpc(node: WakuNode, rpcIp: ValidIpAddress, rpcPort: Port) = let diff --git a/waku/v2/protocol/README.md b/waku/v2/protocol/README.md new file mode 100644 index 000000000..2474257af --- /dev/null +++ b/waku/v2/protocol/README.md @@ -0,0 +1,3 @@ +# Waku v2 protocol + +This folder contains implementations of [Waku v2 protocols](https://specs.vac.dev/specs/waku/v2/waku-v2.html). diff --git a/waku/protocol/v2/message_notifier.nim b/waku/v2/protocol/message_notifier.nim similarity index 97% rename from waku/protocol/v2/message_notifier.nim rename to waku/v2/protocol/message_notifier.nim index 125956391..e9168c00a 100644 --- a/waku/protocol/v2/message_notifier.nim +++ b/waku/v2/protocol/message_notifier.nim @@ -1,7 +1,7 @@ import std/tables, chronos, - ./../../node/v2/waku_types + ../waku_types # The Message Notification system is a method to notify various protocols # running on a node when a new message was received. diff --git a/waku/protocol/v2/waku_filter.nim b/waku/v2/protocol/waku_filter.nim similarity index 99% rename from waku/protocol/v2/waku_filter.nim rename to waku/v2/protocol/waku_filter.nim index 89e0bfac6..4a20fd80f 100644 --- a/waku/protocol/v2/waku_filter.nim +++ b/waku/v2/protocol/waku_filter.nim @@ -11,7 +11,7 @@ import libp2p/crypto/crypto, libp2p/switch, ./message_notifier, - ./../../node/v2/waku_types + ../waku_types # NOTE This is just a start, the design of this protocol isn't done yet. It # should be direct payload exchange (a la req-resp), not be coupled with the diff --git a/waku/protocol/v2/waku_relay.nim b/waku/v2/protocol/waku_relay.nim similarity index 99% rename from waku/protocol/v2/waku_relay.nim rename to waku/v2/protocol/waku_relay.nim index b08dea135..e72e3f3d1 100644 --- a/waku/protocol/v2/waku_relay.nim +++ b/waku/v2/protocol/waku_relay.nim @@ -8,7 +8,7 @@ import libp2p/protocols/pubsub/[pubsub, floodsub, gossipsub], libp2p/protocols/pubsub/rpc/messages, libp2p/stream/connection, - ../../node/v2/waku_types + ../waku_types declarePublicGauge total_messages, "number of messages received" diff --git a/waku/protocol/v2/waku_store.nim b/waku/v2/protocol/waku_store.nim similarity index 99% rename from waku/protocol/v2/waku_store.nim rename to waku/v2/protocol/waku_store.nim index f60e55e8e..c2b4a7ffe 100644 --- a/waku/protocol/v2/waku_store.nim +++ b/waku/v2/protocol/waku_store.nim @@ -8,7 +8,8 @@ import libp2p/protobuf/minprotobuf, libp2p/stream/connection, ./message_notifier, - ./../../node/v2/[waku_types, message_store] + ../node/message_store, + ../waku_types logScope: topics = "wakustore" diff --git a/waku/protocol/v2/waku_swap.nim b/waku/v2/protocol/waku_swap.nim similarity index 98% rename from waku/protocol/v2/waku_swap.nim rename to waku/v2/protocol/waku_swap.nim index 5ee9256b5..550054a8d 100644 --- a/waku/protocol/v2/waku_swap.nim +++ b/waku/v2/protocol/waku_swap.nim @@ -31,7 +31,7 @@ import libp2p/protobuf/minprotobuf, libp2p/stream/connection, ./message_notifier, - ./../../node/v2/waku_types + ../waku_types export waku_types diff --git a/waku/node/v2/waku_types.nim b/waku/v2/waku_types.nim similarity index 100% rename from waku/node/v2/waku_types.nim rename to waku/v2/waku_types.nim