From 647a45d3b1a885ae77979a46a3fe635f1190292d Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 21 Aug 2024 17:08:14 -0500 Subject: [PATCH 1/2] Rebase eip7594 onto Electra --- pysetup/md_doc_paths.py | 2 +- pysetup/spec_builders/eip7594.py | 2 +- specs/_features/eip7594/fork.md | 17 +++++++++++++++-- .../pyspec/eth2spec/test/helpers/constants.py | 2 +- tests/generators/merkle_proof/main.py | 2 +- 5 files changed, 19 insertions(+), 6 deletions(-) diff --git a/pysetup/md_doc_paths.py b/pysetup/md_doc_paths.py index d99fc122ac..0f0d1c8593 100644 --- a/pysetup/md_doc_paths.py +++ b/pysetup/md_doc_paths.py @@ -22,7 +22,7 @@ DENEB: CAPELLA, ELECTRA: DENEB, WHISK: CAPELLA, - EIP7594: DENEB, + EIP7594: ELECTRA, EIP6800: DENEB, EIP7732: ELECTRA, } diff --git a/pysetup/spec_builders/eip7594.py b/pysetup/spec_builders/eip7594.py index 109ad8736f..bbc46294ca 100644 --- a/pysetup/spec_builders/eip7594.py +++ b/pysetup/spec_builders/eip7594.py @@ -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 ''' diff --git a/specs/_features/eip7594/fork.md b/specs/_features/eip7594/fork.md index 790ab0287d..bb688c0dcd 100644 --- a/specs/_features/eip7594/fork.md +++ b/specs/_features/eip7594/fork.md @@ -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, + deposit_balance_to_consume=pre.deposit_balance_to_consume, + # Consolidations + 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 diff --git a/tests/core/pyspec/eth2spec/test/helpers/constants.py b/tests/core/pyspec/eth2spec/test/helpers/constants.py index 7e5d0a0f4c..97ed1134e2 100644 --- a/tests/core/pyspec/eth2spec/test/helpers/constants.py +++ b/tests/core/pyspec/eth2spec/test/helpers/constants.py @@ -57,7 +57,7 @@ ELECTRA: DENEB, # Experimental patches WHISK: CAPELLA, - EIP7594: DENEB, + EIP7594: ELECTRA, EIP7732: ELECTRA, } diff --git a/tests/generators/merkle_proof/main.py b/tests/generators/merkle_proof/main.py index 69500137ab..bf52111e96 100644 --- a/tests/generators/merkle_proof/main.py +++ b/tests/generators/merkle_proof/main.py @@ -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, From b24d53f23afa2f7e4910512a31acd0c546849188 Mon Sep 17 00:00:00 2001 From: Justin Traglia Date: Wed, 21 Aug 2024 20:04:32 -0500 Subject: [PATCH 2/2] Fix comment --- specs/_features/eip7594/fork.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/specs/_features/eip7594/fork.md b/specs/_features/eip7594/fork.md index bb688c0dcd..4f2c17561f 100644 --- a/specs/_features/eip7594/fork.md +++ b/specs/_features/eip7594/fork.md @@ -123,8 +123,8 @@ def upgrade_to_eip7594(pre: electra.BeaconState) -> BeaconState: historical_summaries=pre.historical_summaries, # On-chain deposits deposit_requests_start_index=pre.deposit_requests_start_index, - deposit_balance_to_consume=pre.deposit_balance_to_consume, # 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,