This repository was archived by the owner on Mar 5, 2024. It is now read-only.
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 proposes adding a new validation to validator heartbeat transactions to ensure they are not older than the heartbeat interval + grace period. This change will help ensure that 1) validators who are significantly behind the blockchain (i.e. still syncing) do not submit PoC proposals or gateway reactivations and 2) PoC public keys stored in the ledger do not outlive the private keys stored locally by the validator (and thus causing invalid PoCs).
Currently, heartbeats are validated 1) to make sure they are not ahead of the consensus group validating the transaction and 2) to make sure they are not too soon after the previous heartbeat for that validator. The proposed change in this PR adds another check to make sure that the transaction height is not too old, using the heartbeat interval + grace period as the maximum age. While the miner includes a check to not submit a heartbeat if still synching, this is not currently enforced on chain.
This is likely an edge case, as most validator heartbeats are added to the chain within 2-3 blocks (see below for stats). However, during times of heavily load or in the case of an improperly functioning validator, the difference between the heartbeat transaction height and the height at which it is absorbed, may be significant. The table below shows the count of heartbeat transactions grouped by the difference between the chain height and the heartbeat transaction height in blocks for the last 100000 heartbeats.