Skip to content

Hotkey swap alpha pool#2539

Open
gztensor wants to merge 7 commits intodevnet-readyfrom
fix/hotkey-swap-alpha-pool
Open

Hotkey swap alpha pool#2539
gztensor wants to merge 7 commits intodevnet-readyfrom
fix/hotkey-swap-alpha-pool

Conversation

@gztensor
Copy link
Copy Markdown
Contributor

Description

Cleanup swapping of stake when swapping hotkey

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

@gztensor gztensor added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Mar 25, 2026
@gztensor gztensor requested a review from evgeny-s March 25, 2026 21:51
Comment on lines 539 to 540
for ((coldkey, netuid_alpha), _) in old_alpha_values {
if netuid == netuid_alpha {
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.

can this be a filter maybe?
So it's more clear that none of the loop-body should have netuid_alpha != netuid

@gztensor gztensor requested a review from camfairchild March 26, 2026 02:21
sam0x17
sam0x17 previously approved these changes Mar 26, 2026
.saturating_add(T::DbWeight::get().writes(39_u64)), DispatchClass::Normal, Pays::No))]
#[pallet::weight((Weight::from_parts(263_300_000, 0)
.saturating_add(T::DbWeight::get().reads(45_u64))
.saturating_add(T::DbWeight::get().writes(31_u64)), DispatchClass::Normal, Pays::No))]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Any reason to keep this Pays::No?

Suggested change
.saturating_add(T::DbWeight::get().writes(31_u64)), DispatchClass::Normal, Pays::No))]
.saturating_add(T::DbWeight::get().writes(31_u64)), DispatchClass::Normal, Pays::Yes))]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good catch, I don't see any reason, and it's cleaner that way.

Copy link
Copy Markdown
Collaborator

@l0r1s l0r1s left a comment

Choose a reason for hiding this comment

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

LGTM

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