Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Parity violates EIP-8, causing the network to partition #6647

Closed
karalabe opened this issue Oct 5, 2017 · 1 comment
Closed

Parity violates EIP-8, causing the network to partition #6647

karalabe opened this issue Oct 5, 2017 · 1 comment
Labels
F2-bug 🐞 The client fails to follow expected behavior. M4-core ⛓ Core client code / Rust. P0-dropeverything 🌋 Everyone should address the issue now.
Milestone

Comments

@karalabe
Copy link

karalabe commented Oct 5, 2017

The DEVp2p protocol originally expected version numbers to match exactly for two peers to communicate with each other. This turned out to be a very bad idea because it locked in the protocol to one particular version, and upgrading became semi-impossible due to the network needing to switch over all at once to any update.

As a result, in 2015, EIP-8 was proposed and accepted to add forward compatibility into the DEVp2p layer. In essence, the important points of the EIP were:

  • Ignore the version number the remote side returns (as in, don't expect an exact version match)
  • Ignore any extra fields in the handshake that the local DEVp2p implementation doesn't know about
  • Announce the highest supported version number (which includes speaking anything below that)

Both clients will then be aware of the highest common version number and speak that.


Unfortunately, Parity did not yet implement the part of ignoring the remote version number, rather forces it to be exactly v4.

With the approval of EIP-706, the DEVp2p protocol was extended with Snappy support, and version bumped to v5. The Byzantium release of Geth v1.7.1 includes this new protocol feature, and correctly advertises it's highest version as 5.

All older peers in the network should ignore v5, advertise v4 themselves, which will cause Geth v1.7.1 to correctly identify an older protocol version and not enable Snappy. This works correctly for all old Geth nodes (Homstead and above), however Parity rejects such connections:

2017-10-05 15:50:26  IO Worker #0 DEBUG network  Hello: Geth/v1.7.1-stable-05101641/linux-amd64/go1.9 v5 5094..25dc [SessionCapabilityInfo { protocol: [101, 116, 104], version: 63, packet_count: 17, id_offset: 16 }]
2017-10-05 15:50:26  IO Worker #0 TRACE network  Peer protocol version mismatch: 5

The net effect is, that as people upgrade for Byzantium, the network will fall apart unless Parity is patched to fully implement the 2015 spec of ignoring the announced DEVp2p version number.

@karalabe
Copy link
Author

karalabe commented Oct 5, 2017

I'm assuming this line is the main culprit: https://github.com/paritytech/parity/blob/c49beccadcd3c60c9fd90d1393921b91598c8eb0/util/network/src/session.rs#L522

Though I'm unsure if https://github.com/paritytech/parity/blob/c49beccadcd3c60c9fd90d1393921b91598c8eb0/util/network/src/handshake.rs#L188 should also be changed from PROTOCOL_VERSION to remote_version (which needs retrieval) or not.

@rphmeier rphmeier added F2-bug 🐞 The client fails to follow expected behavior. M4-core ⛓ Core client code / Rust. labels Oct 5, 2017
@5chdn 5chdn added the P0-dropeverything 🌋 Everyone should address the issue now. label Oct 5, 2017
@5chdn 5chdn added this to the Patch milestone Oct 5, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F2-bug 🐞 The client fails to follow expected behavior. M4-core ⛓ Core client code / Rust. P0-dropeverything 🌋 Everyone should address the issue now.
Projects
None yet
Development

No branches or pull requests

3 participants