Skip to content

fix: gossipsub-batch-subscription#6385

Open
Shashwat-Nautiyal wants to merge 1 commit intolibp2p:masterfrom
Shashwat-Nautiyal:fix/gossipsub-batch-subscription
Open

fix: gossipsub-batch-subscription#6385
Shashwat-Nautiyal wants to merge 1 commit intolibp2p:masterfrom
Shashwat-Nautiyal:fix/gossipsub-batch-subscription

Conversation

@Shashwat-Nautiyal
Copy link
Copy Markdown

@Shashwat-Nautiyal Shashwat-Nautiyal commented Apr 18, 2026

Description

Previously, when a new peer connected, the GossipSub behaviour sent one RpcOut::Subscribe message per subscribed topic. This meant N separate protobuf frames were written to the wire for N topics.

This PR introduces RpcOut::SubscribeMany, a batched variant that carries all subscriptions as a Vec<(TopicHash, bool, bool)>, and updates on_connection_established to use it. The result is a single proto::RPCwith multiple SubOpts entries on the wire, which is both spec-compliant and more efficient.

The receiving side was already correct as handle_received_subscriptions already iterates a Vec<proto::SubOpts>, so no changes are needed there and backward compatibility is fully preserved.

Fixes #6271

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@Shashwat-Nautiyal Shashwat-Nautiyal force-pushed the fix/gossipsub-batch-subscription branch from 37ae246 to 40e6f3b Compare April 18, 2026 03:39
@Shashwat-Nautiyal Shashwat-Nautiyal changed the title fix/gossipsub-batch-subscription fix: gossipsub-batch-subscription Apr 18, 2026
@elenaf9 elenaf9 requested a review from jxs April 20, 2026 10:17
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.

Gossipsub Hello RPC not spec compliant

1 participant