statetransition: handle Gloas builder deposits in process_deposit_request#743
Merged
Conversation
…uest Gloas (EIP-7732) diverts builder deposits out of the pending_deposits queue: a deposit request whose pubkey already belongs to a builder, or one carrying the 0x03 builder credential for a brand-new pubkey, is applied immediately to the builder registry via apply_deposit_for_builder and must never enter the queue. applyExecutionRequests unconditionally appended every deposit request to PendingDeposits regardless of fork, so on Gloas it both queued builder deposits that should have been dropped from the queue and never credited the builder's balance. This diverged the state root from consensus (observed on glamsterdam-devnet-5 at slot 64805: PendingDeposits length 3 vs 2 and builder 502 short by 50 ETH), forcing the indexer to fall back to the API. Implement process_deposit_request, apply_deposit_for_builder, add_builder_to_registry, get_index_for_new_builder, is_pending_validator and is_builder_withdrawal_credential per the Gloas spec. Pre-Gloas behaviour is unchanged. Verified by replaying the orphaned slot range 64799-64862 from tracoor: the state root now matches at every slot, including 64805.
barnabasbusa
approved these changes
Jun 17, 2026
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.
Problem
The CL indexer's state-transition replay diverged from consensus on Gloas, logging:
applyExecutionRequests(indexer/beacon/statetransition/operations.go) appended every deposit request toPendingDepositsregardless of fork, so it never implemented Gloas's (EIP-7732) modifiedprocess_deposit_request. On Gloas a deposit whose pubkey already belongs to a builder — or one carrying the0x03builder credential for a brand-new, non-validator pubkey — must be applied immediately to the builder registry viaapply_deposit_for_builderand must never enter the pending_deposits queue.The bug therefore both queued builder deposits that should have been dropped from the queue and never credited the builder's balance, diverging the state root and forcing the indexer to fall back to the beacon API.
Root cause analysis
Reproduced on
glamsterdam-devnet-5at slot 64805 (orphaned by a deep reorg; the state/blocks were fetched from tracoor). Field-level diff vs the consensus post-state:len(PendingDeposits): got=3 expected=2— one builder deposit wrongly queuedBuilders[502].balance: got=1507330036 expected=51507330036— builder short by exactly 50 ETH (the un-applied deposit)Fix
Implement the Gloas deposit-request handling faithfully per spec:
processDepositRequest— builder branch vs. queueapply_deposit_for_builder/add_builder_to_registry/get_index_for_new_builderis_pending_validator/is_builder_withdrawal_credentialPre-Gloas behaviour is unchanged (the request is still appended to the queue exactly as before).
Verification
Replayed the orphaned range 64799→64862 (3 epoch boundaries) from tracoor — the computed state root now matches consensus at every slot, including 64805. A fresh live replay of 64 blocks near head is also clean.
gofmt/go vetclean.