Skip to content

fix: expire a rotated key's slash-evidence window from deactivation, not rotation - #680

Open
zlacfzy wants to merge 1 commit into
developfrom
fix/rotation-evidence-expiry
Open

fix: expire a rotated key's slash-evidence window from deactivation, not rotation#680
zlacfzy wants to merge 1 commit into
developfrom
fix/rotation-evidence-expiry

Conversation

@zlacfzy

@zlacfzy zlacfzy commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Description

On key rotation, editConsensusAddress / editVoteAddress record the rotation timestamp in consensusExpiration / voteExpiration. The evidence guard in doubleSignSlash / maliciousVoteSlash then expires the key's window at expiration + 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 full BREATHE_BLOCK_INTERVAL after 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 leaves consensusExpiration / voteExpiration still 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

@hashdit-bot

hashdit-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

Pull Request Review

This Solidity PR changes StakeHub key-rotation logic so rotated consensus and vote keys expire relative to the next breathe-block boundary rather than the rotation timestamp. This preserves a full BREATHE_BLOCK_INTERVAL evidence-submission window after each key leaves the active validator set.

Sensitive Content

No sensitive content detected.

Security Issues

No 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>
@zlacfzy
zlacfzy force-pushed the fix/rotation-evidence-expiry branch from d2e327f to 941628e Compare July 30, 2026 02:23
@hashdit-bot

hashdit-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

Pull Request Review

This Solidity smart-contract change adjusts the slash-evidence expiry checks for rotated vote and consensus keys. Expiry is now calculated as one full BREATHE_BLOCK_INTERVAL after the next breathe-block boundary following key rotation, aligning the evidence window with key deactivation.

Sensitive Content

No sensitive content detected.

Security Issues

No serious security issues detected.


Generated by Hashdit Bot. This tool can absolutely NOT replace manual audits.

@zlacfzy zlacfzy changed the title fix: expire a rotated consensus/vote key's slash-evidence window from deactivation fix: expire a rotated key's slash-evidence window from deactivation, not rotation Jul 30, 2026
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

Successfully merging this pull request may close these issues.

3 participants