Skip to content

Commit 3fb2b01

Browse files
authored
chore: replace "vote" jargon with "attestation" (#91)
* Use attestation jargon at `test_validator.py` * Rename `latest_{known,new}_votes` into `latest_{known,new}_attestations` * Rename `get_vote_target` into `get_attestation_target` * Rename parameter `latest_votes` to `latest_attestations` * Rename `accept_new_votes` to `accept_new_attestations` * Fix comments on `store.py` * Fix comments on `test_attestation_processing.py` * Fix comments and variable names on `test_helper.py` * Fix comments and variable names on `test_time_management.py` * Fix comments and variable names on `test_fork_choice_algorithm.py` * Fix comments on `block.py` * Fix comments on `attestation.py` * Fix comments and variable names on `state.py` and `test_state.py` * Fix `CLAUDE.md` * Fix documentation in `docs/client` * Few more cleanups regarding "Voting" * Run formatter * Run formatter * Fix comments from updated upstream * Fix typos
1 parent b091ef7 commit 3fb2b01

File tree

19 files changed

+427
-418
lines changed

19 files changed

+427
-418
lines changed

CLAUDE.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ When creating SSZ types, follow these established patterns:
115115
### Domain-Specific Types (Preferred)
116116
- Use meaningful names that describe the purpose: `JustificationValidators`, `HistoricalBlockHashes`, `Attestations`
117117
- Define domain-specific types in modular structure (see Architecture section below)
118-
- Avoid generic names with numbers like `Bitlist68719476736` or `SignedVoteList4096`
118+
- Avoid generic names with numbers like `Bitlist68719476736` or `SignedAttestationList4096`
119119

120120
### SSZType vs SSZModel Design Decision
121121

@@ -168,16 +168,16 @@ class JustificationValidators(BaseBitlist):
168168

169169
# In block/types.py
170170
class Attestations(SSZList):
171-
"""List of signed votes (attestations) included in a block."""
172-
ELEMENT_TYPE = SignedVote
171+
"""List of signed attestations included in a block."""
172+
ELEMENT_TYPE = SignedAttestation
173173
LIMIT = 4096 # VALIDATOR_REGISTRY_LIMIT
174174
```
175175

176176
**Avoid generic types:**
177177
```python
178178
# Don't do this:
179179
class Bitlist68719476736(BaseBitlist): ...
180-
class SignedVoteList4096(SSZList): ...
180+
class SignedAttestationList4096(SSZList): ...
181181
```
182182

183183
### API Compatibility

docs/client/chain.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ exist.
2626
### Consensus Without Epochs
2727

2828
Traditional beacon chain organizes time into epochs. Lean chain removes this.
29-
All validators vote in every slot. This simplifies the protocol significantly.
29+
All validators are expected to create, sign, and broadcast an attestation in every slot. This simplifies the protocol significantly.
3030

3131
### Signature Handling
3232

@@ -37,9 +37,9 @@ are ready.
3737
Real signatures will be large, around 3-4 kilobytes each. Devnet 1 will test
3838
these.
3939

40-
### Vote Processing
40+
### Attestation Processing
4141

42-
Votes are collected and included in blocks without aggregation. Each vote is
42+
Attestations are collected and included in blocks without aggregation. Each attestation is
4343
separate. This is simpler than beacon chain aggregation.
4444

4545
Later devnets will add aggregation to reduce bandwidth.
@@ -74,7 +74,7 @@ configuration.
7474

7575
## Chain Justification
7676

77-
Blocks become justified when enough validators vote for them. Justification
77+
Blocks become justified when enough validators attestation for them. Justification
7878
happens when 2/3 of validators agree.
7979

8080
Not every slot can be justified. Certain slots are special based on how far
@@ -85,7 +85,7 @@ justification from spreading too thin.
8585
## Chain Finalization
8686

8787
Finalization provides stronger guarantees than justification. A block is
88-
finalized when validators vote for it and there are no other justifiable
88+
finalized when validators attestation for it and there are no other justifiable
8989
positions between it and what they're voting for.
9090

9191
Finalized blocks cannot be reverted. This provides economic certainty.
@@ -123,19 +123,19 @@ Blocks must pass several checks:
123123
- Proposer is correct for this slot
124124
- Parent reference is valid
125125

126-
After these checks, the block is processed. Vote processing happens next.
126+
After these checks, the block is processed. Attestation processing happens next.
127127

128-
## Vote Validation
128+
## Attestation Validation
129129

130-
Each vote must meet requirements:
130+
Each attestation must meet requirements:
131131

132132
- Source must be justified
133133
- Target must not already be justified
134134
- Block roots must be valid
135135
- Slot relationships must make sense
136136
- Target must be in a justifiable position
137137

138-
Invalid votes are ignored. Valid votes are counted. When enough votes
138+
Invalid attestations are ignored. Valid attestations are counted. When enough attestations
139139
accumulate, justification happens.
140140

141141
## Justification Tracking

docs/client/forkchoice.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ consensus.
1818
## How It Works
1919

2020
The fork choice algorithm starts from the most recently justified block. It
21-
then follows validator votes forward through the tree of blocks.
21+
then follows validator attestations forward through the tree of blocks.
2222

23-
At each branch point, the algorithm picks the child with the most votes. Votes
23+
At each branch point, the algorithm picks the child with the most attestations. Attestation
2424
for descendants count toward ancestors. This means voting for a block implicitly
2525
supports its entire history.
2626

@@ -32,32 +32,32 @@ Only justified blocks can serve as fork choice starting points. This ties fork
3232
choice to finalization.
3333

3434
Validators must justify new blocks before fork choice considers them. This
35-
creates a feedback loop: votes justify blocks, justified blocks anchor fork
35+
creates a feedback loop: attestations justify blocks, justified blocks anchor fork
3636
choice, fork choice determines what to build on.
3737

38-
## Vote Timing
38+
## Attestation Timing
3939

40-
Votes aren't processed immediately. The protocol divides each slot into
40+
Attestations aren't processed immediately. The protocol divides each slot into
4141
intervals. Different intervals have different roles:
4242

43-
- Some intervals accept new votes
44-
- Some intervals update what's safe to vote for
43+
- Some intervals accept new attestations
44+
- Some intervals update what's safe to attestation for
4545
- Some intervals are for proposal
4646

4747
This careful timing prevents certain attacks and ensures validators have
4848
consistent views.
4949

5050
## Safe Targets
5151

52-
Validators need to know where they can safely vote. The safe target mechanism
52+
Validators need to know where they can safely submit an attestation. The safe target mechanism
5353
finds the latest block that has enough support.
5454

55-
A block needs votes from 2/3 of validators to be safe. This threshold ensures
55+
A block needs attestations from 2/3 of validators to be safe. This threshold ensures
5656
that conflicting blocks can't both be safe simultaneously.
5757

58-
## Computing Vote Targets
58+
## Computing Attestation Targets
5959

60-
When a validator votes, it must choose a target carefully. The target should be
60+
When a validator creates an attestation, it must choose a target carefully. The target should be
6161
recent but not too recent. It should be safe but not too old.
6262

6363
The algorithm starts from the current head and works backward. It moves back a
@@ -66,10 +66,10 @@ justified according to protocol rules.
6666

6767
## Handling New Information
6868

69-
Fork choice must handle new blocks and new votes. When a block arrives, it gets
70-
added to the tree. Its votes are extracted and counted.
69+
Fork choice must handle new blocks and new attestations. When a block arrives, it gets
70+
added to the tree. Its attestations are extracted and counted.
7171

72-
When a vote arrives over gossip, it's held temporarily. Votes are only counted
72+
When an attestation arrives over gossip, it's held temporarily. Attestations are only counted
7373
at specific times to maintain consistency.
7474

7575
## Genesis Initialization
@@ -82,7 +82,7 @@ slot.
8282

8383
## Reorganizations
8484

85-
Sometimes fork choice changes. A new vote might tip the balance to a different
85+
Sometimes fork choice changes. A new attestation might tip the balance to a different
8686
fork. The head switches to the new fork.
8787

8888
Reorganizations are normal in the protocol. Shallow reorgs happen occasionally.
@@ -91,7 +91,7 @@ Deep reorgs past finalization cannot happen if 2/3 of validators are honest.
9191
## View Consistency
9292

9393
Different validators may have different views temporarily. They might see
94-
blocks in different orders. They might receive votes at different times.
94+
blocks in different orders. They might receive attestations at different times.
9595

9696
Fork choice rules ensure these differences don't break consensus. Eventually,
9797
all honest validators converge on the same head.
@@ -108,6 +108,6 @@ lost are discarded.
108108
## Implementation Details
109109

110110
The specification code implements these concepts precisely. It maintains the
111-
tree of blocks, tracks votes, and computes the head.
111+
tree of blocks, tracks attestations, and computes the head.
112112

113113
This documentation explains the concepts. The code provides the exact algorithm.

docs/client/validator.md

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

33
## Overview
44

5-
Validators participate in consensus by proposing blocks and voting. This
5+
Validators participate in consensus by proposing blocks and producing attestations. This
66
document describes what honest validators do.
77

88
## Validator Assignment
@@ -29,17 +29,17 @@ This is deterministic. Everyone can compute who should propose at any slot.
2929
Proposers create blocks at the start of the slot. Specifically, in the first
3030
interval of the slot's four intervals.
3131

32-
Early proposal gives other validators time to see and vote on the block.
32+
Early proposal gives other validators time to see and create an attestation on the block.
3333

3434
### Building a Block
3535

3636
The proposer queries fork choice for the current head. This is the parent for
3737
the new block.
3838

39-
The proposer collects recent votes. Valid votes get included in the block.
40-
A vote is valid if its source matches the current justified checkpoint.
39+
The proposer collects recent attestations. Valid attestations get included in the block.
40+
An attestation is valid if its source matches the current justified checkpoint.
4141

42-
The proposer keeps adding votes until no more valid votes remain. This
42+
The proposer keeps adding attestations until no more valid attestations remain. This
4343
maximizes block utility.
4444

4545
After building the block, the proposer computes the state root. This is the
@@ -50,14 +50,14 @@ state hash after applying the block.
5050
The proposer signs the block and broadcasts it to the network. Other validators
5151
receive and validate it.
5252

53-
## Voting
53+
## Attesting
5454

55-
Every validator votes in every slot. Voting happens in the second interval,
55+
Every validator attestations in every slot. Attesting happens in the second interval,
5656
after proposals are made.
5757

58-
### What to Vote For
58+
### What to Attest For
5959

60-
Validators vote for three things:
60+
Validators express their own views with an attestation, especially for three things:
6161

6262
- The chain head
6363
- A target to justify
@@ -67,41 +67,41 @@ The head is what fork choice says is canonical. The target is computed based on
6767
safe blocks and justifiability rules. The source is the most recent justified
6868
checkpoint.
6969

70-
### Why Vote
70+
### Why Attest
7171

72-
Votes drive justification and finalization. When 2/3 of validators vote for the
72+
Attestations drive justification and finalization. When 2/3 of validators attestation for the
7373
same target, it becomes justified. Justification eventually leads to
7474
finalization.
7575

76-
Votes also inform fork choice. Other validators see these votes and use them to
76+
Attestations also inform fork choice. Other validators see these attestations and use them to
7777
compute the head.
7878

79-
### Broadcasting Votes
79+
### Broadcasting Attestations
8080

81-
Validators sign their votes and broadcast them. The network uses a single topic
82-
for all votes. No subnets or committees in the current design.
81+
Validators sign their attestations and broadcast them. The network uses a single topic
82+
for all attestations. No subnets or committees in the current design.
8383

8484
## Timing
8585

8686
The slot divides into four one-second intervals:
8787

8888
- Interval 0: Proposals happen
89-
- Interval 1: Votes happen
89+
- Interval 1: Attestations happen
9090
- Interval 2: Safe targets update
9191
- Interval 3: More processing
9292

9393
This rhythm keeps the network synchronized. Validators know when to expect
94-
blocks and votes.
94+
blocks and attestations.
9595

9696
## Aggregation
9797

98-
Vote aggregation combines multiple votes into one. This saves bandwidth and
98+
Attestation aggregation combines multiple attestations into one. This saves bandwidth and
9999
block space.
100100

101-
Devnet 0 has no aggregation. Each vote is separate. Future devnets will add
101+
Devnet 0 has no aggregation. Each attestation is separate. Future devnets will add
102102
aggregation.
103103

104-
When aggregation is added, aggregators will collect votes and combine them.
104+
When aggregation is added, aggregators will collect attestations and combine them.
105105
Aggregated attestations will be broadcast separately.
106106

107107
## Signature Handling
@@ -119,7 +119,7 @@ Clients must implement the validator logic correctly. This includes:
119119

120120
- Tracking which validators they control
121121
- Proposing when scheduled
122-
- Voting every slot
122+
- Producing an attestation every slot
123123
- Following fork choice
124124
- Obeying timing rules
125125

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class TickStep(BaseForkChoiceStep):
3838
Time advancement step.
3939
4040
Advances the fork choice store time to a specific unix timestamp.
41-
This triggers interval-based actions like vote processing.
41+
This triggers interval-based actions like attestation processing.
4242
"""
4343

4444
step_type: Literal["tick"] = "tick"
@@ -114,8 +114,8 @@ class AttestationStep(BaseForkChoiceStep):
114114
"""
115115
Attestation processing step.
116116
117-
Processes an attestation (signed vote) received from gossip.
118-
This updates validator vote tracking in the store.
117+
Processes an attestation received from gossip.
118+
This updates validator attestation tracking in the store.
119119
120120
Note: Attestations included in blocks are processed automatically
121121
when the block is processed. This step is for gossip attestations.

src/lean_spec/subspecs/containers/attestation/attestation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class Attestation(Container):
4242
"""The index of the validator making the attestation."""
4343

4444
data: AttestationData
45-
"""The attestation data voted on by the validator."""
45+
"""The attestation data produced by the validator."""
4646

4747

4848
class SignedAttestation(Container):
@@ -62,9 +62,9 @@ class AggregatedAttestations(Container):
6262
"""Bitfield indicating which validators participated in the aggregation."""
6363

6464
data: AttestationData
65-
"""Combined vote data similar to the beacon chain format.
65+
"""Combined attestation data similar to the beacon chain format.
6666
67-
Multiple validator votes are aggregated here without the complexity of
67+
Multiple validator attestations are aggregated here without the complexity of
6868
committee assignments.
6969
"""
7070

@@ -73,10 +73,10 @@ class SignedAggregatedAttestations(Container):
7373
"""Aggregated attestation bundled with aggregated signatures."""
7474

7575
message: AggregatedAttestations
76-
"""Aggregated vote data."""
76+
"""Aggregated attestation data."""
7777

7878
signature: AggregatedSignatures
79-
"""Aggregated vote plus its combined signature.
79+
"""Aggregated attestation plus its combined signature.
8080
8181
Stores a naive list of validator signatures that mirrors the attestation
8282
order.

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@ class BlockBody(Container):
2121
"""
2222
The body of a block, containing payload data.
2323
24-
Currently, the main operation is voting. Validators submit votes which are
24+
Currently, the main operation is voting. Validators submit attestations which are
2525
packaged into blocks.
2626
"""
2727

2828
attestations: Attestations
2929
"""Plain validator attestations carried in the block body.
3030
3131
Individual signatures live in the aggregated block signature list, so
32-
these entries contain only vote data without per-attestation signatures.
32+
these entries contain only attestation data without per-attestation signatures.
3333
"""
3434

3535

@@ -87,14 +87,14 @@ class BlockWithAttestation(Container):
8787
"""The proposed block message."""
8888

8989
proposer_attestation: Attestation
90-
"""The proposer's vote corresponding to this block."""
90+
"""The proposer's attestation corresponding to this block."""
9191

9292

9393
class SignedBlockWithAttestation(Container):
94-
"""Envelope carrying a block, proposer vote, and aggregated signatures."""
94+
"""Envelope carrying a block, an attestation from proposer, and aggregated signatures."""
9595

9696
message: BlockWithAttestation
97-
"""The block plus proposer vote being signed."""
97+
"""The block plus an attestation from proposer being signed."""
9898

9999
signature: BlockSignatures
100100
"""Aggregated signature payload for the block.

0 commit comments

Comments
 (0)