Skip to content

contracts: note that StakeCredit.slash() intentionally ignores the unbond queue - #684

Open
zlacfzy wants to merge 1 commit into
bnb-chain:developfrom
zlacfzy:docs/slash-selfundelegate-known-posture
Open

contracts: note that StakeCredit.slash() intentionally ignores the unbond queue#684
zlacfzy wants to merge 1 commit into
bnb-chain:developfrom
zlacfzy:docs/slash-selfundelegate-known-posture

Conversation

@zlacfzy

@zlacfzy zlacfzy commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Description

StakeCredit.slash() burns only the validator's active self-delegation (balanceOf(validator)) and does not reach the 7-day unbonding queue, so a validator that has already undelegated its self-stake is slashed 0.

Rationale

This is intentional and safe: the unbonded self-stake stays locked for unbondPeriod and is claimable only via StakeHub.claim (gated by whenNotPaused / notInBlackList), so stakeHubProtector can blacklist the operator or pause() within that window to freeze the funds. slash() must also not revert on a 0 burn, since it runs on consensus-driven paths.

Changes

Add a NatSpec @notice at StakeCredit.slash() documenting the above, so the intent is explicit at the call site. Comment-only; no behavior change.

🤖 Generated with Claude Code

@hashdit-bot

hashdit-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

Pull Request Review

This PR adds NatSpec documentation to StakeCredit.slash() clarifying that slashing affects only active validator self-delegation and intentionally excludes funds in the unbonding queue. The change is comment-only and does not alter contract behavior or access control.

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.

…gation

Document at the slash() site that only the validator's active self-delegation is
burned and amounts recorded in the unbonding queue are outside this burn, so a zero
burn is a valid outcome and slash() must not revert on it since it runs on
consensus-driven paths. Comment-only; no behavior change.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@zlacfzy
zlacfzy force-pushed the docs/slash-selfundelegate-known-posture branch from 5796d11 to 4f3b707 Compare August 13, 2026 10:13
@hashdit-bot

hashdit-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

Pull Request Review

This PR adds NatSpec documentation to the Solidity StakeCredit.slash() function clarifying that slashing affects only active validator self-delegation, not funds in the unbonding queue. It also documents that a zero-value burn is an intentional valid outcome; no runtime behavior is changed.

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.

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.

1 participant