Skip to content

Fix/staking fees#1386

Merged
sam0x17 merged 6 commits intodevnet-readyfrom
fix/staking-fees
Mar 11, 2025
Merged

Fix/staking fees#1386
sam0x17 merged 6 commits intodevnet-readyfrom
fix/staking-fees

Conversation

@gztensor
Copy link
Contributor

Description

Introduce flexible staking fees. Fees will be equal to the hotkey staking rewards worth of one epoch for the amount being staked/unstaked.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Other (please describe):

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have run cargo fmt and cargo clippy to ensure my code is formatted and linted correctly
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@gztensor gztensor requested a review from camfairchild March 10, 2025 19:24
@sam0x17 sam0x17 requested a review from unconst March 10, 2025 19:54
@sam0x17 sam0x17 merged commit 1b40d1d into devnet-ready Mar 11, 2025
15 of 17 checks passed
This was referenced Mar 11, 2025
// 3. Ensure the remove operation from the coldkey is a success.
let tao_staked: u64 =
Self::remove_balance_from_coldkey_account(&coldkey, stake_to_be_added)?;
let tao_staked: I96F32 =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need this conversion, if we don't use the fee calculation from that function.


// 5. Ensure the remove operation from the coldkey is a success.
let tao_staked: u64 = Self::remove_balance_from_coldkey_account(&coldkey, possible_stake)?;
let tao_staked: I96F32 =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same thing about conversion here.

hotkey: &T::AccountId,
alpha_estimate: I96F32,
) -> u64 {
if (netuid == Self::get_root_netuid()) || (SubnetMechanism::<T>::get(netuid)) == 0 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

parenthesis are unnecessary here. surprised it passed clippy.

alpha_estimate: I96F32,
) -> u64 {
if (netuid == Self::get_root_netuid()) || (SubnetMechanism::<T>::get(netuid)) == 0 {
DefaultStakingFee::<T>::get()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a personal preference, but it would be more readable with return statement here (guard style check), so you could avoid introducing else block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants