@@ -77,20 +77,20 @@ def get_block_hash(
77
77
recent_block_hashes : Sequence [Hash32 ],
78
78
current_block_slot_number : int ,
79
79
slot : int ,
80
- cycle_length : int ) -> Hash32 :
80
+ epoch_length : int ) -> Hash32 :
81
81
"""
82
82
Return the blockhash from ``ActiveState.recent_block_hashes`` by
83
83
``current_block_slot_number``.
84
84
"""
85
- if len (recent_block_hashes ) != cycle_length * 2 :
85
+ if len (recent_block_hashes ) != epoch_length * 2 :
86
86
raise ValueError (
87
- "Length of recent_block_hashes != cycle_length * 2"
87
+ "Length of recent_block_hashes != epoch_length * 2"
88
88
"\t expected: %s, found: %s" % (
89
- cycle_length * 2 , len (recent_block_hashes )
89
+ epoch_length * 2 , len (recent_block_hashes )
90
90
)
91
91
)
92
92
93
- slot_relative_position = current_block_slot_number - cycle_length * 2
93
+ slot_relative_position = current_block_slot_number - epoch_length * 2
94
94
return _get_element_from_recent_list (
95
95
recent_block_hashes ,
96
96
slot ,
@@ -104,7 +104,7 @@ def get_hashes_from_recent_block_hashes(
104
104
current_block_slot_number : int ,
105
105
from_slot : int ,
106
106
to_slot : int ,
107
- cycle_length : int ) -> Iterable [Hash32 ]:
107
+ epoch_length : int ) -> Iterable [Hash32 ]:
108
108
"""
109
109
Returns the block hashes between ``from_slot`` and ``to_slot``.
110
110
"""
@@ -113,24 +113,24 @@ def get_hashes_from_recent_block_hashes(
113
113
recent_block_hashes ,
114
114
current_block_slot_number ,
115
115
slot ,
116
- cycle_length ,
116
+ epoch_length ,
117
117
)
118
118
119
119
120
120
@to_tuple
121
121
def get_hashes_to_sign (recent_block_hashes : Sequence [Hash32 ],
122
122
block : 'BaseBeaconBlock' ,
123
- cycle_length : int ) -> Iterable [Hash32 ]:
123
+ epoch_length : int ) -> Iterable [Hash32 ]:
124
124
"""
125
125
Given the head block to attest to, collect the list of hashes to be
126
126
signed in the attestation.
127
127
"""
128
128
yield from get_hashes_from_recent_block_hashes (
129
129
recent_block_hashes ,
130
130
block .slot_number ,
131
- from_slot = block .slot_number - cycle_length + 1 ,
131
+ from_slot = block .slot_number - epoch_length + 1 ,
132
132
to_slot = block .slot_number - 1 ,
133
- cycle_length = cycle_length ,
133
+ epoch_length = epoch_length ,
134
134
)
135
135
yield block .hash
136
136
@@ -139,17 +139,17 @@ def get_hashes_to_sign(recent_block_hashes: Sequence[Hash32],
139
139
def get_signed_parent_hashes (recent_block_hashes : Sequence [Hash32 ],
140
140
block : 'BaseBeaconBlock' ,
141
141
attestation : 'AttestationRecord' ,
142
- cycle_length : int ) -> Iterable [Hash32 ]:
142
+ epoch_length : int ) -> Iterable [Hash32 ]:
143
143
"""
144
144
Given an attestation and the block they were included in,
145
145
the list of hashes that were included in the signature.
146
146
"""
147
147
yield from get_hashes_from_recent_block_hashes (
148
148
recent_block_hashes ,
149
149
block .slot_number ,
150
- from_slot = attestation .slot - cycle_length + 1 ,
150
+ from_slot = attestation .slot - epoch_length + 1 ,
151
151
to_slot = attestation .slot - len (attestation .oblique_parent_hashes ),
152
- cycle_length = cycle_length ,
152
+ epoch_length = epoch_length ,
153
153
)
154
154
yield from attestation .oblique_parent_hashes
155
155
@@ -173,19 +173,19 @@ def get_new_recent_block_hashes(old_block_hashes: Sequence[Hash32],
173
173
def get_shards_and_committees_for_slot (
174
174
crystallized_state : 'CrystallizedState' ,
175
175
slot : int ,
176
- cycle_length : int ) -> Iterable [ShardCommittee ]:
176
+ epoch_length : int ) -> Iterable [ShardCommittee ]:
177
177
"""
178
178
FIXME
179
179
"""
180
- if len (crystallized_state .shard_committee_for_slots ) != cycle_length * 2 :
180
+ if len (crystallized_state .shard_committee_for_slots ) != epoch_length * 2 :
181
181
raise ValueError (
182
- "Length of shard_committee_for_slots != cycle_length * 2"
182
+ "Length of shard_committee_for_slots != epoch_length * 2"
183
183
"\t expected: %s, found: %s" % (
184
- cycle_length * 2 , len (crystallized_state .shard_committee_for_slots )
184
+ epoch_length * 2 , len (crystallized_state .shard_committee_for_slots )
185
185
)
186
186
)
187
187
188
- slot_relative_position = crystallized_state .last_state_recalc - cycle_length
188
+ slot_relative_position = crystallized_state .last_state_recalc - epoch_length
189
189
190
190
yield from _get_element_from_recent_list (
191
191
crystallized_state .shard_committee_for_slots ,
@@ -197,7 +197,7 @@ def get_shards_and_committees_for_slot(
197
197
@to_tuple
198
198
def get_attestation_indices (crystallized_state : 'CrystallizedState' ,
199
199
attestation : 'AttestationRecord' ,
200
- cycle_length : int ) -> Iterable [int ]:
200
+ epoch_length : int ) -> Iterable [int ]:
201
201
"""
202
202
FIXME
203
203
Return committee of the given attestation.
@@ -207,7 +207,7 @@ def get_attestation_indices(crystallized_state: 'CrystallizedState',
207
207
shards_and_committees_for_slot = get_shards_and_committees_for_slot (
208
208
crystallized_state ,
209
209
attestation .slot ,
210
- cycle_length ,
210
+ epoch_length ,
211
211
)
212
212
213
213
for shard_committee in shards_and_committees_for_slot :
@@ -248,7 +248,7 @@ def get_new_shuffling(*,
248
248
seed : Hash32 ,
249
249
validators : Sequence ['ValidatorRecord' ],
250
250
crosslinking_start_shard : int ,
251
- cycle_length : int ,
251
+ epoch_length : int ,
252
252
target_committee_size : int ,
253
253
shard_count : int ) -> Iterable [Iterable [ShardCommittee ]]:
254
254
"""
@@ -297,14 +297,14 @@ def get_new_shuffling(*,
297
297
active_validators_size = len (active_validators )
298
298
committees_per_slot = clamp (
299
299
1 ,
300
- shard_count // cycle_length ,
301
- active_validators_size // cycle_length // target_committee_size ,
300
+ shard_count // epoch_length ,
301
+ active_validators_size // epoch_length // target_committee_size ,
302
302
)
303
303
# Shuffle with seed
304
304
shuffled_active_validator_indices = shuffle (active_validators , seed )
305
305
306
306
# Split the shuffled list into epoch_length pieces
307
- validators_per_slot = split (shuffled_active_validator_indices , cycle_length )
307
+ validators_per_slot = split (shuffled_active_validator_indices , epoch_length )
308
308
for index , slot_indices in enumerate (validators_per_slot ):
309
309
# Split the shuffled list into committees_per_slot pieces
310
310
shard_indices = split (slot_indices , committees_per_slot )
@@ -321,11 +321,11 @@ def get_new_shuffling(*,
321
321
#
322
322
def get_block_committees_info (parent_block : 'BaseBeaconBlock' ,
323
323
crystallized_state : 'CrystallizedState' ,
324
- cycle_length : int ) -> BlockCommitteesInfo :
324
+ epoch_length : int ) -> BlockCommitteesInfo :
325
325
shards_and_committees = get_shards_and_committees_for_slot (
326
326
crystallized_state ,
327
327
parent_block .slot_number ,
328
- cycle_length ,
328
+ epoch_length ,
329
329
)
330
330
"""
331
331
FIXME
0 commit comments