-
Notifications
You must be signed in to change notification settings - Fork 171
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
Add ssz format for block production. #205
Conversation
Block production and signed block consumption should allow SSZ encoding to help us reduce overheads on for api consumers. Fallbacks will likely remain json for clients anyway if they're not reading the headers, but if they do read the headers then there's big performance gains to be had in returning / consuming SSZ. At a later time it may be worth also accepting SSZ on other endpoints also.
the linter doesn't like me but if i try to insert schema somehow the swagger UI breaks... so i might leave it in this working state :) |
I don't think that it would be a terrible thing to say that an That said, we're already in a situation where we have an implicit default of JSON so it wouldn't come without some upgrade issues. |
Yeah I can see the thinking here, but it would a) break backwards compatibility for everyone and b) make using the API with curl significantly harder. On the other hand a client doing the weird thing of strictly requiring SSZ can handle that easily by just checking the returned It's also much more common in HTTP to have a default representation that's returned when the |
This should be ready for re-review @mpetrunic but let me know if you wanted more changes? |
|
Do we even need to specify which endpoints must support SSZ? ie clients can simply specify multiple values in http-accept (both json and ssz, with |
@arnetheduck yes we could do that, although from memory not all beacon nodes currently support multi-value |
I consider these to be quality-of-implementation points or optimizations really - if we say the json encoding is canonical/non-optional, I would even go as far as putting a table on top of the spec describing the (possible) encodings and not say anything more in each endpoint. I guess the post requests are the only ones where we need to specify One more format I've been contemplating is snappy-framed compressed encoding using |
IMO this is optional, but of high value. We can't make it compulsory because old endpoints that already exist don't do it. If clients can pick this up, there are gains to be had internally and externally, because clients such as our own validator client can save effort encoding/decoding, and also other products consuming and evaluating can gain the benefits of not having to json encode/decode. |
Block production and signed block consumption should allow SSZ encoding to help us reduce overheads on for api consumers.
Fallbacks will likely remain json for clients anyway if they're not reading the headers, but if they do read the headers then there's big performance gains to be had in returning / consuming SSZ.
At a later time it may be worth also accepting SSZ on other endpoints also.