Skip to content

Price-based emissions with miner-burn scaling (+ locked transfer flags)#2781

Merged
sam0x17 merged 6 commits into
mainfrom
pr-2780
Jun 22, 2026
Merged

Price-based emissions with miner-burn scaling (+ locked transfer flags)#2781
sam0x17 merged 6 commits into
mainfrom
pr-2780

Conversation

@unconst

@unconst unconst commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Summary

This branch moves subnet emission allocation to a price-based model, scales it by root proportion and a miner-burn penalty, and also carries the locked transfer flags changes.

Emission changes

Each subnet's share of the TAO block emission is proportional to:

root_proportion_i * price_i * (1 - miner_burned_i)

normalized over emit-enabled subnets, where:

  • price is the subnet's EMA price (SubnetMovingPrice). Replaces the TAO-flow share method; base shares are p_i / Σ p_j.
  • root_proportion = tao_weight / (tao_weight + alpha_issuance). It shrinks as a subnet's alpha issuance grows, so emission is reallocated away from older subnets toward newer ones (easier entrance for new subnets).
  • (1 - miner_burned) reallocates emission away from subnets that withhold miner emission. MinerBurned is a new per-subnet proportion (0..1) of each tempo's miner (incentive) emission that is withheld from miners because the recipient hotkey is owned by the subnet owner (immune key). It counts emission whether it is recycled or burned, so the value is independent of the subnet's RecycleOrBurn config.
  • Fallback: if the combined weight is zero for every subnet (e.g. no root stake, or every subnet burning all of its miner emission), get_shares falls back to unweighted price shares so the block's emission is not stranded.
  • MinerBurned is cleared on subnet removal (no stale proportion after deregistration).

Alpha injection cap (root-proportion based)

In get_subnet_terms the alpha-injection cap is root_proportion_i * alpha_emission_i (instead of min(alpha_emission, tao_block_emission)), so older subnets transition from liquidity injection toward chain buys (excess TAO).

Locked transfer flags

Adds controls/dispatches/events for gating locked alpha transfers (see staking/lock.rs, macros/dispatches.rs, tests/locks.rs).

Test plan

  • cargo fmt --all clean
  • cargo clippy -p pallet-subtensor clean
  • cargo test -p pallet-subtensor --lib green (1168 passed)
  • get_shares tests: no-burn == price shares, partial burn reallocates away, full burn => zero, all-full-burn => price-share fallback, and root_proportion favoring newer subnets
  • dissolve_clears_all_per_subnet_storages extended to assert MinerBurned cleared on removal
  • Emission/coinbase suites updated for price-based shares + root-proportion cap

Note: overlaps in scope with #2780 (hotfix/tx-flags-ema-price-emissions); this branch is the consolidated version targeting main.

gztensor and others added 3 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>
@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 22, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚨🚨🚨 HOTFIX DETECTED 🚨🚨🚨

It looks like you are trying to merge a hotfix PR into main. If this isn't what you wanted to do, and you just wanted to make a regular PR, please close this PR, base your changes off the devnet-ready branch and open a new PR into devnet ready.

If you are trying to merge a hotfix PR, please complete the following essential steps:

  1. go ahead and get this PR into main merged, so we can get the change in as quickly as possible!
  2. merge main into testnet, bumping spec_version
  3. deploy testnet
  4. merge testnet into devnet, bumping spec_version
  5. deploy devnet
  6. merge devnet into devnet-ready

If you do not complete these steps, your hotfix may be inadvertently removed in the future when branches are promoted to main, so it is essential that you do so.

@github-actions

github-actions Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

🛡️ AI Review — Skeptic (security review)

VERDICT: SAFE

BASELINE scrutiny: established 2017 account with repo write permission and substantial prior subtensor history; pr-2780 targets main as a labeled/described hotfix.

Static review found no changes to .github/ai-review/*, .github/copilot-instructions.md, workflows, dependencies, build scripts, or lockfiles. The changed runtime/pallet code adds price/root/miner-burn emission weighting plus locked-alpha receive flags; added unwrap/expect use is confined to tests, and I did not find new origin bypasses, unsafe runtime code, production panic paths, suspicious account/block keyed backdoors, or supply-chain risk.

Findings

No findings.

Conclusion

No malicious intent or security vulnerability was found in the reviewed diff. The direct-to-main target is justified by the hotfix label and PR body, so the branch-policy check does not produce a finding.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor: LIKELY; no allowlist hit for unconst, but the author has repo write permission and substantial prior OpenTensor/subtensor activity.

PR body is substantive and matches the implementation at static-review depth. No auto-fixes were needed; the worktree is clean.

Duplicate-work check: PR #2780 overlaps materially with the hotfix scope, and this PR is the better candidate because it consolidates the price-emission, miner-burn scaling, and locked-alpha flag changes with targeted tests. Recommend closing #2780. PR #2746 overlaps the locked-transfer flag area but appears broader and is not a better substitute for this hotfix.

Findings

No findings.

Conclusion

The runtime changes use saturating/checked arithmetic, preserve explicit origins and weights for the new dispatch, bump spec_version, and include focused tests for the emission and locked-alpha behaviors. I did not run tests because no finding required runtime confirmation.

@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 pallets/subtensor/src/staking/lock.rs Outdated
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👎

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>

@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 pallets/subtensor/src/staking/lock.rs Outdated
@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: 👍

@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@sam0x17 sam0x17 merged commit 6016381 into main Jun 22, 2026
185 of 232 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hotfix This PR needs to be merged very quickly and will likely skip testing on devnet and testnet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants