diff --git a/apps/chat2/chat2.nim b/apps/chat2/chat2.nim index c04e7b7590..d27357633c 100644 --- a/apps/chat2/chat2.nim +++ b/apps/chat2/chat2.nim @@ -45,6 +45,7 @@ import ../../waku/node/peer_manager, ../../waku/factory/builder, ../../waku/common/utils/nat, + ../../waku/waku_relay, ./config_chat2 import libp2p/protocols/pubsub/rpc/messages, libp2p/protocols/pubsub/pubsub @@ -522,7 +523,7 @@ proc processInput(rfd: AsyncFD, rng: ref HmacDrbgContext) {.async.} = if msg.contentTopic == chat.contentTopic: chat.printReceivedMessage(msg) - node.subscribe((kind: PubsubSub, topic: DefaultPubsubTopic), some(handler)) + node.subscribe((kind: PubsubSub, topic: DefaultPubsubTopic), some(WakuRelayHandler(handler))) if conf.rlnRelay: info "WakuRLNRelay is enabled" diff --git a/apps/networkmonitor/networkmonitor.nim b/apps/networkmonitor/networkmonitor.nim index 12ca3dd591..52c5736a0c 100644 --- a/apps/networkmonitor/networkmonitor.nim +++ b/apps/networkmonitor/networkmonitor.nim @@ -528,7 +528,7 @@ proc subscribeAndHandleMessages( else: msgPerContentTopic[msg.contentTopic] = 1 - node.subscribe((kind: PubsubSub, topic: pubsubTopic), some(handler)) + node.subscribe((kind: PubsubSub, topic: pubsubTopic), some(WakuRelayHandler(handler))) when isMainModule: # known issue: confutils.nim(775, 17) Error: can raise an unlisted exception: ref IOError diff --git a/examples/subscriber.nim b/examples/subscriber.nim index b878a008b8..87b52dc8d7 100644 --- a/examples/subscriber.nim +++ b/examples/subscriber.nim @@ -16,7 +16,8 @@ import ../../../waku/waku_node, ../../../waku/waku_enr, ../../../waku/waku_discv5, - ../../../waku/factory/builder + ../../../waku/factory/builder, + ../../../waku/waku_relay # An accesible bootstrap node. See waku.sandbox fleets.status.im const bootstrapNode = @@ -115,7 +116,7 @@ proc setupAndSubscribe(rng: ref HmacDrbgContext) {.async.} = contentTopic = msg.contentTopic, timestamp = msg.timestamp - node.subscribe((kind: PubsubSub, topic: pubsubTopic), some(handler)) + node.subscribe((kind: PubsubSub, topic: pubsubTopic), some(WakuRelayHandler(handler))) when isMainModule: let rng = crypto.newRng() diff --git a/vendor/nim-bearssl b/vendor/nim-bearssl index 7640cc6aa8..86f212c6a5 160000 --- a/vendor/nim-bearssl +++ b/vendor/nim-bearssl @@ -1 +1 @@ -Subproject commit 7640cc6aa859f6d4ad657c892f14c76dc1d34bd5 +Subproject commit 86f212c6a5d76b52e20fad2e318cc5436d04fc26 diff --git a/vendor/nim-chronos b/vendor/nim-chronos index 7b02247ce7..8e49df1400 160000 --- a/vendor/nim-chronos +++ b/vendor/nim-chronos @@ -1 +1 @@ -Subproject commit 7b02247ce74d5ad5630013334f2e347680b02f65 +Subproject commit 8e49df14007e27370cd1ce77edb2843783b45e6d diff --git a/vendor/nim-faststreams b/vendor/nim-faststreams index 8ff78919aa..11b9d952a8 160000 --- a/vendor/nim-faststreams +++ b/vendor/nim-faststreams @@ -1 +1 @@ -Subproject commit 8ff78919aa5a23aecaf4a647e23cfa8ecda6736a +Subproject commit 11b9d952a80ec87e2443405a6a5382f9daac51f8 diff --git a/vendor/nim-json-serialization b/vendor/nim-json-serialization index 7516a92eb8..1ac1d69f95 160000 --- a/vendor/nim-json-serialization +++ b/vendor/nim-json-serialization @@ -1 +1 @@ -Subproject commit 7516a92eb8339f8fc1de7dd16cfa3d77bce87cd2 +Subproject commit 1ac1d69f9512d55d15e8218a9dbdff129bf96ddb diff --git a/vendor/nim-libbacktrace b/vendor/nim-libbacktrace index 008de2cd42..66864ed4ae 160000 --- a/vendor/nim-libbacktrace +++ b/vendor/nim-libbacktrace @@ -1 +1 @@ -Subproject commit 008de2cd425cbca19f7d922e4e8b209d92313752 +Subproject commit 66864ed4ae18d14a2b4acb4549561efd7755351f diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index d08ce17144..09b3e11956 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit d08ce17144cabe2ac9925bd75a11ad88a607c04e +Subproject commit 09b3e11956459ad4c364b353b7f1067f42267997 diff --git a/vendor/nim-presto b/vendor/nim-presto index 223aadeb82..a9687dda1c 160000 --- a/vendor/nim-presto +++ b/vendor/nim-presto @@ -1 +1 @@ -Subproject commit 223aadeb82d35b57e6dae99f0b325ec6345ce7ff +Subproject commit a9687dda1c3e20d5b066d42b33c2a63f018af93f diff --git a/vendor/nim-stew b/vendor/nim-stew index 1662762c01..a0c085a51f 160000 --- a/vendor/nim-stew +++ b/vendor/nim-stew @@ -1 +1 @@ -Subproject commit 1662762c0144854db60632e4115fe596ffa67fca +Subproject commit a0c085a51fe4f2d82aa96173ac49b3bfe6043858 diff --git a/vendor/nim-stint b/vendor/nim-stint index 7bb0ccc784..3c238df6cd 160000 --- a/vendor/nim-stint +++ b/vendor/nim-stint @@ -1 +1 @@ -Subproject commit 7bb0ccc7842577243edc3b8d61f75bf498551a7a +Subproject commit 3c238df6cd4b9c1f37a9f103383e7d2bbd420c13 diff --git a/vendor/nim-unicodedb b/vendor/nim-unicodedb index 04a154eee0..3db16f8ece 160000 --- a/vendor/nim-unicodedb +++ b/vendor/nim-unicodedb @@ -1 +1 @@ -Subproject commit 04a154eee0b8a2ad313e24ba46a4e5b4e0b9036f +Subproject commit 3db16f8ece5d0eba310c8f1ed812c6ff5a21a34a diff --git a/vendor/nim-unittest2 b/vendor/nim-unittest2 index b5028a4471..e96f321503 160000 --- a/vendor/nim-unittest2 +++ b/vendor/nim-unittest2 @@ -1 +1 @@ -Subproject commit b5028a44710f0317c5e710c80cec90127aa7e77c +Subproject commit e96f3215030cbfa13abc2f5827069b6f8ba87e38 diff --git a/vendor/nimbus-build-system b/vendor/nimbus-build-system index cf0c9cfa40..d7e7f1044d 160000 --- a/vendor/nimbus-build-system +++ b/vendor/nimbus-build-system @@ -1 +1 @@ -Subproject commit cf0c9cfa408189c6d428799bf2e9da8d0c0f7f08 +Subproject commit d7e7f1044def3c62d0b4bcec60c0b53876e44d71 diff --git a/waku/waku_relay/protocol.nim b/waku/waku_relay/protocol.nim index 48dd93551b..62f3be0b6a 100644 --- a/waku/waku_relay/protocol.nim +++ b/waku/waku_relay/protocol.nim @@ -60,58 +60,58 @@ const TopicParameters = TopicParams( ) # see: https://rfc.vac.dev/spec/29/#gossipsub-v10-parameters -const GossipsubParameters = GossipSubParams( - explicit: true, - pruneBackoff: chronos.minutes(1), - unsubscribeBackoff: chronos.seconds(5), - floodPublish: true, - gossipFactor: 0.25, - d: 6, - dLow: 4, - dHigh: 8, - dScore: 6, - dOut: 3, - dLazy: 6, - heartbeatInterval: chronos.seconds(1), - historyLength: 6, - historyGossip: 3, - fanoutTTL: chronos.minutes(1), - seenTTL: chronos.minutes(2), +const GossipsubParameters = GossipSubParams.init( + explicit = true, + pruneBackoff = chronos.minutes(1), + unsubscribeBackoff = chronos.seconds(5), + floodPublish = true, + gossipFactor = 0.25, + d = 6, + dLow = 4, + dHigh = 8, + dScore = 6, + dOut = 3, + dLazy = 6, + heartbeatInterval = chronos.seconds(1), + historyLength = 6, + historyGossip = 3, + fanoutTTL = chronos.minutes(1), + seenTTL = chronos.minutes(2), # no gossip is sent to peers below this score - gossipThreshold: -100, + gossipThreshold = -100, # no self-published msgs are sent to peers below this score - publishThreshold: -1000, + publishThreshold = -1000, # used to trigger disconnections + ignore peer if below this score - graylistThreshold: -10000, + graylistThreshold = -10000, # grafts better peers if the mesh median score drops below this. unset. - opportunisticGraftThreshold: 0, + opportunisticGraftThreshold = 0, # how often peer scoring is updated - decayInterval: chronos.seconds(12), + decayInterval = chronos.seconds(12), # below this we consider the parameter to be zero - decayToZero: 0.01, + decayToZero = 0.01, # remember peer score during x after it disconnects - retainScore: chronos.minutes(10), + retainScore = chronos.minutes(10), # p5: application specific, unset - appSpecificWeight: 0.0, + appSpecificWeight = 0.0, # p6: penalizes peers sharing more than threshold ips - ipColocationFactorWeight: -50.0, - ipColocationFactorThreshold: 5.0, + ipColocationFactorWeight = -50.0, + ipColocationFactorThreshold = 5.0, # p7: penalizes bad behaviour (weight and decay) - behaviourPenaltyWeight: -10.0, - behaviourPenaltyDecay: 0.986, + behaviourPenaltyWeight = -10.0, + behaviourPenaltyDecay = 0.986, # triggers disconnections of bad peers aka score