diff --git a/pallets/subtensor/src/macros/errors.rs b/pallets/subtensor/src/macros/errors.rs index 6c3d7a35df..cd66721db0 100644 --- a/pallets/subtensor/src/macros/errors.rs +++ b/pallets/subtensor/src/macros/errors.rs @@ -38,7 +38,9 @@ mod errors { NotEnoughStakeToSetChildkeys, /// The caller is requesting adding more stake than there exists in the coldkey account. /// See: "[add_stake()]" - NotEnoughBalanceToStake, + /// The caller is requesting adding more stake than there exists in the coldkey account. + /// See: "[add_stake()]" + // NotEnoughBalanceToStake, /// The caller is trying to add stake, but for some reason the requested amount could not be /// withdrawn from the coldkey account. BalanceWithdrawalError, @@ -210,8 +212,10 @@ mod errors { ZeroMaxStakeAmount, /// Invalid netuid duplication SameNetuid, - /// The caller does not have enough balance for the operation. - InsufficientBalance, + /// The caller does not have enough balance to pay the fee. + NotEnoughBalanceToPayFee, + /// The caller does not have enough balance to pay the stake. + NotEnoughBalanceToPayStake, /// Too frequent staking operations StakingOperationRateLimitExceeded, /// Invalid lease beneficiary to register the leased network. diff --git a/pallets/subtensor/src/staking/stake_utils.rs b/pallets/subtensor/src/staking/stake_utils.rs index f61a8a6ce2..4f5a4b768a 100644 --- a/pallets/subtensor/src/staking/stake_utils.rs +++ b/pallets/subtensor/src/staking/stake_utils.rs @@ -971,7 +971,7 @@ impl Pallet { // Ensure the callers coldkey has enough stake to perform the transaction. ensure!( Self::can_remove_balance_from_coldkey_account(coldkey, stake_to_be_added.into()), - Error::::NotEnoughBalanceToStake + Error::::NotEnoughBalanceToPayStake ); // Ensure that the hotkey account exists this is only possible through registration. diff --git a/pallets/subtensor/src/subnets/registration.rs b/pallets/subtensor/src/subnets/registration.rs index a7771857bb..18780a33b7 100644 --- a/pallets/subtensor/src/subnets/registration.rs +++ b/pallets/subtensor/src/subnets/registration.rs @@ -107,7 +107,7 @@ impl Pallet { let registration_cost = Self::get_burn(netuid); ensure!( Self::can_remove_balance_from_coldkey_account(&coldkey, registration_cost.into()), - Error::::NotEnoughBalanceToStake + Error::::NotEnoughBalanceToPayFee ); // If the network account does not exist we will create it here. diff --git a/pallets/subtensor/src/tests/staking.rs b/pallets/subtensor/src/tests/staking.rs index 4146786709..0ac6aa86af 100644 --- a/pallets/subtensor/src/tests/staking.rs +++ b/pallets/subtensor/src/tests/staking.rs @@ -249,7 +249,7 @@ fn test_add_stake_err_not_enough_belance() { netuid, stake, ), - Error::::NotEnoughBalanceToStake + Error::::NotEnoughBalanceToPayStake ); }); } diff --git a/pallets/subtensor/src/transaction_extension.rs b/pallets/subtensor/src/transaction_extension.rs index cf1d410ea9..daeb9acfca 100644 --- a/pallets/subtensor/src/transaction_extension.rs +++ b/pallets/subtensor/src/transaction_extension.rs @@ -54,7 +54,8 @@ where Err(match err { Error::::AmountTooLow => CustomTransactionError::StakeAmountTooLow.into(), Error::::SubnetNotExists => CustomTransactionError::SubnetNotExists.into(), - Error::::NotEnoughBalanceToStake => CustomTransactionError::BalanceTooLow.into(), + Error::::NotEnoughBalanceToPayFee => CustomTransactionError::BalanceTooLow.into(), + Error::::NotEnoughBalanceToPayStake => CustomTransactionError::BalanceTooLow.into(), Error::::HotKeyAccountNotExists => { CustomTransactionError::HotkeyAccountDoesntExist.into() }