mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-04 15:03:08 +00:00
more appropriate naming type in networks_config.nim
This commit is contained in:
parent
75b8838fbf
commit
29c3f49734
@ -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
|
||||
|
||||
@ -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:
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user