fix #1783 by not assuming that an attached validator will attest (#1787)

This commit is contained in:
tersec 2020-10-01 14:48:24 +00:00 committed by GitHub
parent bdc864da0b
commit 13d4831664
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 4 deletions

View File

@ -126,8 +126,8 @@ proc get_attestation_subnet_changes*(
state: BeaconState, attachedValidators: openarray[ValidatorIndex],
prevAttestationSubnets: AttestationSubnets, epoch: Epoch):
tuple[a: AttestationSubnets, b: set[uint8], c: set[uint8]] =
static:
doAssert ATTESTATION_SUBNET_COUNT == 64
static: doAssert ATTESTATION_SUBNET_COUNT == 64 # Fits in a set[uint8]
doAssert attachedValidators.len > 0
var attestationSubnets = prevAttestationSubnets
@ -144,8 +144,7 @@ proc get_attestation_subnet_changes*(
state, state.slot.epoch + 1, attachedValidators.toHashSet):
nextEpochSubnets.incl it.subnetIndex.uint8
doAssert nextEpochSubnets.len > 0 and
nextEpochSubnets.len <= attachedValidators.len
doAssert nextEpochSubnets.len <= attachedValidators.len
let
epochParity = epoch mod 2