Skip to content

Conversation

@konrad0960
Copy link

Description

Voting power feature
Purpose: Track validator voting power using an Exponential Moving Average (EMA) of their stake over time, preventing sudden stake changes from immediately affecting governance weight.

Key Components:

  • EMA-based voting power calculation (updated each epoch)
  • Per-subnet enable/disable with 14-day grace period
  • Configurable alpha parameter for EMA smoothness
  • Voting power transfers on hotkey swap
  • EVM precompile for smart contract access

Extrinsics: enable_voting_power_tracking, disable_voting_power_tracking, sudo_set_voting_power_ema_alpha

Storage: VotingPower, VotingPowerTrackingEnabled, VotingPowerDisableAtBlock, VotingPowerEmaAlpha

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

Additional Notes

I’ve attempted to run the VotingPower precompile EVM tests locally but encountered multiple Node.js compatibility issues with the polkadot-api dependencies.
Being unable to resolve them I want to give CI a try
That being said the unit tests written cover the core logic.

@konrad0960 konrad0960 changed the title commit Cargo.lock Voting Power EMA Dec 1, 2025
@open-junius
Copy link
Contributor

Enabled the CI process, to check if EVM test is runnable for PR.

@konrad0960
Copy link
Author

Enabled the CI process, to check if EVM test is runnable for PR.

can we try again?

@konrad0960 konrad0960 force-pushed the voting-power-feature branch from 2a22ace to e541d53 Compare January 8, 2026 22:39
@konrad0960 konrad0960 requested a review from gztensor January 8, 2026 22:40
@konrad0960 konrad0960 requested a review from gztensor January 9, 2026 21:52
Copy link
Collaborator

@shamil-gadelshin shamil-gadelshin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have tests for voting power calculation methods?

@ppolewicz ppolewicz added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jan 19, 2026
pub validator_trust: u16,
pub new_validator_permit: bool,
pub bond: Vec<(u16, u16)>,
pub stake: u64,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should use type-safe method of expressing stake (alpha): AlphaCurrency.

@sam0x17 sam0x17 merged commit 3d528d2 into opentensor:devnet-ready Jan 19, 2026
314 of 319 checks passed
@sam0x17
Copy link
Contributor

sam0x17 commented Jan 19, 2026

Accidentally merged and then reverted, @gztensor has some changes

@ppolewicz ppolewicz mentioned this pull request Jan 19, 2026
@sam0x17 sam0x17 mentioned this pull request Jan 19, 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.

6 participants