@@ -44,6 +44,8 @@ def compute_fork_version(epoch: Epoch) -> Version:
4444 """
4545 if epoch >= EIP7594_FORK_EPOCH :
4646 return EIP7594_FORK_VERSION
47+ if epoch >= ELECTRA_FORK_EPOCH :
48+ return ELECTRA_FORK_VERSION
4749 if epoch >= DENEB_FORK_EPOCH :
4850 return DENEB_FORK_VERSION
4951 if epoch >= CAPELLA_FORK_EPOCH :
@@ -71,8 +73,8 @@ If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) ==
7173an irregular state change is made to upgrade to EIP7594.
7274
7375``` python
74- def upgrade_to_eip7594 (pre : deneb .BeaconState) -> BeaconState:
75- epoch = deneb .get_current_epoch(pre)
76+ def upgrade_to_eip7594 (pre : electra .BeaconState) -> BeaconState:
77+ epoch = electra .get_current_epoch(pre)
7678 post = BeaconState(
7779 # Versioning
7880 genesis_time = pre.genesis_time,
@@ -119,6 +121,17 @@ def upgrade_to_eip7594(pre: deneb.BeaconState) -> BeaconState:
119121 next_withdrawal_validator_index = pre.next_withdrawal_validator_index,
120122 # Deep history valid from Capella onwards
121123 historical_summaries = pre.historical_summaries,
124+ # On-chain deposits
125+ deposit_requests_start_index = pre.deposit_requests_start_index,
126+ # Consolidations
127+ deposit_balance_to_consume = pre.deposit_balance_to_consume,
128+ exit_balance_to_consume = pre.exit_balance_to_consume,
129+ earliest_exit_epoch = pre.earliest_exit_epoch,
130+ consolidation_balance_to_consume = pre.consolidation_balance_to_consume,
131+ earliest_consolidation_epoch = pre.earliest_consolidation_epoch,
132+ pending_balance_deposits = pre.pending_balance_deposits,
133+ pending_partial_withdrawals = pre.pending_partial_withdrawals,
134+ pending_consolidations = pre.pending_consolidations,
122135 )
123136
124137 return post
0 commit comments