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

Validators API needs filtering #476

Open
tdenisenko opened this issue Oct 8, 2024 · 2 comments
Open

Validators API needs filtering #476

tdenisenko opened this issue Oct 8, 2024 · 2 comments

Comments

@tdenisenko
Copy link

tdenisenko commented Oct 8, 2024

When calling /eth/v1/beacon/states/head/validators?status=active over 1 gigabyte of data is returned. We need to be able to get only the fields requested for various reasons. Such as only the indexes of the active validators which would reduce the size of the data returned significantly (~4 KB).

Proposal:

Allow filtering by fields, such as /eth/v1/beacon/states/head/validators?status=active&fields=index,public_key

@nflaig
Copy link
Collaborator

nflaig commented Oct 8, 2024

A new endpoint has been added recently to provide a minimal response /eth/v1/beacon/states/{state_id}/validator_identities (see postStateValidatorIdentities) which gives you just the index and public key. It's not widely supported yet though, Lodestar will have it in the next release (v1.23.0)

Allow filtering by fields

This is problematic as we want to support both JSON and SSZ responses, in case of SSZ it requires to predefine a container, a generic approach to select fields dynamically would be difficult to apply. We also try to return data structures that are defined by the CL spec.

Curious what others think.

@mcdee
Copy link
Contributor

mcdee commented Oct 8, 2024

As @nflaig says, returning only a subset of fields would be a fair bit of pain from the server side, I suspect, as they are likely to map the validator object to it's spec struct for encoding. Field selection would likely be worse for this particular endpoint given that we have the validator struct embedded in the returned data rather than being a top-level object. (so fields would likely have to be fields=index,validator.pubkey and that is already looking ugly).

Note that running /eth/v1/beacon/states/head/validators?status=active with compression enabled is about 68MB of transferred data, so if bandwidth is a major issue this could be alleviated with a proxy.

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

No branches or pull requests

3 participants