Skip to content

Commit

Permalink
improving logs and using defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Aug 29, 2024
1 parent 32d3780 commit ddd03bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/testlib/wakunode.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ proc defaultTestWakuNodeConf*(): WakuNodeConf =
nat: "any",
maxConnections: 50,
maxMessageSize: "1024 KiB",
clusterId: 0,
shards: @[uint16(0)],
clusterId: DefaultClusterId,
shards: @[DefaultShardId],
relay: true,
storeMessageDbUrl: "sqlite://store.sqlite3",
)
Expand Down
11 changes: 7 additions & 4 deletions waku/factory/waku.nim
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ proc validateShards(conf: WakuNodeConf): Result[void, string] =

for shard in conf.shards:
if shard >= networkShards:
let msg = "Invalid shard: " & $shard & " when networkShards: " & $networkShards
# fmt doesn't work
let msg =
"validateShards invalid shard: " & $shard & " when networkShards: " &
$networkShards # fmt doesn't work
error "validateShards failed", error = msg
return err(msg)

Expand Down Expand Up @@ -120,9 +121,11 @@ proc init*(T: type Waku, conf: WakuNodeConf): Result[Waku, string] =
if shardsOpt.isSome():
let relayShards = shardsOpt.get()
if relayShards.clusterId != conf.clusterId:
error "clusterId of the pubsub topic should match the node's cluster",
error "clusterId of the pubsub topic should match the node's cluster. e.g. --pubsub-topic=/waku/2/rs/22/1 and --cluster-id=22",
nodeCluster = conf.clusterId, pubsubCluster = relayShards.clusterId
return err("clusterId of the pubsub topic should match the node's cluster")
return err(
"clusterId of the pubsub topic should match the node's cluster. e.g. --pubsub-topic=/waku/2/rs/22/1 and --cluster-id=22"
)

for shard in relayShards.shardIds:
shards.add(shard)
Expand Down

0 comments on commit ddd03bb

Please sign in to comment.