Skip to content

Commit

Permalink
fixing redundant funcion types
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmer committed May 30, 2024
1 parent f213b58 commit 2f36607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
6 changes: 2 additions & 4 deletions waku/waku_core/topics/pubsub_topic.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 `/<application>/<version>/<topic-name>/<encoding>`
NsPubsubTopic.parseStaticSharding(topic)
Expand Down
4 changes: 2 additions & 2 deletions waku/waku_enr/sharding.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 2f36607

Please sign in to comment.