-
Notifications
You must be signed in to change notification settings - Fork 4
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
Fix/delegate all #125
Fix/delegate all #125
Conversation
cebd949
to
8b59670
Compare
…as used minor change
8b59670
to
cbc0810
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall good; let's just change the arg name to avoid name shadowing.
bittensor_cli/src/commands/root.py
Outdated
@@ -484,19 +484,19 @@ async def delegate_extrinsic( | |||
the response is `True`. | |||
""" | |||
|
|||
async def _do_delegation() -> tuple[bool, str]: | |||
async def _do_delegation(staking_balance: Balance) -> tuple[bool, str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's change this to staking_balance_
to avoid name shadowing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed.
bittensor_cli/src/commands/root.py
Outdated
@@ -569,14 +569,7 @@ async def get_stake_for_coldkey_and_hotkey( | |||
# Stake it all. | |||
staking_balance = Balance.from_tao(my_prev_coldkey_balance.tao) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey!
Since this also include undelegating, we should also make a distinction here when unstaking all:
if amount is None:
# Stake it all.
if delegate_string == "delegate":
staking_balance = Balance.from_tao(my_prev_coldkey_balance.tao)
else:
# Unstake all
staking_balance = Balance.from_tao(my_prev_delegated_stake.tao)
else:
staking_balance = Balance.from_tao(amount)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Unit tests need to be updated as well to check for the wallet balance change. Unit tests stopped working locally for me (infinite wait for the local subtensor). Once I resolve the issue I will update the tests too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests updated.
However, I couldn't check the delegate balance when staking all. Float existential deposit, some bug or output value got truncated (rounded). Used wallet balance instead. Open for suggestions or could be just merged as is :)
This looks good. I just want to test out something with regard to the checking staked balance instead of coldkey balance before merging. |
Changes made:
--all
option is used fordelegate-stake
andundelegate-stake
.