Adjust the sanity test for attestation verification integration

This commit is contained in:
Hsiao-Wei Wang 2019-03-23 11:58:20 +08:00
parent 80e2553afd
commit 5b40baa69e
No known key found for this signature in database
GPG Key ID: 95B070122902DEA4
1 changed files with 6 additions and 10 deletions

View File

@ -227,22 +227,18 @@ def test_attestation(state, pubkeys, privkeys):
crosslink_committees = get_crosslink_committees_at_slot(state, slot) crosslink_committees = get_crosslink_committees_at_slot(state, slot)
crosslink_committee = [committee for committee, _shard in crosslink_committees if _shard == attestation_data.shard][0] crosslink_committee = [committee for committee, _shard in crosslink_committees if _shard == attestation_data.shard][0]
committee_size = len(crosslink_committee) # Select the first validator to be the attester
bitfield_length = (committee_size + 7) // 8 participants = [crosslink_committee[0]]
aggregation_bitfield = b'\x01' + b'\x00' * (bitfield_length - 1) aggregation_bitfield_length = (len(crosslink_committee) + 7) // 8
custody_bitfield = b'\x00' * bitfield_length custody_bitfield_length = (len(participants) + 7) // 8
aggregation_bitfield = b'\x01' + b'\x00' * (aggregation_bitfield_length - 1)
custody_bitfield = b'\x00' * custody_bitfield_length
attestation = Attestation( attestation = Attestation(
aggregation_bitfield=aggregation_bitfield, aggregation_bitfield=aggregation_bitfield,
data=attestation_data, data=attestation_data,
custody_bitfield=custody_bitfield, custody_bitfield=custody_bitfield,
aggregate_signature=EMPTY_SIGNATURE, aggregate_signature=EMPTY_SIGNATURE,
) )
participants = get_attestation_participants(
test_state,
attestation.data,
attestation.aggregation_bitfield,
)
assert len(participants) == 1
validator_index = participants[0] validator_index = participants[0]
privkey = privkeys[validator_index] privkey = privkeys[validator_index]