Fix/delegate all#125
Conversation
…as used minor change
thewhaleking
left a comment
There was a problem hiding this comment.
Overall good; let's just change the arg name to avoid name shadowing.
bittensor_cli/src/commands/root.py
Outdated
| """ | ||
|
|
||
| async def _do_delegation() -> tuple[bool, str]: | ||
| async def _do_delegation(staking_balance: Balance) -> tuple[bool, str]: |
There was a problem hiding this comment.
Let's change this to staking_balance_ to avoid name shadowing.
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.
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.
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.
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:
--alloption is used fordelegate-stakeandundelegate-stake.