Skip to content

feat: waku kademlia integration and mix updates#3722

Merged
chaitanyaprem merged 3 commits into
masterfrom
feat/waku-kademlia-mix
Feb 19, 2026
Merged

feat: waku kademlia integration and mix updates#3722
chaitanyaprem merged 3 commits into
masterfrom
feat/waku-kademlia-mix

Conversation

@chaitanyaprem
Copy link
Copy Markdown
Contributor

@chaitanyaprem chaitanyaprem commented Feb 13, 2026

Description

Extracting items which are needed for long term from pr into this.

Changes

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 stop with discard prevents any base MixProtocol cleanup 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 = true whenever MIX is mounted, even if the caller explicitly requested mixify = false. It also removes the previous error path when mixify = true but MIX is not mounted (now commented out). Suggested fix: keep lmixify = mixify, and if mixify is true while node.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.

Comment thread library/kernel_api/protocols/lightpush_api.nim Outdated
Comment thread waku/discovery/waku_kademlia.nim
Comment thread waku/discovery/waku_kademlia.nim
Comment thread apps/chat2mix/chat2mix.nim Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 13, 2026

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3722

Built from b583435

Copy link
Copy Markdown
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! 🙌
Some comments so far.

Comment thread nix/default.nix
Comment thread waku/discovery/waku_kademlia.nim
Comment thread waku/discovery/waku_kademlia.nim Outdated
Comment thread waku/discovery/waku_kademlia.nim
Comment thread waku/factory/node_factory.nim
Comment on lines -88 to +85
toSeq(peerStore[LastSeenBook].book.keys()),
toSeq(peerStore[LastSeenOutboundBook].book.keys()),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

explained here

Comment thread waku/waku_mix/protocol.nim Outdated
Comment thread waku/waku_mix/protocol.nim
Comment thread waku/node/waku_node.nim
@igor-sirotin
Copy link
Copy Markdown
Contributor

igor-sirotin commented Feb 18, 2026

@Ivansete-status @darshankabariya this PR has to be part of 0.38-beta release

Copy link
Copy Markdown
Collaborator

@Ivansete-status Ivansete-status left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for it! 🙌
I'm just adding some nitpicks that I hope you find useful.

Comment thread waku/discovery/waku_kademlia.nim Outdated
Comment thread waku/discovery/waku_kademlia.nim Outdated
Comment thread waku/discovery/waku_kademlia.nim
Comment thread waku/discovery/waku_kademlia.nim Outdated
Comment thread waku/node/waku_node.nim
Copy link
Copy Markdown
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!!!

Comment thread nix/default.nix
@chaitanyaprem chaitanyaprem merged commit 335600e into master Feb 19, 2026
11 of 13 checks passed
@chaitanyaprem chaitanyaprem deleted the feat/waku-kademlia-mix branch February 19, 2026 04:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants