Skip to content

Clean small values from Alpha map. #1635

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: devnet-ready
Choose a base branch
from

Conversation

shamil-gadelshin
Copy link
Collaborator

Description

This PR adds a process that iterates through small number (10) of Alpha map entries each block and cleans values less than 10 RAO.

Related Issue(s)

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):

Breaking Change

This PR clears alpha stake values. We need to be sure that we chose the constants correctly.

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 cargo fmt and cargo clippy 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

@shamil-gadelshin shamil-gadelshin added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label May 14, 2025
@shamil-gadelshin shamil-gadelshin marked this pull request as ready for review May 14, 2025 13:55
@sam0x17 sam0x17 requested review from camfairchild and gztensor May 14, 2025 14:11
@shamil-gadelshin shamil-gadelshin marked this pull request as draft May 15, 2025 16:58
@shamil-gadelshin shamil-gadelshin marked this pull request as ready for review May 16, 2025 07:16
for key in keys {
let alpha = Alpha::<T>::get(&key);
if alpha < U64F64::saturating_from_num(MIN_ALPHA) {
Alpha::<T>::remove(&key);
Copy link
Contributor

Choose a reason for hiding this comment

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

In the ideal case when there are no rounding errors, the sum of all alpha for one hotkey will match TotalHotkeyShares, so TotalHotkeyShares should be also decreased here, but in practice we need to check (offline, not in the chain code) if the sum really matches.

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.

2 participants