fix: expire a rotated key's slash-evidence window from deactivation, not rotation - #680
fix: expire a rotated key's slash-evidence window from deactivation, not rotation#680zlacfzy wants to merge 1 commit into
Conversation
Pull Request ReviewThis Solidity PR changes Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
…not rotation The evidence guard in doubleSignSlash / maliciousVoteSlash expired a rotated key's window at consensusExpiration/voteExpiration + BREATHE_BLOCK_INTERVAL, i.e. one interval after the rotation timestamp. But a rotated-out key only leaves the active validator set at the next daily breathe block, so anchoring the deadline to rotation can leave it inconsistent with the block-based felonySlashScope window (~1 day from the offending block). Compute the deadline in the check from the stored rotation timestamp so it falls one BREATHE_BLOCK_INTERVAL after the key's deactivation (the next breathe block): (rotationTimestamp / BREATHE + 2) * BREATHE. This keeps consensusExpiration/voteExpiration meaning the rotation timestamp (no storage-semantics change) and only widens the acceptance window (never narrows it), consistent with felonySlashScope for any rotation time. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d2e327f to
941628e
Compare
Pull Request ReviewThis Solidity smart-contract change adjusts the slash-evidence expiry checks for rotated vote and consensus keys. Expiry is now calculated as one full Sensitive ContentNo sensitive content detected. Security IssuesNo serious security issues detected. Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits. |
Description
On key rotation,
editConsensusAddress/editVoteAddressrecord the rotation timestamp inconsensusExpiration/voteExpiration. The evidence guard indoubleSignSlash/maliciousVoteSlashthen expires the key's window atexpiration + BREATHE_BLOCK_INTERVAL.Rationale
A rotated-out key only leaves the active validator set at the next daily breathe block, so anchoring the deadline to the rotation timestamp can leave this window inconsistent with the block-based
felonySlashScope. Anchor it to the key's deactivation (the next breathe block) instead, so the grace is a fullBREATHE_BLOCK_INTERVALafter the key actually leaves the active set — consistent for any rotation time.Changes
contracts/StakeHub.sol: compute the deadline in the two slash checks from the stored rotation timestamp as(expiration / BREATHE_BLOCK_INTERVAL + 2) * BREATHE_BLOCK_INTERVAL(= deactivation +BREATHE_BLOCK_INTERVAL). This leavesconsensusExpiration/voteExpirationstill meaning the rotation timestamp (no storage-semantics change) and only widens the acceptance window, never narrows it._bep563MsgSender(reads only== 0) is unaffected.🤖 Generated with Claude Code