Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebase eip7594 onto Electra #3893

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pysetup/md_doc_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DENEB: CAPELLA,
ELECTRA: DENEB,
WHISK: CAPELLA,
EIP7594: DENEB,
EIP7594: ELECTRA,
EIP6800: DENEB,
EIP7732: ELECTRA,
}
Expand Down
2 changes: 1 addition & 1 deletion pysetup/spec_builders/eip7594.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
'''


Expand Down
17 changes: 15 additions & 2 deletions specs/_features/eip7594/fork.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/core/pyspec/eth2spec/test/helpers/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
ELECTRA: DENEB,
# Experimental patches
WHISK: CAPELLA,
EIP7594: DENEB,
EIP7594: ELECTRA,
EIP7732: ELECTRA,
}

Expand Down
2 changes: 1 addition & 1 deletion tests/generators/merkle_proof/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
'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,
Expand Down