Skip to content

Commit 2ea8946

Browse files
committed
refactor: variable naming
1 parent bc35513 commit 2ea8946

File tree

13 files changed

+46
-46
lines changed

13 files changed

+46
-46
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
SignedBlockWithAttestation,
2222
)
2323
from lean_spec.subspecs.containers.block.types import (
24-
AggregatedAttestationList,
25-
AttestationSignatures,
24+
AggregatedAttestations,
25+
NaiveAggregatedSignature,
2626
)
2727
from lean_spec.subspecs.containers.checkpoint import Checkpoint
2828
from lean_spec.subspecs.containers.slot import Slot
@@ -137,7 +137,7 @@ def set_anchor_block_default(self) -> ForkChoiceTest:
137137
proposer_index=self.anchor_state.latest_block_header.proposer_index,
138138
parent_root=self.anchor_state.latest_block_header.parent_root,
139139
state_root=hash_tree_root(self.anchor_state),
140-
body=BlockBody(attestations=AggregatedAttestationList(data=[])),
140+
body=BlockBody(attestations=AggregatedAttestations(data=[])),
141141
)
142142
return self
143143

@@ -362,7 +362,7 @@ def _build_block_from_spec(
362362
proposer_attestation=proposer_attestation,
363363
),
364364
signature=BlockSignatures(
365-
attestation_signatures=AttestationSignatures(data=attestation_signatures),
365+
attestation_signatures=NaiveAggregatedSignature(data=attestation_signatures),
366366
proposer_signature=proposer_signature,
367367
),
368368
)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
attestation_to_aggregated,
1010
)
1111
from lean_spec.subspecs.containers.block.block import Block, BlockBody
12-
from lean_spec.subspecs.containers.block.types import AggregatedAttestationList
12+
from lean_spec.subspecs.containers.block.types import AggregatedAttestations
1313
from lean_spec.subspecs.containers.state.state import State
1414
from lean_spec.subspecs.ssz.hash import hash_tree_root
1515
from lean_spec.types import Bytes32, Uint64
@@ -227,7 +227,7 @@ def _build_block_from_spec(self, spec: BlockSpec, state: State) -> tuple[Block,
227227
proposer_index=proposer_index,
228228
parent_root=parent_root,
229229
state_root=spec.state_root,
230-
body=spec.body or BlockBody(attestations=AggregatedAttestationList(data=[])),
230+
body=spec.body or BlockBody(attestations=AggregatedAttestations(data=[])),
231231
)
232232
return block, None
233233

@@ -240,7 +240,7 @@ def _build_block_from_spec(self, spec: BlockSpec, state: State) -> tuple[Block,
240240
state_root=Bytes32.zero(),
241241
body=spec.body
242242
or BlockBody(
243-
attestations=AggregatedAttestationList(
243+
attestations=AggregatedAttestations(
244244
data=[attestation_to_aggregated(att) for att in attestations]
245245
)
246246
),

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
BlockWithAttestation,
1818
SignedBlockWithAttestation,
1919
)
20-
from lean_spec.subspecs.containers.block.types import AttestationSignatures
20+
from lean_spec.subspecs.containers.block.types import NaiveAggregatedSignature
2121
from lean_spec.subspecs.containers.checkpoint import Checkpoint
2222
from lean_spec.subspecs.containers.slot import Slot
2323
from lean_spec.subspecs.containers.state.state import State
@@ -239,7 +239,7 @@ def _build_block_from_spec(
239239
proposer_attestation=proposer_attestation,
240240
),
241241
signature=BlockSignatures(
242-
attestation_signatures=AttestationSignatures(data=signatures),
242+
attestation_signatures=NaiveAggregatedSignature(data=signatures),
243243
proposer_signature=proposer_attestation_signature,
244244
),
245245
)

src/lean_spec/subspecs/containers/block/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
BlockWithAttestation,
99
SignedBlockWithAttestation,
1010
)
11-
from .types import AggregatedAttestationList, AttestationSignatures
11+
from .types import AggregatedAttestations, NaiveAggregatedSignature
1212

1313
__all__ = [
1414
"Block",
@@ -17,6 +17,6 @@
1717
"BlockSignatures",
1818
"BlockWithAttestation",
1919
"SignedBlockWithAttestation",
20-
"AggregatedAttestationList",
21-
"AttestationSignatures",
20+
"AggregatedAttestations",
21+
"NaiveAggregatedSignature",
2222
]

src/lean_spec/subspecs/containers/block/block.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
from ...xmss.containers import Signature as XmssSignature
2121
from ..attestation import Attestation, AttestationData, aggregation_bits_to_validator_indices
2222
from ..validator import Validator
23-
from .types import AggregatedAttestationList, AttestationSignatures
23+
from .types import AggregatedAttestations, NaiveAggregatedSignature
2424

