Skip to content

p2p: implement new Transport interface#5791

Merged
mergify[bot] merged 60 commits intomasterfrom
erik/p2p-transport
Dec 15, 2020
Merged

p2p: implement new Transport interface#5791
mergify[bot] merged 60 commits intomasterfrom
erik/p2p-transport

Conversation

@erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Dec 11, 2020

This implements a new Transport interface and related types for the P2P refactor in #5670. Previously, conn.MConnection was very tightly coupled to the Peer implementation -- in order to allow alternative non-multiplexed transports (e.g. QUIC), MConnection has now been moved below the Transport interface, as MConnTransport, and decoupled from the peer. Since the p2p package is not covered by our Go API stability, this is not considered a breaking change, and not listed in the changelog.

The initial approach was to implement the new interface in its final form (which also involved possible protocol changes, see tendermint/spec#227). However, it turned out that this would require a large amount of changes to existing P2P code because of the previous tight coupling between Peer and MConnection and the reliance on subtleties in the MConnection behavior. Instead, I have broadened the Transport interface to expose much of the existing MConnection interface, preserved much of the existing MConnection logic and behavior in the transport implementation, and tried to make as few changes to the rest of the P2P stack as possible. We will instead reduce this interface gradually as we refactor other parts of the P2P stack.

The low-level transport code and protocol (e.g. MConnection, SecretConnection and so on) has not been significantly changed, and refactoring this is not a priority until we come up with a plan for QUIC adoption, as we may end up discarding the MConnection code entirely.

There are no tests of the new MConnTransport, as this code is likely to evolve as we proceed with the P2P refactor, but tests should be added before a final release. The E2E tests are sufficient for basic validation in the meanwhile.

@erikgrinaker
Copy link
Contributor Author

erikgrinaker commented Dec 11, 2020

Looks like a bunch of non-P2P tests rely on P2P testing infrastructure and internals, I'll do a pass over these on Monday.

Copy link
Contributor

@melekes melekes left a comment

Choose a reason for hiding this comment

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

amazing work 🔥 looking forward to p2p 2.0

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Looks great! I'm still reviewing the MConnTransport implementation, but I'm giving a preliminary ACK.

@codecov
Copy link

codecov bot commented Dec 15, 2020

Codecov Report

Merging #5791 (fd389e3) into master (6dce4ef) will decrease coverage by 0.49%.
The diff coverage is 46.39%.

@@            Coverage Diff             @@
##           master    #5791      +/-   ##
==========================================
- Coverage   60.46%   59.96%   -0.50%     
==========================================
  Files         261      262       +1     
  Lines       23627    23712      +85     
==========================================
- Hits        14285    14218      -67     
- Misses       7853     7981     +128     
- Partials     1489     1513      +24     
Impacted Files Coverage Δ
libs/log/testing_logger.go 0.00% <0.00%> (ø)
p2p/node_info.go 95.29% <ø> (ø)
p2p/transport.go 28.00% <28.00%> (-55.54%) ⬇️
p2p/transport_mconn.go 41.63% <41.63%> (ø)
p2p/peer.go 52.98% <46.80%> (-6.05%) ⬇️
node/node.go 58.08% <62.50%> (+0.06%) ⬆️
p2p/test_util.go 70.73% <80.00%> (+5.06%) ⬆️
p2p/switch.go 63.28% <83.87%> (-2.77%) ⬇️
p2p/conn/connection.go 78.45% <100.00%> (+0.27%) ⬆️
p2p/netaddress.go 53.68% <100.00%> (+0.17%) ⬆️
... and 22 more

@erikgrinaker erikgrinaker added the S:automerge Automatically merge PR when requirements pass label Dec 15, 2020
@mergify mergify bot merged commit bcfc889 into master Dec 15, 2020
@mergify mergify bot deleted the erik/p2p-transport branch December 15, 2020 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C:p2p Component: P2P pkg S:automerge Automatically merge PR when requirements pass

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants