From 9cd946a19203c1dc96e6d023e7f60c9d3ee6c74c Mon Sep 17 00:00:00 2001 From: cheatfate Date: Fri, 9 Apr 2021 19:12:59 +0300 Subject: [PATCH] Proper fix for ValidatorIndex supported values. --- beacon_chain/rpc/rest_utils.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/beacon_chain/rpc/rest_utils.nim b/beacon_chain/rpc/rest_utils.nim index e14713259..fc135729d 100644 --- a/beacon_chain/rpc/rest_utils.nim +++ b/beacon_chain/rpc/rest_utils.nim @@ -606,7 +606,9 @@ proc toValidatorIndex*(value: RestValidatorIndex): Result[ValidatorIndex, ValidatorIndexError] = when sizeof(ValidatorIndex) == 4: if uint64(value) < VALIDATOR_REGISTRY_LIMIT: - if uint64(value) <= uint64(high(uint32)): + # On x86 platform Nim allows only `int32` indexes, so all the indexes in + # range `2^31 <= x < 2^32` are not supported. + if uint64(value) <= uint64(high(int32)): ok(ValidatorIndex(value)) else: err(ValidatorIndexError.UnsupportedValue)