Fix SSZ underflow

This commit is contained in:
Hsiao-Wei Wang 2021-10-15 22:49:43 +08:00
parent 7480fad8cd
commit e70ef11b4d
No known key found for this signature in database
GPG Key ID: 1111A8A81778319E
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ def exit_random_validators(spec, state, rng, fraction=0.5, exit_epoch=None, with
""" """
if from_epoch is None: if from_epoch is None:
from_epoch = spec.MAX_SEED_LOOKAHEAD + 1 from_epoch = spec.MAX_SEED_LOOKAHEAD + 1
epoch_diff = from_epoch - spec.get_current_epoch(state) epoch_diff = int(from_epoch) - int(spec.get_current_epoch(state))
for _ in range(epoch_diff): for _ in range(epoch_diff):
# NOTE: if `epoch_diff` is negative, then this loop body does not execute. # NOTE: if `epoch_diff` is negative, then this loop body does not execute.
next_epoch(spec, state) next_epoch(spec, state)