diff --git a/packages/testing/src/consensus_testing/test_fixtures/state_transition.py b/packages/testing/src/consensus_testing/test_fixtures/state_transition.py index 3637c1a47..fccac8c5f 100644 --- a/packages/testing/src/consensus_testing/test_fixtures/state_transition.py +++ b/packages/testing/src/consensus_testing/test_fixtures/state_transition.py @@ -116,7 +116,7 @@ def generate(self) -> StateTransitionFixture: if cached_state is not None: state = cached_state - elif block_spec.skip_slot_processing: + elif block_spec.skip_slot_processing and not block_spec.check_state_transition: state = spec.process_block(state, block) else: state = spec.state_transition(state, block=block) diff --git a/packages/testing/src/consensus_testing/test_types/block_spec.py b/packages/testing/src/consensus_testing/test_types/block_spec.py index c08d36b8e..ea317b86f 100644 --- a/packages/testing/src/consensus_testing/test_types/block_spec.py +++ b/packages/testing/src/consensus_testing/test_types/block_spec.py @@ -71,6 +71,9 @@ class BlockSpec(CamelModel): skip_slot_processing: bool = False """Skip automatic slot advancement before processing, to exercise slot-mismatch failures.""" + check_state_transition: bool = False + """Call `state_transition` after block is generated by `_build_block_from_spec`.""" + def resolve_proposer_index(self, num_validators: int) -> ValidatorIndex: """Return the proposer index, falling back to the spec's round-robin schedule.""" if self.proposer_index is not None: diff --git a/tests/consensus/lstar/state_transition/test_slot_monotonicity.py b/tests/consensus/lstar/state_transition/test_slot_monotonicity.py index 46d2fe368..99970eba6 100644 --- a/tests/consensus/lstar/state_transition/test_slot_monotonicity.py +++ b/tests/consensus/lstar/state_transition/test_slot_monotonicity.py @@ -39,7 +39,11 @@ def test_process_slots_target_equal_to_state_slot_rejected( state_transition_test( pre=pre_state, blocks=[ - BlockSpec(slot=Slot(1)), + BlockSpec( + slot=Slot(1), + skip_slot_processing=True, + check_state_transition=True, + ), ], post=None, expected_rejection=ExpectedRejection(