Skip to content
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

[bug] Clear small noms should emit events and/or return stake removed #1126

Open
camfairchild opened this issue Jan 4, 2025 · 1 comment

Comments

@camfairchild
Copy link
Contributor

I found a very minor, but annoying bug in the runtime. My beloved coworker unstaked all but 1 rao (X), and now the runtime decided to unstake the full amount (X+1), leading to an additional balances.Deposit of 1 rao, but the SubtensorModule.StakeRemoved event does not include the additional 1 rao, i.e. it reports a removal of X instead of X+1.

I think this is a bug. pallets/subtensor/src/staking/helpers.rs:clear_small_nomination_if_required() should either emit StakeRemoved if it removes stake, or it should return the additional rao removed so that pallets/subtensor/src/staking/remove_stake.rs:do_remove_stake() knows what additional amount to report as being unstaked.

Another way to look at it: Self::deposit_event(Event::StakeRemoved(hotkey, stake_to_be_removed)); should not report "stake to be removed" but "stake actually removed" if these numbers are not equal in practice.

I suspect an additional (minor) bug is that StakeDeltaSinceLastEmissionDrain is not mutated with the correct amount, for the same reason.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@camfairchild and others