feat(deposits): Migration to EIP-6110 style processing#2794
feat(deposits): Migration to EIP-6110 style processing#2794
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2794 +/- ##
==========================================
+ Coverage 60.42% 60.80% +0.37%
==========================================
Files 367 367
Lines 18600 18728 +128
==========================================
+ Hits 11239 11387 +148
+ Misses 6422 6384 -38
- Partials 939 957 +18
🚀 New features to boost your workflow:
|
| requests, err := blk.GetBody().GetExecutionRequests() | ||
| if err != nil { | ||
| // EIP-6110 Deposits. | ||
| for _, dep := range requests.Deposits { |
There was a problem hiding this comment.
the biggest change is here: Post this fork, we will just accept the deposits from here as we have instant finality. No deposits queue or epoch processing is necessary here; real-time instant deposits very easily done
|
Supportive of this approach. Especially since its <200 line diff and gets rid of the CL querying the EL which isn't a great pattern. Agreed that the Block Gas Limit is a good enough protection from hitting the deposit queue. It's unlikely we'll be x10'ing the gas limit arbitrarily in the coming months as that's not a bottleneck. As you noted, the EL change is trivial. There is a point to be noted that we deviate from the spec by removing the deposit queue altogether, which is present in the spec. In the spec, deposit processing is done per epoch, whereas we do it per block. This allows us to avoid any BeaconState changes. IMO the processing overhead of deposits is low enough that it doesn't need to be batched into an epoch (don't have empirical data to support this tho). Unsure on the solution for the overlap period between old system and new. Perhaps it's just a custom state transition as part of |
It does "deviate from spec" but not any more than we already are "deviated from the spec". Currently also deposits are processed block by block and the state transition operation for each is not too expensive (signatures are not verified on repeat -- most -- deposits). This change only affects the "lag" at which deposits are processed but not the frequency of processing itself. |
…ing (#3045) Signed-off-by: Cal Bera <calbera@berachain.com> Co-authored-by: Claude <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4ea7da0ba3
ℹ️ 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.
Pull request overview
This PR migrates deposit handling toward an EIP-6110-style “deposit requests” flow activated at the new Electra2 fork, including special-case logic to avoid losing pre-fork deposits and updating configs/tests to recognize the new fork version.
Changes:
- Add Electra2 fork plumbing across chain spec/versioning, engine API selection, and block/type version support.
- Shift deposit handling: pre-Electra2 uses the deposit DB + block-body deposits; Electra2 uses execution requests (with a one-block catchup mechanism at the fork boundary).
- Update devnet/kurtosis/e2e/test specs and genesis templates for new fork timing and deposit contract address wiring.
Reviewed changes
Copilot reviewed 53 out of 53 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| testing/simulated/components.go | Adds Electra2 fork time to simulated chain specs. |
| testing/networks/80094/spec.toml | Adds electra-two-fork-time for mainnet test config. |
| testing/networks/80094/eth-genesis.json | Adds depositContractAddress (currently duplicated). |
| testing/networks/80069/spec.toml | Adds electra-two-fork-time for Bepolia config. |
| testing/networks/80069/eth-genesis.json | Adds depositContractAddress to EL genesis. |
| testing/files/spec.toml | Adds electra-two-fork-time to fixture spec. |
| testing/files/eth-genesis.json | Adds depositContractAddress to fixture EL genesis. |
| testing/e2e/standard/withdrawal_test.go | Updates expected fork version to Electra2. |
| testing/e2e/standard/beacon_api_test.go | Updates balance caps and expected fork version (Electra2 / 33 BERA). |
| testing/e2e/config/defaults.go | Pins reth image to a specific digest/tag. |
| storage/deposit/v1/store.go | Avoids huge slice preallocation (needed for MaxUint64 ranges). |
| state-transition/core/validation_deposits.go | Renames/extends non-genesis deposit validation for pre-/first-block Electra2. |
| state-transition/core/validation_deposits_test.go | Adds Electra2 catchup test coverage and adjusts setup for pre-Electra2. |
| state-transition/core/state_processor.go | Passes previous block fork version into operations processing. |
| state-transition/core/state_processor_withdrawals_test.go | Moves deposits into execution requests in tests (Electra2-style). |
| state-transition/core/state_processor_staking.go | Adds Electra2 deposit-request path + first-block catchup deposit processing. |
| state-transition/core/state_processor_staking_test.go | Updates staking tests to provide deposits via execution requests. |
| state-transition/core/state_processor_forks.go | Adds Electra2 fork upgrade + logging; refactors Electra1 upgrade flow. |
| state-transition/core/core_test.go | Adds helper to keep tests pre-Electra2 by default. |
| primitives/version/versions.go | Documents Electra2 version constant. |
| primitives/version/name.go | Adds “electra2” to version naming. |
| node-core/components/validator_service.go | Injects deposit contract into validator service. |
| kurtosis/src/nodes/consensus/beacond/node.star | Sets DEPOSIT_AMOUNT to 33e9. |
| kurtosis/src/nodes/consensus/beacond/launcher.star | Sets DEPOSIT_AMOUNT to 33e9. |
| kurtosis/src/networks/kurtosis-devnet/network-configs/genesis.json.template | Adds depositContractAddress to EL genesis template. |
| execution/deposit/interfaces.go | Removes redundant comment line. |
| execution/deposit/contract.go | Comment change for ReadDeposits (currently mismatched with exported name). |
| execution/client/ethclient/engine.go | Treats Electra2 like Electra1 for V4P11 engine methods. |
| execution/client/ethclient/engine_test.go | Adjusts invalid-version test now that Electra2 is supported. |
| consensus-types/types/signed_beacon_block.go | Allows Electra2 in empty signed block creation. |
| consensus-types/types/payload.go | Allows Electra2 payload->header conversion. |
| consensus-types/types/block.go | Allows Electra2 block construction. |
| config/spec/testnet.go | Adds Electra2 fork time to testnet spec data. |
| config/spec/mainnet.go | Adds Electra2 fork time to mainnet spec data. |
| config/spec/devnet.go | Sets devnet to start at Electra2 (fork time 0). |
| cli/commands/genesis/payload.go | Extends supported fork range up to Electra2. |
| cli/commands/deposit/db_check.go | Updates command to use pre-Electra2 deposit validation function. |
| chain/spec.go | Adds Electra2ForkTime to spec interface + validation ordering + inflation fork handling. |
| chain/spec_test.go | Extends fork-order tests to include Electra2. |
| chain/helpers.go | Adds Electra2 to ActiveForkVersionForTimestamp. |
| chain/helpers_test.go | Adds Electra2ForkTime to helper test spec. |
| chain/data.go | Adds Electra2ForkTime to SpecData / mapstructure key. |
| beacon/validator/service.go | Stores deposit contract on validator service; updates constructor signature. |
| beacon/validator/errors.go | Removes ErrDepositStoreIncomplete (moved to deposits package). |
| beacon/validator/block_builder.go | Uses new deposits helper functions for catchup + setting deposits on block body. |
| beacon/deposits/interfaces.go | New: ChainSpec interface for deposit helpers. |
| beacon/deposits/errors.go | New: ErrDepositStoreIncomplete moved here. |
| beacon/deposits/deposits.go | New: Electra2 catchup + pre-Electra2 fetch + block-body deposit setting helpers. |
| beacon/blockchain/service.go | Removes old deposit retry loop; adds a catchup sync.Once. |
| beacon/blockchain/process_proposal.go | Calls Electra2 catchup during incoming block verification (currently guarded by sync.Once). |
| beacon/blockchain/interfaces.go | Extends ServiceChainSpec with MaxDepositsPerBlock. |
| beacon/blockchain/finalize_block.go | Uses new pre-Electra2 fetch helper and Electra2 catchup (currently guarded by sync.Once). |
| beacon/blockchain/deposit.go | Deleted: old deposit fetch + retry queue implementation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Super simple implementation of EIP-6110 style deposits
3 requirements for the implementation:
Given an 8192 limit of deposits per block, we need to guarantee that an EL doesn't include more than 8192 deposits in 1 block.
Given the way deposits are taken from EL deposit contract events and then processed in CL, as is we will lose deposits from the 2 blocks right before the Electra1 fork (which starts using 6110) is activated.
Forking on the EL to change the deposit event signature to Berachain's:
0x68af751683498a9f9be59fe8b0d52a64dd155255d85cdb29fea30b1e3f891d46(sample deposit)TODOs: