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

Could SSZ be replaced through protocol buffers? #503

Closed
decanus opened this issue Jan 27, 2019 · 5 comments
Closed

Could SSZ be replaced through protocol buffers? #503

decanus opened this issue Jan 27, 2019 · 5 comments
Labels
general:RFC Request for Comments

Comments

@decanus
Copy link
Contributor

decanus commented Jan 27, 2019

Abstract

The goal of this issue is to start a discussion on whether abandoning SimpleSeralize and replacing it with ProtocolBuffers is a possibility, and whether this change should be adopted.

Motivation

The reason for proposing this, would be to reduce the amount of new standards created by eth2.0 and fallback on robust technologies with already various implementations in the languages currently being used to build eth2.0 clients.

Changes

Changes to the specification would include changing all DataStructures to Protocol Buffer proto's, this could also help reduce the requirement of implementation as anyone would be able to generate the data structures for their specific implementation from these protos.

The hash function could remain as is, but the way it is called could be changed. Changing it to being called with the already byte encoded proto.

@decanus decanus changed the title Could SSZ be replaced through protocol buffers Could SSZ be replaced through protocol buffers? Jan 27, 2019
@paulhauner
Copy link
Contributor

See: #129

TLDR;

  1. Protobuf is non-deterministic, therefore not suitable for hashing.
  2. It's potentially a good candidate for network serialization, but there are some downsides with fixed-length array support and it being key-value.

@decanus
Copy link
Contributor Author

decanus commented Jan 27, 2019

@paulhauner yeah, I spoke with @prestonvanloon and he mentioned that the fact that they are non-deterministic means they can't be used. I still question if we should discuss reducing the usage of SSZ over all and stick to protocol buffers for all p2p communication.

Potentially discussing changing SSZ to define a seralization standard for Protocol Buffers would also be a possibility.

@paulhauner
Copy link
Contributor

See also some brief analysis here: https://github.com/sigp/serialization_sandbox/blob/report/report/serialization_report.md. That is from a spec many moons ago, so it's very outdated!

Protobuf is marginally bigger on the wire than SSZ. You'd probably want to do some more analysis before you make a firm judgement on that, though.

If we really want to see gains from proto we'd make SSZ an encode-only format. Whilst that's probably cpu-cycles-optimal, I'm not sure it's meeting-project-deadlines-optimal.

Personally, I'm fine for either SSZ or protobuf across the wire -- I'm using protos for the node API so it's minimal effort for me to switch between them.

@djrtwo
Copy link
Contributor

djrtwo commented Jan 28, 2019

Another reason for SSZ for consensus is the tree hashing algorithm. We need to be able to cache large portions of the state that do not change at state updates to reduce load of hashing the large state object at each slot/epoch

@hwwhww hwwhww added the general:RFC Request for Comments label Jan 28, 2019
@JustinDrake
Copy link
Contributor

Could SSZ be replaced through protocol buffers?

I think the answer is pretty clear: "No" :) Closing for now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general:RFC Request for Comments
Projects
None yet
Development

No branches or pull requests

5 participants