Skip to content

fix(testing): tell the fixture when slot processing is skipped - #1212

Open
gopikannappan wants to merge 1 commit into
leanEthereum:mainfrom
gopikannappan:fixture-skip-slot-processing
Open

gopikannappan wants to merge 1 commit into
leanEthereum:mainfrom
gopikannappan:fixture-skip-slot-processing

Conversation

@gopikannappan

Copy link
Copy Markdown

Closes #1198.

test_block_with_wrong_slot and test_block_at_parent_slot_rejected_when_slot_processing_skipped both process a block against a state deliberately left behind the block's slot, because that mismatch is the rejection they test. The spec arranges it with BlockSpec.skip_slot_processing, but the emitted fixture said nothing about it.

So a runner replaying the fixture calls the whole state transition, advances the slot first, never reaches the mismatch, and has no way to tell whether the fixture is wrong or its own client is. As the issue puts it, test runners cannot know which tests they should skip slot processing for.

The change

The fixture gains a per-block skipSlotProcessing list:

"skipSlotProcessing": [true]

It is emitted only when at least one block needs it. Every other fixture is byte-identical to before, and an absent field keeps meaning exactly what runners already do, so nothing existing has to change.

I wrote it as a list beside blocks rather than as something attached to each block, because a block is an SSZ container and this is an instruction to the runner rather than part of the block.

Checked against the real output

Not just unit tested. Running fill for the two tests named in the issue, both fixtures now carry skipSlotProcessing: [true], and test_block_extends_deep_chain, an ordinary test, emits no such field. The determinism check passes in both runs.

Three tests cover it: an ordinary run emits nothing, a skipping run emits the flag, and a run that mixes both pins [true, false]. That last one matters, because a single flag or a list built in the wrong order would pass a test where every block skips. I checked both mutations: reversing the list fails the ordering test, and never emitting the field fails two of the three.

ruff check, ruff format --check, ty check and codespell are all clean.

Closes leanEthereum#1198.

Two state-transition tests process a block against a state deliberately
left behind the block's slot, because that mismatch is the rejection they
test. The spec does that by skipping slot processing, but the emitted
fixture said nothing about it, so a runner replaying the fixture ran the
whole state transition, advanced the slot first, never reached the
mismatch, and had no way to know why.

The fixture now carries a per-block `skipSlotProcessing` list. It is
emitted only when some block needs it, so every ordinary fixture stays
byte-identical, and an absent field keeps meaning what runners already do.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

test_block_with_wrong_slot non-reproducible from fixture alone

1 participant