Skip to content

Back propagate new subnet emission off - clean merge#2790

Merged
sam0x17 merged 11 commits into
devnet-readyfrom
feat/back-propagate-new-subnet-emission-off
Jun 24, 2026
Merged

Back propagate new subnet emission off - clean merge#2790
sam0x17 merged 11 commits into
devnet-readyfrom
feat/back-propagate-new-subnet-emission-off

Conversation

@gztensor

@gztensor gztensor commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Back-propagates the main-branch locked-alpha receiver flag and subnet-emission scaling changes onto devnet-ready after resolving merge conflicts.

What Changed

  • Adds AccountFlags and set_reject_locked_alpha, allowing a coldkey to opt in or out of receiving locked alpha from stake transfers and coldkey swaps. Coldkeys reject locked alpha by default unless they opt in.
  • Blocks locked-alpha stake transfers and coldkey lock swaps when the destination coldkey rejects locked alpha, while still allowing unlocked alpha transfers.
  • Adds per-subnet MinerBurned tracking for the proportion of miner incentive emission withheld from miners because it was directed to owner/immune hotkeys.
  • Weights price-based subnet emission shares by root_proportion * (1 - miner_burned) and renormalizes, reallocating emission away from older/high-withholding subnets.
  • Clears MinerBurned on subnet dissolve and updates transfer-stake weights for the extra AccountFlags read.
  • Bumps runtime spec_version to 422.

Behavioral Impact

Destination coldkeys must explicitly opt in before receiving nonzero locked alpha through stake transfer or coldkey swap paths. Subnet block emission allocation now depends on EMA price, root proportion, and the recently withheld miner-emission proportion.

Testing

The diff includes unit coverage for account flag defaults and fee payment, locked-alpha transfer rejection/allowance, coldkey swap rejection/allowance, and subnet dissolve cleanup. Before merge, active tests should also cover the new MinerBurned recording and get_shares emission weighting boundary cases.

gztensor and others added 11 commits June 22, 2026 22:07
- Add a per-subnet MinerBurned storage holding the proportion (0..1) of each
  tempo's miner (incentive) emission that was burned during emission
  distribution because the recipient hotkey is owned by the subnet owner.
- Weight price-based emission shares by (1 - miner_burned) and renormalize, so
  subnets that burn more of their miner emission receive proportionally less
  chain emission (reallocated toward non-burning subnets).

Co-authored-by: Cursor <cursoragent@cursor.com>
- Count miner emission withheld via an owner/immune hotkey toward the burned
  proportion whether it is recycled or burned, so the emission penalty is
  independent of a subnet's RecycleOrBurn config (no Recycle bypass, no
  unique penalty for the unset default).
- Clear MinerBurned on subnet removal so a deregistered subnet leaves no stale
  proportion; extend dissolve cleanup test to cover it.
- Add active tests for the price-share reweight by (1 - miner_burned):
  no-burn, partial burn, full burn, and all-full-burn fallback to price shares.

Co-authored-by: Cursor <cursoragent@cursor.com>
Emission share is now proportional to root_proportion * price * (1 - miner_burned),
renormalized. Multiplying by root_proportion (which shrinks as a subnet's alpha
issuance grows) reallocates chain emission away from older subnets toward newer
ones, easing entrance for new subnets. Falls back to unweighted price shares when
the combined weight is zero (e.g. no root stake).

Adds get_shares tests: no-burn, partial/full burn, all-full-burn fallback, and
root_proportion favoring newer subnets.

Co-authored-by: Cursor <cursoragent@cursor.com>
Price-based emissions with miner-burn scaling (+ locked transfer flags)
New subnets registered via do_register_network now start with
SubnetEmissionEnabled set to false so emission must be explicitly
enabled, rather than relying on the storage default of true.

Update the two coinbase tests that registered a dynamic network and
expected emission to be on by enabling it explicitly.

Co-authored-by: Cursor <cursoragent@cursor.com>
…-off

