From 048f342e1d014b325f61d1c29eb67c881366ab7f Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Mon, 20 May 2019 16:46:44 +1000 Subject: [PATCH] Fix off-by-one error in `CommitteeCache` --- eth2/types/src/beacon_state/committee_cache.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eth2/types/src/beacon_state/committee_cache.rs b/eth2/types/src/beacon_state/committee_cache.rs index 1667e3c7e..afefaa6ba 100644 --- a/eth2/types/src/beacon_state/committee_cache.rs +++ b/eth2/types/src/beacon_state/committee_cache.rs @@ -76,7 +76,7 @@ impl CommitteeCache { .ok_or_else(|| Error::UnableToShuffle)?; // The use of `NonZeroUsize` reduces the maximum number of possible validators by one. - if state.validator_registry.len() >= usize::max_value() - 1 { + if state.validator_registry.len() > usize::max_value() - 1 { return Err(Error::TooManyValidators); }