fix #1782 by checking for empty attester index sets (#1786)

This commit is contained in:
tersec 2020-10-01 19:05:22 +00:00 committed by GitHub
parent 0280d6c73e
commit ee114deb82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -226,6 +226,11 @@ proc validateAttestation*(
attesting_indices = get_attesting_indices(
epochRef, attestation.data, attestation.aggregation_bits)
if attesting_indices.len == 0:
# an extension of the check_aggregation_count() check
const err_str: cstring =
"validateAttestation: inconsistent aggregation and committee length"
return err((EVRESULT_REJECT, err_str))
doAssert attesting_indices.len == 1, "Per bits check above"
let validator_index = toSeq(attesting_indices)[0]