Skip to content

Preserve hotkey successor mappings until netuid dissolution - #3128

Draft
UnArbosFour wants to merge 3 commits into
mainfrom
fix/hotkey-successor
Draft

Preserve hotkey successor mappings until netuid dissolution#3128
UnArbosFour wants to merge 3 commits into
mainfrom
fix/hotkey-successor

Conversation

@UnArbosFour

Copy link
Copy Markdown
Contributor

Summary

Stops clearing HotkeySuccessor when a neuron is replaced or re-registered, ensuring smart contracts can continue locating funds after a hotkey swap followed closely by neuron deregistration—even within the same batch.

Netuid dissolution already clears HotkeySuccessor and HotkeyRoot by prefix, so this PR retains that existing cleanup and documents why lineage must survive individual neuron deregistration.

Testing

  • Adds regression coverage for same-block hotkey swap and neuron deregistration.
  • Retains existing coverage confirming lineage is cleared when the netuid is dissolved.

@vercel

vercel Bot commented Aug 28, 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 Aug 28, 2026 8:16pm

Request Review

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

VERY HIGH scrutiny (young account and one public repo), mitigated by repository write permission and substantive contributions; no Gittensor association found; fix/hotkey-successor → release-v451.

Static review found only a helper rename/documentation refinement in runtime code plus revised lineage tests. Bounded traversal and netuid-dissolution cleanup remain intact. No dependency, CI, or AI-review trust-boundary files changed.

Findings

No findings.

Conclusion

No malicious behavior or security vulnerability found in the current diff.


🔍 AI Review — Auditor (domain review)

VERDICT: 👎

Gittensor association UNKNOWN; the author is a recent but established repository contributor with write permission.

Description discrepancy

The PR claims to stop clearing successor mappings during neuron replacement/re-registration, but the production change only renames clear_stale_hotkey_successor; before and after this PR, replace_neuron and append_neuron remove the successor of new_hotkey. The described lifecycle behavior is therefore unchanged.

The overlapping PRs touch only individual shared files and address unrelated features.

Quick checks: git diff --check passed. cargo fmt --check --all was attempted but could not run because rustup cannot write to its locked environment under /home/runner/.rustup.

Findings

Sev File Finding
MEDIUM pallets/subtensor/src/tests/hotkey_lineage.rs:427 Test does not reproduce the claimed regression inline

Conclusion

The proposed regression test does not exercise the stated swap-then-deregistration scenario and would pass before this PR. The PR should demonstrate the actual failing behavior and include the production change that fixes it, or correct its stated purpose.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@UnArbosFour
UnArbosFour marked this pull request as draft August 28, 2026 17:18
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@UnArbosFour
UnArbosFour changed the base branch from release-v451 to main August 28, 2026 20:14

@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.

false,
));
assert_eq!(SubtensorModule::hotkey_lineage_tip(netuid, &h0), h1);
SubtensorModule::record_hotkey_swap_lineage(netuid, &h0, &h1);

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.

[MEDIUM] Test does not reproduce the claimed regression

This directly creates h0 → h1 while h0 remains registered, then replaces h0 with an unrelated key. That is not the stated swap-then-deregistration flow: after a real h0 → h1 swap, h1 is registered and h0 is not. Moreover, the pre-PR replace_neuron already cleared the successor of new_hotkey (replacement here), so this test passes without the PR. Exercise do_swap_hotkey followed by deregistration/replacement of the resulting live hotkey and first demonstrate that the test fails against the base branch.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

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