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
4 changes: 0 additions & 4 deletions packages/testing/src/framework/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,3 @@
This module provides base classes and utilities that are common across
both consensus and execution layer testing.
"""

from .markers import requires_capability

__all__ = ["requires_capability"]
34 changes: 0 additions & 34 deletions packages/testing/src/framework/markers.py

This file was deleted.

37 changes: 3 additions & 34 deletions packages/testing/src/framework/pytest_plugins/filler.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""Layer-agnostic pytest plugin for generating Ethereum test fixtures."""

import functools
import importlib
import json
import shutil
Expand All @@ -13,13 +12,6 @@
import pytest


@functools.cache
def _spec_instance_for(fork_class: type) -> Any:
"""Build the active fork's spec instance once and reuse across collection."""
spec_class_method: Any = fork_class.spec_class # ty: ignore[unresolved-attribute]
return spec_class_method()()


class FixtureCollector:
"""Collects generated fixtures and writes them to disk."""

Expand Down Expand Up @@ -234,11 +226,6 @@ def pytest_configure(config: pytest.Config) -> None:
"markers",
"valid_at(fork): specifies at which fork a test case is valid",
)
config.addinivalue_line(
"markers",
"requires(*capabilities): only collect when the active fork "
"advertises every listed runtime-checkable Protocol",
)

# Get options
output_dir = Path(config.getoption("--output"))
Expand Down Expand Up @@ -326,14 +313,6 @@ def _check_markers_valid_for_fork(
"""Check if test markers indicate validity for the given fork.

Shared logic for both collection-time and parametrization-time fork filtering.

Composition rules:

- Fork-range markers form an intersection across kinds and a union
within a kind.
- The exact-fork marker short-circuits to a single-fork match.
- The capability marker AND-composes on top of either branch — the
active fork must satisfy every listed capability Protocol.
"""
has_valid_from = False
has_valid_until = False
Expand All @@ -342,7 +321,6 @@ def _check_markers_valid_for_fork(
valid_from_forks = []
valid_until_forks = []
valid_at_forks = []
required_capabilities: list[type] = []

for marker in markers:
if marker.name == "valid_from":
Expand All @@ -363,21 +341,12 @@ def _check_markers_valid_for_fork(
target_fork = get_fork_by_name(fork_name)
if target_fork:
valid_at_forks.append(target_fork)
elif marker.name == "requires":
required_capabilities.extend(marker.args)

def _capability_check() -> bool:
"""Active fork must structurally satisfy every required capability."""
if not required_capabilities:
return True
spec = _spec_instance_for(fork_class)
return all(isinstance(spec, cap) for cap in required_capabilities)

if not (has_valid_from or has_valid_until or has_valid_at or required_capabilities):
if not (has_valid_from or has_valid_until or has_valid_at):
return True

if has_valid_at:
return fork_class in valid_at_forks and _capability_check()
return fork_class in valid_at_forks

from_valid = True
if has_valid_from:
Expand All @@ -387,7 +356,7 @@ def _capability_check() -> bool:
if has_valid_until:
until_valid = any(fork_class <= until_fork for until_fork in valid_until_forks)

return from_valid and until_valid and _capability_check()
return from_valid and until_valid


def _is_test_item_valid_for_fork(
Expand Down
3 changes: 0 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ addopts = [
]
markers = [
"slow: marks tests as slow (deselect with '-m \"not slow\"')",
"valid_from: marks tests as valid from a specific fork version",
"valid_until: marks tests as valid until a specific fork version",
"valid_at: marks tests as valid only at a specific fork version",
"requires: marks tests as requiring one or more fork capabilities",
"interop: integration tests for multiple leanSpec nodes",
"num_validators: number of validators for interop test cluster",
]
Expand Down
4 changes: 0 additions & 4 deletions src/lean_spec/forks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Multi-fork dispatch layer for leanSpec consensus specification."""

from . import capabilities
from .capabilities import SigScheme
from .lstar.containers import (
AggregatedAttestation,
AggregatedAttestations,
Expand Down Expand Up @@ -48,7 +46,6 @@
"ForkRegistry",
"LstarSpec",
"LstarStore",
"SigScheme",
"SignedAggregatedAttestation",
"SignedAttestation",
"SignedBlock",
Expand All @@ -58,5 +55,4 @@
"Store",
"Validator",
"Validators",
"capabilities",
]
16 changes: 0 additions & 16 deletions src/lean_spec/forks/capabilities.py

This file was deleted.

12 changes: 3 additions & 9 deletions src/lean_spec/forks/lstar/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
TypeTwoMultiSignature,
)
from lean_spec.subspecs.xmss.containers import PublicKey
from lean_spec.subspecs.xmss.interface import TARGET_SIGNATURE_SCHEME, GeneralizedXmssScheme
from lean_spec.subspecs.xmss.interface import TARGET_SIGNATURE_SCHEME
from lean_spec.types import (
ZERO_HASH,
Boolean,
Expand Down Expand Up @@ -72,9 +72,6 @@ class LstarSpec(ForkProtocol):

previous: ClassVar[type[ForkProtocol] | None] = None

# Capabilities advertised by this fork.
sig_scheme: ClassVar[GeneralizedXmssScheme] = TARGET_SIGNATURE_SCHEME

state_class: type[State] = State
block_class: type[Block] = Block
block_body_class: type[BlockBody] = BlockBody
Expand Down Expand Up @@ -874,7 +871,6 @@ def verify_signatures(
The block envelope holds one SSZ-encoded Type-2 proof binding
every body attestation plus the proposer's signature over the
block root.
The signing scheme is read from this fork's capability.

Args:
signed_block: The signed block whose merged proof is checked.
Expand Down Expand Up @@ -1109,7 +1105,7 @@ def on_gossip_attestation(

This method:

1. Verifies the XMSS signature using this fork's capability
1. Verifies the XMSS signature
2. Stores the signature when the node is in aggregator mode

Subnet filtering happens at the p2p subscription layer — only
Expand Down Expand Up @@ -1148,7 +1144,7 @@ def on_gossip_attestation(
)
public_key = key_state.validators[validator_id].get_attestation_pubkey()

assert self.sig_scheme.verify(
assert TARGET_SIGNATURE_SCHEME.verify(
public_key, attestation_data.slot, hash_tree_root(attestation_data), signature
), "Signature verification failed"

Expand Down Expand Up @@ -1251,8 +1247,6 @@ def on_block(
3. Processing attestations included in the block body (on-chain)
4. Updating the forkchoice head

Signatures are verified using this fork's capability.

Raises:
AssertionError: If parent block/state not found in store.
"""
Expand Down
39 changes: 0 additions & 39 deletions tests/consensus/lstar/test_capability_gating.py

This file was deleted.

Loading
Loading