From 121c1487a3694854d9024dd48b09009adaf6af06 Mon Sep 17 00:00:00 2001 From: Dmitrii Shmatko Date: Mon, 9 Oct 2023 21:33:53 +0300 Subject: [PATCH] Early fail on 0 active validators when computing sync committees (#7585) --- .../versions/altair/helpers/BeaconStateAccessorsAltair.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java index fecb5bbcd56..21333cf8115 100644 --- a/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java +++ b/ethereum/spec/src/main/java/tech/pegasys/teku/spec/logic/versions/altair/helpers/BeaconStateAccessorsAltair.java @@ -101,6 +101,8 @@ public IntList getNextSyncCommitteeIndices(final BeaconState state) { final UInt64 epoch = getCurrentEpoch(state).plus(1); final IntList activeValidatorIndices = getActiveValidatorIndices(state, epoch); final int activeValidatorCount = activeValidatorIndices.size(); + checkArgument(activeValidatorCount > 0, "Provided state has no active validators"); + final Bytes32 seed = getSeed(state, epoch, Domain.SYNC_COMMITTEE); int i = 0; final SszList validators = state.getValidators();