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

Remove post-altair initialize_beacon_state_from_eth1 from specs #4017

Merged
merged 6 commits into from
Dec 2, 2024

Conversation

KatyaRyazantseva
Copy link
Contributor

This PR removes post-altair initialize_beacon_state_from_eth1 from specs.

Issue addressed #3663

@KatyaRyazantseva
Copy link
Contributor Author

@hwwhww electra and eip-7594 ci tests fail, because add_validator_to_registry(state, pubkey, withdrawal_credentials, Gwei(0)) in apply_deposit() leaves state.balances empty. This change has been marked as Modified in Electra:EIP7251. It causes some assertion failures like assert spec.is_valid_genesis_state(state) and others. I found the same failures in the dev branch when running citest. Example:

def initialize_beacon_state_from_eth1(eth1_block_hash: Hash32,
                                      eth1_timestamp: uint64,
                                      deposits: Sequence[Deposit]) -> BeaconState:
    fork = Fork(
    ....
        for index, validator in enumerate(state.validators):
            # balances are empty
            balance = state.balances[index] 
            # validator's effective balance is empty, validator is not active
            validator.effective_balance = min(balance - balance % EFFECTIVE_BALANCE_INCREMENT, 
                  MAX_EFFECTIVE_BALANCE) 
            if validator.effective_balance == MAX_EFFECTIVE_BALANCE:
                validator.activation_eligibility_epoch = GENESIS_EPOCH
                validator.activation_epoch = GENESIS_EPOCH

@dapplion
Copy link
Collaborator

@KatyaRyazantseva there appears to be an involuntary commit of .idea files

@hwwhww
Copy link
Contributor

hwwhww commented Nov 28, 2024

@KatyaRyazantseva

Suggestions:

  1. remove tests/core/pyspec/eth2spec/test/bellatrix/genesis/test_initialization.py file since it is no longer relevant
  2. for the test cases in tests/core/pyspec/eth2spec/test/phase0/genesis/test_initialization.py, replace @with_all_phases with @with_phases([PHASE0]) so that we only test initialize_beacon_state_from_eth1 helper with Phase0.

@KatyaRyazantseva KatyaRyazantseva marked this pull request as ready for review November 29, 2024 07:19
Copy link
Contributor

@hwwhww hwwhww left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

No more redundant initialize_beacon_state_from_eth1 when writing a new feature!

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jtraglia jtraglia merged commit 85b4d00 into ethereum:dev Dec 2, 2024
27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants