-
Notifications
You must be signed in to change notification settings - Fork 651
spec/p2p: new structure for the p2p specification #966
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
d2d41e3
spec/p2p: moving legacy documents to legacy/ dir
cason 4b2622d
spec/p2p: using capitalized names for README.md
cason 5a4f072
spec/p2p: intro to p2p spec, moved from other README
cason cb12ccb
spec/p2p: v0.34.x documentation, README shortened
cason b522e3c
spec/p2p: minor changes on READMEs
cason 251fe3a
spec/p2p: moving messages/ content to legacy/ dir
cason 09092e5
spec/p2p: dir for docs of the p2p implementation
cason 977247b
spec/p2p: renamed reactor dirs to reactor-api
cason f556734
spec/p2p: legacy content to legacy-docs/ dir
cason e508ebf
8000
spec/p2p: fixes on implementation/README.md file
cason 03e4d3a
spec/p2p: moving images to a single subdir
cason fe4dcf6
spec/p2p: fixing Markdown links
cason 065533a
spec/p2p: fixing Markdown links in all repo
cason ba77f1c
spec/p2p: table of contents for the p2p docs
cason 2ab144f
spec/p2p: applying suggestions from Josef
cason File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
--- | ||
order: 1 | ||
parent: | ||
title: P2P | ||
order: 6 | ||
--- | ||
|
||
# Peer-to-Peer Communication | ||
|
||
A CometBFT network is composed of multiple CometBFT instances, hereafter called | ||
`nodes`, that interact by exchanging messages. | ||
|
||
The CometBFT protocols are designed under the assumption of a partially-connected network model. | ||
This means that a node is not assumed to be directly connected to every other | ||
node in the network. | ||
Instead, each node is directly connected to only a subset of other nodes, | ||
hereafter called its `peers`. | ||
|
||
The peer-to-peer (p2p) communication layer is then the component of CometBFT that: | ||
|
||
1. establishes connections between nodes in a CometBFT network | ||
2. manages the communication between a node and the connected peers | ||
3. intermediates the exchange of messages between peers in CometBFT protocols | ||
|
||
The specification the p2p layer is a work in progress, | ||
tracked by [issue #19](https://github.com/cometbft/cometbft/issues/19). | ||
The current content is organized as follows: | ||
|
||
- [`implementation`](./implementation/README.md): documents the current state | ||
of the implementation of the p2p layer, covering the main components of the | ||
`p2p` package. The documentation covers, in a fairly comprehensive way, | ||
the items 1. and 2. from the list above. | ||
- [`reactor-api`](./reactor-api/README.md): specifies the API offered by the | ||
p2p layer to the protocol layer, through the `Reactor` abstraction. | ||
This is a high-level specification (i.e., it should not be implementation-specific) | ||
of the p2p layer API, covering item 3. from the list above. | ||
- [`legacy-docs`](./legacy-docs/): We keep older documentation in | ||
the `legacy-docs` directory, as overall, it contains useful information. | ||
However, part of this content is redundant, | ||
being more comprehensively covered in more recent documents, | ||
and some implementation details might be outdated | ||
(see [issue #981](https://github.com/cometbft/cometbft/issues/981)). | ||
|
||
In addition to this content, some unfinished, work in progress, and auxiliary | ||
material can be found in the | ||
[knowledge-base](https://github.com/cometbft/knowledge-base/tree/main/p2p) repository. |
File renamed without changes
File renamed without changes
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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,38 @@ | ||||||
# Implementation of the p2p layer | ||||||
|
||||||
This section documents the implementation of the peer-to-peer (p2p) | ||||||
communication layer in CometBFT. | ||||||
|
||||||
The documentation was [produced](https://github.com/tendermint/tendermint/pull/9348) | ||||||
using the `v0.34.*` releases | ||||||
and the branch [`v0.34.x`](https://github.com/cometbft/cometbft/tree/v0.34.x) | ||||||
of this repository as reference. | ||||||
As there were no substancial changes in the p2p implementation, the | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
documentation also applies to the releases `v0.37.*` and `v0.38.*` [^v35]. | ||||||
|
||||||
[^v35]: The releases `v0.35.*` and `v0.36.*`, which included a major | ||||||
refactoring of the p2p layer implementation, were [discontinued][v35postmorten]. | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
[v35postmorten]: https://interchain-io.medium.com/discontinuing-tendermint-v0-35-a-postmortem-on-the-new-networking-layer-3696c811dabc | ||||||
|
||||||
## Contents | ||||||
|
||||||
The documentation follows the organization of the | ||||||
[`p2p` package](https://github.com/cometbft/cometbft/tree/v0.34.x/p2p), | ||||||
which implements the following abstractions: | ||||||
|
||||||
- [Transport](./transport.md): establishes secure and authenticated | ||||||
connections with peers; | ||||||
- [Switch](./switch.md): responsible for dialing peers and accepting | ||||||
connections from peers, for managing established connections, and for | ||||||
routing messages between the reactors and peers, | ||||||
< E377 td id="diff-ca27d4557ff3e0b4e26e5a46aa45192a45aed35fdec28520905283bfdd245869R29" data-line-number="29" class="blob-num blob-num-addition js-linkable-line-number js-blob-rnum"> | that is, between local and remote instances of the CometBFT protocols; | |||||
- [PEX Reactor](./pex.md): due to the several roles of this component, the | ||||||
documentation is split in several parts: | ||||||
- [Peer Exchange protocol](./pex-protocol.md): enables nodes to exchange peer addresses, thus implementing a peer discovery service; | ||||||
- [Address Book](./addressbook.md): stores discovered peer addresses and | ||||||
quality metrics associated to peers with which the node has interacted; | ||||||
- [Peer Manager](./peer_manager.md): defines when and to which peers a node | ||||||
should dial, in order to establish outbound connections; | ||||||
- [Types](./types.md) and [Configuration](./configuration.md) provide a list of | ||||||
existing types and configuration parameters used by the p2p package. |
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
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
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
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
File renamed without changes.
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.