Skip to content

preserve dissolution stake settlement cursor#2894

Closed
UnArbosSix wants to merge 2 commits into
mainfrom
fix-dissolution-off-by-one
Closed

preserve dissolution stake settlement cursor#2894
UnArbosSix wants to merge 2 commits into
mainfrom
fix-dissolution-off-by-one

Conversation

@UnArbosSix

@UnArbosSix UnArbosSix commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Stake settlement during subnet dissolution is resumable across blocks. When the weight budget was exhausted after reading a hotkey but before queuing its payout, the settlement cursor advanced past that unpaid hotkey because iter_from resumes exclusively after the supplied key.

Changes

  • Track the last fully completed TotalHotkeyAlpha storage key during stake settlement.
  • Preserve the incoming cursor when the next hotkey cannot be fully processed within the remaining weight.
  • Add regression tests for exhaustion before the first payout and after a previous hotkey has completed.

Behavioral impact

An unpaid hotkey is retried during the next dissolution settlement pass, while already completed hotkeys remain excluded. This prevents stake payouts from being skipped at weight-budget boundaries.

Migration and runtime version

No storage migration is required. The PR targets main, where the configured live-network spec-version checks do not require an automatic bump.

Testing

Added targeted unit tests in pallets/subtensor/src/tests/destroy_alpha_tests.rs covering both cursor boundary cases.

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
subtensor Ready Ready Preview, Comment Jul 14, 2026 4:38pm

Request Review

@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

VERY HIGH raw scrutiny (12-day-old account, 13 lifetime contributions, no public repos), mitigated by repository write permission and no known Gittensor association; branch correctly targets main.

Static analysis confirms the cursor remains a TotalHotkeyAlpha storage key and advances only after a hotkey is fully queued for payout. The change does not touch protected review instructions, dependencies, build scripts, origin checks, or storage formats.

Findings

No findings.

Conclusion

The patch fixes the weight-boundary payout skip without introducing a security vulnerability or suspicious behavior.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor association UNKNOWN; the account is new with sparse public history but has repository write access. No overlapping PR was identified.

Static inspection confirms the cursor advances only after a hotkey is fully queued for payout. If weight is exhausted mid-hotkey, the previous completed cursor is retained, retrying the unpaid hotkey without repaying completed ones.

The focused regression tests cover both cursor boundary cases, and the PR description matches the implementation. No spec-version or other auto-fix is required.

Findings

No findings.

Conclusion

The change correctly fixes the exclusive iter_from resume boundary and provides appropriate regression coverage. No substantive correctness issues were found.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@UnArbosSix UnArbosSix force-pushed the fix-dissolution-off-by-one branch from 372e89c to dfb3f3f Compare July 13, 2026 19:29
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI review — see the sticky summary comment for the verdict and the inline comments below for specific findings.

Comment thread pallets/subtensor/src/staking/remove_stake.rs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@UnArbosSix UnArbosSix force-pushed the fix-dissolution-off-by-one branch from ac12c47 to dfb3f3f Compare July 14, 2026 13:36
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@unarbos unarbos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor semantics fix is correct: only advance past fully paid hotkeys, and preserve the incoming cursor when no hotkey completes in a pass. Tests cover both regressions. Clone-upgrade failure was stale codegen drift fixed on main; branch updated.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@IntiTechnologies

Copy link
Copy Markdown
Contributor

Superseded by #2898 (v431 release): these changes were reviewed and integrated there.

@IntiTechnologies IntiTechnologies deleted the fix-dissolution-off-by-one branch July 14, 2026 17:27
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.

4 participants