Skip to content

Add continuous stake reporting throughout subnet dissolution lifecycle - #3101

Open
UnArbosFour wants to merge 5 commits into
release-449from
feat/subnet-state
Open

Add continuous stake reporting throughout subnet dissolution lifecycle#3101
UnArbosFour wants to merge 5 commits into
release-449from
feat/subnet-state

Conversation

@UnArbosFour

Copy link
Copy Markdown
Contributor

Summary

Adds continuous user-visible stake reporting throughout subnet dissolution without changing dissolution, settlement, or cleanup behavior.

Changes

  • Adds SubnetState lifecycle storage with Registered, Started, PendingDissolution, and Dissolving states.
  • Maintains lifecycle transitions during registration, startup, dissolution, cleanup selection, and completion.
  • Adds an idempotent migration to initialize lifecycle state for existing subnets.
  • Keeps unpaid alpha stake visible during dissolution using the settlement payout cursor.
  • Removes a position from reporting in the same finalized block its TAO payout appears, avoiding reporting gaps or double counting.
  • Reports pending/dissolving stake as unavailable for manual unstaking.
  • Applies lifecycle-aware reporting across stake, delegate, neuron, metagraph/mechagraph, subnet-state, dynamic-info, and price APIs.
  • Adds typed lifecycle state, block-pinned reads, pre-upgrade fallback, and model integration to the Python SDK.
  • Exposes lifecycle and automatic-payout status in relevant btcli commands and JSON output.
  • Bumps the runtime spec version and regenerates metadata-derived Python bindings.

Operational subnet behavior remains governed by NetworksAdded, and existing runtime API signatures remain unchanged.

Testing

  • Rust pallet suite: 1,438 passed, 9 ignored.
  • Lifecycle and migration tests: 3 passed.
  • Python suite: 1,110 passed, 2 skipped.
  • Ruff, codegen gates, benchmark-feature check, release build, and diff validation passed.
  • Local-chain dissolution verified that alpha disappears in the same finalized block its TAO payout appears, with no reporting gap or double count.

Follow-ups

  • Benchmark coverage and database-access accounting are included, but measured reference-time and proof-size weights must be regenerated using the canonical benchmark hardware or approved pipeline.
  • Mainnet-clone replay was blocked by the configured Finney peer rejecting warp proofs; the complete transition was verified on a freshly built local development chain instead.

@vercel

vercel Bot commented Aug 20, 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 21, 2026 4:53pm

Request Review

@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 runtime/src/lib.rs
@github-actions

github-actions Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: VULNERABLE

VERY HIGH account-metadata scrutiny (50-day-old account, one public repository), moderated by repository write access and substantive merged work; no Gittensor association found. Branch: feat/subnet-state → release-449.

Static analysis covered lifecycle migration and transitions, dissolution-cursor reporting, runtime APIs, weight accounting, generated SDK artifacts, dependencies, and review trust-boundary files. No additional security findings or trust-boundary changes were identified.

Findings

Sev File Finding
HIGH runtime/src/lib.rs:2489 Runtime changes ship without a spec-version bump inline

Prior-comment reconciliation

  • cb14e634: not addressedruntime/src/lib.rs still declares spec_version: 449 while this diff changes current_alpha_price_all and introduces runtime storage and migration behavior.

Conclusion

The PR changes runtime storage and behavior while retaining spec_version: 449. It is unsafe to merge until the runtime specification version is incremented.


📜 Previous run (superseded)
Sev File Finding Status
HIGH runtime/src/lib.rs:2489 Runtime changes ship without a spec-version bump ➡️ Carried forward to current findings
runtime/src/lib.rs still declares spec_version: 449 while this diff changes current_alpha_price_all and introduces runtime storage and migration behavior.

# 🔍 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 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 runtime/src/lib.rs

fn current_alpha_price_all() -> Vec<SubnetPrice> {
pallet_subtensor::Pallet::<Runtime>::get_all_subnet_netuids()
pallet_subtensor::Pallet::<Runtime>::get_all_reportable_subnet_netuids()

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.

[HIGH] Runtime changes ship without a spec-version bump

This PR adds runtime storage, migration logic, lifecycle transitions, and changes runtime API behavior, but VERSION.spec_version remains 449, unchanged from the base. Nodes may therefore treat native runtime code for release 449 as compatible with this different on-chain Wasm runtime. Increment the runtime spec_version for this upgrade; the PR body's claim that it was bumped does not match the diff.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@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 runtime/src/lib.rs

fn current_alpha_price_all() -> Vec<SubnetPrice> {
pallet_subtensor::Pallet::<Runtime>::get_all_subnet_netuids()
pallet_subtensor::Pallet::<Runtime>::get_all_reportable_subnet_netuids()

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.

[HIGH] Runtime changes ship without a spec-version bump

This PR changes runtime storage, migration logic, dissolution behavior, and runtime API results, but RuntimeVersion::spec_version remains 449. Runtime-affecting upgrades require a new spec version so nodes and clients can distinguish the new state transition and metadata. Increment spec_version and regenerate the version-coupled SDK metadata artifacts from that runtime.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@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 runtime/src/lib.rs

fn current_alpha_price_all() -> Vec<SubnetPrice> {
pallet_subtensor::Pallet::<Runtime>::get_all_subnet_netuids()
pallet_subtensor::Pallet::<Runtime>::get_all_reportable_subnet_netuids()

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.

[HIGH] Runtime changes ship without a spec-version bump

This PR adds runtime storage, an upgrade migration, and changes runtime API behavior, but RuntimeVersion::spec_version remains 449. Nodes can therefore treat materially different runtime code as the same specification, undermining upgrade/version detection. Increment spec_version for this runtime release.

@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