diff --git a/tests/all_tests_waku.nim b/tests/all_tests_waku.nim index 07e0cd895..2723fac8f 100644 --- a/tests/all_tests_waku.nim +++ b/tests/all_tests_waku.nim @@ -108,4 +108,4 @@ import import ./waku_rln_relay/test_all # Node Factory -import ./factory/test_external_config +import ./factory/[test_external_config, test_node_factory, test_waku_conf] diff --git a/tests/factory/test_waku_conf.nim b/tests/factory/test_waku_conf.nim index 6b7040dd5..c18a2c73c 100644 --- a/tests/factory/test_waku_conf.nim +++ b/tests/factory/test_waku_conf.nim @@ -9,7 +9,7 @@ import testutils/unittests import waku/factory/waku_conf, - waku/factory/waku_conf_builder, + waku/factory/conf_builder/conf_builder, waku/factory/networks_config, waku/common/utils/parse_size_units @@ -24,7 +24,7 @@ suite "Waku Conf - build with cluster conf": let expectedShards = toSeq[0.uint16 .. 7.uint16] ## Given - builder.rlnRelayConf.withEthClientAddress("https://my_eth_rpc_url/") + builder.rlnRelayConf.withEthClientUrls(@["https://my_eth_rpc_url/"]) builder.withClusterConf(clusterConf) builder.withRelay(true) builder.rlnRelayConf.withTreePath("/tmp/test-tree-path") @@ -65,7 +65,7 @@ suite "Waku Conf - build with cluster conf": let expectedShards = toSeq[0.uint16 .. 7.uint16] ## Given - builder.rlnRelayConf.withEthClientAddress("https://my_eth_rpc_url/") + builder.rlnRelayConf.withEthClientUrls(@["https://my_eth_rpc_url/"]) builder.withClusterConf(clusterConf) builder.withRelay(false) @@ -95,7 +95,7 @@ suite "Waku Conf - build with cluster conf": expectedShards = toSeq[0.uint16 .. 7.uint16] ## Given - builder.rlnRelayConf.withEthClientAddress("https://my_eth_rpc_url/") + builder.rlnRelayConf.withEthClientUrls(@["https://my_eth_rpc_url/"]) builder.withClusterConf(clusterConf) builder.rlnRelayConf.withEnabled(false) @@ -122,7 +122,7 @@ suite "Waku Conf - build with cluster conf": let shards = @[2.uint16, 3.uint16] ## Given - builder.rlnRelayConf.withEthClientAddress("https://my_eth_rpc_url/") + builder.rlnRelayConf.withEthClientUrls(@["https://my_eth_rpc_url/"]) builder.withClusterConf(clusterConf) builder.withShards(shards) @@ -148,7 +148,7 @@ suite "Waku Conf - build with cluster conf": let shards = @[2.uint16, 10.uint16] ## Given - builder.rlnRelayConf.withEthClientAddress("https://my_eth_rpc_url/") + builder.rlnRelayConf.withEthClientUrls(@["https://my_eth_rpc_url/"]) builder.withClusterConf(clusterConf) builder.withShards(shards) @@ -158,11 +158,11 @@ suite "Waku Conf - build with cluster conf": ## Then assert resConf.isErr(), "Invalid shard was accepted" - test "Cluster Conf is passed and RLN contract is overridden": + test "Cluster Conf is passed and RLN contract is **not** overridden": ## Setup let clusterConf = ClusterConf.TheWakuNetworkConf() var builder = WakuConfBuilder.init() - builder.rlnRelayConf.withEthClientAddress("https://my_eth_rpc_url/") + builder.rlnRelayConf.withEthClientUrls(@["https://my_eth_rpc_url/"]) # Mount all shards in network let expectedShards = toSeq[0.uint16 .. 7.uint16] @@ -194,7 +194,8 @@ suite "Waku Conf - build with cluster conf": assert conf.rlnRelayConf.isSome let rlnRelayConf = conf.rlnRelayConf.get() - check rlnRelayConf.ethContractAddress.string == contractAddress + check rlnRelayConf.ethContractAddress.string == + clusterConf.rlnRelayEthContractAddress check rlnRelayConf.dynamic == clusterConf.rlnRelayDynamic check rlnRelayConf.chainId == clusterConf.rlnRelayChainId check rlnRelayConf.epochSizeSec == clusterConf.rlnEpochSizeSec diff --git a/waku/factory/conf_builder/discv5_conf_builder.nim b/waku/factory/conf_builder/discv5_conf_builder.nim index 30755669b..e2729021e 100644 --- a/waku/factory/conf_builder/discv5_conf_builder.nim +++ b/waku/factory/conf_builder/discv5_conf_builder.nim @@ -38,6 +38,9 @@ proc withTableIpLimit*(b: var Discv5ConfBuilder, tableIpLimit: uint) = proc withUdpPort*(b: var Discv5ConfBuilder, udpPort: Port) = b.udpPort = some(udpPort) +proc withUdpPort*(b: var Discv5ConfBuilder, udpPort: uint) = + b.udpPort = some(Port(udpPort.uint16)) + proc withBootstrapNodes*(b: var Discv5ConfBuilder, bootstrapNodes: seq[string]) = # TODO: validate ENRs? b.bootstrapNodes = concat(b.bootstrapNodes, bootstrapNodes)