This repository has been archived by the owner on Jun 12, 2023. It is now read-only.
Add heartbeat interval to local POC key lifespan #1743
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This change addresses an edge case which can cause a validator to garbage collect a local poc private key before the public key is removed from the ledger leading to a failed PoC. The issue is caused by the fact that the local private key is stored with its height at the time of key/heartbeat creation while the public key is stored with the height at which the heartbeat is accepted on the blockchain. In typical cases, this differences between heartbeat creation and acceptance is only a few blocks. However, it can be longer under heavy network load or with an improperly functioning validator..
To address this case, this change extends the time that local poc key remains in the validator's key store by the validator liveliness heartbeat interval and grace period (currently 100 + 50 = 150 blocks). Assuming that all heartbeats are no more than the 150 blocks old, this will ensure PoCs are not GC'ed to early.
See related but independent blockchain-core PR 1393 that ensures heartbeats are no more than the liveliness interval + grace period old.