Skip to content

Feat/squashed 2026 07 06#2847

Open
UnArbosFour wants to merge 90 commits into
devnet-readyfrom
feat/squashed-2026-07-06
Open

Feat/squashed 2026 07 06#2847
UnArbosFour wants to merge 90 commits into
devnet-readyfrom
feat/squashed-2026-07-06

Conversation

@UnArbosFour

@UnArbosFour UnArbosFour commented Jul 10, 2026

Copy link
Copy Markdown

Motivation

This integration PR consolidates the fixes and features previously collected in #2832, including work from #2753, #2707, #2734, #2736, #2750, #2758, and #2818. It prepares the combined runtime changes for devnet-ready while preserving accounting invariants and adding regression coverage.

Changes

  • Keep Subtensor total issuance synchronized when balance dust is removed.
  • Route TAO transfers through the accounting-aware transfer helper.
  • Preserve protocol TAO and alpha emissions in liquidity reservoirs when balancer limits prevent immediate activation.
  • Materialize and clear reservoir liquidity correctly during subnet dissolution.
  • Correct excess-TAO rollback when a protocol swap fails.
  • Update lock-swap migration handling and reverse-index maintenance.
  • Charge transaction fees for delegate take updates.
  • Correct hotkey-swap weight accounting and ownership validation.
  • Add Mentat/indexer runtime API coverage.

Files of interest

  • pallets/subtensor/src/coinbase/
  • pallets/subtensor/src/migrations/
  • pallets/subtensor/src/subnets/dissolution.rs
  • pallets/swap/src/pallet/
  • runtime/src/lib.rs
  • runtime/tests/balances_dust.rs
  • eco-tests/src/tests_mentat_indexer.rs

Behavioral and migration impact

Protocol emissions that cannot immediately become price-active are retained in per-subnet reservoirs and retried later instead of being omitted from accounting. Dust removal now updates Subtensor issuance alongside Balances issuance. Existing one-shot issuance and hotkey-lock repair migrations are extended for the corrected state transitions.

The runtime spec_version is bumped from 427 to 428.

Testing

The PR adds targeted unit and runtime tests covering dust reaping, order-swap and leasing transfers, failed excess-TAO swaps, liquidity reservoir activation and cleanup, subnet dissolution, migration indexing, delegate fee metadata, hotkey ownership checks, and Mentat/indexer runtime APIs. The source PR reports that formatting, linting, and existing unit tests pass locally.

gztensor and others added 30 commits June 2, 2026 14:29
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…r/subtensor into feat/ck-take-settings-pays-yes
@vercel

vercel Bot commented Jul 10, 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 Jul 10, 2026 3:57pm

Request Review

@UnArbosFour UnArbosFour added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jul 10, 2026
@github-actions

Copy link
Copy Markdown
Contributor

eco-tests changed — indexer review required

This PR modifies files under eco-tests/. and may affect downstream indexing.
cc @evgeny-s — please review manually

Changed files
  • eco-tests/src/lib.rs
  • eco-tests/src/mock.rs
  • eco-tests/src/tests_mentat_indexer.rs

@github-actions github-actions Bot requested a review from evgeny-s July 10, 2026 13:49
@github-actions

github-actions Bot commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

VERY HIGH scrutiny: 8-day-old account with 1 public repo and 2 lifetime PR contributions, tempered by repository write permission and commits predominantly authored by established contributor gztensor; correctly targets devnet-ready and has no known Gittensor association.

Static review covered the consensus-critical dust accounting, issuance migration, coinbase liquidity reservoirs, swap cleanup, and runtime configuration changes. No trusted AI-review or Copilot instruction files were modified.

Findings

No findings.

Prior-comment reconciliation

  • 709af33f: addressedRuntimeVersion::spec_version is now incremented from 427 to 428.

Conclusion

The previously missing runtime version bump is now present, and no malicious behavior or security vulnerability remains evident in the patch.


📜 Previous run (superseded)
Sev File Finding Status
CRITICAL runtime/src/lib.rs (RuntimeVersion::spec_version) Runtime changes are missing a spec_version bump ✅ Addressed
RuntimeVersion::spec_version is now incremented from 427 to 428.

🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor association UNKNOWN; newly created contributor account with repository write access, so the large integration diff received heightened scrutiny.

PR body was empty/trivial; the Auditor has auto-filled it. Please review.

The runtime change is accompanied by a spec_version bump from 427 to 428 and targeted coverage for dust accounting, liquidity reservoirs, migrations, fee dispatch metadata, hotkey swapping, and runtime APIs.

This PR subsumes the dust-accounting work in #2754 and adds broader integration coverage. This PR is the better candidate. Recommend closing #2754. Other overlaps are incidental or concern broader active branches rather than equivalent implementations.

The devnet endpoint was unavailable in this environment, so its live spec_version could not be queried; no automatic edit was made.

Findings

No findings.

Conclusion

The integrated changes are internally consistent, appropriately tested, and contain no merge-blocking domain defects in the reviewed diff.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

… restore HotKeyAlreadyRegisteredInSubNet coverage

- spec_version 427 -> 428: this PR changes consensus behavior (DustRemoval
  wiring, new balancer reservoir storage, coinbase injection, Pays::Yes on
  take extrinsics) but repeated devnet-ready merges neutralized the branch's
  earlier spec bumps.
- test_coinbase_inject_and_maybe_swap_reverts_excess_tao_deposit_on_swap_failure
  was missing #[test] and never ran (masked by the file's allow(unused));
  it passes once enabled.
- test_swap_owner_new_hotkey_already_exists had been rewired to assert
  NonAssociatedColdKey, silently dropping coverage of the
  already-registered-in-subnet guard; the foreign-coldkey case is now its own
  test and the original coverage is restored.

Co-authored-by: Cursor <cursoragent@cursor.com>
@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

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants