Skip to content

Commit 98535f1

Browse files
committed
More shard_and_committee -> shard_committee
1 parent 12da90b commit 98535f1

File tree

4 files changed

+23
-23
lines changed

4 files changed

+23
-23
lines changed

eth/beacon/block_committees_info.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
('proposer_index_in_committee', int),
1616
('proposer_shard_id', int),
1717
('proposer_committee_size', int),
18-
('shards_and_committees', Tuple['ShardCommittee'])
18+
('shards_committees', Tuple['ShardCommittee'])
1919
)
2020
)

eth/beacon/helpers.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ def get_new_recent_block_hashes(old_block_hashes: Sequence[Hash32],
167167

168168

169169
#
170-
# Get shards_and_committees or indices
170+
# Get shards_committees or indices
171171
#
172172
@to_tuple
173-
def get_shards_and_committees_for_slot(
173+
def get_shards_committees_for_slot(
174174
crystallized_state: 'CrystallizedState',
175175
slot: int,
176176
epoch_length: int) -> Iterable[ShardCommittee]:
@@ -204,13 +204,13 @@ def get_attestation_indices(crystallized_state: 'CrystallizedState',
204204
"""
205205
shard_id = attestation.shard_id
206206

207-
shards_and_committees_for_slot = get_shards_and_committees_for_slot(
207+
shards_committees_for_slot = get_shards_committees_for_slot(
208208
crystallized_state,
209209
attestation.slot,
210210
epoch_length,
211211
)
212212

213-
for shard_committee in shards_and_committees_for_slot:
213+
for shard_committee in shards_committees_for_slot:
214214
if shard_committee.shard_id == shard_id:
215215
yield from shard_committee.committee
216216

@@ -229,7 +229,7 @@ def get_active_validator_indices(validators: Sequence['ValidatorRecord']) -> Tup
229229
# Shuffling
230230
#
231231
@to_tuple
232-
def _get_shards_and_committees_for_shard_indices(
232+
def _get_shards_committees_for_shard_indices(
233233
shard_indices: Sequence[Sequence[int]],
234234
start_shard: int,
235235
total_validator_count: int,
@@ -311,7 +311,7 @@ def get_new_shuffling(*,
311311
# Split the shuffled list into committees_per_slot pieces
312312
shard_indices = split(slot_indices, committees_per_slot)
313313
start_shard = crosslinking_start_shard + index * committees_per_slot
314-
yield _get_shards_and_committees_for_shard_indices(
314+
yield _get_shards_committees_for_shard_indices(
315315
shard_indices,
316316
start_shard,
317317
active_validators_size,
@@ -325,7 +325,7 @@ def get_new_shuffling(*,
325325
def get_block_committees_info(parent_block: 'BaseBeaconBlock',
326326
crystallized_state: 'CrystallizedState',
327327
epoch_length: int) -> BlockCommitteesInfo:
328-
shards_and_committees = get_shards_and_committees_for_slot(
328+
shards_committees = get_shards_committees_for_slot(
329329
crystallized_state,
330330
parent_block.slot_number,
331331
epoch_length,
@@ -337,9 +337,9 @@ def get_block_committees_info(parent_block: 'BaseBeaconBlock',
337337
# `proposer_index_in_committee` th attester in `shard_committee`
338338
# is the proposer of the parent block.
339339
try:
340-
shard_committee = shards_and_committees[0]
340+
shard_committee = shards_committees[0]
341341
except IndexError:
342-
raise ValueError("shards_and_committees should not be empty.")
342+
raise ValueError("shards_committees should not be empty.")
343343

344344
proposer_committee_size = len(shard_committee.committee)
345345
if proposer_committee_size <= 0:
@@ -360,5 +360,5 @@ def get_block_committees_info(parent_block: 'BaseBeaconBlock',
360360
proposer_index_in_committee=proposer_index_in_committee,
361361
proposer_shard_id=shard_committee.shard_id,
362362
proposer_committee_size=proposer_committee_size,
363-
shards_and_committees=shards_and_committees,
363+
shards_committees=shards_committees,
364364
)

tests/beacon/test_helpers.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
get_hashes_from_recent_block_hashes,
1515
get_hashes_to_sign,
1616
get_new_shuffling,
17-
get_shards_and_committees_for_slot,
17+
get_shards_committees_for_slot,
1818
get_signed_parent_hashes,
1919
get_block_committees_info,
2020
)
@@ -200,7 +200,7 @@ def test_get_new_recent_block_hashes(genesis_block,
200200

201201

202202
#
203-
# Get shards_and_committees or indices
203+
# Get shards_committees or indices
204204
#
205205
@pytest.mark.xfail(reason="Need to be fixed")
206206
@pytest.mark.parametrize(
@@ -222,16 +222,16 @@ def test_get_shard_committee_for_slot(
222222
crystallized_state = genesis_crystallized_state
223223

224224
if success:
225-
shards_and_committees_for_slot = get_shards_and_committees_for_slot(
225+
shards_committees_for_slot = get_shards_committees_for_slot(
226226
crystallized_state,
227227
slot,
228228
epoch_length,
229229
)
230-
assert len(shards_and_committees_for_slot) > 0
231-
assert len(shards_and_committees_for_slot[0].committee) > 0
230+
assert len(shards_committees_for_slot) > 0
231+
assert len(shards_committees_for_slot[0].committee) > 0
232232
else:
233233
with pytest.raises(ValueError):
234-
get_shards_and_committees_for_slot(
234+
get_shards_committees_for_slot(
235235
crystallized_state,
236236
slot,
237237
epoch_length,
@@ -363,17 +363,17 @@ def test_get_block_committees_info(monkeypatch,
363363
epoch_length):
364364
from eth.beacon import helpers
365365

366-
def mock_get_shards_and_committees_for_slot(parent_block,
367-
crystallized_state,
368-
epoch_length):
366+
def mock_get_shards_committees_for_slot(parent_block,
367+
crystallized_state,
368+
epoch_length):
369369
return [
370370
ShardCommittee(shard_id=1, committee=committee),
371371
]
372372

373373
monkeypatch.setattr(
374374
helpers,
375-
'get_shards_and_committees_for_slot',
376-
mock_get_shards_and_committees_for_slot
375+
'get_shards_committees_for_slot',
376+
mock_get_shards_committees_for_slot
377377
)
378378

379379
parent_block = genesis_block

tests/beacon/types/test_shard_committee.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ def test_defaults(sample_shard_committee_params):
77
shard_committee = ShardCommittee(**sample_shard_committee_params)
88
assert shard_committee.shard == sample_shard_committee_params['shard']
99
assert shard_committee.committee == sample_shard_committee_params['committee']
10-
assert shard_committee.total_validator_count == sample_shard_committee_params['total_validator_count']
10+
assert shard_committee.total_validator_count == sample_shard_committee_params['total_validator_count'] # noqa: E501

0 commit comments

Comments
 (0)