10 Commits

Author SHA1 Message Date
SionoiS
af512314b9 fix: chat2disco (and circuit-relay nodes) segfault at waku_node.nim:589 on start
Root cause (post libp2p f54c715 update + rv/kad/service-disco changes):
- chat2disco (and waku factory for circuitRelayClient) do direct
  `node.switch.services = @[Service(hp/autonat)]` (bypassing the
  deprecated switch.add that called .setup).
- AutonatService (enableAddressMapper=true by default) + HP require
  their .setup(switch) to populate .addressMapper (and handlers)
  before start().
- In switch.start: services.start → autonat.start does
  addressMappers.add(nil); await peerInfo.update() → for m in ...:
  await m(...) → nil proc deref (Defect/SEGV in release).
- Surfaces at the `await node.switch.start()` (waku_node:589).
- Secondary: wakuKademlia.start() + waku mapper (capturing node,
  returning announced which hp mutates) scheduled before switch.start
  (which activates the mounted kad via ms + runs the hp mappers/updates).

Fix:
- After services= in apps/chat2disco/chat2disco.nim and in
  waku/factory/waku.nim (both hp and bare autonat branches), explicitly
  call the .setup(node.switch) (or hp.setup) and handle error.
- Move `if not node.wakuKademlia.isNil(): ...start()` to after
  switch.start() + reconnectRelayPeers (correct ordering for mounted
  protocol user loops).
- Harden waku addressMapper (nil/empty guard, return listenAddrs) and
  set peerInfo.announcedAddrs (short-circuit) at the add site, in
  updateAnnounced..., and in the onReservation callbacks (chat2disco +
  factory) so expandAddrs prefers it.
- Minor: lookup/periodic guards in waku_kademlia; doc in
  autonat_service.

Also nph reformats on touched files.

Reuses: the .setup methods, existing post-switch init patterns,
isNil guards, CatchableError handling, make chat2disco + nph.

Verified: make chat2disco (twice, pre/post nph) SuccessX; no SEGV in
multiple start-path runs (only expected thread EOF on pipe close);
diff only our 5 files.

Builds on 82d87cfa (libp2p update) without touching pins or vendored.
Caveat: clean `make update` still requires the mix temp patches in
pkgs2 (as documented in the update).

Fixes the reported chat2disco startup segfault.
2026-06-05 12:44:35 +00:00
Simon-Pierre
31f9c0dfee
pubsub topic instead of content topic 2026-05-27 10:13:48 -04:00
Simon-Pierre
8672b30445
fix message formating 2026-05-22 08:38:31 -04:00
Simon-Pierre
aa295ccfab
Startup prompt & fixes 2026-05-22 07:59:12 -04:00
Simon-Pierre
7f98fd1fe9
autonat & config default 2026-05-20 09:50:45 -04:00
Simon-Pierre
cae051ba6f
dns resolution 2026-05-19 11:41:38 -04:00
SionoiS
55e752c526
update to latest libp2p 2026-05-12 07:57:20 -04:00
SionoiS
7776a5f81a
latest libp2p master & disable bootstrapping 2026-05-12 07:56:39 -04:00
SionoiS
a424e712fa
makefile chat2disco update 2026-05-12 07:56:38 -04:00
SionoiS
dd722cf5b0
chat2disco 2026-05-12 07:56:36 -04:00