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

Support content negotiation of light client data served via rest api #4641

Closed

Conversation

dadepo
Copy link
Contributor

@dadepo dadepo commented Oct 5, 2022

Motivation

The REST API for light client related data should also be able to return results as SSZ.

Closes #4635

This PR also includes changes to align the JSON object returned by the API to include version.

Closes #4812

dadepo added 30 commits August 1, 2022 22:28
…nt_optimistic_update available via the gossip domain
@@ -24,5 +25,53 @@ export function getRoutes(config: IChainForkConfig, api: Api): ServerRoutes<Api,
return Buffer.from(serializeProof(proof));
},
},
getBootstrap: {
...serverRoutes.getBootstrap,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tried de-duplicating some of the code here, but was a bit tricky getting the types to line up right. If this is a blocker, then I'll revisit.

Copy link
Contributor

@dapplion dapplion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this PR fullfils it's intent it's re-using an API (that I introduced in /debug/beacon/states) that doesn't scale really well.

If this feature is not urgent, since it's technically just a bandwidth optimization for the lightclient. We can sit on this and look for a design of dual JSON / SSZ that scales to multiple routes without so much boilerplate code.

There's an open discussion to support dual JSON / SSZ on the engine API + beacon API so we may want to wait for that

Base automatically changed from dadepo/p2p-lightclient to unstable October 28, 2022 19:08
@dadepo dadepo marked this pull request as draft November 4, 2022 14:16
@dadepo
Copy link
Contributor Author

dadepo commented Dec 6, 2022

While this PR fullfils it's intent it's re-using an API (that I introduced in /debug/beacon/states) that doesn't scale really well.

There's an open discussion to support dual JSON / SSZ on the engine API + beacon API so we may want to wait for that

@dapplion do you know when this discussion will be concluded? Because I do not think it makes sense to keep this PR indefinitely at limbo.

My suggestion is to review and merge so at least we have complaint with this part of the API spec. The optimisation of the API you introduced can follow later.

@dadepo dadepo marked this pull request as ready for review December 6, 2022 20:40
@dapplion
Copy link
Contributor

dapplion commented Dec 7, 2022

This PR has two different scopes:

  1. Be able to return results as SSZ
  2. Align the JSON object returned by the API to include version.

Point 1. I do not like the approach since it doesn't scale and we want to eventually support many more routes with the same functionality. Point 1. is not urgent and can wait to figure out on other design

Point 2. is a necessary bug fix to align with the spec, which is (a) urgent, and (b) clearly defined so it can be merged immediately.

In general having PRs with multiple scopes is not great but in this case it's an obvious example to split so we can get the bug fix asap.

@dadepo
Copy link
Contributor Author

dadepo commented Dec 7, 2022

Both of these changes are bug fixes, in the sense that both are needed due to the fact that the spec got updated/properly defined, and our implementation needed to be modified to be compliant with the updated spec.

But If you think one is more "buggier" than the other and deserves urgent attention, while the other does not? Then I guess that's fine. Only that i would go about it differently. I would have the "less than perfect changes" reviewed and merged now, instead of waiting to figure out an improved design, while we keep differing from the spec.

But I guess here we disagree.

Anyways, here is a separate PR #4877 that adds versioning to the LC API. Please help review 🙏

@dapplion
Copy link
Contributor

Closing as this approach does not scale for reasons outlined above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants