feat: waku kademlia integration and mix updates#3722
Conversation
There was a problem hiding this comment.
Pull request overview
Integrates extended Kademlia discovery (incl. mix service advertisement/lookup) and updates MIX protocol wiring to match newer nim-libp2p APIs, plus related config/CLI and simulation updates.
Changes:
- Vendor bump + dependency bump to libp2p >= 1.15.0 and refactors MIX initialization to use new delay strategy / node pool handling.
- Adds extended Kademlia discovery module, configuration builders, CLI flags, and node factory wiring.
- Updates FFI/kernel APIs (relay subscribe/unsubscribe signature, lightpush publish path) and simulation configs/scripts.
Reviewed changes
Copilot reviewed 34 out of 35 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| waku/waku_mix/protocol.nim | Refactors MIX protocol initialization and bootnode processing; removes old node-pool manager loop. |
| waku/waku_core/peers.nim | Adds PeerOrigin.Kademlia enum value. |
| waku/node/waku_node.nim | Adds kademlia fields + extMultiAddrsOnly behavior; stops kademlia on shutdown. |
| waku/node/peer_manager/waku_peer_store.nim | Updates peer key source used by peers() aggregation. |
| waku/node/kernel_api/lightpush.nim | Adjusts mixify handling for lightpush publish. |
| waku/factory/waku_conf.nim | Adds KademliaDiscoveryConf and integrates it into WakuConf. |
| waku/factory/waku.nim | Propagates extMultiAddrsOnly to node instance. |
| waku/factory/node_factory.nim | Wires MIX mount refactor and adds extended kademlia discovery setup/start. |
| waku/factory/conf_builder/waku_conf_builder.nim | Adds kademlia discovery conf builder to the main builder and build path. |
| waku/factory/conf_builder/kademlia_discovery_conf_builder.nim | New builder for parsing kademlia bootstrap nodes from CLI/config strings. |
| waku/factory/conf_builder/conf_builder.nim | Exports the new kademlia discovery conf builder. |
| waku/discovery/waku_kademlia.nim | New extended kademlia discovery module: advertising mix, ingesting records, targeted lookup. |
| waku.nimble | Bumps minimum libp2p dependency version. |
| vendor/nim-libp2p | Updates vendored libp2p submodule commit. |
| tools/confutils/cli_args.nim | Adds CLI flags for enabling kademlia discovery and providing bootstrap nodes. |
| simulations/mixnet/run_mix_node4.sh | Pipes node output to a log file. |
| simulations/mixnet/run_mix_node3.sh | Pipes node output to a log file. |
| simulations/mixnet/run_mix_node2.sh | Pipes node output to a log file. |
| simulations/mixnet/run_mix_node1.sh | Pipes node output to a log file. |
| simulations/mixnet/run_mix_node.sh | Pipes node output to a log file. |
| simulations/mixnet/run_chat_mix.sh | Adds --kad-bootstrap-node to simulation command. |
| simulations/mixnet/config4.toml | Updates simulation config: disables discv5/rendezvous/px, adds kad bootstrap + ext-multiaddr-only. |
| simulations/mixnet/config3.toml | Updates simulation config: disables discv5/rendezvous/px, adds kad bootstrap + ext-multiaddr-only. |
| simulations/mixnet/config2.toml | Updates simulation config: disables discv5/rendezvous/px, adds kad bootstrap + ext-multiaddr-only. |
| simulations/mixnet/config1.toml | Updates simulation config: disables discv5/rendezvous/px, adds kad bootstrap + ext-multiaddr-only. |
| simulations/mixnet/config.toml | Updates simulation config: enables kademlia discovery + ext-multiaddr-only, disables discv5/rendezvous/px. |
| nix/default.nix | Fixes Android env var assignment syntax and patches build script behavior under nix sandbox. |
| library/libwaku.h | Extends relay subscribe/unsubscribe signatures; adds debug APIs for mix pool size + lightpush peer count. |
| library/kernel_api/protocols/store_api.nim | Adds base64 JSON encoding for seq[byte]; tweaks store query response serialization. |
| library/kernel_api/protocols/relay_api.nim | Adds content-topic based relay subscribe/unsubscribe in FFI. |
| library/kernel_api/protocols/lightpush_api.nim | Switches to node.lightpushPublish and adds optional pubsub topic handling. |
| library/kernel_api/protocols/filter_api.nim | Allows optional pubsub topic for filter subscribe. |
| library/kernel_api/debug_node_api.nim | Adds FFI debug endpoints for mix pool size and lightpush peer count. |
| apps/chat2mix/config_chat2mix.nim | Changes defaults and adds CLI arg for kademlia bootstrap nodes. |
| apps/chat2mix/chat2mix.nim | Adds kademlia bootstrap parsing and starts kademlia discovery for mix peer discovery path. |
Comments suppressed due to low confidence (3)
waku/waku_mix/protocol.nim:1
- Overriding
stopwithdiscardprevents any baseMixProtocolcleanup from running (and may leak resources or background tasks owned by the parent protocol). If no extra shutdown is needed anymore, remove this override so the base method runs; otherwise, call the base implementation (e.g.,procCall MixProtocol(mix).stop()), then perform any WakuMix-specific cleanup.
waku/node/kernel_api/lightpush.nim:1 - This forces
lmixify = truewhenever MIX is mounted, even if the caller explicitly requestedmixify = false. It also removes the previous error path whenmixify = truebut MIX is not mounted (now commented out). Suggested fix: keeplmixify = mixify, and ifmixifyis true whilenode.wakuMix.isNil(), return the appropriate SERVICE_NOT_AVAILABLE error.
waku/waku_mix/protocol.nim:1 - Correct spelling/grammar in the warning message: use 'at least' instead of 'atleast'.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
You can find the image built from this PR at Built from b583435 |
9bd8b5f to
942e02b
Compare
942e02b to
45da95f
Compare
Ivansete-status
left a comment
There was a problem hiding this comment.
Thanks for the PR! 🙌
Some comments so far.
| toSeq(peerStore[LastSeenBook].book.keys()), | ||
| toSeq(peerStore[LastSeenOutboundBook].book.keys()), |
b03d8ac to
b9ffbfe
Compare
|
@Ivansete-status @darshankabariya this PR has to be part of 0.38-beta release |
Ivansete-status
left a comment
There was a problem hiding this comment.
LGTM! Thanks for it! 🙌
I'm just adding some nitpicks that I hope you find useful.
NagyZoltanPeter
left a comment
There was a problem hiding this comment.
After the original PR addressed my most concerns I find this one great!
I could not add more now than what was already mentioned.
Huge thanks for it!!!
Co-authored-by: Ivan FB <128452529+Ivansete-status@users.noreply.github.com>
b9ffbfe to
3abe1d9
Compare
Description
Extracting items which are needed for long term from pr into this.
Changes