Make unstake and unstake_multiple for all Alphas more clear#2885
Merged
Make unstake and unstake_multiple for all Alphas more clear#2885
unstake and unstake_multiple for all Alphas more clear#2885Conversation
added 5 commits
May 20, 2025 14:09
ibraheem-abe
approved these changes
May 21, 2025
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.
Addressing Dynamic Stake Unstaking Challenges in Bittensor
This Pull Request (PR) addresses a critical issue impacting the unstaking experience for Bittensor users, particularly when attempting to withdraw their entire Alpha (stake) from a hotkey within a specific subnet.
The Problem: Discrepancy Between Expected and Actual Unstake Amounts
Due to the highly dynamic nature of stake and emissions in the dTao ecosystem, users attempting an unstake or unstake_multiple operation with a previously retrieved Alpha amount often find that a residual stake remains on hotkey. This discrepancy occurs because network emissions can accrue between the moment the coldkey's Alpha value is queried and when the unstaking extrinsic is executed. As a result, the "full unstake" operation doesn't completely clear the hotkey's stake as intended.
The Solution: Enhanced Unstake Logic for Full Alpha Withdrawal
The changes introduced in this PR modify the existing logic to improve the handling of "full Alpha" unstake requests. By refining the SDK's approach to determining the unstake amount, we aim to minimize time where residual stake is left behind due to dynamic network conditions.
Future Considerations: Chain-Side Improvements for Robustness
While these SDK-side enhancements provide a significant improvement, the inherent latency and dynamic nature of network operations (especially for users with high latency connections or unstable internet) mean this solution isn't entirely perfect.
For a truly robust and definitive solution, we propose exploring chain-side improvements. This would involve adding new arguments
unstake_allto theremove_stake_limitandremove_stakefunctions within the Subtensor itself. By doing so, the chain would gain a precise understanding of a user's intent to unstake all Alpha currently held on a hotkey within a given subnet. This would allow the network to handle the dynamic nature of stake and emissions directly, ensuring a complete and accurate unstake regardless of client-side latency.This is the issus created on subtensor: opentensor/subtensor#1661