Prem Chaitanya Prathi f8ebf4dead
refactor(mix): split DoS-protection self-registration into background retry
WakuMix.start() previously ran a single sequential pipeline that ended
with mixRlnSpamProtection.registerSelf() — which publishes the new
member's idCommitment to other mix nodes via relay. With master's flow
(switch.start() then reconnectRelayPeers() then ...), running registerSelf
inline would either:
  - block startup for ~62s when reconnectRelayPeers backs off, or
  - run before relay peers exist and silently no-op.

Split the start() proc into:
  - method start*(WakuMix): local-only init (cred load, tree restore,
    plugin start). Safe to await before peers are connected.
  - proc registerDoSProtectionWithNetwork*(WakuMix): kick off a background
    task that retries registerSelf + saveTree indefinitely until the
    broadcast lands. Cancelled when WakuMix.stop() is invoked.

waku_node.start() now wires these in order:
  switch.start()
  wakuMix.start()                   # local init, errors propagate
  reconnectRelayPeers()             # may back off; no longer blocks mix
  wakuMix.registerDoSProtectionWithNetwork()  # fire-and-forget retry
  node.started = true

Re-call safety: registerDoSProtectionWithNetwork no-ops if a prior task
is still running. Lifecycle: WakuMix.stop() cancelAndWait()s the task
before calling plugin.stop().

For keystore-loaded nodes the first attempt early-returns successfully
(membershipIndex already set); the retry path only exercises for fresh
joins where the initial broadcast hits a not-yet-subscribed network.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 17:26:01 +05:30
..
2026-05-16 00:09:07 +02:00
2026-05-16 00:09:07 +02:00