Skip to content

Attestation slashing protection exhaustive tests - #10027

Open
eserilev wants to merge 1 commit into
unstablefrom
slashing-protection-exhaustive-tests
Open

eserilev wants to merge 1 commit into
unstablefrom
slashing-protection-exhaustive-tests

Conversation

@eserilev

@eserilev eserilev commented Sep 9, 2026 •

Copy link
Copy Markdown
Member

Issue Addressed

Bounded exhaustive equivalence check for the attester slashing conditions.

check_attestation contains slashing rules across five SQL queries. This test suite
restates these rules in plain Rust and compares it against the production codepaths for
every attestation history up to MAX_HISTORY attestations from epochs 0..=MAX_EPOCH.

Exhaustive tests are helpful here because the rules for check_attestation only depend
on relative attestation ordering between epochs. For example attestation histories with
epochs {5, 40, 1000} work the same as ones with epochs {0, 1, 2}. The gaps between epochs
are irrelevant, so we can stick to a small range of epochs.

These tests exist to add more coverage to the SQL itself. Our other test cases test
against the same SQL queries but for a much smaller set of inputs.

Test coverage added by this PR that doesn't currently exist in unstable:

  1. SourceLessThanLowerBound and TargetLessThanOrEqLowerBound. The interchange test vectors reach them by accident after an import, but only check pass or fail. The exhaustive sweep cover both across thousands of histories.
  2. No test case created an attestation that is both a double vote and a surround, or malformed with a matching target. The exhaustive tests produce every overlap.
  3. Nothing on unstable checks that preliminary_check_attestation agrees with check_and_insert_attestation. The exhaustive tests do it for every attestation candidate on every history.
  4. Rejected insertions in the middle of a sequence. The current tests stop at the first failure or only fail on the last item. The exhaustive tests continue after a rejection, so a later candidate is checked against a history that did not change.
  5. No gaps. The exhaustive tests include all scenarios up to three stored attestations over eight epochs. The current tests only contain specific hard coded scenarios

@eserilev eserilev added test improvement Improve tests val-client Relates to the validator client binary ready-for-review The code is ready for review labels Sep 9, 2026
@mergify

mergify Bot commented Sep 9, 2026

Copy link
Copy Markdown

Some required checks have failed. Could you please take a look @eserilev? 🙏

@mergify mergify Bot added waiting-on-author The reviewer has suggested changes and awaits thier implementation. and removed ready-for-review The code is ready for review labels Sep 9, 2026
@eserilev
eserilev added this pull request to stack #10029 September 9, 2026 18:11
@eserilev eserilev changed the title Slashing protection exhaustive tests Attestation slashing protection exhaustive tests Sep 9, 2026
@eserilev
eserilev force-pushed the slashing-protection-exhaustive-tests branch from 18355ea to f7b1cd3 Compare September 9, 2026 20:37
@mergify mergify Bot added ready-for-review The code is ready for review and removed waiting-on-author The reviewer has suggested changes and awaits thier implementation. labels Sep 9, 2026
@eserilev
eserilev force-pushed the slashing-protection-exhaustive-tests branch from f7b1cd3 to 54d6c8b Compare September 9, 2026 22:49
@eserilev
eserilev force-pushed the slashing-protection-exhaustive-tests branch from 54d6c8b to 70a2ed9 Compare September 10, 2026 05:57

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-review The code is ready for review test improvement Improve tests val-client Relates to the validator client binary

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant