Skip to content

Commit 3fb619d

Browse files
tcoratgerclaude
andauthored
refactor(forks/lstar): collapse containers package into a single module (leanEthereum#785)
Replace the lstar containers/ package and its attestation, block, and state subpackages with one containers.py file holding every container. Update all import sites to pull from lean_spec.forks.lstar.containers. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 32fbfe3 commit 3fb619d

56 files changed

Lines changed: 351 additions & 479 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/testing/src/consensus_testing/genesis.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
"""Consensus layer pre-state generation."""
22

3-
from lean_spec.forks.lstar.containers.block import AggregatedAttestations, Block, BlockBody
4-
from lean_spec.forks.lstar.containers.state import State, Validators
5-
from lean_spec.forks.lstar.containers.validator import Validator
3+
from lean_spec.forks.lstar.containers import (
4+
AggregatedAttestations,
5+
Block,
6+
BlockBody,
7+
State,
8+
Validator,
9+
Validators,
10+
)
611
from lean_spec.forks.lstar.spec import LstarSpec
712
from lean_spec.subspecs.ssz.hash import hash_tree_root
813
from lean_spec.types import Bytes52, Slot, Uint64, ValidatorIndex

packages/testing/src/consensus_testing/keys.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@
4141
from typing import ClassVar, Literal
4242

4343
from lean_spec.config import LEAN_ENV
44-
from lean_spec.forks.lstar.containers import AttestationData
45-
from lean_spec.forks.lstar.containers.block.types import AggregatedAttestations
44+
from lean_spec.forks.lstar.containers import AggregatedAttestations, AttestationData
4645
from lean_spec.subspecs.koalabear import Fp
4746
from lean_spec.subspecs.ssz.hash import hash_tree_root
4847
from lean_spec.subspecs.xmss.aggregation import TypeOneMultiSignature

packages/testing/src/consensus_testing/test_fixtures/api_endpoint.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@
44
from typing import Any, ClassVar
55

66
from lean_spec.forks.lstar import Store
7-
from lean_spec.forks.lstar.containers import BlockBody
8-
from lean_spec.forks.lstar.containers.block import Block
9-
from lean_spec.forks.lstar.containers.block.types import AggregatedAttestations
10-
from lean_spec.forks.lstar.containers.state import State
7+
from lean_spec.forks.lstar.containers import AggregatedAttestations, Block, BlockBody, State
118
from lean_spec.forks.lstar.spec import LstarSpec
129
from lean_spec.subspecs.ssz.hash import hash_tree_root
1310
from lean_spec.types import Bytes32, Slot, Uint64, ValidatorIndex

packages/testing/src/consensus_testing/test_fixtures/fork_choice.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,13 @@
1111

1212
from pydantic import Field, model_validator
1313

14-
from lean_spec.forks.lstar.containers.block import (
14+
from lean_spec.forks.lstar.containers import (
15+
AggregatedAttestations,
1516
Block,
1617
BlockBody,
18+
State,
19+
Validators,
1720
)
18-
from lean_spec.forks.lstar.containers.block.types import (
19-
AggregatedAttestations,
20-
)
21-
from lean_spec.forks.lstar.containers.state import State, Validators
2221
from lean_spec.forks.lstar.spec import LstarSpec
2322
from lean_spec.subspecs.chain.clock import Interval
2423
from lean_spec.subspecs.ssz import hash_tree_root

packages/testing/src/consensus_testing/test_fixtures/state_transition.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,14 @@
44

55
from pydantic import ConfigDict, PrivateAttr, field_serializer
66

7-
from lean_spec.forks.lstar.containers.attestation import AggregatedAttestation, AttestationData
8-
from lean_spec.forks.lstar.containers.block.block import Block, BlockBody
9-
from lean_spec.forks.lstar.containers.block.types import AggregatedAttestations
10-
from lean_spec.forks.lstar.containers.state import State
7+
from lean_spec.forks.lstar.containers import (
8+
AggregatedAttestation,
9+
AggregatedAttestations,
10+
AttestationData,
11+
Block,
12+
BlockBody,
13+
State,
14+
)
1115
from lean_spec.forks.lstar.spec import LstarSpec
1216
from lean_spec.subspecs.ssz.hash import hash_tree_root
1317
from lean_spec.subspecs.xmss.aggregation import TypeOneMultiSignature

packages/testing/src/consensus_testing/test_fixtures/verify_signatures.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,13 @@
66

77
from pydantic import Field
88

9-
from lean_spec.forks.lstar.containers.attestation import AggregatedAttestation, AttestationData
10-
from lean_spec.forks.lstar.containers.block import SignedBlock
11-
from lean_spec.forks.lstar.containers.block.types import AggregatedAttestations
12-
from lean_spec.forks.lstar.containers.state import State
9+
from lean_spec.forks.lstar.containers import (
10+
AggregatedAttestation,
11+
AggregatedAttestations,
12+
AttestationData,
13+
SignedBlock,
14+
State,
15+
)
1316
from lean_spec.forks.lstar.spec import LstarSpec
1417
from lean_spec.types import (
1518
AggregationBits,

packages/testing/src/consensus_testing/test_types/aggregated_attestation_spec.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22

33
from __future__ import annotations
44

5-
from lean_spec.forks.lstar.containers.attestation import AggregatedAttestation, AttestationData
6-
from lean_spec.forks.lstar.containers.block.block import Block
7-
from lean_spec.forks.lstar.containers.block.types import AggregatedAttestations
8-
from lean_spec.forks.lstar.containers.state import State
5+
from lean_spec.forks.lstar.containers import (
6+
AggregatedAttestation,
7+
AggregatedAttestations,
8+
AttestationData,
9+
Block,
10+
State,
11+
)
912
from lean_spec.subspecs.xmss.aggregation import TypeOneMultiSignature
1013
from lean_spec.types import (
1114
ByteList512KiB,

packages/testing/src/consensus_testing/test_types/block_spec.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44

55
from collections import defaultdict
66

7-
from lean_spec.forks.lstar.containers.attestation import (
7+
from lean_spec.forks.lstar.containers import (
88
AggregatedAttestation,
9+
AggregatedAttestations,
910
Attestation,
1011
AttestationData,
12+
Block,
13+
BlockBody,
1114
SignedAttestation,
15+
SignedBlock,
16+
State,
1217
)
13-
from lean_spec.forks.lstar.containers.block import Block, BlockBody, SignedBlock
14-
from lean_spec.forks.lstar.containers.block.types import AggregatedAttestations
15-
from lean_spec.forks.lstar.containers.state import State
1618
from lean_spec.forks.lstar.spec import LstarSpec
1719
from lean_spec.forks.lstar.store import Store
1820
from lean_spec.subspecs.chain.clock import Interval

packages/testing/src/consensus_testing/test_types/gossip_aggregated_attestation_spec.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
from __future__ import annotations
44

5-
from lean_spec.forks.lstar.containers.attestation import AttestationData
6-
from lean_spec.forks.lstar.containers.attestation.attestation import SignedAggregatedAttestation
7-
from lean_spec.forks.lstar.containers.block.block import Block
8-
from lean_spec.forks.lstar.containers.state import State
5+
from lean_spec.forks.lstar.containers import (
6+
AttestationData,
7+
Block,
8+
SignedAggregatedAttestation,
9+
State,
10+
)
911
from lean_spec.subspecs.xmss.aggregation import TypeOneMultiSignature
1012
from lean_spec.types import (
1113
ByteList512KiB,

packages/testing/src/consensus_testing/test_types/gossip_attestation_spec.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
from __future__ import annotations
44

5-
from lean_spec.forks.lstar.containers.attestation import AttestationData, SignedAttestation
6-
from lean_spec.forks.lstar.containers.block.block import Block
5+
from lean_spec.forks.lstar.containers import AttestationData, Block, SignedAttestation
76
from lean_spec.forks.lstar.spec import LstarSpec
87
from lean_spec.forks.lstar.store import Store
98
from lean_spec.subspecs.ssz.hash import hash_tree_root

0 commit comments

Comments
 (0)