Skip to content

Commit

Permalink
Rename amount back to amount_staked in add_stake parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
gztensor committed Jan 24, 2025
1 parent f0534f1 commit ab4d6e1
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions pallets/subtensor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1781,11 +1781,11 @@ where
Some(Call::add_stake {
hotkey,
netuid,
amount,
amount_staked,
}) => {
// Fully validate the user input
Self::result_to_validity(Pallet::<T>::validate_add_stake(
who, hotkey, *netuid, *amount,
who, hotkey, *netuid, *amount_staked,
))
}
Some(Call::remove_stake {
Expand Down
4 changes: 2 additions & 2 deletions pallets/subtensor/src/macros/dispatches.rs
Original file line number Diff line number Diff line change
Expand Up @@ -584,9 +584,9 @@ mod dispatches {
origin: OriginFor<T>,
hotkey: T::AccountId,
netuid: u16,
amount: u64,
amount_staked: u64,
) -> DispatchResult {
Self::do_add_stake(origin, hotkey, netuid, amount)
Self::do_add_stake(origin, hotkey, netuid, amount_staked)
}

/// Remove stake from the staking account. The call must be made
Expand Down
14 changes: 7 additions & 7 deletions pallets/subtensor/src/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ use sp_core::{Get, H256, U256};
fn test_add_stake_dispatch_info_ok() {
new_test_ext(1).execute_with(|| {
let hotkey = U256::from(0);
let amount = 5000;
let amount_staked = 5000;
let netuid = 1;
let call = RuntimeCall::SubtensorModule(SubtensorCall::add_stake {
hotkey,
netuid,
amount,
amount_staked,
});
assert_eq!(
call.get_dispatch_info(),
Expand Down Expand Up @@ -2075,17 +2075,17 @@ fn test_stake_below_min_validate() {
let subnet_owner_hotkey = U256::from(1002);
let hotkey = U256::from(2);
let coldkey = U256::from(3);
let amount = DefaultMinStake::<Test>::get() + DefaultStakingFee::<Test>::get() - 1;
let amount_staked = DefaultMinStake::<Test>::get() + DefaultStakingFee::<Test>::get() - 1;

let netuid = add_dynamic_network(&subnet_owner_hotkey, &subnet_owner_coldkey);
SubtensorModule::create_account_if_non_existent(&coldkey, &hotkey);
SubtensorModule::add_balance_to_coldkey_account(&coldkey, amount);
SubtensorModule::add_balance_to_coldkey_account(&coldkey, amount_staked);

// Add stake call
let call = RuntimeCall::SubtensorModule(SubtensorCall::add_stake {
hotkey,
netuid,
amount,
amount_staked,
});

let info: crate::DispatchInfo =
Expand All @@ -2104,11 +2104,11 @@ fn test_stake_below_min_validate() {
);

// Increase the stake to be equal to the minimum, but leave the balance low
let amount = DefaultMinStake::<Test>::get() + DefaultStakingFee::<Test>::get();
let amount_staked = DefaultMinStake::<Test>::get() + DefaultStakingFee::<Test>::get();
let call_2 = RuntimeCall::SubtensorModule(SubtensorCall::add_stake {
hotkey,
netuid,
amount,
amount_staked,
});

// Submit to the signed extension validate function
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/precompiles/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ impl StakingPrecompile {
let call = RuntimeCall::SubtensorModule(pallet_subtensor::Call::<Runtime>::add_stake {
hotkey,
netuid,
amount: amount_sub.unique_saturated_into(),
amount_staked: amount_sub.unique_saturated_into(),
});
// Dispatch the add_stake call
Self::dispatch(handle, call)
Expand Down
4 changes: 2 additions & 2 deletions runtime/tests/pallet_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ fn call_senate() -> RuntimeCall {
// staking call
fn call_add_stake() -> RuntimeCall {
let netuid = 1;
let amount = 100;
let amount_staked = 100;
RuntimeCall::SubtensorModule(pallet_subtensor::Call::add_stake {
hotkey: AccountId::from(DELEGATE),
netuid,
amount,
amount_staked,
})
}

Expand Down

0 comments on commit ab4d6e1

Please sign in to comment.