Closed jamesray1 closed 6 years ago
Thank you for reviewing!
period
in the getEligibleProposer
actually can be the future period we want to know.LOOKAHEAD_PERIODS
periods ahead, it implies that the eligible proposer of the current period cannot be sampled before LOOKAHEAD_PERIODS
periods.
So if I'm a validator, current_block_number
is 25
, current_period
is 5
, and LOOKAHEAD_PERIODS
is 4
. Then the validator uses message call to call getEligibleProposer
with period = current_period + LOOKAHEAD_PERIODS = 5 + 4 = 9
.This line is for making sure that we already have enough block.number to sample the collator of the given future period
.
assert (period - LOOKAHEAD_PERIODS) * PERIOD_LENGTH < block.number
assert (9 - 4) * 5 < 26
OK, thanks for clarifying!
Shouldn't this be:
This is supported by "The function should be able to return a value for the current period or any future period up to
LOOKAHEAD_PERIODS
periods ahead."