more appropriate naming type in networks_config.nim

This commit is contained in:
Ivan Folgueira Bande 2025-04-08 22:46:41 +02:00
parent 75b8838fbf
commit 29c3f49734
5 changed files with 9 additions and 9 deletions

View File

@ -568,7 +568,7 @@ when isMainModule:
info "cli flags", conf = conf
if conf.clusterId == 1:
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
let twnClusterConf = NetworkConfig.TheWakuNetworkConf()
conf.bootstrapNodes = twnClusterConf.discv5BootstrapNodes
conf.rlnRelayDynamic = twnClusterConf.rlnRelayDynamic

View File

@ -25,7 +25,7 @@ proc setup*(): Waku =
var conf = confRes.get()
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
let twnClusterConf = NetworkConfig.TheWakuNetworkConf()
if len(conf.shards) != 0:
conf.pubsubTopics = conf.shards.mapIt(twnClusterConf.pubsubTopics[it.uint16])
else:

View File

@ -18,7 +18,7 @@ import
suite "Waku config - apply preset":
test "Default preset is TWN":
## Setup
let expectedConf = ClusterConf.TheWakuNetworkConf()
let expectedConf = NetworkConfig.TheWakuNetworkConf()
## Given
let preConfig = WakuNodeConf(cmd: noCommand, preset: "twn")
@ -43,7 +43,7 @@ suite "Waku config - apply preset":
test "Subscribes to all valid shards in twn":
## Setup
let expectedConf = ClusterConf.TheWakuNetworkConf()
let expectedConf = NetworkConfig.TheWakuNetworkConf()
## Given
let shards: seq[uint16] = @[0, 1, 2, 3, 4, 5, 6, 7]
@ -59,7 +59,7 @@ suite "Waku config - apply preset":
test "Subscribes to some valid shards in twn":
## Setup
let expectedConf = ClusterConf.TheWakuNetworkConf()
let expectedConf = NetworkConfig.TheWakuNetworkConf()
## Given
let shards: seq[uint16] = @[0, 4, 7]

View File

@ -170,7 +170,7 @@ proc applyPresetConfiguration*(srcConf: WakuNodeConf): Result[WakuNodeConf, stri
case toLowerAscii(resConf.preset)
of "twn":
let twnClusterConf = ClusterConf.TheWakuNetworkConf()
let twnClusterConf = NetworkConfig.TheWakuNetworkConf()
# Override configuration
resConf.maxMessageSize = twnClusterConf.maxMessageSize

View File

@ -1,6 +1,6 @@
{.push raises: [].}
type ClusterConf* = object
type NetworkConfig* = object
maxMessageSize*: string
clusterId*: uint16
rlnRelay*: bool
@ -17,8 +17,8 @@ type ClusterConf* = object
# cluster-id=1 (aka The Waku Network)
# Cluster configuration corresponding to The Waku Network. Note that it
# overrides existing cli configuration
proc TheWakuNetworkConf*(T: type ClusterConf): ClusterConf =
return ClusterConf(
proc TheWakuNetworkConf*(T: type NetworkConfig): NetworkConfig =
return NetworkConfig(
maxMessageSize: "150KiB",
clusterId: 1,
rlnRelay: true,