From c6e7332ab45e5546740eedcbddc927aa69af4d03 Mon Sep 17 00:00:00 2001 From: Gabriel mermelstein Date: Tue, 10 Sep 2024 09:18:38 -0600 Subject: [PATCH] setting 1024 shards as default if users don't set it --- waku/factory/node_factory.nim | 5 +++-- waku/waku_enr/sharding.nim | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/waku/factory/node_factory.nim b/waku/factory/node_factory.nim index d5452ef030..d6672f8a8a 100644 --- a/waku/factory/node_factory.nim +++ b/waku/factory/node_factory.nim @@ -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 diff --git a/waku/waku_enr/sharding.nim b/waku/waku_enr/sharding.nim index 3b7cdae149..d1beb2864b 100644 --- a/waku/waku_enr/sharding.nim +++ b/waku/waku_enr/sharding.nim @@ -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"