File tree Expand file tree Collapse file tree 13 files changed +66
-89
lines changed
packages/testing/src/consensus_testing Expand file tree Collapse file tree 13 files changed +66
-89
lines changed Original file line number Diff line number Diff line change 4444 AttestationSignatures ,
4545)
4646from lean_spec .subspecs .containers .slot import Slot
47- from lean_spec .subspecs .containers .state .types import AttestationSignatureKey
48- from lean_spec .subspecs .xmss .aggregation import MultisigAggregatedSignature
47+ from lean_spec .subspecs .xmss .aggregation import (
48+ AttestationSignatureKey ,
49+ MultisigAggregatedSignature ,
50+ )
4951from lean_spec .subspecs .xmss .containers import KeyPair , PublicKey , Signature
5052from lean_spec .subspecs .xmss .interface import (
5153 PROD_SIGNATURE_SCHEME ,
Original file line number Diff line number Diff line change 2626from lean_spec .subspecs .containers .slot import Slot
2727from lean_spec .subspecs .containers .state import Validators
2828from lean_spec .subspecs .containers .state .state import State
29- from lean_spec .subspecs .containers .state .types import AttestationSignatureKey
3029from lean_spec .subspecs .forkchoice import Store
3130from lean_spec .subspecs .koalabear import Fp
3231from lean_spec .subspecs .ssz import hash_tree_root
32+ from lean_spec .subspecs .xmss .aggregation import AttestationSignatureKey
3333from lean_spec .subspecs .xmss .containers import Signature
3434from lean_spec .subspecs .xmss .types import HashDigestList , HashTreeOpening , Randomness
3535from lean_spec .types import Bytes32 , Uint64
Original file line number Diff line number Diff line change 1313 AggregationBits ,
1414 Attestation ,
1515 AttestationData ,
16- NaiveAggregatedSignature ,
17- SignedAggregatedAttestation ,
16+ AttestationsByValidator ,
1817 SignedAttestation ,
1918)
2019from .block import (
3130
3231__all__ = [
3332 "AggregatedAttestation" ,
34- "NaiveAggregatedSignature" ,
3533 "AggregationBits" ,
36- "AttestationData" ,
3734 "Attestation" ,
38- "SignedAttestation " ,
39- "SignedAggregatedAttestation " ,
35+ "AttestationData " ,
36+ "AttestationsByValidator " ,
4037 "Block" ,
41- "BlockWithAttestation" ,
4238 "BlockBody" ,
4339 "BlockHeader" ,
40+ "BlockWithAttestation" ,
4441 "Checkpoint" ,
4542 "Config" ,
43+ "SignedAttestation" ,
4644 "SignedBlockWithAttestation" ,
47- "Validator" ,
4845 "State" ,
46+ "Validator" ,
4947]
Original file line number Diff line number Diff line change 44 AggregatedAttestation ,
55 Attestation ,
66 AttestationData ,
7- SignedAggregatedAttestation ,
87 SignedAttestation ,
98)
10- from .types import AggregationBits , NaiveAggregatedSignature
9+ from .types import AggregationBits , AttestationsByValidator
1110
1211__all__ = [
13- "AttestationData" ,
14- "Attestation" ,
15- "SignedAttestation" ,
16- "SignedAggregatedAttestation" ,
1712 "AggregatedAttestation" ,
18- "NaiveAggregatedSignature" ,
1913 "AggregationBits" ,
14+ "Attestation" ,
15+ "AttestationData" ,
16+ "AttestationsByValidator" ,
17+ "SignedAttestation" ,
2018]
Original file line number Diff line number Diff line change 2222
2323from ...xmss .containers import Signature
2424from ..checkpoint import Checkpoint
25- from .types import AggregationBits , NaiveAggregatedSignature
25+ from .types import AggregationBits
2626
2727
2828class AttestationData (Container ):
@@ -107,22 +107,3 @@ def aggregate_by_data(
107107 )
108108 for data , validator_ids in data_to_validator_ids .items ()
109109 ]
110-
111-
112- class SignedAggregatedAttestation (Container ):
113- """Aggregated attestation bundled with aggregated signatures."""
114-
115- message : AggregatedAttestation
116- """Aggregated attestation data."""
117-
118- signature : NaiveAggregatedSignature
119- """Aggregated attestation plus its combined signature.
120-
121- Stores a naive list of validator signatures that mirrors the attestation
122- order.
123-
124- TODO:
125- - signatures will be replaced by MegaBytes in next PR to include leanVM proof.
126- - this will be replaced by a SNARK in future devnets.
127- - this will be aggregated by aggregators in future devnets.
128- """
Original file line number Diff line number Diff line change 22
33from __future__ import annotations
44
5- from lean_spec .types import SSZList , Uint64
5+ from typing import TYPE_CHECKING
6+
7+ from lean_spec .types import Uint64
68from lean_spec .types .bitfields import BaseBitlist
79
810from ...chain .config import VALIDATOR_REGISTRY_LIMIT
9- from ...xmss .containers import Signature
11+
12+ if TYPE_CHECKING :
13+ from .attestation import AttestationData
14+
15+ AttestationsByValidator = dict [Uint64 , "AttestationData" ]
16+ """Mapping from validator index to attestation data."""
1017
1118
1219class AggregationBits (BaseBitlist ):
@@ -57,10 +64,3 @@ def to_validator_indices(self) -> list[Uint64]:
5764 raise AssertionError ("Aggregated attestation must reference at least one validator" )
5865
5966 return indices
60-
61-
62- class NaiveAggregatedSignature (SSZList [Signature ]):
63- """Naive list of validator signatures used for aggregation placeholders."""
64-
65- ELEMENT_TYPE = Signature
66- LIMIT = int (VALIDATOR_REGISTRY_LIMIT )
Original file line number Diff line number Diff line change 1111from .types import (
1212 AggregatedAttestations ,
1313 AttestationSignatures ,
14+ BlockLookup ,
1415)
1516
1617__all__ = [
1718 "Block" ,
1819 "BlockBody" ,
1920 "BlockHeader" ,
21+ "BlockLookup" ,
2022 "BlockSignatures" ,
2123 "BlockWithAttestation" ,
2224 "SignedBlockWithAttestation" ,
Original file line number Diff line number Diff line change 11"""Block-specific SSZ types for the Lean Ethereum consensus specification."""
22
3+ from __future__ import annotations
4+
5+ from typing import TYPE_CHECKING
6+
37from lean_spec .subspecs .xmss .aggregation import MultisigAggregatedSignature
4- from lean_spec .types import SSZList
8+ from lean_spec .types import Bytes32 , SSZList
59
610from ...chain .config import VALIDATOR_REGISTRY_LIMIT
711from ..attestation import AggregatedAttestation
812
13+ if TYPE_CHECKING :
14+ from .block import Block
15+
16+ BlockLookup = dict [Bytes32 , "Block" ]
17+ """Mapping from block root to Block objects."""
18+
919
1020class AggregatedAttestations (SSZList [AggregatedAttestation ]):
1121 """List of aggregated attestations included in a block."""
Original file line number Diff line number Diff line change 22
33from .state import State
44from .types import (
5- AggregatedSignaturePayload ,
6- AggregatedSignaturePayloads ,
7- AttestationsByValidator ,
8- AttestationSignatureKey ,
9- BlockLookup ,
105 HistoricalBlockHashes ,
116 JustificationRoots ,
127 JustificationValidators ,
1611)
1712
1813__all__ = [
19- "State" ,
20- "AggregatedSignaturePayload" ,
21- "AggregatedSignaturePayloads" ,
22- "AttestationSignatureKey" ,
23- "AttestationsByValidator" ,
24- "BlockLookup" ,
2514 "HistoricalBlockHashes" ,
2615 "JustificationRoots" ,
2716 "JustificationValidators" ,
2817 "JustifiedSlots" ,
18+ "State" ,
2919 "StateLookup" ,
3020 "Validators" ,
3121]
Original file line number Diff line number Diff line change 33from typing import AbstractSet , Iterable
44
55from lean_spec .subspecs .ssz .hash import hash_tree_root
6- from lean_spec .subspecs .xmss .aggregation import MultisigAggregatedSignature
6+ from lean_spec .subspecs .xmss .aggregation import (
7+ AggregatedSignaturePayloads ,
8+ AttestationSignatureKey ,
9+ MultisigAggregatedSignature ,
10+ )
711from lean_spec .subspecs .xmss .containers import PublicKey , Signature
812from lean_spec .types import (
913 ZERO_HASH ,
2125from ..config import Config
2226from ..slot import Slot
2327from .types import (
24- AggregatedSignaturePayloads ,
25- AttestationSignatureKey ,
2628 HistoricalBlockHashes ,
2729 JustificationRoots ,
2830 JustificationValidators ,
You can’t perform that action at this time.
0 commit comments