subtensor
subtensor copied to clipboard
Comments not aligned with code in get_max_amount_remove() (remove_stake.rs)
Describe the bug
Hi,
While reading through get_max_amount_remove() in remove_stake.rs, I noticed that some of the inline comments doesn't reflect the current implementation. It says if limit price is 1e9 rao or higher, but the code does the opposite :
// Returns the maximum amount of RAO that can be executed with price limit
pub fn get_max_amount_remove(netuid: u16, limit_price: u64) -> u64 {
// Corner case: root and stao
// There's no slippage for root or stable subnets, so if limit price is 1e9 rao or
// higher, then max_amount equals u64::MAX, otherwise it is 0.
if (netuid == Self::get_root_netuid()) || (SubnetMechanism::<T>::get(netuid)) == 0 {
if limit_price <= 1_000_000_000 {
return u64::MAX;
} else {
return 0;
}
}
For get_max_amount_add() in add_stake.rs, the comment and code are aligned.
To Reproduce
take a look at get_max_amount_remove() in subtensor/pallets/subtensor/src/staking/remove_stake.rs
Expected behavior
need to change comments or code
Screenshots
No response
Environment
subtensor repo
Additional context
No response