Context
During attestation processing, if the target slot is already justified, the attestation is silently skipped. Re-justifying an already-justified slot is pointless and could lead to accounting errors.
The check in `process_attestations`:
```python
if self.justified_slots.is_slot_justified(att_data.target.slot, ...):
continue # Already justified, skip
```
This matters because:
- After justification, attestations targeting that slot may still arrive (delayed gossip)
- Blocks containing such attestations must not be rejected
- The attestation simply has no effect
What to test
Write a state transition filler that:
- Builds a chain and achieves justification at slot X
- In a subsequent block, includes an attestation targeting slot X (already justified)
- Verifies the attestation is silently skipped (no error, no state change)
Key assertions
- Post-state shows slot X was justified (from the first round)
- The second attestation targeting X produces no additional state change
- No errors during processing
Where to add the test
Add to: `tests/consensus/devnet/state_transition/test_justification.py`
Code skeleton
def test_attestation_with_already_justified_target_is_silently_skipped(
state_transition_test: StateTransitionTestFiller,
) -> None:
"""Attestation targeting an already-justified slot is ignored without error."""
# 1. Build chain and justify slot 1 (supermajority attest)
# 2. In a later block, include attestation also targeting slot 1
# 3. Verify no double-counting or error
pass # TODO: implement with justification setup from existing patterns
How to run
uv run fill --fork=devnet --clean -n auto -k test_attestation_with_already_justified
References
- `State.process_attestations`: `src/lean_spec/subspecs/containers/state/state.py`
- Justification patterns: `tests/consensus/devnet/state_transition/test_justification.py`
Context
During attestation processing, if the target slot is already justified, the attestation is silently skipped. Re-justifying an already-justified slot is pointless and could lead to accounting errors.
The check in `process_attestations`:
```python
if self.justified_slots.is_slot_justified(att_data.target.slot, ...):
continue # Already justified, skip
```
This matters because:
What to test
Write a state transition filler that:
Key assertions
Where to add the test
Add to: `tests/consensus/devnet/state_transition/test_justification.py`
Code skeleton
How to run
References