Skip to content

Custom dust collection type in subtensor#2707

Open
gztensor wants to merge 7 commits into
devnet-readyfrom
feat/account-dust-collection
Open

Custom dust collection type in subtensor#2707
gztensor wants to merge 7 commits into
devnet-readyfrom
feat/account-dust-collection

Conversation

@gztensor

@gztensor gztensor commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds a subtensor pallet type implementation for dust collection that reflects dust collection in subtensor TotalIssuance. Also, it adds a migration that syncs total issuance of subtensor pallet to the source of truth in balances pallet.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run ./scripts/fix_rust.sh to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@gztensor gztensor added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jun 2, 2026

@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 Jun 2, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

LOW scrutiny: established repo writer with write permission, substantial contribution history, no Gittensor allowlist hit; one non-author merge-from-base commit noted but no PR-diff security impact; branch feat/account-dust-collection -> devnet-ready.

Static review used only the trusted instructions and pre-fetched local context. The PR diff is limited to runtime/accounting changes: Balances dust removal now adjusts Subtensor TotalIssuance, the migration remains bounded to fixed migration keys, and the runtime wires the Balances DustRemoval hook. No .github/, dependency, Cargo.lock, or build-script changes are present in the PR diff.

Findings

No findings.

Conclusion

No malicious pattern or exploitable security vulnerability found in the static diff.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor UNKNOWN: no allowlist hit; author has write permission and substantial recent subtensor contribution history, so review focused on correctness and migration behavior.

The Auditor proposed a replacement PR description, but the current body is non-trivial; not overwriting. Maintainers: ask the Auditor to regenerate if you want it.

No blocking domain findings. The PR centralizes Subtensor TotalIssuance adjustment in the Balances DustRemoval hook, removes the narrower transfer-local dust accounting, wires runtime and pallet test mocks consistently, and keeps the issuance repair migration bounded to fixed migration keys.

Duplicate-work check: #2754 is the only topical overlap from the prefetched open-PR list (Handle dust in order_swap.rs and leasing.rs to sync TI). This PR is the better candidate because the global Balances hook covers dust collection across expendable balance paths instead of patching individual call sites. Recommend closing or rebasing #2754 if its remaining changes only duplicate this accounting fix.

Verification: git diff --check on the PR diff passed. Targeted cargo/rustc verification could not start because rustup attempted to write under read-only /home/runner/.rustup; the devnet spec-version RPC lookup also failed DNS resolution (dev.chain.opentensor.ai). No auto-fixes were applied.

Findings

No findings.

Conclusion

Approve. The runtime-affecting accounting change is scoped, uses saturating arithmetic for Subtensor issuance adjustment, and includes focused coverage for the dust path and migration idempotence.

@github-actions

github-actions Bot commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@gztensor gztensor self-assigned this Jun 5, 2026

@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

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
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: VULNERABLE

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

sam0x17
sam0x17 previously approved these changes Jun 12, 2026
@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: 👍

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.

3 participants