Skip to content

Make unstake and unstake_multiple for all Alphas more clear#2885

Merged
basfroman merged 9 commits intostagingfrom
feat/roman/staking-unstaking-issue
May 21, 2025
Merged

Make unstake and unstake_multiple for all Alphas more clear#2885
basfroman merged 9 commits intostagingfrom
feat/roman/staking-unstaking-issue

Conversation

@basfroman
Copy link
Collaborator

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_all to the remove_stake_limit and remove_stake functions 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

@basfroman basfroman requested a review from a team May 20, 2025 21:36
@basfroman basfroman self-assigned this May 20, 2025
@basfroman basfroman added bug Something isn't working enhancement New feature or request labels May 20, 2025
@basfroman basfroman merged commit 6c6689c into staging May 21, 2025
127 checks passed
@basfroman basfroman deleted the feat/roman/staking-unstaking-issue branch May 21, 2025 01:49
@ibraheem-abe ibraheem-abe mentioned this pull request May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants