-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Instead of using ssz for both network and consensus, I think we should use ssz only for consensus and standardize around protobuf at the network layer.
Benefits
- Eliminates the ssz decoder since there's no need for the encoding to be reversible.
- Eliminates the need for a length prefix in the ssz encoder. Same reason as above.
- Allows the ssz encoder to be space inefficient (e.g. padding) since the result doesn't need to be stored or sent over the wire.
- protobuf is already battle-tested and fits this use case well.
- protobuf supports schemas and versioning out of the box.
- protobuf already has solid libraries for many languages.
- protobuf's code generation provides good ergonomics for developers.
Potential conerns
- Supporting two serializers increases complexity
- In my opinion, inventing a serializer that satisfies the needs of both consensus and networking is much more complex.
- Using protobuf for networking is way simpler. This is definitely true for Prysm, and I imagine this is true for other implementation teams as well, but I'd like to hear other team's opinions.
- ssz becomes simpler if its only used for consensus.
- Re-encoding a block from the wire is inefficient
- The cost of re-encoding is negligible when compared to the other steps necessary for verification. The byte array needs to be decoded, the encoding needs to be hashed, and the signature needs to be verified.
- Protobuf is bad because [insert opinion here]
- I'm open to other libraries, but protobuf seems like a good fit for the reasons stated above.
Previous discussions
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels