From 2f366072ffb454ccded431029e8c421ca3ab0100 Mon Sep 17 00:00:00 2001 From: Gabriel mermelstein Date: Thu, 30 May 2024 13:07:19 +0200 Subject: [PATCH] fixing redundant funcion types --- waku/waku_core/topics/pubsub_topic.nim | 6 ++---- waku/waku_enr/sharding.nim | 4 ++-- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/waku/waku_core/topics/pubsub_topic.nim b/waku/waku_core/topics/pubsub_topic.nim index 41ea75fb0f..b8150de40d 100644 --- a/waku/waku_core/topics/pubsub_topic.nim +++ b/waku/waku_core/topics/pubsub_topic.nim @@ -41,7 +41,7 @@ const StaticShardingPubsubTopicPrefix = Waku2PubsubTopicPrefix & "/rs" proc parseStaticSharding*( - T: type NsPubsubTopic, topic: PubsubTopic | string + T: type NsPubsubTopic, topic: PubsubTopic ): ParsingResult[NsPubsubTopic] = if not topic.startsWith(StaticShardingPubsubTopicPrefix): return err( @@ -72,9 +72,7 @@ proc parseStaticSharding*( ok(NsPubsubTopic.staticSharding(clusterId, shardId)) -proc parse*( - T: type NsPubsubTopic, topic: PubsubTopic | string -): ParsingResult[NsPubsubTopic] = +proc parse*(T: type NsPubsubTopic, topic: PubsubTopic): ParsingResult[NsPubsubTopic] = ## Splits a namespaced topic string into its constituent parts. ## The topic string has to be in the format `////` NsPubsubTopic.parseStaticSharding(topic) diff --git a/waku/waku_enr/sharding.nim b/waku/waku_enr/sharding.nim index 05671c9909..978d1ea5b4 100644 --- a/waku/waku_enr/sharding.nim +++ b/waku/waku_enr/sharding.nim @@ -85,7 +85,7 @@ func contains*(rs: RelayShards, clusterId, shardId: uint16): bool = func contains*(rs: RelayShards, topic: NsPubsubTopic): bool = return rs.contains(topic.clusterId, topic.shardId) -func contains*(rs: RelayShards, topic: PubsubTopic | string): bool = +func contains*(rs: RelayShards, topic: PubsubTopic): bool = let parseRes = NsPubsubTopic.parse(topic) if parseRes.isErr(): return false @@ -240,7 +240,7 @@ proc containsShard*(r: Record, clusterId, shardId: uint16): bool = proc containsShard*(r: Record, topic: NsPubsubTopic): bool = return containsShard(r, topic.clusterId, topic.shardId) -proc containsShard*(r: Record, topic: PubsubTopic | string): bool = +proc containsShard*(r: Record, topic: PubsubTopic): bool = let parseRes = NsPubsubTopic.parse(topic) if parseRes.isErr(): debug "invalid static sharding topic", topic = topic, error = parseRes.error