diff --git a/waku/discovery/waku_discv5.nim b/waku/discovery/waku_discv5.nim index 0c57eb384..221acef42 100644 --- a/waku/discovery/waku_discv5.nim +++ b/waku/discovery/waku_discv5.nim @@ -134,13 +134,13 @@ proc updateENRShards( ): Result[void, string] = ## Add or remove shards from the Discv5 ENR let newShardOp = topicsToRelayShards(newTopics).valueOr: - return err("ENR update failed: " & error) + return err("ENR update failed topicsToRelayShards: " & error) let newShard = newShardOp.valueOr: return ok() let typedRecord = wd.protocol.localNode.record.toTyped().valueOr: - return err("ENR update failed: " & $error) + return err("ENR update failed toTyped: " & $error) let currentShardsOp = typedRecord.relaySharding() @@ -149,17 +149,17 @@ proc updateENRShards( let currentShard = currentShardsOp.get() if currentShard.clusterId != newShard.clusterId: - return err("ENR update failed: clusterId id mismatch") + return err("ENR update failed: clusterId id mismatch in add") RelayShards.init( currentShard.clusterId, currentShard.shardIds & newShard.shardIds ).valueOr: - return err("ENR update failed: " & error) + return err("ENR update failed RelayShards.init in add: " & error) elif not add and currentShardsOp.isSome(): let currentShard = currentShardsOp.get() if currentShard.clusterId != newShard.clusterId: - return err("ENR update failed: clusterId id mismatch") + return err("ENR update failed: clusterId id mismatch in not add") let currentSet = toHashSet(currentShard.shardIds) let newSet = toHashSet(newShard.shardIds) @@ -170,7 +170,7 @@ proc updateENRShards( return err("ENR update failed: cannot remove all shards") RelayShards.init(currentShard.clusterId, indices).valueOr: - return err("ENR update failed: " & error) + return err("ENR update failed RelayShards.init in not add: " & error) elif add and currentShardsOp.isNone(): newShard else: @@ -181,12 +181,12 @@ proc updateENRShards( (ShardingBitVectorEnrField, resultShard.toBitVector()) else: let list = resultShard.toIndicesList().valueOr: - return err("ENR update failed: " & $error) + return err("ENR update failed toIndicesList: " & $error) (ShardingIndicesListEnrField, list) wd.protocol.updateRecord([(field, value)]).isOkOr: - return err("ENR update failed: " & $error) + return err("ENR update failed updateRecord: " & $error) return ok() diff --git a/waku/factory/external_config.nim b/waku/factory/external_config.nim index ba0785f01..800b61e63 100644 --- a/waku/factory/external_config.nim +++ b/waku/factory/external_config.nim @@ -70,7 +70,7 @@ type WakuNodeConf* = object .}: logging.LogFormat rlnRelayCredPath* {. - desc: "The path for peristing rln-relay credential", + desc: "The path for persisting rln-relay credential", defaultValue: "", name: "rln-relay-cred-path" .}: string diff --git a/waku/factory/waku.nim b/waku/factory/waku.nim index 55d311963..01dc7a36f 100644 --- a/waku/factory/waku.nim +++ b/waku/factory/waku.nim @@ -177,7 +177,7 @@ proc new*( var deliveryMonitor: DeliveryMonitor if wakuConf.p2pReliability: if wakuConf.remoteStoreNode.isNone(): - return err("A remoteStoreNode should be set when reliability mode is on") + return err("A storenode should be set when reliability mode is on") let deliveryMonitorRes = DeliveryMonitor.new( node.wakuStoreClient, node.wakuRelay, node.wakuLightpushClient, @@ -222,7 +222,7 @@ proc getPorts( proc getRunningNetConfig(waku: ptr Waku): Result[NetConfig, string] = var conf = waku[].conf let (tcpPort, websocketPort) = getPorts(waku[].node.switch.peerInfo.listenAddrs).valueOr: - return err("Could not retrieve ports " & error) + return err("Could not retrieve ports: " & error) if tcpPort.isSome(): conf.networkConf.p2pTcpPort = tcpPort.get() @@ -246,7 +246,7 @@ proc updateEnr(waku: ptr Waku): Result[void, string] = return err("ENR setup failed: " & error) if isClusterMismatched(record, waku[].conf.clusterId): - return err("cluster id mismatch configured shards") + return err("cluster-id mismatch configured shards") waku[].node.enr = record diff --git a/waku/factory/waku_conf.nim b/waku/factory/waku_conf.nim index 9f5160135..94b89a26e 100644 --- a/waku/factory/waku_conf.nim +++ b/waku/factory/waku_conf.nim @@ -164,7 +164,7 @@ proc logConf*(conf: WakuConf) = proc validateNodeKey(wakuConf: WakuConf): Result[void, string] = wakuConf.nodeKey.getPublicKey().isOkOr: - return err("Node key is invalid") + return err("nodekey param is invalid") return ok() proc validateShards(wakuConf: WakuConf): Result[void, string] = @@ -187,58 +187,52 @@ proc validateShards(wakuConf: WakuConf): Result[void, string] = proc validateNoEmptyStrings(wakuConf: WakuConf): Result[void, string] = if wakuConf.networkConf.dns4DomainName.isSome() and isEmptyOrWhiteSpace(wakuConf.networkConf.dns4DomainName.get().string): - return err("dns4DomainName is an empty string, set it to none(string) instead") + return err("dns4-domain-name is an empty string, set it to none(string) instead") if isEmptyOrWhiteSpace(wakuConf.relayServiceRatio): - return err("relayServiceRatio is an empty string") + return err("relay-service-ratio is an empty string") for sn in wakuConf.staticNodes: if isEmptyOrWhiteSpace(sn): - return err("staticNodes contain an empty string") + return err("staticnode contain an empty string") if wakuConf.remoteStoreNode.isSome() and isEmptyOrWhiteSpace(wakuConf.remoteStoreNode.get()): - return err("remoteStoreNode is an empty string, set it to none(string) instead") + return err("storenode is an empty string, set it to none(string) instead") if wakuConf.remoteLightPushNode.isSome() and isEmptyOrWhiteSpace(wakuConf.remoteLightPushNode.get()): - return err("remoteLightPushNode is an empty string, set it to none(string) instead") + return err("lightpushnode is an empty string, set it to none(string) instead") if wakuConf.remotePeerExchangeNode.isSome() and isEmptyOrWhiteSpace(wakuConf.remotePeerExchangeNode.get()): - return - err("remotePeerExchangeNode is an empty string, set it to none(string) instead") + return err("peer-exchange-node is an empty string, set it to none(string) instead") if wakuConf.remoteFilterNode.isSome() and isEmptyOrWhiteSpace(wakuConf.remoteFilterNode.get()): - return - err("remotePeerExchangeNode is an empty string, set it to none(string) instead") + return err("filternode is an empty string, set it to none(string) instead") if wakuConf.dnsDiscoveryConf.isSome() and isEmptyOrWhiteSpace(wakuConf.dnsDiscoveryConf.get().enrTreeUrl): - return err("dnsDiscoveryConf.enrTreeUrl is an empty string") + return err("dns-discovery-url is an empty string") # TODO: rln relay config should validate itself if wakuConf.rlnRelayConf.isSome(): let rlnRelayConf = wakuConf.rlnRelayConf.get() if isEmptyOrWhiteSpace(rlnRelayConf.treePath): - return err("rlnRelayConf.treepath is an empty string") + return err("rln-relay-tree-path is an empty string") if rlnRelayConf.ethClientUrls.len == 0: - return err("rlnRelayConf.ethClientUrls is empty") + return err("rln-relay-eth-client-address is empty") if isEmptyOrWhiteSpace(rlnRelayConf.ethContractAddress): - return err("rlnRelayConf.ethContractAddress is an empty string") + return err("rln-relay-eth-contract-address is an empty string") if rlnRelayConf.creds.isSome(): let creds = rlnRelayConf.creds.get() if isEmptyOrWhiteSpace(creds.path): - return err ( - "rlnRelayConf.creds.path is an empty string, set rlnRelayConf.creds it to none instead" - ) + return err ("rln-relay-cred-path is an empty string") if isEmptyOrWhiteSpace(creds.password): - return err ( - "rlnRelayConf.creds.password is an empty string, set rlnRelayConf.creds to none instead" - ) + return err ("rln-relay-cred-password is an empty string") return ok() diff --git a/waku/waku_rln_relay/group_manager/on_chain/group_manager.nim b/waku/waku_rln_relay/group_manager/on_chain/group_manager.nim index 61c9948ee..600291ecf 100644 --- a/waku/waku_rln_relay/group_manager/on_chain/group_manager.nim +++ b/waku/waku_rln_relay/group_manager/on_chain/group_manager.nim @@ -335,9 +335,6 @@ method generateProof*( let message_id = uint64ToField(messageId) var path_elements = newSeq[byte](0) - if (g.merkleProofCache.len mod 32) != 0: - return err("Invalid merkle proof cache length") - let identity_path_index = uint64ToIndex(g.membershipIndex.get(), 20) for i in 0 ..< g.merkleProofCache.len div 32: let chunk = g.merkleProofCache[i * 32 .. (i + 1) * 32 - 1]