Skip to content
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

docs(network): README #2100

Merged
merged 13 commits into from
Dec 15, 2021
Merged

docs(network): README #2100

merged 13 commits into from
Dec 15, 2021

Conversation

danforbes
Copy link
Contributor

@danforbes danforbes commented Dec 3, 2021

Changes

Added README to network package. Rendered docs here.

Tests

N/A

Issues

Closes #2036

Primary Reviewer

@noot

@codecov
Copy link

codecov bot commented Dec 3, 2021

Codecov Report

Merging #2100 (e26b4c9) into development (d096d44) will increase coverage by 0.00%.
The diff coverage is n/a.

Impacted file tree graph

@@             Coverage Diff              @@
##           development    #2100   +/-   ##
============================================
  Coverage        61.35%   61.36%           
============================================
  Files              202      202           
  Lines            27355    27355           
============================================
+ Hits             16785    16787    +2     
+ Misses            8694     8691    -3     
- Partials          1876     1877    +1     
Flag Coverage Δ
unit-tests 61.36% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/runtime/wasmer/imports.go 48.71% <0.00%> (+0.05%) ⬆️
dot/network/connmgr.go 90.41% <0.00%> (+1.36%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d096d44...e26b4c9. Read the comment docs.

dot/network/README.md Outdated Show resolved Hide resolved
Copy link
Contributor

@jimjbrettj jimjbrettj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you said this is a WIP, but looks great so far!

dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
@danforbes danforbes force-pushed the dfo/doc/net branch 4 times, most recently from f3477da to 7fcabc1 Compare December 7, 2021 22:34
@danforbes danforbes requested a review from qdm12 December 8, 2021 11:28
@danforbes danforbes changed the title README for network Package docs(network): README Dec 8, 2021
dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
dot/network/README.md Outdated Show resolved Hide resolved
Comment on lines 91 to 92
[key distribution](#identity--key-management) capabilities. The Noise protocol is
[well documented](http://cryptowiki.net/index.php?title=Noise_Protocol_Framework) and the Go implementation is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it might be nicer to link to the libp2p spec: https://github.com/libp2p/specs/blob/master/noise/README.md afaik the libp2p version of noise and the "official" version have some slight differences

Comment on lines 133 to 135
unidirectionally "push" information to other peers in the network. Although the peer receiving the information must
explicitly accept a handshake in order to open a stream for a notification protocol, this stream does not allow the
receiver to "push" information to the sender.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
unidirectionally "push" information to other peers in the network. Although the peer receiving the information must
explicitly accept a handshake in order to open a stream for a notification protocol, this stream does not allow the
receiver to "push" information to the sender.
unidirectionally "push" information to other peers in the network. On stream opening, the outgoing and incoming sides will exchange a handshake. After this handshake is completed, the incoming side is closed for writing; ie. the receiver of the stream can only receive data over the stream, but not write to it. The opposite is true for the outgoing side; the stream is closed for reading after the handshake has completed, and data can only be sent.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also update this to say something like "the stream can be left open indefinitely until one side no longer wishes to communicate"

dot/network/README.md Outdated Show resolved Hide resolved
Comment on lines 146 to 147
contains a [block header](https://docs.substrate.io/v3/getting-started/glossary/#header) and associated data, such as
the [BABE pre-runtime digest](https://crates.parity.io/sp_consensus_babe/digests/enum.PreDigest.html).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the BABE digests are part of the header, so I'd just leave this as saying the message is a block header.

dot/network/README.md Outdated Show resolved Hide resolved
[Finality](https://wiki.polkadot.network/docs/learn-consensus#finality-gadget-grandpa) protocols ("gadgets") such as
GRANDPA are often described in terms of "games" that are played by the participants in a network. In GRANDPA, this game
relates to voting on the blocks that inform the canonical chain. This notification protocol is used by peers to cast
votes for participation in the GRANDPA game.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
votes for participation in the GRANDPA game.
votes for participation in the GRANDPA game, and as well to gossip a `Commit` message when a chain has been finalised.


[These protocols](https://crates.parity.io/sc_network/index.html#request-response-protocols) allow peers to request
specific information from one another. The requesting peer sends a protocol-specific message that describes the request
and the peer to which the request was sent replies with a message.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd update this to also say if a node opens a stream with some remote peer, then the outgoing side will only push requests and the incoming side will only expect to receive requests. same for the other way around, the outgoing side expects to only receive responses.

Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work! just a few comments/suggestions. it might also be good to add something about "polite gossip" - ie. don't send the same message to a peer twice and that kinda thing

peer-to-peer networks use have evolved over time - [Napster](https://en.wikipedia.org/wiki/Napster) relied on a central
database, [Gnutella](https://en.wikipedia.org/wiki/Gnutella) used a brute-force technique called "flooding",
[BitTorrent](https://en.wikipedia.org/wiki/BitTorrent) takes a performance-preserving approach that relies on a
[distributed hash table (DHT)](https://en.wikipedia.org/wiki/Distributed_hash_table). Gossamer uses a `libp2p`-based
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BitTorrent also uses Kademlia

dot/network/README.md Outdated Show resolved Hide resolved
@danforbes
Copy link
Contributor Author

Thank you for your clarifications, @noot - can you please review this commit to make sure I got everything right? 🙏🏻 e26b4c9

Copy link
Contributor

@noot noot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me! do you still plan to add links to the codebase here? oh, and also stuff about polite gossip?

@danforbes
Copy link
Contributor Author

@noot yes I am working on "deeper" links into the codebase/godocs but if you think this is correct and compete enough I say that we go ahead and merge it in and I can continue with iterative improvements on the docs 👍🏻

@danforbes danforbes merged commit 7ce1cd7 into development Dec 15, 2021
@danforbes danforbes deleted the dfo/doc/net branch December 15, 2021 18:54
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.

Documentation for dot/network Package
6 participants