Highlights
- Removed
minprotobufusage, replacing it instead by nim-protobuf-serialization. - Protobuf metrics are now protocol-wide, with byte and message counters for sent/received protobuf traffic, and C bindings can expose metrics through
libp2p_collect_metrics. - PubSub and GossipSub were hardened with a default per-peer topic cap, bounded partial-message group state, duplicate IHAVE fixes, better validation ordering, and safer extension subscription handling.
- Kademlia gained a bounded local value store, improved routing-table peer admission, and cancellation of timed-out lookup RPCs so RPC slots are not leaked during bootstrap.
- Peerstore and connection-manager behavior was tightened: dial addresses are normalized, signed peer record updates are validated, connected peer addresses no longer expire while the peer is connected, and peer lifecycle event ordering is more consistent around trimming and drops.
- QUIC, yamux, and teardown paths were made more robust by tracking spawned futures, improving muxer close behavior, cleaning flushed-stream tracking, and updating lsquic for pending read/write cancellation.
- C bindings gained
libp2p_decode_xprfor decoding and verifying signed Extended Peer Records, plus stricter handling of invalid configured private keys. - Test coverage were expanded across priority queues, peerstore address TTLs, dual-stack transports, workflow caching, and parallel test execution.
Breaking changes
- PubSub protobuf/RPC structs now use
Opt[T]for fields that are optional on the wire. Code that directly constructs or readsMessage,SubOpts,PeerInfoMsg,ControlIHave,ControlGraft,ControlPrune,PartialMessageExtensionRPC,PingPongExtensionRPC,Preamble, orIMReceivingmay need to wrap values withOpt.some(...)and unwrap with.isSome,.get(), or.valueOr(...). - PubSub protobuf metrics changed. The old
libp2p_pubsub_rpc_bytes_readandlibp2p_pubsub_rpc_bytes_writecounters were replaced bylibp2p_protobuf_bytes_received,libp2p_protobuf_bytes_sent,libp2p_protobuf_messages_received, andlibp2p_protobuf_messages_sent. topicsHighnow defaults to1024instead of being effectively unlimited. Applications that legitimately expect a peer to subscribe to more than 1024 topics should settopicsHighexplicitly.- Kademlia local value storage is now bounded by configuration, with a default aligned to the provider-store capacity. Applications relying on unbounded local
PUT_VALUEretention should configure the limit explicitly.
PubSub Opt migration example
# before
let sub = SubOpts(subscribe: true, topic: topic)
if msg.signature.len > 0:
discard msg.verify()
# after
let sub = SubOpts(subscribe: Opt.some(true), topic: Opt.some(topic))
if msg.signature.isSome:
discard msg.verify()What's Changed
- chore: move
debugutilsfile to utils by @vladopajic in #2636 - feat(protobuf): add universal protobuf metrics by @vladopajic in #2637
- chore(kad): add local record store limit by @richard-ramos in #2633
- test(service-disco): improve flaky test by @rlve in #2629
- test(conn-manager): misc by @rlve in #2628
- chore(kad): protobuf_serialization by @vladopajic in #2617
- test(gossipsub): priority queues by @rlve in #2642
- fix: strip peeIDs fom dial addresses by @richard-ramos in #2630
- chore(ci): autobump nimbus-eth2 stable by @richard-ramos in #2634
- fix(ci): install latest daily deps into nimbledeps/ by @gmelodie in #2639
- chore: enable XCannotRaiseY warning-as-error by @gmelodie in #2648
- fix(yamux): clean up flushed stream tracking by @richard-ramos in #2640
- chore(peerstore): validate spr updates by @richard-ramos in #2641
- test(gossipsub): priority queues 2 by @rlve in #2646
- chore(examples): utilize protobuf_serialization by @vladopajic in #2649
- fix(nix): nat traversal build by @gmelodie in #2645
- chore(kad): refine routing table peer admission by @richard-ramos in #2643
- chore(signed-envelope): utilize protobuf-serialization by @vladopajic in #2650
- chore(deps): Bump
protobuf_serializationto v0.5.3 by @nitely in #2655 - chore(yamux): fix send window integer bounds by @gmelodie in #2651
- fix(pubsub): peerEventHandler to unsubscribe peer only on left event by @vladopajic in #2657
- chore(gossipsub): cap partial-message group state by @gmelodie in #2652
- chore: remove outdated performance/reliability tests by @rlve in #2658
- test(peerstore): Address TTL 1 by @rlve in #2662
- fix: track and cancel asyncSpawn-ed futures on teardown by @gmelodie in #2605
- chore(crypto): protobuf_serialization by @vladopajic in #2666
- chore(ExtendedPeerRecord): protobuf_serialization by @vladopajic in #2665
- test(gossipsub): priority queues 3 by @rlve in #2656
- feat(cbind): expose metrics via libp2p_collect_metrics by @gmelodie in #2625
- chore: removing usage of minprotobuf by @vladopajic in #2672
- chore(pubsub)!: protobuf_serialization by @vladopajic in #2638
- fix(pubsub): cap number of topics a peer can subscribe to by @gmelodie in #2667
- fix(quic): guard against concurrent session close by @richard-ramos in #2675
- test(peerstore): address TTL 3 by @rlve in #2664
- fix(quic):
cancelStreamHandlersnil pointer dereference by @vladopajic in #2678 - test(peerstore): address TTL 2 by @rlve in #2663
- chore(protobuf): main type encode/decode metrics by @vladopajic in #2677
- fix(gossipsub): keep extension subscriptions within topic cap by @richard-ramos in #2676
- fix(quic): QuicMuxer.close improvements by @vladopajic in #2686
- chore(protobuf): cosmetics by @vladopajic in #2682
- chore: bump lsquic by @richard-ramos in #2685
- chore: bump lsquic to handle cancel of pending reads/writes by @richard-ramos in #2692
- test: linux i386 asan by @richard-ramos in #2695
- chore: fix job names in daily jobs by @richard-ramos in #2694
- chore(protobuf): add metric for count of messages received/set by @vladopajic in #2690
- test(transports): dual stack 1 by @rlve in #2698
- feat(cbind): decode and verify XPR by @gmelodie in #2683
- fix(connmanager): emit Joined before trimming new peers by @richard-ramos in #2670
- chore(pubsub): adjust incoming message validation order by @richard-ramos in #2647
- fix(tests): remove chronicles import hacks by @richard-ramos in #2687
- test(transports): dual stack 2 by @rlve in #2704
- fix(cbind): error on invalid private key instead of generating a random one by @gmelodie in #2717
- fix(autotls): decouple ACME RSA keys from libp2p identity schemes by @richard-ramos in #2719
- test(ipaddr): dual stack 3 by @rlve in #2712
- test(transports): multiple addresses by @rlve in #2714
- test(transports): improve hanging test by @rlve in #2725
- fix(gossipsub): sending duplicate IHAVE by @vladopajic in #2724
- fix(pubsub): avoid sink params for small RPC fields by @richard-ramos in #2729
- fix(kad): cancel timed-out lookup RPCs so they don't leak rpc slots by @radiken in #2696
- fix(autotls): release certificate keys after CSR generation by @richard-ramos in #2699
- fix: Cleanup peers from readyEvents list when upgrade timed out by @etan-status in #2726
- fix(peerstore): keep connected peer addresses from expiring by @richard-ramos in #2734
- test(autonat): dual stack 4 by @rlve in #2733
- fix(connmanager): avoid late Joined after peer drop by @richard-ramos in #2737
- fix(test): use captured variable for closure by @vladopajic in #2740
- test: utilize new switch builder with multiple addresses by @vladopajic in #2742
- test(pubsub): cover stale peer cleanup after dropped connection by @richard-ramos in #2745
- fix: avoid deadlock when dropping peers from stream handler by @richard-ramos in #2751
- fix(gossipsub): concurrent peers table access during topic unsubscribe by @gmelodie in #2815
New Contributors
Full Changelog: v2.1.0...v2.2.0