Skip to content

Propagate price-based emissions and locked transfer flags - testnet#2782

Closed
gztensor wants to merge 17 commits into
testnetfrom
feat/propagate-pr-2780-testnet
Closed

Propagate price-based emissions and locked transfer flags - testnet#2782
gztensor wants to merge 17 commits into
testnetfrom
feat/propagate-pr-2780-testnet

Conversation

@gztensor

@gztensor gztensor commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Description

Back-propagates the locked-alpha transfer flag and price-based emission updates to testnet.

What changed

  • Adds AccountFlags storage and the set_reject_locked_alpha extrinsic so coldkeys can opt in or out of receiving locked alpha.
  • Blocks nonzero locked-alpha receipt during stake transfers and coldkey lock swaps unless the destination coldkey has opted in.
  • Adds MinerBurned accounting for the proportion of miner incentive emission withheld from miners because it was directed to subnet owner or immune hotkeys.
  • Reweights subnet emission shares by root_proportion * price * (1 - miner_burned) and falls back to price shares if all combined weights are zero.
  • Clears MinerBurned on subnet dissolution and updates weights/tests for the new storage reads.

Behavioral impact

Coldkeys reject incoming locked alpha by default. A coldkey can call set_reject_locked_alpha(false) to accept locked alpha from stake transfers or coldkey swaps, and set_reject_locked_alpha(true) to return to the default rejection behavior.

Subnets that withhold miner incentive emission through owner or immune hotkeys receive proportionally less future chain emission, with that emission reallocated among eligible subnets.

Spec version / migration

This changes runtime behavior and requires a testnet runtime spec_version bump. The Auditor auto-fix bumped runtime/src/lib.rs from 421 to 422. The new storage maps use defaults and do not require an explicit storage migration.

Testing

The PR adds coverage for account flag defaults and setter behavior, locked-alpha rejection/allowance on stake transfer and coldkey swap paths, subnet dissolve cleanup, and emission-share reweighting for no burn, partial burn, full burn, all-full-burn fallback, and root-proportion weighting.

gztensor and others added 13 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)
- 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>
@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 repo write permission, account age >2 years, substantial subtensor contribution history, no trusted Gittensor allowlist hit; branch feat/propagate-pr-2780-testnet -> testnet.

Static Skeptic review covered the runtime/pallet changes for locked-alpha receive flags and miner-burn emission weighting. The PR does not modify .github/ai-review/*, .github/copilot-instructions.md, dependency manifests, lockfiles, or build scripts.

Findings

No findings.

Conclusion

No malicious pattern or security vulnerability was found in the diff. The new dispatch is signed and fee-paying, locked-alpha rejection checks run before affected storage writes, and the emission reweighting uses saturating fixed-point math with a zero-weight fallback.


🔍 AI Review — Auditor (domain review)

VERDICT: 👍

Gittensor: UNKNOWN by trusted allowlists; author has repo write permission and substantial subtensor contribution history.

Description matches the implementation. The PR carries a testnet runtime spec_version bump to 422; I could not independently query the live testnet endpoint from this sandbox because DNS resolution failed, but the local bump is present and no auto-fix was needed.

Duplicate-work check: #2785 is the matching devnet-ready propagation and does not supersede this testnet-targeted PR. #2746 is a broader main-targeted account-transfer flag proposal, not a better candidate for this deployment propagation. Other overlapping PRs are deployment branches or unrelated work sharing common subtensor files.

git diff --check passed. I did not run cargo tests because no finding required runtime confirmation.

Findings

No findings.

Conclusion

I found no domain-level blockers in the locked-alpha receive flag, same-subnet stake transfer and coldkey swap checks, miner-burn accounting, emission-share reweighting, or dissolve cleanup. This is ready from the Auditor perspective, subject to normal CI.

@gztensor gztensor self-assigned this Jun 23, 2026
@gztensor gztensor added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jun 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🔄 AI review updated — Skeptic: SAFE Auditor: 👍

@gztensor gztensor marked this pull request as ready for review June 23, 2026 13:30
gztensor added 2 commits June 23, 2026 16:43
# Conflicts:
#	pallets/subtensor/src/macros/dispatches.rs
#	pallets/subtensor/src/macros/errors.rs
#	pallets/subtensor/src/staking/lock.rs
#	pallets/subtensor/src/tests/coinbase.rs
@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 closed this Jun 23, 2026
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