2525
if TYPE_CHECKING:
2626
from ..state import State
@@ -34,7 +34,7 @@ class BlockBody(Container):
3434
packaged into blocks.
3535
"""
3636

37-
attestations: AggregatedAttestationList
37+
attestations: AggregatedAttestations
3838
"""Plain validator attestations carried in the block body.
3939
4040
Individual signatures live in the aggregated block signature list, so
@@ -102,7 +102,7 @@ class BlockWithAttestation(Container):
102102
class BlockSignatures(Container):
103103
"""Signature payload for the block."""
104104

105-
attestation_signatures: AttestationSignatures
105+
attestation_signatures: NaiveAggregatedSignature
106106
"""Signatures for the attestations in the block body.
107107
108108
Contains a naive list of signatures for the attestations in the block body.

src/lean_spec/subspecs/containers/block/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,19 @@
33
from lean_spec.types import SSZList
44

55
from ...chain.config import VALIDATOR_REGISTRY_LIMIT
6-
from ...xmss.containers import Signature
6+
from ...xmss.containers import Signature as XmssSignature
77
from ..attestation import AggregatedAttestation
88

99

10-
class AggregatedAttestationList(SSZList):
10+
class AggregatedAttestations(SSZList):
1111
"""List of aggregated attestations included in a block."""
1212

1313
ELEMENT_TYPE = AggregatedAttestation
1414
LIMIT = int(VALIDATOR_REGISTRY_LIMIT)
1515

1616

17-
class AttestationSignatures(SSZList):
17+
class NaiveAggregatedSignature(SSZList):
1818
"""Aggregated signature list included alongside the block proposer's attestation."""
1919

20-
ELEMENT_TYPE = Signature
20+
ELEMENT_TYPE = XmssSignature
2121
LIMIT = int(VALIDATOR_REGISTRY_LIMIT)

src/lean_spec/subspecs/containers/state/state.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
if TYPE_CHECKING:
2323
from lean_spec.subspecs.xmss.containers import Signature
2424
from ..block import Block, BlockBody, BlockHeader
25-
from ..block.types import AggregatedAttestationList
25+
from ..block.types import AggregatedAttestations
2626
from ..checkpoint import Checkpoint
2727
from ..config import Config
2828
from ..slot import Slot
@@ -101,7 +101,7 @@ def generate_genesis(cls, genesis_time: Uint64, validators: Validators) -> "Stat
101101
proposer_index=Uint64(0),
102102
parent_root=Bytes32.zero(),
103103
state_root=Bytes32.zero(),
104-
body_root=hash_tree_root(BlockBody(attestations=AggregatedAttestationList(data=[]))),
104+
body_root=hash_tree_root(BlockBody(attestations=AggregatedAttestations(data=[]))),
105105
)
106106

