mirror of
https://github.com/ethereum/consensus-specs.git
synced 2026-02-01 11:04:57 -05:00
add 7045 fork boundary test
This commit is contained in:
@@ -1,16 +1,24 @@
|
||||
from eth2spec.test.helpers.state import (
|
||||
state_transition_and_sign_block
|
||||
state_transition_and_sign_block,
|
||||
next_epoch_via_block,
|
||||
transition_to,
|
||||
)
|
||||
from eth2spec.test.helpers.block import (
|
||||
build_empty_block_for_next_slot
|
||||
build_empty_block_for_next_slot,
|
||||
)
|
||||
from eth2spec.test.context import (
|
||||
DENEB,
|
||||
spec_state_test,
|
||||
spec_configured_state_test,
|
||||
with_deneb_and_later,
|
||||
with_phases,
|
||||
)
|
||||
from eth2spec.test.helpers.execution_payload import (
|
||||
compute_el_block_hash,
|
||||
)
|
||||
from eth2spec.test.helpers.attestations import (
|
||||
get_valid_attestation,
|
||||
)
|
||||
from eth2spec.test.helpers.sharding import (
|
||||
get_sample_opaque_tx,
|
||||
)
|
||||
@@ -58,3 +66,35 @@ def test_max_blobs_per_block(spec, state):
|
||||
@spec_state_test
|
||||
def test_invalid_exceed_max_blobs_per_block(spec, state):
|
||||
yield from run_block_with_blobs(spec, state, blob_count=spec.MAX_BLOBS_PER_BLOCK + 1, valid=False)
|
||||
|
||||
|
||||
@with_phases([DENEB])
|
||||
@spec_configured_state_test({
|
||||
'DENEB_FORK_EPOCH': 2,
|
||||
})
|
||||
def test_include_attestation_from_previous_fork_with_new_range(spec, state):
|
||||
# Transition to the epoch prior to the fork epoch
|
||||
next_epoch_via_block(spec, state)
|
||||
|
||||
# Generate an attestation for slot 0 of this epoch
|
||||
attestation = get_valid_attestation(spec, state, signed=True)
|
||||
|
||||
# Transition to second to last slot in `DENEB_FORK_EPOCH
|
||||
next_epoch_via_block(spec, state)
|
||||
current_epoch = spec.get_current_epoch(state)
|
||||
assert current_epoch == spec.config.DENEB_FORK_EPOCH
|
||||
penultimate_slot = spec.compute_start_slot_at_epoch(current_epoch + 1) - 2
|
||||
transition_to(spec, state, penultimate_slot)
|
||||
|
||||
# Ensure the new state is in the increased EIP-7045 slot inclusion range
|
||||
assert penultimate_slot - attestation.data.slot > spec.SLOTS_PER_EPOCH
|
||||
|
||||
block = build_empty_block_for_next_slot(spec, state)
|
||||
block.body.attestations.append(attestation)
|
||||
|
||||
yield 'pre', state
|
||||
|
||||
signed_block = state_transition_and_sign_block(spec, state, block)
|
||||
|
||||
yield 'blocks', [signed_block]
|
||||
yield 'post', state
|
||||
|
||||
Reference in New Issue
Block a user