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

Exit properly with terminal block hash #11892

Merged
merged 4 commits into from
Jan 23, 2023
Merged

Conversation

terencechain
Copy link
Member

@terencechain terencechain commented Jan 18, 2023

What type of PR is this?

Bug fix

What does this PR do? Why is it needed?

Incorrectly implemented consensus spec that we didn't properly return once terminal block hash conditions are met:

def validate_merge_block(block: BeaconBlock) -> None:
    if TERMINAL_BLOCK_HASH != Hash32():
        # If `TERMINAL_BLOCK_HASH` is used as an override, the activation epoch must be reached.
        assert compute_epoch_at_slot(block.slot) >= TERMINAL_BLOCK_HASH_ACTIVATION_EPOCH
        assert block.body.execution_payload.parent_hash == TERMINAL_BLOCK_HASH
        # WE DID NOT RETURN BELOW
        return 
    pow_block = get_pow_block(block.body.execution_payload.parent_hash)
    assert pow_block is not None
    pow_parent = get_pow_block(pow_block.parent_hash)
    assert pow_parent is not None
    assert is_valid_terminal_pow_block(pow_block, pow_parent)

Which issues(s) does this PR fix?

Fixes #

Other notes for review

Caught by hive test via starting Bellatrix as genesis state. Thanks @marioevz

@terencechain terencechain requested a review from a team as a code owner January 18, 2023 23:54
@terencechain terencechain self-assigned this Jan 18, 2023
nisdas
nisdas previously approved these changes Jan 23, 2023
@terencechain terencechain added the Blocked Blocked by research or external factors label Jan 23, 2023
@terencechain terencechain added Ready For Review and removed Blocked Blocked by research or external factors labels Jan 23, 2023
@terencechain terencechain merged commit 3df2ded into develop Jan 23, 2023
@delete-merged-branch delete-merged-branch bot deleted the terminal-block-hash branch January 23, 2023 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants