Open ngyam opened 5 years ago
Hi @ngyam,
Yes, you're right, the isValidator
shouldn't return true
until the pending validator set is not finalized (the finalizeChange
is called). The isValidator
is lying for the newly added or removed validator in the period of time when the validator set is already changed but not yet finalized (several blocks between callings of the addValidator
and finalizeChange
).
We, unfortunately, missed this moment and didn't fix it when we were working on the last hard fork. However, the isValidatorFinalized
getter can be used instead to determine if the specified address is a finalized validator.
For the current version of PoaNetworkConsensus
contract, it's recommended to use the getValidators()
getter: if some address is in the current validator set, that address will be in the returned array of the getValidators()
. The getValidators()
always returns an actual validator set taking into account the finalization.
Thank you for this issue - we should fix this when we have next hard fork which we'll ever do.
Hi @varasev Thanks for the clarification!
Hi,
When a validator is added, but it is still pending (not finalized), why is it already considered a validator? The
isValidator
call on it returns true already if pending. For Kovan, the validator is only anisValidator
if it is in the finalized validators list. What is the reason behind this different approach? https://github.com/poanetwork/poa-network-consensus-contracts/blob/master/contracts/PoaNetworkConsensus.sol#L212 https://github.com/poanetwork/poa-network-consensus-contracts/blob/master/contracts/PoaNetworkConsensus.sol#L178 https://github.com/parity-contracts/kovan-validator-set/blob/master/contracts/interfaces/BaseOwnedSet.sol#L66