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

Fix testing helper process_and_sign_block_without_header_validations #2579

Merged
merged 1 commit into from
Sep 7, 2021
Merged
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
11 changes: 11 additions & 0 deletions tests/core/pyspec/eth2spec/test/phase0/sanity/test_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from eth2spec.test.helpers.proposer_slashings import get_valid_proposer_slashing, check_proposer_slashing_effect
from eth2spec.test.helpers.attestations import get_valid_attestation
from eth2spec.test.helpers.deposits import prepare_state_and_deposit
from eth2spec.test.helpers.execution_payload import build_empty_execution_payload
from eth2spec.test.helpers.voluntary_exits import prepare_signed_exits
from eth2spec.test.helpers.multi_operations import (
run_slash_and_exit,
Expand All @@ -38,6 +39,7 @@
with_custom_state,
large_validator_set,
is_post_altair,
is_post_merge,
)


Expand Down Expand Up @@ -146,6 +148,11 @@ def process_and_sign_block_without_header_validations(spec, state, block):
spec.process_randao(state, block.body)
spec.process_eth1_data(state, block.body)
spec.process_operations(state, block.body)
if is_post_altair(spec):
spec.process_sync_aggregate(state, block.body.sync_aggregate)
if is_post_merge(spec):
if spec.is_execution_enabled(state, block.body):
spec.process_execution_payload(state, block.body.execution_payload, spec.EXECUTION_ENGINE)

# Insert post-state rot
block.state_root = state.hash_tree_root()
Expand Down Expand Up @@ -188,6 +195,10 @@ def test_parent_from_same_slot(spec, state):
child_block = parent_block.copy()
child_block.parent_root = state.latest_block_header.hash_tree_root()

if is_post_merge(spec):
randao_mix = spec.compute_randao_mix(state, child_block.body.randao_reveal)
child_block.body.execution_payload = build_empty_execution_payload(spec, state, randao_mix)

# Show that normal path through transition fails
failed_state = state.copy()
expect_assertion_error(
Expand Down