chore: extract mix to logos-co/nim-libp2p-mix#2378
Merged
Conversation
Mix has been moved out of nim-libp2p into its own repository at https://github.com/logos-co/nim-libp2p-mix so it can evolve independently. This commit removes the mix code from nim-libp2p: - libp2p/protocols/mix/ (tree) - libp2p/protocols/mix.nim (facade) - tests/libp2p/mix/ (mix tests) - examples/mix_ping.nim (mix example) - libp2p/peerstore.nim: drop MixPubKeyBook (was only used by mix) - cbind: drop the libp2p_mix_* C API and Mix-specific types/fields: * 7 libp2p_mix_* exported procs in cbind/libp2p.nim * Mix APIs section in cbind/libp2p.h * MixCurve25519Key, MixSecp256k1PubKey, MixReadBehaviorKind in ffi_types.nim * mix and mixNodeInfo fields on the LibP2P context type * MIX_DIAL / MIX_REGISTER_DEST_READ / MIX_SET_NODE_INFO / MIX_NODEPOOL_ADD request kinds and their processors * cbind/examples/mix.c - libp2p.nimble: drop -d:libp2p_mix_experimental_exit_is_dest from the default test cfg (the new repo sets the flag in its own nimble file) - docs/protocols_mix.md and docs/protocols_mix_spam_protection.md - README, docs/README, .github/copilot-instructions: drop mix entries Consumers have already been migrated: - logos-co/mix-rln-spam-protection-plugin#6 - logos-messaging/logos-delivery#3842 Net change: 49 files deleted, 16 modified (-538 / +6). History for the extracted mix code is preserved in logos-co/nim-libp2p-mix with original authors, dates, and PR references rewritten as cross-repo links to vacp2p/nim-libp2p#NNNN.
vladopajic
approved these changes
Apr 30, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2378 +/- ##
==========================================
- Coverage 74.06% 73.41% -0.65%
==========================================
Files 170 149 -21
Lines 22357 20027 -2330
Branches 19 19
==========================================
- Hits 16558 14703 -1855
+ Misses 5799 5324 -475
🚀 New features to boost your workflow:
|
…libp2p-mix # Conflicts: # cbind/libp2p.nim # examples/mix_ping.nim # libp2p/protocols/mix/mix_node.nim # tests/libp2p/mix/component/test_cover_traffic.nim # tests/libp2p/mix/component/test_message_delivery.nim # tests/libp2p/mix/component/test_node_failures.nim # tests/libp2p/mix/component/test_spam_protection.nim # tests/libp2p/mix/test_multiaddr.nim # tests/libp2p/mix/test_pool.nim # tests/libp2p/mix/utils.nim
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the Mix protocol implementation (and all related tests, docs, examples, peerstore book, build flags, and C bindings) from nim-libp2p, following the extraction of Mix into logos-co/nim-libp2p-mix so it can evolve independently of the core library.
Changes:
- Deleted the Mix protocol code under
libp2p/protocols/mix/and thelibp2p/protocols/mix.nimfacade. - Removed Mix-specific tests/examples/docs and related references in repository docs and example runner.
- Removed Mix-related peerstore and C-bindings surface area, including config flags and exported Mix APIs.
Reviewed changes
Copilot reviewed 65 out of 65 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/libp2p/test_peer_store.nim | Removes MixPubKeyBook tests from the PeerStore suite. |
| tests/libp2p/mix/utils.nim | Deletes Mix test utilities (switch setup, helpers, fake protocols). |
| tests/libp2p/mix/test_tag_manager.nim | Deletes Mix replay-tag manager tests. |
| tests/libp2p/mix/test_sphinx.nim | Deletes Sphinx packet construction/processing tests. |
| tests/libp2p/mix/test_spam_protection_interface.nim | Deletes Mix spam-protection interface tests. |
| tests/libp2p/mix/test_serialization.nim | Deletes Mix serialization tests (Header/Message/SphinxPacket/SURBs). |
| tests/libp2p/mix/test_seq_no_generator.nim | Deletes Mix seq-no generator tests. |
| tests/libp2p/mix/test_pool.nim | Deletes Mix node pool tests. |
| tests/libp2p/mix/test_multiaddr.nim | Deletes Mix multiaddr serialization/conversion tests. |
| tests/libp2p/mix/test_mix_message.nim | Deletes MixMessage serialization/deserialization tests. |
| tests/libp2p/mix/test_fragmentation.nim | Deletes Mix payload fragmentation/padding tests. |
| tests/libp2p/mix/test_delay_strategy.nim | Deletes Mix delay strategy tests. |
| tests/libp2p/mix/test_curve25519.nim | Deletes Mix curve25519 helper tests. |
| tests/libp2p/mix/test_crypto.nim | Deletes Mix crypto helper tests (AES-CTR/SHA256/HMAC/KDF). |
| tests/libp2p/mix/test_cover_traffic.nim | Deletes Mix cover-traffic unit tests. |
| tests/libp2p/mix/spam_protection_impl.nim | Deletes spam-protection test implementations used by Mix tests. |
| tests/libp2p/mix/mock_mix.nim | Deletes MockMixProtocol used in integration tests. |
| tests/libp2p/mix/component/test_spam_protection.nim | Deletes Mix protocol spam-protection integration tests. |
| tests/libp2p/mix/component/test_security.nim | Deletes Mix protocol security integration tests (replay/failure behavior). |
| tests/libp2p/mix/component/test_node_failures.nim | Deletes Mix node-failure integration tests (multi-SURB, invalid nodes, etc.). |
| tests/libp2p/mix/component/test_message_delivery.nim | Deletes Mix message delivery integration tests (reply/no-reply, delays, concurrency). |
| tests/libp2p/mix/component/test_cover_traffic.nim | Deletes Mix cover-traffic integration tests. |
| tests/libp2p/mix/component/test_connection_api.nim | Deletes Mix connection API integration tests. |
| README.md | Removes Mix from the documented list of implemented protocols. |
| libp2p/protocols/mix/tag_manager.nim | Deletes Mix replay-tag manager implementation. |
| libp2p/protocols/mix/sphinx.nim | Deletes Sphinx packet construction/processing implementation used by Mix. |
| libp2p/protocols/mix/spam_protection.nim | Deletes Mix spam-protection interface and helpers. |
| libp2p/protocols/mix/serialization.nim | Deletes Mix header/message/SphinxPacket/SURB serialization code. |
| libp2p/protocols/mix/seqno_generator.nim | Deletes Mix sequence-number generation logic. |
| libp2p/protocols/mix/reply_connection.nim | Deletes Mix reply connection implementation. |
| libp2p/protocols/mix/pool.nim | Deletes Mix node pool abstraction backed by PeerStore. |
| libp2p/protocols/mix/multiaddr.nim | Deletes Mix-specific multiaddr encoding/decoding helpers. |
| libp2p/protocols/mix/mix_node.nim | Deletes Mix node identity/public-info structures and generators. |
| libp2p/protocols/mix/mix_metrics.nim | Deletes Mix metrics definitions. |
| libp2p/protocols/mix/mix_message.nim | Deletes MixMessage encoding/decoding logic. |
| libp2p/protocols/mix/fragmentation.nim | Deletes Mix message padding/chunking implementation. |
| libp2p/protocols/mix/exit_layer.nim | Deletes Mix exit-layer forwarding/handler logic. |
| libp2p/protocols/mix/exit_connection.nim | Deletes MixExitConnection implementation. |
| libp2p/protocols/mix/entry_connection.nim | Deletes MixEntryConnection and toConnection construction. |
| libp2p/protocols/mix/delay.nim | Deletes Mix Delay type and conversions. |
| libp2p/protocols/mix/delay_strategy.nim | Deletes Mix delay strategy implementations. |
| libp2p/protocols/mix/curve25519.nim | Deletes Mix curve25519 wrapper/utilities. |
| libp2p/protocols/mix/crypto.nim | Deletes Mix crypto helpers (AES-CTR/HMAC/KDF/SHA256). |
| libp2p/protocols/mix/benchmark.nim | Deletes Mix benchmarking metadata/logging helper. |
| libp2p/protocols/mix.nim | Deletes the Mix protocol facade/re-exports and helper read behaviors. |
| libp2p/peerstore.nim | Removes the MixPubKeyBook type and the curve25519 dependency only used by Mix. |
| libp2p.nimble | Removes the default test compile flag for experimental Mix behavior. |
| examples/mix_ping.nim | Deletes the Mix ping example. |
| examples/examples_run.nim | Removes mix_ping from the runnable examples aggregation. |
| docs/README.md | Removes Mix docs links from the docs index. |
| docs/protocols_mix.md | Deletes Mix protocol documentation page. |
| docs/protocols_mix_spam_protection.md | Deletes Mix spam-protection documentation page. |
| docs/development.md | Removes nimble testpath mix from development/testing docs. |
| cbind/types.nim | Removes Mix fields/types from the C bindings LibP2P object. |
| cbind/libp2p.nim | Removes exported C APIs related to Mix (dialing, key helpers, node pool, etc.). |
| cbind/libp2p.h | Removes Mix C API declarations/types and config flag exposure. |
| cbind/libp2p_thread/inter_thread_communication/requests/libp2p_stream_requests.nim | Removes Mix stream request types/fields and request processors. |
| cbind/libp2p_thread/inter_thread_communication/requests/libp2p_lifecycle_requests.nim | Removes Mix protocol mounting/config plumbing. |
| cbind/libp2p_thread/inter_thread_communication/libp2p_thread_request.nim | Removes Mix request dispatch cases from the thread request processor. |
| cbind/ffi_types.nim | Removes Mix-related FFI config fields and key/read-behavior types. |
| cbind/examples/mix.c | Deletes the Mix C-bindings example. |
| cbind/cbind.nimble | Stops building/running the removed Mix C example in the cbind examples task. |
| .github/copilot-instructions.md | Removes Mix-specific repo layout/docs/flags references from contributor instructions. |
Comment on lines
133
to
135
| peerStore.cleanup(randomPeerId) | ||
|
|
||
| check peerStore[AgentBook].len == 30 |
After the MixPubKeyBook tests were removed, the file no longer references any Curve25519 symbols. With UnusedImport treated as an error in config.nims, this would fail strict builds (it's silently tolerated today only because the surrounding bracketed import has other still-used entries).
chaitanyaprem
added a commit
to logos-co/nim-libp2p-mix
that referenced
this pull request
May 6, 2026
Until the deletion PR in nim-libp2p (vacp2p/nim-libp2p#2378) merges and a new libp2p version is registered, libp2p/peerstore still exports MixPubKeyBook. Combined with our local definition in libp2p_mix/pool, this triggers 'ambiguous identifier' in test files that import both. Use `except MixPubKeyBook` on the libp2p/peerstore import in those tests; the clause becomes a no-op once the deletion PR lands.
chaitanyaprem
added a commit
to logos-co/nim-libp2p-mix
that referenced
this pull request
May 6, 2026
Pin libp2p to the head of vacp2p/nim-libp2p#2378 so libp2p/peerstore no longer ships MixPubKeyBook. With our local definition in libp2p_mix/pool, this avoids the transitional 'ambiguous identifier' errors. Once #2378 merges to master and is published, replace this pin with a version range.
Member
|
FYI @gmelodie , merging this will require changes in logos libp2p module |
richard-ramos
approved these changes
May 6, 2026
gmelodie
approved these changes
May 6, 2026
This was referenced May 8, 2026
chaitanyaprem
added a commit
to logos-co/nim-libp2p-mix
that referenced
this pull request
May 8, 2026
…tion
Three follow-ups to the original mix extraction:
1. Move `MixPubKeyBook` from libp2p/peerstore into libp2p_mix/pool.
The type is mix-specific (Curve25519 keys per peer), only used
by libp2p_mix's own pool, and shouldn't bleed into core libp2p.
The peer-store extension mechanism makes this trivial:
`ref object of PeerBook[Curve25519Key]` defined locally is
indistinguishable from the previous version at the call site.
2. Drop the stale `{.public.}` pragma from method overrides in
entry/exit/reply_connection.nim. Upstream nim-libp2p removed the
marker pragma; our overrides referenced it without an importing
module that defined it.
3. Bump the libp2p git pin to the tip of vacp2p/nim-libp2p#2378
(mix-extraction PR, merged). With our local definition in
libp2p_mix/pool, this avoids ambiguous identifier errors against
the registered libp2p. We pin to the PR-tip rather than the
post-merge master commit because libp2p master picked up an
unrelated boringssl git-pin that nimble's SAT solver can't
currently resolve. Once a release including #2378 is tagged,
replace the pin with `libp2p >= <new-version>`.
This re-lands the work originally merged as #5 — that PR was
mistakenly merged into the (already-merged) PR #4 stacked branch
instead of master, so the changes never reached master.
chaitanyaprem
added a commit
to logos-co/nim-libp2p-mix
that referenced
this pull request
May 8, 2026
…tion
Three follow-ups to the original mix extraction:
1. Move `MixPubKeyBook` from libp2p/peerstore into libp2p_mix/pool.
The type is mix-specific (Curve25519 keys per peer), only used
by libp2p_mix's own pool, and shouldn't bleed into core libp2p.
The peer-store extension mechanism makes this trivial:
`ref object of PeerBook[Curve25519Key]` defined locally is
indistinguishable from the previous version at the call site.
2. Drop the stale `{.public.}` pragma from method overrides in
entry/exit/reply_connection.nim. Upstream nim-libp2p removed the
marker pragma; our overrides referenced it without an importing
module that defined it.
3. Bump the libp2p git pin to the master commit that merges
vacp2p/nim-libp2p#2378 (mix-extraction PR). With our local
definition in libp2p_mix/pool, this avoids ambiguous identifier
errors against the registered libp2p. The newer libp2p pulls in
a git-pinned boringssl dep that nimble's default SAT solver
can't resolve, so CI now runs `nimble --solver:legacy setup`.
Drop both the legacy flag and the git pin once a release
including #2378 is tagged.
This re-lands the work originally merged as #5 — that PR was
mistakenly merged into the (already-merged) PR #4 stacked branch
instead of master, so the changes never reached master.
chaitanyaprem
added a commit
to logos-co/nim-libp2p-mix
that referenced
this pull request
May 8, 2026
…tion
Three follow-ups to the original mix extraction:
1. Move `MixPubKeyBook` from libp2p/peerstore into libp2p_mix/pool.
The type is mix-specific (Curve25519 keys per peer), only used
by libp2p_mix's own pool, and shouldn't bleed into core libp2p.
The peer-store extension mechanism makes this trivial:
`ref object of PeerBook[Curve25519Key]` defined locally is
indistinguishable from the previous version at the call site.
2. Drop the stale `{.public.}` pragma from method overrides in
entry/exit/reply_connection.nim. Upstream nim-libp2p removed the
marker pragma; our overrides referenced it without an importing
module that defined it.
3. Bump the libp2p git pin to the master commit that merges
vacp2p/nim-libp2p#2378 (mix-extraction PR). With our local
definition in libp2p_mix/pool, this avoids ambiguous identifier
errors against the registered libp2p. The newer libp2p pulls in
a git-pinned boringssl dep that nimble's default SAT solver
can't resolve, so CI now runs `nimble --solver:legacy setup`.
Drop both the legacy flag and the git pin once a release
including #2378 is tagged.
This re-lands the work originally merged as #5 — that PR was
mistakenly merged into the (already-merged) PR #4 stacked branch
instead of master, so the changes never reached master.
5 tasks
This was referenced May 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mix has been extracted out of nim-libp2p into its own repository at
logos-co/nim-libp2p-mix
so it can evolve independently of the core libp2p library. This PR
removes the mix code from nim-libp2p.
What's removed
Net change: 49 files deleted, 16 modified (−538 / +6).
Consumer migrations (already up)
These should land before this PR merges, otherwise consumers break:
Verification
History preservation
Full mix git history is preserved in `logos-co/nim-libp2p-mix` with original
authors, dates, and PR references rewritten as cross-repo links to
`vacp2p/nim-libp2p#NNNN`.
Test plan