107107
# Assemble and return the full genesis state.
@@ -670,7 +670,7 @@ def build_block(
670670
parent_root=parent_root,
671671
state_root=Bytes32.zero(),
672672
body=BlockBody(
673-
attestations=AggregatedAttestationList(
673+
attestations=AggregatedAttestations(
674674
data=aggregate_attestations_by_data(attestations)
675675
)
676676
),

tests/consensus/devnet/state_transition/test_genesis.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from consensus_testing import StateExpectation, StateTransitionTestFiller, generate_pre_state
1212

1313
from lean_spec.subspecs.containers.block import Block, BlockBody
14-
from lean_spec.subspecs.containers.block.types import AggregatedAttestationList
14+
from lean_spec.subspecs.containers.block.types import AggregatedAttestations
1515
from lean_spec.subspecs.containers.slot import Slot
1616
from lean_spec.subspecs.containers.state import State, Validators
1717
from lean_spec.subspecs.containers.state.types import (
@@ -55,7 +55,7 @@ def test_genesis_default_configuration(
5555
latest_block_header_parent_root=Bytes32.zero(),
5656
latest_block_header_state_root=Bytes32.zero(),
5757
latest_block_header_body_root=hash_tree_root(
58-
BlockBody(attestations=AggregatedAttestationList(data=[]))
58+
BlockBody(attestations=AggregatedAttestations(data=[]))
5959
),
6060
historical_block_hashes=HistoricalBlockHashes(data=[]),
6161
justified_slots=JustifiedSlots(data=[]),
@@ -100,7 +100,7 @@ def test_genesis_custom_time(
100100
latest_block_header_parent_root=Bytes32.zero(),
101101
latest_block_header_state_root=Bytes32.zero(),
102102
latest_block_header_body_root=hash_tree_root(
103-
BlockBody(attestations=AggregatedAttestationList(data=[]))
103+
BlockBody(attestations=AggregatedAttestations(data=[]))
104104
),
105105
historical_block_hashes=HistoricalBlockHashes(data=[]),
106106
justified_slots=JustifiedSlots(data=[]),
@@ -143,7 +143,7 @@ def test_genesis_custom_validator_set(
143143
latest_block_header_parent_root=Bytes32.zero(),
144144
latest_block_header_state_root=Bytes32.zero(),
145145
latest_block_header_body_root=hash_tree_root(
146-
BlockBody(attestations=AggregatedAttestationList(data=[]))
146+
BlockBody(attestations=AggregatedAttestations(data=[]))
147147
),
148148
historical_block_hashes=HistoricalBlockHashes(data=[]),
149149
justified_slots=JustifiedSlots(data=[]),
@@ -173,7 +173,7 @@ def test_genesis_block_hash_comparison() -> None:
173173
proposer_index=Uint64(0),
174174
parent_root=Bytes32.zero(),
175175
state_root=hash_tree_root(genesis_state1),
176-
body=BlockBody(attestations=AggregatedAttestationList(data=[])),
176+
body=BlockBody(attestations=AggregatedAttestations(data=[])),
177177
)
178178

179179
# Compute hash of first genesis block
@@ -190,7 +190,7 @@ def test_genesis_block_hash_comparison() -> None:
190190
proposer_index=Uint64(0),
191191
parent_root=Bytes32.zero(),
192192
state_root=hash_tree_root(genesis_state1_copy),
193-
body=BlockBody(attestations=AggregatedAttestationList(data=[])),
193+
body=BlockBody(attestations=AggregatedAttestations(data=[])),
194194
)
195195

196196
genesis_block_hash1_copy = hash_tree_root(genesis_block1_copy)
@@ -215,7 +215,7 @@ def test_genesis_block_hash_comparison() -> None:
215215
proposer_index=Uint64(0),
216216
parent_root=Bytes32.zero(),
217217
state_root=hash_tree_root(genesis_state2),
218-
body=BlockBody(attestations=AggregatedAttestationList(data=[])),
218+
body=BlockBody(attestations=AggregatedAttestations(data=[])),
219219
)
220220

221221
genesis_block_hash2 = hash_tree_root(genesis_block2)
@@ -240,7 +240,7 @@ def test_genesis_block_hash_comparison() -> None:
240240
proposer_index=Uint64(0),
241241
parent_root=Bytes32.zero(),
242242
state_root=hash_tree_root(genesis_state3),
243-
body=BlockBody(attestations=AggregatedAttestationList(data=[])),
243+
body=BlockBody(attestations=AggregatedAttestations(data=[])),
244244
)
245245

246246
genesis_block_hash3 = hash_tree_root(genesis_block3)

tests/lean_spec/subspecs/forkchoice/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
SignedAttestation,
1212
State,
1313
)
14-
from lean_spec.subspecs.containers.block import AggregatedAttestationList, BlockHeader
14+
from lean_spec.subspecs.containers.block import AggregatedAttestations, BlockHeader
1515
from lean_spec.subspecs.containers.config import Config
1616
from lean_spec.subspecs.containers.slot import Slot
1717
from lean_spec.subspecs.containers.state import Validators
@@ -44,7 +44,7 @@ def __init__(self, latest_justified: Checkpoint) -> None:
4444
proposer_index=Uint64(0),
4545
parent_root=Bytes32.zero(),
4646
state_root=Bytes32.zero(),
47-
body_root=hash_tree_root(BlockBody(attestations=AggregatedAttestationList(data=[]))),
47+
body_root=hash_tree_root(BlockBody(attestations=AggregatedAttestations(data=[]))),
4848
)
4949

5050
super().__init__(

tests/lean_spec/subspecs/forkchoice/test_store_attestations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
SignedBlockWithAttestation,
1717
)
1818
from lean_spec.subspecs.containers.block.types import (
19-
AggregatedAttestationList,
20-
AttestationSignatures,
19+
AggregatedAttestations,
20+
NaiveAggregatedSignature,
2121
)
2222
from lean_spec.subspecs.containers.checkpoint import Checkpoint
2323
from lean_spec.subspecs.containers.slot import Slot
@@ -43,7 +43,7 @@ def test_on_block_processes_multi_validator_aggregations() -> None:
4343
proposer_index=Uint64(0),
4444
parent_root=Bytes32.zero(),
4545
state_root=hash_tree_root(genesis_state),
46-
body=BlockBody(attestations=AggregatedAttestationList(data=[])),
46+
body=BlockBody(attestations=AggregatedAttestations(data=[])),
4747
)
4848

4949
base_store = Store.get_forkchoice_store(genesis_state, genesis_block)
@@ -93,7 +93,7 @@ def test_on_block_processes_multi_validator_aggregations() -> None:
9393
proposer_attestation=proposer_attestation,
9494
),
9595
signature=BlockSignatures(
96-
attestation_signatures=AttestationSignatures(data=attestation_signatures),
96+
attestation_signatures=NaiveAggregatedSignature(data=attestation_signatures),
9797
proposer_signature=proposer_signature,
9898
),
9999
)

0 commit comments

Comments
 (0)