fix: sum emission across mechanisms instead of weighting it - #3038
Open
kyron1112567 wants to merge 1 commit into
Open
fix: sum emission across mechanisms instead of weighting it#3038kyron1112567 wants to merge 1 commit into
kyron1112567 wants to merge 1 commit into
Conversation
Emission is an absolute alpha amount, not a normalized ratio, so aggregating it as a weighted sum reported roughly 1/N of what a hotkey on an N-mechanism subnet was actually paid. Sum it like server_emission and validator_emission, which come from the same per-mechanism split. Emission also orders pruning candidates, so with an uneven split this could rank a higher earner below a lower one. Bump spec_version to 443.
|
@kyron1112567 is attempting to deploy a commit to the RaoFoundation Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2194.
Problem
epoch_with_mechanismsmerges each mechanism'sEpochTerms, but aggregates two dimensionally different kinds of field the same way:The fields weighted alongside
emission—consensus,dividend,validator_trust,stake_weight— are normalized ratios, where a weighted sum is correct.emissionis an absolute alpha amount: per mechanism it equalsserver_emission + validator_emission, the two fields summed immediately above it. Weighting it reports a fraction of what the hotkey was actually paid.persist_netuid_epoch_termswrites that value intoEmission, which is what the metagraph reports per UID. On an even N-mechanism split it reads ~1/N of the real figure.This was first reported in #2194 (Nov 2025) and independently confirmed by the owner of a subnet running mechanisms on mainnet. The issue was closed on 2026-07-31 with no linked commit or PR; the defect is unchanged on
main.Not just display
get_neuron_to_prunereadsEmissionand selects the lowest value. On an uneven split the weighting can invert relative order between mechanism-specialized neurons:So on multi-mechanism subnets with a non-even split this can deregister the higher earner. That is a behaviour change, hence the
spec_versionbump.Payout-neutral
epoch_with_mechanismsreturns(hotkey, terms.server_emission, terms.validator_emission)and never returnsterms.emission. Those two were already summed and are untouched here, so no hotkey's alpha changes. This matches @dougsillars' original observation that miners were being paid correctly and only the reported value was wrong.Change
emissionacross mechanisms instead of weighting it, in both theand_modifyandor_insert_witharms.weighted_acc_alpha, now unused.spec_version442 → 443.Tests
Added
epoch_with_mechanisms_persisted_emission_matches_paid_emission: asserts persistedEmissionper UID equalsserver_emission + validator_emissionfor that hotkey, and that the per-UID total accounts for the whole epoch emission. It uses an uneven 25/75 split with each miner favoured by a different mechanism, so the weighting cannot cancel out.Against the unfixed aggregation it fails as expected:
Also updated the emission assertion in
epoch_with_mechanisms_persists_and_aggregates_all_terms, which encoded the previous behaviour.Locally:
cargo fmt --check --allclean,cargo clippy -p pallet-subtensor --all-targets -- -D warningsclean,cargo test -p pallet-subtensor --lib1397 passed / 0 failed.