Skip to content

Commit

Permalink
setting 1024 shards as default if users don't set it
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed Sep 10, 2024
1 parent 1ac8ee3 commit dbfdda7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions waku/factory/node_factory.nim
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,9 @@ proc initNode(
proc getNumShardsInNetwork*(conf: WakuNodeConf): uint32 =
if conf.numShardsInNetwork != 0:
return conf.numShardsInNetwork
# If conf.numShardsInNetwork is not set, use the number of shards configured as numShardsInNetwork
return uint32(max(conf.shards) + 1)
# If conf.numShardsInNetwork is not set, use 1024 - the maximum possible as per the static sharding spec
# https://github.com/waku-org/specs/blob/master/standards/core/relay-sharding.md#static-sharding
return uint32(MaxShardIndex + 1)

proc setupProtocols(
node: WakuNode, conf: WakuNodeConf, nodeKey: crypto.PrivateKey
Expand Down
2 changes: 1 addition & 1 deletion waku/waku_enr/sharding.nim
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ../common/enr, ../waku_core
logScope:
topics = "waku enr sharding"

const MaxShardIndex: uint16 = 1023
const MaxShardIndex*: uint16 = 1023

const
ShardingIndicesListEnrField* = "rs"
Expand Down

0 comments on commit dbfdda7

Please sign in to comment.