From 13d48316643ca9d97999fa92467b8ecc65d9ed60 Mon Sep 17 00:00:00 2001 From: tersec Date: Thu, 1 Oct 2020 14:48:24 +0000 Subject: [PATCH] fix #1783 by not assuming that an attached validator will attest (#1787) --- beacon_chain/spec/network.nim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/beacon_chain/spec/network.nim b/beacon_chain/spec/network.nim index ea16b4f92..089fa7117 100644 --- a/beacon_chain/spec/network.nim +++ b/beacon_chain/spec/network.nim @@ -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