Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about PoaNetworkConsensus contract validator states #206

Open
ngyam opened this issue Mar 15, 2019 · 2 comments
Open

Question about PoaNetworkConsensus contract validator states #206

ngyam opened this issue Mar 15, 2019 · 2 comments

Comments

@ngyam
Copy link

ngyam commented Mar 15, 2019

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 an isValidator 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

@varasev
Copy link
Contributor

varasev commented Mar 16, 2019

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.

@ngyam
Copy link
Author

ngyam commented Mar 18, 2019

Hi @varasev
Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants