docs: add sequence diagrams for partial messages protocol flows#11
Open
adarsh-7-satyam wants to merge 1 commit into
Open
Conversation
Signed-off-by: Adarsh Satyam <adarsh5.satyam@gmail.com>
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.
Description
The
partial-messages.mdspecification is the core document describing Gossipsub 1.4's Large Message Handling extension. While the text accurately describes the protocol mechanics, it lacks any visual representation of the multi-step flows involved. For a protocol as nuanced as Partial Messages — involving capability negotiation, eager data pushing, bitmap-based metadata exchange, and heartbeat gossip — text alone makes it difficult for new implementers to build a correct mental model of how the pieces fit together.Problem
A developer reading
partial-messages.mdfor the first time would encounter terms likepartsMetadata,groupID,requestsPartial, andsupportsSendingPartialwithout ever seeing how these fields flow between peers in a real interaction. The absence of sequence diagrams forces implementers to mentally simulate the protocol from scattered prose, increasing the risk of misimplementation and interoperability failures betweenpy-libp2pandnim-libp2p.Changes Made
Added a new
## Sequence Diagramssection topartial-messages.mdcontaining four Mermaid sequence diagrams, each covering a distinct protocol flow:Extension Negotiation — Illustrates how two peers exchange
SubOptsmessages withrequestsPartialandsupportsSendingPartialflags to establish mutual support for the Partial Messages extension before any data is transferred.Eager Push Flow — Shows how a publisher can immediately push initial
partialMessagedata to a peer as Eager Data without waiting for a metadata exchange, and how the peer can subsequently sendpartsMetadatato request any remaining parts.partsMetadata Exchange Flow — Demonstrates the core synchronization mechanism where a peer sends a bitmap of its held parts, the responding peer identifies what is missing, and sends only those specific parts back, enabling efficient reassembly at the receiver.
Heartbeat Gossip with Partial Messages — Depicts how during the periodic heartbeat, a node replaces the standard
IHAVEgossip withpartsMetadatawhen communicating with non-mesh peers, allowing them to request and receive only the parts they are missing.How It Solves The Problem
Each diagram is placed within the existing flow of the document and preceded by a short explanatory paragraph that bridges the prose and the visual. Together, the four diagrams cover the complete lifecycle of a large message — from initial capability announcement, through eager and metadata-driven delivery, to gossip-based propagation — giving implementers a clear, unambiguous reference for every major interaction pattern defined in the spec.
Impact
py-libp2pandnim-libp2pby providing a shared visual reference for expected message sequencesRelated Issue
Closes #10