waku-org / nwaku

Waku node and protocol.
Other
183 stars 46 forks source link

bug: nwaku node fails to start without a shard flag #2644

Closed fbarbu15 closed 2 weeks ago

fbarbu15 commented 2 weeks ago

Problem

Seems that shard flag was made mandatory. But I maybe it should default to 0 (like cluster id) if not passed. And even if it's left mandatory maybe a clearer error message can be added so the node operator is aware that shard is mandatory

docker run -i -t -p 52779:52779 -p 52780:52780 -p 52781:52781 -p 52782:52782 -p 52783:52783 harbor.status.im/wakuorg/nwaku:latest --listen-address=0.0.0.0 --rest=true --rest-admin=true --websocket-support=true --log-level=TRACE --rest-relay-cache-capacity=100 --websocket-port=52781 --rest-port=52779 --tcp-port=52780 --discv5-udp-port=52782 --rest-address=0.0.0.0 --nat=extip:172.18.65.132 --peer-exchange=true --discv5-discovery=true --cluster-id=0 --metrics-server=true --metrics-server-address=0.0.0.0 --metrics-server-port=52783 --metrics-logging=true --relay=true --filter=true --nodekey=30348dd51465150e04a5d9d932c72864c8967f806cce60b5d26afeca1e77
eb68
INF 2024-04-29 06:45:51.874+00:00 Running nwaku node                         topics="wakunode main" tid=1 file=wakunode2.nim:121 version=v0.27.0-rc.0-27-g6e6cb2
INF 2024-04-29 06:45:51.874+00:00 Configuration: Enabled protocols           topics="wakunode main" tid=1 file=wakunode2.nim:29 relay=true rlnRelay=false store=false filter=true lightpush=false peerExchange=true
INF 2024-04-29 06:45:51.875+00:00 Configuration. Network                     topics="wakunode main" tid=1 file=wakunode2.nim:37 cluster=0 maxPeers=none(int)
INF 2024-04-29 06:45:51.875+00:00 Configuration. Shards                      topics="wakunode main" tid=1 file=wakunode2.nim:40 shard=/waku/2/default-waku/proto
NTC 2024-04-29 06:45:51.875+00:00 REST service started                       tid=1 file=server.nim:189 address=0.0.0.0:52779
INF 2024-04-29 06:45:51.875+00:00 Starting REST HTTP server                  tid=1 file=builder.nim:109 url=http://0.0.0.0:52779/
DBG 2024-04-29 06:45:51.875+00:00 Retrieve dynamic bootstrap nodes           topics="wakunode main" tid=1 file=app.nim:123
DBG 2024-04-29 06:45:51.875+00:00 No method for retrieving dynamic bootstrap nodes specified. topics="wakunode app" tid=1 file=app.nim:107
/app/apps/wakunode2/wakunode2.nim(137) wakunode2
/app/waku/factory/app.nim(134) init
/app/waku/factory/node_factory.nim(406) setupNode
/app/vendor/nim-chronicles/chronicles.nim(170) enrConfiguration
/app/vendor/nim-results/results.nim(906) error
/app/vendor/nim-results/results.nim(376) raiseResultDefect
Error: unhandled exception: Trying to access error when value is set: none(RelayShards) [ResultDefect]

nwaku version/commit hash

harbor.status.im/wakuorg/nwaku:latest

alrevuelta commented 2 weeks ago

Agree, this should works and doesnt:

  ./build/wakunode2\
  --rest=true\
  --log-level=DEBUG\
  --relay=true\
  --cluster-id=0

But I maybe it should default to 0

I would say shard should not default to 0. Right now it defaults to all shards. Meaning this defaults to shard 0, 1, 2, 3.

./build/wakunode2\
  --rest=true\
  --log-level=DEBUG\
  --relay=true\
  --pubsub-topic=/waku/2/rs/10/0\
  --pubsub-topic=/waku/2/rs/10/1\
  --pubsub-topic=/waku/2/rs/10/2\
  --pubsub-topic=/waku/2/rs/10/3\
  --cluster-id=10\
chaitanyaprem commented 2 weeks ago

This looks like it has been caused by my recent fix https://github.com/waku-org/nwaku/pull/2633 as the error is pointing to the code that was introduced.

Will take a look.