3 Commits

Author SHA1 Message Date
Prem Chaitanya Prathi
4365df4b56
fixup(mix): address PR #3807 review + sim alignment
- waku/waku_mix/protocol.nim: drop the magic-2 cover-traffic fallback
  and the hardcoded 10s epoch. Source cover-traffic totalSlots and
  epochDuration from spamProtectionConfig when RLN is on (so cover
  emission can't outpace proof minting), and from named waku
  constants (WakuCoverTrafficTotalSlots=40, WakuCoverTrafficEpochDuration=60s,
  ~10 emissions/min/node) when RLN is disabled. Single ConstantRate
  CoverTraffic.new call site at the end of the block; the if/else
  only sets up spam protection. Addresses PR review comment on
  protocol.nim line 102.
- waku.nimble: bump mix-rln plugin to 8ec5dc24 (latest on
  feat/cover-traffic-epoch-support: messageId guard + drift-corrected
  epoch timer) and pin nim-lsquic to #6d2bc489 (v0.2.0) so libp2p
  1.15.3's certificate_ffi keeps finding EVP_PKEY in lsquic_ffi.nim.
- waku/common/option_shims: explain in a header comment that the file
  exists because libp2p 1.15.3 dropped Option[T] overloads of
  valueOr/withValue from libp2p/utility; can be removed once those are
  restored upstream. Addresses PR review comment.
- simulations/mixnet/setup_credentials: drop the unused
  SpammerUserMessageLimit constant (the "Higher" comment was wrong
  since 3 < DefaultUserMessageLimit=4, and zerokit blocks proof-gen
  past the per-user limit anyway, so it could never simulate a
  spammer). Addresses PR review comment.
- simulations/mixnet/run_chat_mix{,1}.sh: pass --rln-user-message-limit=4
  so the chat client's RLN budget matches the keystores baked at
  limit=4, otherwise cover-traffic totalSlots vs RLN-budget mismatch
  jams the sim.

Sim verified end-to-end:
  - RLN-on (default sim config): PASS, ≥2 proof-verified per node,
    cover-traffic metrics non-zero.
  - RLN-off (mix nodes only, ad-hoc config): cover-traffic emits at
    ~13/min/node from the new waku defaults (target ~10/min); the
    no-RLN code path is exercised correctly.
2026-06-05 12:34:08 +05:30
Prem Chaitanya Prathi
fc6af2fdf1
feat(mix): cover traffic with constant rate
- Integrate ConstantRateCoverTraffic from libp2p mix module with default
  totalSlots = userMessageLimit (or 2) and 10s epoch
- Add --mix-user-message-limit and --mix-disable-spam-protection CLI flags
  with corresponding MixConfBuilder accessors and MixConf fields
- Wrap mixRlnSpamProtection construction so it is skipped when spam
  protection is disabled, with a nil guard in setupSpamProtectionCallbacks
- Add waku/common/option_shims.nim restoring valueOr/withValue templates
  for std/options (removed upstream by results), and import it across
  modules that relied on the old behavior
- Sink chat2mix logs to textlines (stdout) instead of textlines[file] to
  work around a chronicles compile-time macro-eval bug under Nim 2.2.4
- Rename ExtendedKademliaDiscoveryParams -> ExtendedServiceDiscoveryParams
  to match the kad_disco -> service_discovery rename in nim-libp2p
- Bump nim-libp2p to e1bbda4f6 (PR #2243 "cover traffic with constant
  rate") and mix-rln-spam-protection-plugin to 153d0c0 (PR #5 cover
  traffic epoch change support); both pre-libp2p_mix-extraction
- Add simulations/mixnet/check_cover_traffic.sh for monitoring
  mix_cover_* / mix_slot_* metrics, plus per-node cover-traffic configs
2026-06-05 12:32:57 +05:30
Prem Chaitanya Prathi
d8e6dcef22
feat(mix): integrate mix protocol with extended kademlia + RLN spam protection
Rebased poc/mix-spam-protection onto origin/master. Bundles:

- Extended kademlia discovery integration for mix node pool
  (waku/discovery/waku_kademlia.nim, tools/confutils/cli_args.nim)
- RLN spam protection plugin (vacp2p/mix-rln-spam-protection) wired in:
  WakuMix gains mixRlnSpamProtection + publishMessage callback,
  per-hop proof generation / verification, membership coordination
  via /mix/rln/metadata/v1 content topic
- chat2mix sim app: filter-subscribes to spam-protection coordination
  topic, defers publishing until mix node pool is populated
- Makefile: automated librln_mix_v2.0.0.a build via
  scripts/build_rln_mix.sh and mix-librln target
- simulations/mixnet: 5-node mixnet sim infrastructure
  (config1-4.toml, run_*.sh, build_setup.sh, setup_credentials.nim,
  README, roundtrip_check.sh automated round-trip verification)

Rebase fixes:
- Plugin previously vendored as submodule; now a nimble requires entry
  pinned to logos-co/mix-rln-spam-protection-plugin@037f8e10
- waku.nimble: zlib < 0.2 pin to keep nimble lock resolution stable
  (upstream zlib HEAD bumped to 0.2.0)
- apps/chat2mix/config_chat2mix.nim: replace
  `defaultValue: parseIpAddress("...")` with IpAddress literal,
  works around confutils macro generating
  `defaultValueHelpName(): string {.raises: [].}` that violates the
  raises pragma when stringifying a parseIpAddress call
- config.nims: nimble setup --noNimblePath reordering

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-04 16:53:05 +05:30