ethereum / devp2p

Ethereum peer-to-peer networking specifications
984 stars 275 forks source link

ETH1 and ETH2 cross-compatible ENRs (RLP and SSZ) #107

Closed raulk closed 4 years ago

raulk commented 5 years ago

The encoding of ENRs is defined as RLP. However, ETH2 clients don't have the necessity to support RLP per se, and ETH1 don't need to support SSZ per se.

We appear to have a mismatch that either:

  1. Makes one side "cave" to the other.
  2. We migrate ENRs to a neutral third-party serialisation format with ample pre-existing support in all programming languages (e.g. Protobuf).

Another possible direction would entail making ENRs themselves encoding-agnostic, e.g. by prepending a multicodec.

While in theory that would enable the ENR standard to cater for both ETH1 and ETH2 natural encodings, in practice it would end up segregating discovery networks -- which is an undesired effect, i.e. ETH1 nodes would ignore SSZ-encoded ENRs, and ETH2 nodes would ignore RLP-encoded ENRs.

Thoughts?

fjl commented 5 years ago

I really don't want to have more than one encoding of ENRs. If clients support discv5, they will need to have an RLP library for better or worse. RLP is a fine encoding, and has served us very well. I don't think using it for networking is a bad choice.