Fix tests

This commit is contained in:
Hsiao-Wei Wang 2023-05-24 00:08:45 +08:00
parent 0754b94948
commit 48618fe866
No known key found for this signature in database
GPG Key ID: AE3D6B174F971DE4
3 changed files with 34 additions and 3 deletions

View File

@ -8,7 +8,13 @@ from eth2spec.test.helpers.execution_payload import (
build_state_with_incomplete_transition,
build_state_with_complete_transition,
)
from eth2spec.test.context import spec_state_test, expect_assertion_error, with_bellatrix_and_later
from eth2spec.test.context import (
BELLATRIX,
expect_assertion_error,
spec_state_test,
with_bellatrix_and_later,
with_phases,
)
from eth2spec.test.helpers.state import next_slot
@ -117,7 +123,7 @@ def test_invalid_bad_execution_regular_payload(spec, state):
yield from run_bad_execution_test(spec, state)
@with_bellatrix_and_later
@with_phases([BELLATRIX])
@spec_state_test
def test_bad_parent_hash_first_payload(spec, state):
state = build_state_with_incomplete_transition(spec, state)

View File

@ -0,0 +1,24 @@
from eth2spec.test.helpers.execution_payload import (
build_empty_execution_payload,
compute_el_block_hash,
build_state_with_incomplete_transition,
)
from eth2spec.test.context import (
spec_state_test,
with_capella_and_later,
)
from eth2spec.test.helpers.state import next_slot
from eth2spec.test.bellatrix.block_processing.test_process_execution_payload import run_execution_payload_processing
@with_capella_and_later
@spec_state_test
def test_invalid_bad_parent_hash_first_payload(spec, state):
state = build_state_with_incomplete_transition(spec, state)
next_slot(spec, state)
execution_payload = build_empty_execution_payload(spec, state)
execution_payload.parent_hash = b'\x55' * 32
execution_payload.block_hash = compute_el_block_hash(spec, execution_payload)
yield from run_execution_payload_processing(spec, state, execution_payload, valid=False)

View File

@ -30,8 +30,9 @@ if __name__ == "__main__":
bellatrix_mods = combine_mods(_new_bellatrix_mods, altair_mods)
_new_capella_mods = {key: 'eth2spec.test.capella.block_processing.test_process_' + key for key in [
'deposit',
'bls_to_execution_change',
'deposit',
'execution_payload',
'withdrawals',
]}
capella_mods = combine_mods(_new_capella_mods, bellatrix_mods)