Merge pull request #3893 from jtraglia/rebase-eip7594-onto-electra

Rebase eip7594 onto Electra
This commit is contained in:
Justin Traglia 2024-10-21 14:07:51 -05:00 committed by GitHub
commit 526625d387
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 6 deletions

View File

@ -22,7 +22,7 @@ PREVIOUS_FORK_OF = {
DENEB: CAPELLA,
ELECTRA: DENEB,
WHISK: CAPELLA,
EIP7594: DENEB,
EIP7594: ELECTRA,
EIP6800: DENEB,
EIP7732: ELECTRA,
}

View File

@ -10,7 +10,7 @@ class EIP7594SpecBuilder(BaseSpecBuilder):
@classmethod
def imports(cls, preset_name: str):
return f'''
from eth2spec.deneb import {preset_name} as deneb
from eth2spec.electra import {preset_name} as electra
'''

View File

@ -44,6 +44,8 @@ def compute_fork_version(epoch: Epoch) -> Version:
"""
if epoch >= EIP7594_FORK_EPOCH:
return EIP7594_FORK_VERSION
if epoch >= ELECTRA_FORK_EPOCH:
return ELECTRA_FORK_VERSION
if epoch >= DENEB_FORK_EPOCH:
return DENEB_FORK_VERSION
if epoch >= CAPELLA_FORK_EPOCH:
@ -71,8 +73,8 @@ If `state.slot % SLOTS_PER_EPOCH == 0` and `compute_epoch_at_slot(state.slot) ==
an irregular state change is made to upgrade to EIP7594.
```python
def upgrade_to_eip7594(pre: deneb.BeaconState) -> BeaconState:
epoch = deneb.get_current_epoch(pre)
def upgrade_to_eip7594(pre: electra.BeaconState) -> BeaconState:
epoch = electra.get_current_epoch(pre)
post = BeaconState(
# Versioning
genesis_time=pre.genesis_time,
@ -119,6 +121,17 @@ def upgrade_to_eip7594(pre: deneb.BeaconState) -> BeaconState:
next_withdrawal_validator_index=pre.next_withdrawal_validator_index,
# Deep history valid from Capella onwards
historical_summaries=pre.historical_summaries,
# On-chain deposits
deposit_requests_start_index=pre.deposit_requests_start_index,
# Consolidations
deposit_balance_to_consume=pre.deposit_balance_to_consume,
exit_balance_to_consume=pre.exit_balance_to_consume,
earliest_exit_epoch=pre.earliest_exit_epoch,
consolidation_balance_to_consume=pre.consolidation_balance_to_consume,
earliest_consolidation_epoch=pre.earliest_consolidation_epoch,
pending_balance_deposits=pre.pending_balance_deposits,
pending_partial_withdrawals=pre.pending_partial_withdrawals,
pending_consolidations=pre.pending_consolidations,
)
return post

View File

@ -57,7 +57,7 @@ PREVIOUS_FORK_OF = {
ELECTRA: DENEB,
# Experimental patches
WHISK: CAPELLA,
EIP7594: DENEB,
EIP7594: ELECTRA,
EIP7732: ELECTRA,
}

View File

@ -10,7 +10,7 @@ if __name__ == "__main__":
'single_merkle_proof',
]}
electra_mods = deneb_mods
eip_7594_mods = combine_mods(_new_eip7594_mods, deneb_mods)
eip_7594_mods = combine_mods(_new_eip7594_mods, electra_mods)
all_mods = {
DENEB: deneb_mods,