Default subnet emission off on registration
@gztensor gztensor added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jun 23, 2026
@gztensor gztensor self-assigned this Jun 23, 2026
@github-actions github-actions Bot added the hotfix This PR needs to be merged very quickly and will likely skip testing on devnet and testnet label Jun 23, 2026
@gztensor gztensor changed the base branch from main to devnet-ready June 23, 2026 18:18
@gztensor gztensor removed the hotfix This PR needs to be merged very quickly and will likely skip testing on devnet and testnet label Jun 23, 2026
@opentensor opentensor deleted a comment from github-actions Bot Jun 23, 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/Cargo.toml
  • eco-tests/src/helpers.rs
  • eco-tests/src/lib.rs
  • eco-tests/src/mock.rs
  • eco-tests/src/tests_taocom_indexer.rs

@github-actions github-actions Bot requested a review from evgeny-s June 23, 2026 18:18
@github-actions

github-actions Bot commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

BASELINE scrutiny: gztensor has write permission, an established account, and substantial prior subtensor PR history; branch targets devnet-ready.

Static Skeptic review found no .github/ai-review/* or .github/copilot-instructions.md changes, no dependency/build-script changes, and no direct-to-main branch-policy issue.

The security-relevant changes are limited to pallet/runtime code: locked-alpha recipient opt-in flags, guards on locked stake transfer/coldkey swap, miner-burn tracking, emission-share reweighting, storage cleanup, weights, tests, and a runtime spec_version bump. The added runtime arithmetic uses saturating/fixed-point operations and handles zero denominators; the locked-alpha checks occur before persistent stake-transfer writes in the reviewed paths.

Findings

No findings.

Conclusion

No malicious behavior or security vulnerability was found in the static diff review. I did not run builds or tests, per Skeptic rules.


🔍 AI Review — Auditor (domain review)

VERDICT: 👎

Gittensor: UNKNOWN by allowlist; author has write access and substantial repo history, so review is calibrated as established contributor/backport work.

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

The PR body is currently trivial, so I populated proposed_pr_body with a fuller description.

Duplicate-work check: PR #2785 is the same author's earlier propagation branch and includes the missing get_shares tests, but also carries unrelated generated weight churn; this PR is the better candidate once the missing tests are restored. PR #2789 also overlaps heavily and carries the same tests, but its branch currently has a duplicate call_index(139) against set_tempo, so I would not prefer it over this branch.

Findings

Sev File Finding
HIGH pallets/subtensor/src/coinbase/run_coinbase.rs:734 Emission penalty path lacks active tests inline

Conclusion

Blocking on missing active tests for the new emission accounting and share-weighting behavior. The runtime spec bump is present and the locked-alpha transfer paths have targeted coverage.

@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 on lines 726 to +734
);
}

// Record the proportion of this tempo's miner emission that was withheld from
// miners (directed to owner/immune hotkeys, whether recycled or burned).
let withheld_proportion: U96F32 = U96F32::saturating_from_num(withheld_incentive.to_u64())
.checked_div(U96F32::saturating_from_num(total_incentive.to_u64()))
.unwrap_or_else(|| U96F32::saturating_from_num(0));
MinerBurned::<T>::insert(netuid, withheld_proportion);

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] Emission penalty path lacks active tests

This adds a new economic signal (MinerBurned) and feeds it into chain emission allocation, but the final diff has no active test proving the recorded ratio or the resulting share math. The only change in tests/subnet_emissions.rs is an import, even though the commits and overlapping branches contain tests for no-burn, partial-burn, full-burn, all-full-burn fallback, and root-proportion weighting. Please restore/add active coverage for both sides of the behavior: distribute_emissions records withheld_incentive / total_incentive correctly, including recycle/burn/default and zero-total cases, and get_shares reallocates as root_proportion * price * (1 - miner_burned) with the all-zero fallback. This is runtime emission economics, so it should not merge untested.

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

@sam0x17 sam0x17 merged commit 016d888 into devnet-ready Jun 24, 2026
236 of 255 checks passed
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