Skip to content

Tests for attester-slashing bitfield intersection variations #1690

@protolambda

Description

@protolambda

Prysm experienced a bad bug with attester slashings where the intersection effectively always returned the full committee of the first attestation, due to intersection being called with the duplicate inputs: OffchainLabs/prysm#5229

The spec-tests cover indices missing/extra in various ways, but missed more variants of the valid case where different indices are slashed: https://github.com/ethereum/eth2.0-specs/blob/dev/tests/core/pyspec/eth2spec/test/phase_0/block_processing/test_process_attester_slashing.py

And the sanity tests seems to be testing this, but the utility code actually returns a full-participation attestation, so it went unnoticed through this test as well. https://github.com/ethereum/eth2.0-specs/blob/9f7a5491d749ced2f2fe9b44f2b467bb6db8c746/tests/core/pyspec/eth2spec/test/helpers/attester_slashings.py#L4

More valid test cases should be introduced to cover combinations of:

  • full attestations
  • partial participation attestations, different permutations
  • empty attestations

Thanks to @mcdee for finding this gap in tests and helping Prysm.

Metadata

Metadata

Assignees

No one assigned

    Labels

    testingCI, actions, tests, testing infra

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions