Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions pallets/subtensor/src/macros/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/staking/stake_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ impl<T: Config> Pallet<T> {
// 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::<T>::NotEnoughBalanceToStake
Error::<T>::NotEnoughBalanceToPayStake
);

// Ensure that the hotkey account exists this is only possible through registration.
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/subnets/registration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ impl<T: Config> Pallet<T> {
let registration_cost = Self::get_burn(netuid);
ensure!(
Self::can_remove_balance_from_coldkey_account(&coldkey, registration_cost.into()),
Error::<T>::NotEnoughBalanceToStake
Error::<T>::NotEnoughBalanceToPayFee
);

// If the network account does not exist we will create it here.
Expand Down
2 changes: 1 addition & 1 deletion pallets/subtensor/src/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ fn test_add_stake_err_not_enough_belance() {
netuid,
stake,
),
Error::<Test>::NotEnoughBalanceToStake
Error::<Test>::NotEnoughBalanceToPayStake
);
});
}
Expand Down
3 changes: 2 additions & 1 deletion pallets/subtensor/src/transaction_extension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ where
Err(match err {
Error::<T>::AmountTooLow => CustomTransactionError::StakeAmountTooLow.into(),
Error::<T>::SubnetNotExists => CustomTransactionError::SubnetNotExists.into(),
Error::<T>::NotEnoughBalanceToStake => CustomTransactionError::BalanceTooLow.into(),
Error::<T>::NotEnoughBalanceToPayFee => CustomTransactionError::BalanceTooLow.into(),
Error::<T>::NotEnoughBalanceToPayStake => CustomTransactionError::BalanceTooLow.into(),
Error::<T>::HotKeyAccountNotExists => {
CustomTransactionError::HotkeyAccountDoesntExist.into()
}
Expand Down