Conversation
syjn99
force-pushed
the
chore/remove-beaconstate-proto
branch
5 times, most recently
from
September 23, 2026 01:12
133d059 to
6d86111
Compare
syjn99
marked this pull request as ready for review
September 23, 2026 08:36
syjn99
requested review from
a team,
kasey and
prestonvanloon
as code owners
September 23, 2026 08:36
BeaconState proto messageBeaconState proto message
The SSZ query analyzer took the spec field name from the json struct tag, which only protobuf-generated structs carry. Hand-written SSZ containers (the beacon states) have none, so fall back to the snake_case of the Go field name. Both spellings come from the same words, so the derived names match the ones protoc used to emit.
Every message left in the file was dead, SSZ-only, or needed by exactly
one other proto. Where each one went:
- CheckPtInfo: deleted, no references.
- StateSummary: moved to beacon_core_types.proto. Stays protobuf because
db/kv stores it as protobuf bytes; field numbers and full name are
unchanged, so existing databases decode as before.
- SyncAggregatorSelectionData: moved to sync_committee.proto. Stays
protobuf because it is a SignRequest oneof member in keymanager.proto.
- PendingAttestation: moved to attestation.proto. Stays protobuf because
the Att interface embeds proto.Message.
- HistoricalBatch: hand-written in beacon_state_{mainnet,minimal}.go,
since the roots vector size differs per preset, with the same
field-parity test the states have.
- SigningData, ForkData, DepositMessage, PowBlock: hand-written in
beacon_state_types.go, preset-independent and SSZ-only.
beacon_state.pb.go and beacon_state.minimal.pb.go go with the file, and
block_roots.size/state_roots.size were the last preset tokens it used.
Regenerated *.ssz.go files are byte-identical.
beacon_state.proto is gone, so the spec references for BeaconState (phase0..fulu), HistoricalBatch, DepositMessage, ForkData, SigningData and PowBlock now search the hand-written Go structs, and PendingAttestation / SyncAggregatorSelectionData follow their messages to attestation.proto / sync_committee.proto. BeaconState#gloas stays an exception as before.
- Make CI see normal go file in proto package - Style change - Run test in minimal config as well
syjn99
force-pushed
the
chore/remove-beaconstate-proto
branch
from
September 23, 2026 11:24
6d86111 to
2b4c717
Compare
Inspector-Butters
self-requested a review
September 23, 2026 14:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
What does this PR do? Why is it needed?
This PR removes
beacon_state.protoand automatically generated*.pb.gofiles corresponds to it. Instead, we now replaces all proto message definition ofBeaconState{Fork}with native Go struct.Before:
BeaconStateper fork inbeacon_state.protofilemake genfor executingprotoc, so that we have a Go struct.After:
BeaconStateper fork inbeacon_state_{mainnet|minimal}.gofile*.pb.gofiles related to the state. Plus we remove over 9K lines of generated files which is awesome.ssz_proto_library.bzlas it is now natively maintained in native Go struct definition.Which issue(s) does this PR fix?
Fixes #17503
Other notes for review
How to review this PR
This PR is designed to review commit by commit. It consists of three parts:
Revisit the testing harness
Until fix(ssz): derive query field names without json tags, these are collections of groundwork for the later work. First commit (test(state): support non-protobuf states in SSZ harness) is note-worthy - as it touches our equality check. Main purpose is dropping proto dependency on equality check.
Mechanical change from Altair to Gloas, and then Phase0
From refactor(state): replace Altair protobuf with SSZ struct to refactor(state): replace Phase0 protobuf with SSZ struct,
each commit mechanically migrates to native struct per fork. Most of the diff of each commit is regenerated
*.pb.gofiles and some equality check in our spectest runner.Phase0 is deliberately done after Gloas as it has different wire format and pattern when saving in the storage.
Cleanups
From refactor(state): drop protobuf from beacon-chain/state, commits are mostly cleaning things up which are now unused or dead. refactor(proto): remove beacon_state.proto is note-worthy, as it retires
beacon_state.protoand moves each proto message into separate parts in the codebase, so please read the description.Production Risk
Before #17523, there was a very tiny production risk on DB migration, but now we don't have. I believe this PR doesn't bring any production risk and should work well without any problems, but here's some notes:
BeaconStatein SSZ format, so it doesn't need to be considered. Same behavior.CopySlice(nil)returnsnilinstead of[].Follow-ups
proto/package is not proper location now.*Proto*methods. I deliberately omitted it in this PR because it covers almost entire codebase.fieldparamsconfiguration which is considered as canonical.methodical-sszdoesn't support yet for array type, we need a patch there.Acknowledgements