Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/testing/src/consensus_testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
StateTransitionTest,
SwapParticipantPublicKey,
SyncTest,
VerifyProofsTest,
VerifySignaturesTest,
VerifySingleMessageProofsTest,
)
from .test_types import (
AggregatedAttestationCheck,
Expand All @@ -41,7 +41,7 @@

StateTransitionTestFiller = Type[StateTransitionTest]
ForkChoiceTestFiller = Type[ForkChoiceTest]
VerifyProofsTestFiller = Type[VerifyProofsTest]
VerifySingleMessageProofsTestFiller = Type[VerifySingleMessageProofsTest]
VerifySignaturesTestFiller = Type[VerifySignaturesTest]
SSZTestFiller = Type[SSZTest]
NetworkingCodecTestFiller = Type[NetworkingCodecTest]
Expand All @@ -66,7 +66,7 @@
"BaseConsensusFixture",
"StateTransitionTest",
"ForkChoiceTest",
"VerifyProofsTest",
"VerifySingleMessageProofsTest",
"RebindToAlternateHeadRoot",
"IncrementEmittedSlot",
"SwapParticipantPublicKey",
Expand All @@ -93,7 +93,7 @@
# Type aliases for test function signatures
"StateTransitionTestFiller",
"ForkChoiceTestFiller",
"VerifyProofsTestFiller",
"VerifySingleMessageProofsTestFiller",
"VerifySignaturesTestFiller",
"SSZTestFiller",
"NetworkingCodecTestFiller",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,19 @@
from .ssz import SSZTest
from .state_transition import StateTransitionTest
from .sync import SyncTest
from .verify_proofs import (
from .verify_signatures import VerifySignaturesTest
from .verify_single_message_proofs import (
IncrementEmittedSlot,
RebindToAlternateHeadRoot,
SwapParticipantPublicKey,
VerifyProofsTest,
VerifySingleMessageProofsTest,
)
from .verify_signatures import VerifySignaturesTest

__all__ = [
"BaseConsensusFixture",
"StateTransitionTest",
"ForkChoiceTest",
"VerifyProofsTest",
"VerifySingleMessageProofsTest",
"RebindToAlternateHeadRoot",
"IncrementEmittedSlot",
"SwapParticipantPublicKey",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class SwapParticipantPublicKey(BaseModel):
"""Discriminated union of post-generation mutations that produce a rejection vector."""


class VerifyProofsTest(BaseConsensusFixture):
class VerifySingleMessageProofsTest(BaseConsensusFixture):
"""Verify a single-message aggregate proof against precomputed bytes."""

format_name: ClassVar[str] = "verify_proofs_test"
format_name: ClassVar[str] = "verify_single_message_proofs_test"

description: ClassVar[str] = (
"Tests multi-signature proof verification against precomputed proof bytes."
"Tests single-message aggregate proof verification against precomputed proof bytes."
)

validator_indices: list[ValidatorIndex] = Field(exclude=True)
Expand Down Expand Up @@ -95,7 +95,7 @@ class VerifyProofsTest(BaseConsensusFixture):
proof: ByteList512KiB | None = None
"""Aggregated proof bytes for clients to verify."""

def make_fixture(self) -> VerifyProofsTest:
def make_fixture(self) -> VerifySingleMessageProofsTest:
"""Generate the proof, optionally tamper, self-verify, and return the populated copy.

Raises:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
IncrementEmittedSlot,
RebindToAlternateHeadRoot,
SwapParticipantPublicKey,
VerifyProofsTestFiller,
VerifySingleMessageProofsTestFiller,
)

from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex
Expand All @@ -16,10 +16,10 @@


def test_single_message_wrong_message(
verify_proofs_test: VerifyProofsTestFiller,
verify_single_message_proofs_test: VerifySingleMessageProofsTestFiller,
) -> None:
"""Proof bound to an alternate head root must not verify against the honest message."""
verify_proofs_test(
verify_single_message_proofs_test(
validator_indices=[ValidatorIndex(0)],
attestation_data=AttestationData(
slot=Slot(6),
Expand All @@ -33,10 +33,10 @@ def test_single_message_wrong_message(


def test_single_message_wrong_slot(
verify_proofs_test: VerifyProofsTestFiller,
verify_single_message_proofs_test: VerifySingleMessageProofsTestFiller,
) -> None:
"""Proof bound to slot 4, emitted under slot 5, must reject on the slot binding mismatch."""
verify_proofs_test(
verify_single_message_proofs_test(
validator_indices=[ValidatorIndex(0)],
attestation_data=AttestationData(
slot=Slot(4),
Expand All @@ -50,10 +50,10 @@ def test_single_message_wrong_slot(


def test_single_message_wrong_public_keys(
verify_proofs_test: VerifyProofsTestFiller,
verify_single_message_proofs_test: VerifySingleMessageProofsTestFiller,
) -> None:
"""Public key at the only participant slot swapped for another validator's must reject."""
verify_proofs_test(
verify_single_message_proofs_test(
validator_indices=[ValidatorIndex(0)],
attestation_data=AttestationData(
slot=Slot(7),
Expand Down
14 changes: 7 additions & 7 deletions tests/consensus/lstar/verify_proofs/test_single_message_valid.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Single-message aggregate proof verification vectors — valid cases."""

import pytest
from consensus_testing import VerifyProofsTestFiller
from consensus_testing import VerifySingleMessageProofsTestFiller

from lean_spec.spec.forks import Checkpoint, Slot, ValidatorIndex
from lean_spec.spec.forks.lstar.containers import AttestationData
Expand All @@ -11,10 +11,10 @@


def test_single_message_single_validator(
verify_proofs_test: VerifyProofsTestFiller,
verify_single_message_proofs_test: VerifySingleMessageProofsTestFiller,
) -> None:
"""Single-validator single-message aggregate proof must verify."""
verify_proofs_test(
verify_single_message_proofs_test(
validator_indices=[ValidatorIndex(0)],
attestation_data=AttestationData(
slot=Slot(1),
Expand All @@ -26,10 +26,10 @@ def test_single_message_single_validator(


def test_single_message_four_validators(
verify_proofs_test: VerifyProofsTestFiller,
verify_single_message_proofs_test: VerifySingleMessageProofsTestFiller,
) -> None:
"""Four-validator single-message aggregate, all participating, must verify."""
verify_proofs_test(
verify_single_message_proofs_test(
validator_indices=[ValidatorIndex(i) for i in range(4)],
attestation_data=AttestationData(
slot=Slot(2),
Expand All @@ -41,10 +41,10 @@ def test_single_message_four_validators(


def test_single_message_four_validators_partial(
verify_proofs_test: VerifyProofsTestFiller,
verify_single_message_proofs_test: VerifySingleMessageProofsTestFiller,
) -> None:
"""Non-contiguous four-validator committee, aggregation bits resolve to [1, 0, 1, 1]."""
verify_proofs_test(
verify_single_message_proofs_test(
validator_indices=[ValidatorIndex(0), ValidatorIndex(2), ValidatorIndex(3)],
attestation_data=AttestationData(
slot=Slot(3),
Expand Down
Loading