Skip to content

Added SSZ support for validator balance responses - #10933

Merged
rolfyone merged 4 commits into
Consensys:masterfrom
rolfyone:balances-ssz
Jul 3, 2026
Merged

Added SSZ support for validator balance responses#10933
rolfyone merged 4 commits into
Consensys:masterfrom
rolfyone:balances-ssz

Conversation

@rolfyone

@rolfyone rolfyone commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Added SSZ support for validator balance responses using SszList.

Moved StateValidatorBalanceData into spec API schemas and added StateValidatorBalanceDataSchema.

Updated GET/POST validator balances endpoints to advertise application/octet-stream and return 406 Not Acceptable when needed.

Updated OpenAPI fixtures to include binary SSZ responses and a reusable ValidatorBalanceResponse schema.

Added tests for SSZ response serialization and 406 metadata handling.

Added StateValidatorBalances to the debug SSZ object types.

Cleaned up formatting/import issues found during the build check.

Addresses ethereum/beacon-APIs#622

Fixes #10934

Documentation

  • I thought about documentation and added the doc-change-required label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

Note

Medium Risk
Extends a widely used beacon REST API with new content negotiation and response shapes; JSON behavior should remain, but SSZ clients and metadata must stay aligned with the beacon-APIs spec.

Overview
Adds SSZ (application/octet-stream) responses for GET and POST /eth/v1/beacon/states/{state_id}/validator_balances, alongside existing JSON. Clients that negotiate SSZ get serialized SszList<StateValidatorBalanceData>; unsupported negotiation can return 406 Not Acceptable.

StateValidatorBalanceData is moved from api.migrated into spec.schemas.api as an SSZ container (StateValidatorBalanceDataSchema / ValidatorBalanceResponse), and ChainDataProvider now builds balances via SSZ_LIST_SCHEMA instead of a plain List.

OpenAPI fixtures gain application/octet-stream, a shared ValidatorBalanceResponse schema, and 406 responses. Tests cover SSZ metadata serialization and 406 handling. The debug CLI accepts .ssz input and adds StateValidatorBalances as an SSZ object type for pretty-printing.

Reviewed by Cursor Bugbot for commit 64bd8a2. Bugbot is set up for automated code reviews on this repo. Configure here.

rolfyone added 2 commits July 3, 2026 09:11
Added SSZ support for validator balance responses using SszList<StateValidatorBalanceData>.
Moved StateValidatorBalanceData into spec API schemas and added StateValidatorBalanceDataSchema.
Updated GET/POST validator balances endpoints to advertise application/octet-stream and return 406 Not Acceptable when needed.
Updated OpenAPI fixtures to include binary SSZ responses and a reusable ValidatorBalanceResponse schema.
Added tests for SSZ response serialization and 406 metadata handling.
Added StateValidatorBalances to the debug SSZ object types.
Cleaned up formatting/import issues found during the build check.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit 463cb93. Configure here.

Comment thread teku/src/main/java/tech/pegasys/teku/cli/subcommand/debug/SszObjectType.java Outdated
@rolfyone
rolfyone merged commit 5bc4680 into Consensys:master Jul 3, 2026
83 checks passed
@rolfyone
rolfyone deleted the balances-ssz branch July 3, 2026 01:36
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add ssz output for validator balances api.

2 participants