PR feedback: use `filter_participant_set`

This commit is contained in:
Hsiao-Wei Wang 2020-06-23 00:13:48 +08:00
parent 97d0048eaa
commit 5357bddcf8
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 2 additions and 8 deletions

View File

@ -7,7 +7,6 @@ from eth2spec.test.helpers.attestations import (
get_valid_attestation, get_valid_attestation,
get_valid_on_time_attestation, get_valid_on_time_attestation,
run_attestation_processing, run_attestation_processing,
sign_aggregate_attestation,
) )
from eth2spec.test.helpers.shard_transitions import run_shard_transitions_processing from eth2spec.test.helpers.shard_transitions import run_shard_transitions_processing
from eth2spec.test.helpers.shard_block import ( from eth2spec.test.helpers.shard_block import (
@ -140,17 +139,12 @@ def test_no_winning_root(spec, state):
spec, state, spec, state,
index=committee_index, index=committee_index,
shard_transition=shard_transition, shard_transition=shard_transition,
# Decrease attested participants to 1/3 committee
filter_participant_set=lambda committee: set(list(committee)[:len(committee) // 3]),
signed=True, signed=True,
on_time=True, on_time=True,
) )
# Decrease attested participants to 1/3 committee
beacon_committee = spec.get_beacon_committee(state, state.slot, committee_index)
attested_participants = beacon_committee[:len(beacon_committee) // 3]
for i in range(len(beacon_committee)):
attestation.aggregation_bits[i] = beacon_committee[i] in attested_participants
attestation.signature = sign_aggregate_attestation(spec, state, attestation.data, attested_participants)
next_slot(spec, state) next_slot(spec, state)
_, _, _ = run_attestation_processing(spec, state, attestation) _, _, _ = run_attestation_processing(spec, state, attestation)