Skip to content

Commit

Permalink
chore(networking): lower dhigh to limit amplification factor (#2168)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrevuelta committed Oct 30, 2023
1 parent 282c2e8 commit f0f69b3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions waku/waku_relay/protocol.nim
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const GossipsubParameters = GossipSubParams(

d: 6,
dLow: 4,
dHigh: 12,
dHigh: 8,
dScore: 6,
dOut: 3,
dLazy: 6,
Expand Down Expand Up @@ -174,8 +174,8 @@ proc new*(T: type WakuRelay, switch: Switch): WakuRelayResult[T] =

return ok(w)

proc addValidator*(w: WakuRelay,
topic: varargs[string],
proc addValidator*(w: WakuRelay,
topic: varargs[string],
handler: WakuValidatorHandler) {.gcsafe.} =
for t in topic:
w.wakuValidators.mgetOrPut(t, @[]).add(handler)
Expand All @@ -196,7 +196,7 @@ proc subscribedTopics*(w: WakuRelay): seq[PubsubTopic] =

proc generateOrderedValidator*(w: WakuRelay): auto {.gcsafe.} =
# rejects messages that are not WakuMessage
let wrappedValidator = proc(pubsubTopic: string,
let wrappedValidator = proc(pubsubTopic: string,
message: messages.Message): Future[ValidationResult] {.async.} =
# can be optimized by checking if the message is a WakuMessage without allocating memory
# see nim-libp2p protobuf library
Expand Down Expand Up @@ -245,15 +245,15 @@ proc subscribe*(w: WakuRelay, pubsubTopic: PubsubTopic, handler: WakuRelayHandle

proc unsubscribeAll*(w: WakuRelay, pubsubTopic: PubsubTopic) =
## Unsubscribe all handlers on this pubsub topic

debug "unsubscribe all", pubsubTopic=pubsubTopic

procCall GossipSub(w).unsubscribeAll(pubsubTopic)
w.validatorInserted.del(pubsubTopic)

proc unsubscribe*(w: WakuRelay, pubsubTopic: PubsubTopic, handler: TopicHandler) =
## Unsubscribe this handler on this pubsub topic

debug "unsubscribe", pubsubTopic=pubsubTopic

procCall GossipSub(w).unsubscribe(pubsubTopic, handler)
Expand Down

0 comments on commit f0f69b3

Please sign in to comment.