Skip to content

Fix alplha accounting - #3074

Open
UnArbosFour wants to merge 3 commits into
fix/restore-miner-burn-scalingfrom
fix/alplha-accounting
Open

Fix alplha accounting#3074
UnArbosFour wants to merge 3 commits into
fix/restore-miner-burn-scalingfrom
fix/alplha-accounting

Conversation

@UnArbosFour

Copy link
Copy Markdown
Contributor

Summary

Fixes two historical SubnetAlphaOut accounting deviations and updates the subnet ownership-transfer quorum to exclude alpha that cannot support a challenger.

The migration only corrects accounting counters. It does not mint alpha, modify stake, or replay historical chain state.

Historical accounting reconstruction

Every block from the RAO activation at block 4,920,351 through block 8,780,303 was scanned across the applicable runtime versions.

Duplicated RAO dividends

Between blocks 4,920,351 and 4,962,968, local dividends were duplicated: participant stake received both the full local dividend and the root portion, while SubnetAlphaOut recorded only the intended issuance.

At hotfix block 4,962,968, the per-subnet difference between TotalHotkeyAlpha and SubnetAlphaOut was used to calculate the missing accounting amount. The migration increases SubnetAlphaOut by that stabilized difference.

Subnets 65 and 66 were not missed:

  • Netuid 65 registered at block 4,950,813 and accumulated a correction of 4,932.684752021 alpha.
  • Netuid 66 registered at block 4,958,013 and accumulated a correction of 2,003.518827049 alpha.

Their corrections are smaller because they were exposed to the duplication only from their registration blocks until the hotfix.

Root accounting

Legacy root dividends were credited directly to root stake without increasing SubnetAlphaOut(0).

The root discrepancy was measured immediately before Root Reborn at block 8,765,683 and verified again at block 8,822,961. The difference remained unchanged at 728,652.620877147 alpha, confirming that the deviation had stopped before applying the correction.

Excluded subnet generations

Eleven netuids were excluded:

15, 16, 26, 31, 36, 38, 40, 47, 49, 57, 58

Their affected historical subnet generations were dissolved and the netuids were subsequently reused. Applying the old correction would modify an unrelated current subnet asset.

Migration behavior

  • Runs once and only on mainnet.
  • Applies 56 current-generation corrections.
  • Increases SubnetAlphaOut by a total of 1,618,308.219994798 alpha.
  • Uses fixed amounts reconstructed offline.
  • Does not access historical blocks during runtime execution.
  • Does not change participant balances or total stake.

Ownership-transfer threshold

Changes the challenger requirement from:

10% × SubnetAlphaOut

to:

10% × (SubnetAlphaOut - SubnetProtocolAlpha - AlphaBurned)

Subtraction is saturating, and ownership cannot transfer when the resulting eligible alpha is zero. AlphaBurned is exposed through AlphaAssetsInterface to avoid coupling Subtensor directly to alpha-assets storage.

Testing

  • Verified all embedded migration corrections against the reconstruction data.
  • Verified mainnet application, idempotency, and non-mainnet exclusion.
  • Verified ownership transfer at the exact adjusted 10% threshold.
  • Passed focused Subtensor ownership and migration tests.
  • Passed the alpha-assets test suite.
  • Passed no-default-features compilation, formatting, and diff checks.

@vercel

vercel Bot commented Aug 11, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
subtensor Error Error Aug 11, 2026 9:53pm

Request Review

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: VULNERABLE

VERY HIGH scrutiny: 40-day-old account with one public repository; repository write access, no Gittensor association found, and no author/committer mismatch.

Findings

Sev File Finding
HIGH runtime/src/lib.rs:238 Runtime changes lack a spec_version bump (off-diff)

Other findings

  • [HIGH] Runtime changes lack a spec_version bump (runtime/src/lib.rs:238) — The PR changes consensus-critical accounting, ownership-transfer, dissolution, registration, and migration behavior, but VERSION.spec_version remains 445, unchanged from the target branch. Increment it so nodes distinguish this runtime for upgrade detection and native/Wasm compatibility.

Prior-comment reconciliation

  • 5007a9f4: not addressedruntime/src/lib.rs still declares spec_version: 445; the file remains absent from the PR diff.

Conclusion

Consensus-critical runtime logic and migrations still change without incrementing spec_version, so this branch is unsafe to deploy as submitted.


📜 Previous run (superseded)
Sev File Finding Status
HIGH runtime/src/lib.rs:238 Runtime changes lack a spec_version bump ➡️ Carried forward to current findings
runtime/src/lib.rs still declares spec_version: 445; the file remains absent from the PR diff.

# 🔍 AI Review — Auditor (domain review) has not yet run on this PR.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions github-actions Bot mentioned this pull request Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@UnArbosFour UnArbosFour changed the title Fix/alplha accounting Fix alplha accounting Aug 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

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