-
Notifications
You must be signed in to change notification settings - Fork 62
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
Allow SSZ encoding in addition to JSON encoding (for request and response payloads) #53
Comments
in general I think this would be great to add ASAP!
can always just make a otherwise, we update the |
Thinking about it, upgrading
Should be easy to notify other release before this change gets out, for them to add least make sure they can handle it correctly and not error out (even if not using SSZ). |
@metachris Could you expand the benchmarks to different block sizes within what's observed in mainnet? Agree that would be great to add this asap. No strong opinions on whether to bump to v2 or not |
Agree with @dapplion that this would be a good addition. |
A few notes on this after investigating this for the beacon APIs:
This won't require any changes to API versioning, if it is assumes that a lack of a Content-type header implies "application/json", and a lack of Accept header the same. |
Indeed, there's no official Here's more about the It seems it would be okay to add to the current |
I would also love to see this for builder submissions. |
This is the reason we have rest API instead of JSON-RPC on the builder. I'm strongly in favour of this!
I think that the 415 flow as @mcdee sayd must be the standard (and the easiest way is to implement a fallback mechanism) we already implemented it in beacon API when VC posts signed blocks. To avoid additional systematic additional latency during rollout, clients should remember that they falledback to json and not try to post ssz again. To remove even the first attempt latency, a nice to have would be, as you're saying, that CLs (and mev-boost) switch their rest clients to json as long as they receive a json response from |
Sidenote: would the |
Yep, it is |
Sounds like the headers is a more proper way to do things but I'm pro |
If going with v2, we could also allow SSZ encoding for validator registrations, which could speed up the processing a whole lot. This wouldn't work with v1 in a backwards-compatible manner (without some workarounds on the BN). |
This is a change to the server rather than the endpoints, so I'd really rather not see it resulting in incrementing versions. It's possible for clients to work out what encodings servers accept with a little bit of back-and-forth, and as long as they persist that information over the lifetime of the connection it shouldn't result in much in terms of additional overhead. |
In my opinion it would be best to be consistent with the current beacon-APIs https://ethereum.github.io/beacon-APIs/ and the way the support for SSZ is described for the endpoints (basically support In terms of backwards compatibility, if clients (CLs and mev-boost) don't change anything, everything will work same as before since all requests default to json anyways. If the same clients start sending ssz requests and expect ssz responses, they should handle:
For mev-boost it would be good to mark a relay as ssz-not-supported and immediately use json for further requests. (with some expiry maybe since the relay could upgrade) For CLs, I suppose it is better to have a configuration option to use ssz or not for the builder interface, since they only talk to one component and can switch it on/off depending on what is supported. |
What's the argument for having a switch, rather than simply checking for SSZ support on
I don't think mev-boost should do transformations on the requests. It seems preferable to have mev-boost continue to be just proxying the original calls. The logic with detecting SSZ support on getHeader seems solid enough. |
Maybe an user would want to only use the json flow and not ssz, so having the choice is more user-friendly. Not super important though since it is implementation details, which each client will handle in their preferred way.
Yeah, it seems solid enough to be fair as long as mev-boost honors the |
Related: ethereum/beacon-APIs#250 |
bump on this issue, with the introduction of blobs seeing client timeouts in the devnets when max blob payloads are returned to the beacon node.
|
I've benchmarked encoding and decoding of signed-blinded-beacon-block payloads with SSZ vs JSON: flashbots/go-boost-utils#50
SSZ seems 40-50x faster:
This would be particularly relevant for
getPayload
calls, because of the payload size and timing constraints (but perhaps also interesting forgetHeader
andregisterValidator
).Each
getPayload
call currently does 8 JSON encoding and decoding steps (if we include mev-boost in the mix):getPayload
request body (signed blinded beacon block)getPayload
request bodygetPayload
request bodygetPayload
request bodygetPayload
response body (execution payload)getPayload
response bodygetPayload
response bodygetPayload
response bodyConsidering 20-40ms per coding on average, that's up to 200-300ms JSON latency (or more).
Sending the data SSZ encoded could reliably shave 200-250ms off each
getPayload
roundtrip.I propose we add SSZ encoded payloads as first-class citizens.
Questions:
getPayload
with SSZ body, and if the relay responds with an error then try with JSON again? Or should it send anaccept-encoding: ssz
header to getHeader, and if it receives the header in SSZ encoding then use SSZ for getPayload too, otherwise fall back to JSON?The text was updated successfully, but these errors were encountered: