feat: add getStateBuilders endpoint#9593
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e923627cb8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Code Review
This pull request introduces the getStateBuilders endpoint (POST /eth/v1/beacon/states/{state_id}/builders) to retrieve and filter builders from a Gloas state by ID and status. It includes updates to state views, types, helper functions, and unit tests. The review feedback points out a potential out-of-bounds issue where negative builder indices are not rejected as invalid, and suggests moving the uniqueness validation for statuses to the beginning of the handler to prevent it from being bypassed when builderIds are provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Performance Report✔️ no performance regression detected Full benchmark results
|
nflaig
left a comment
There was a problem hiding this comment.
@lodekeeper please review/approve if it looks good
lodekeeper
left a comment
There was a problem hiding this comment.
LGTM — reviewed the full diff. Clean new endpoint that mirrors getStateValidators end-to-end:
getStateBuildersfollows the validators pattern exactly: pre-Gloas → 400, ids-path + full-scan path,assertUniqueItemson both ids and statuses, status filtering.getStateBuilderIndexmirrorsgetStateValidatorIndexand guards the edges correctly —< 0/ non-safe-integer → 400,>= getBuildersLength()→ 404 (future state), pre-Gloas throws. Linear pubkey scan is reasonable given there's no builder pubkey cache and the registry is small.- Good catch fixing the same negative-index gap in
getStateValidatorIndex(d7c793a5d7) and adding the regression tests. getBuilderStatus(exited → active → pending) reads clean and matches beacon-APIs #614.getBuildersLengthadded to both state views with pre-Gloas guards, memoized on the native view.
Bot threads all resolved. 👍
Motivation
Implement
POST /eth/v1/beacon/states/{state_id}/buildersadded to the beacon-api spec in ethereum/beacon-APIs#614.Description
getStateBuildersroute, filterable by builder ids (hex encoded public key or builder index) and statuses (pending,active,exited)getBuildersLength()to the beacon state view to enumerate the builder registry