Proper fix for ValidatorIndex supported values.

This commit is contained in:
cheatfate 2021-04-09 19:12:59 +03:00 committed by zah
parent af1a4d0c05
commit 9cd946a192
1 changed files with 3 additions and 1 deletions

View File

@ -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)