Skip to content

test(st): block with maximum attestations (16 AttestationData entries) #573

@tcoratger

Description

@tcoratger

Context

Each block body can contain at most `MAX_ATTESTATIONS_DATA = 16` distinct `AttestationData` entries. This test verifies that a block at the maximum capacity is processed correctly by the state transition function.

This is important for client teams to verify their state transition handles the maximum-size case without issues (e.g., buffer overflows, incorrect iteration).

What to test

Write a state transition filler that:

  1. Builds a chain with enough validators and forks to generate 16 distinct valid `AttestationData` entries
  2. Constructs a block containing exactly 16 `AggregatedAttestationSpec` entries
  3. Processes the block through state transition
  4. Verifies all 16 attestations are processed correctly

Key assertions

  • Post-state reflects the effects of all 16 attestation groups
  • No errors during processing
  • Justification state updated correctly from the combined attestation weight

Where to add the test

Add to: `tests/consensus/devnet/state_transition/test_block_processing.py`

Code skeleton

def test_block_with_maximum_attestations(
    state_transition_test: StateTransitionTestFiller,
) -> None:
    """Block with 16 AttestationData entries (MAX_ATTESTATIONS_DATA) processes correctly."""
    # Strategy: create a chain with many forks to produce 16 distinct
    # (source, target, head) triples, then pack them into one block.
    #
    # Each AggregatedAttestationSpec with a different target_slot or
    # target_root_label creates a distinct AttestationData entry.
    #
    # TODO: design the chain topology to support 16 distinct valid attestations
    pass

How to run

uv run fill --fork=devnet --clean -n auto -k test_block_with_maximum_attestations

References

  • `MAX_ATTESTATIONS_DATA = 16`: `src/lean_spec/subspecs/chain/config.py`
  • `State.process_attestations`: `src/lean_spec/subspecs/containers/state/state.py`
  • `Store.on_block`: `src/lean_spec/subspecs/forkchoice/store.py` — validates count

Metadata

Metadata

Assignees

Labels

good first issueGood for newcomerstestsScope: Changes to the spec tests

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions