Skip to content

Reduce staking fees#1848

Merged
sam0x17 merged 10 commits intodevnet-readyfrom
feat/staking-fees-corrected
Jul 16, 2025
Merged

Reduce staking fees#1848
sam0x17 merged 10 commits intodevnet-readyfrom
feat/staking-fees-corrected

Conversation

@gztensor
Copy link
Contributor

Description

  • Fees for all intra-subnet stake moving will be zero
  • Default fee rate reduced to 0.05%

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 July 11, 2025 15:15
sam0x17
sam0x17 previously approved these changes Jul 11, 2025
Error::<T>::AmountTooLow
);

// Step 3: Update StakingHotkeys if the hotkey's total alpha, across all subnets, is zero
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we have this snippet commented?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It needs a better fix than just O(n) iteration over all all subnets for this hotkey. Probably we should store aggregate alpha for each hotkey or some king of bitmap that shows whether the hotkey has any alpha in a subnet. This is an older tech debt.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Is it valid without the update? Can we get away with the postponed solution?

Copy link
Contributor

Choose a reason for hiding this comment

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

Ya we can clean up the map later if needed. There's a call for it also

@shamil-gadelshin shamil-gadelshin self-requested a review July 11, 2025 16:31
@github-actions github-actions bot dismissed stale reviews from shamil-gadelshin and sam0x17 via c47ae2b July 11, 2025 17:19
TransferToggle::<T>::get(destination_netuid),
Error::<T>::TransferDisallowed
);
if origin_netuid != destination_netuid {
Copy link
Contributor

Choose a reason for hiding this comment

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

Saves one read

We need to make sure we check only for coldkey dest != coldkey origin

Error::<T>::AmountTooLow
);

// Step 3: Update StakingHotkeys if the hotkey's total alpha, across all subnets, is zero
Copy link
Contributor

Choose a reason for hiding this comment

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

Ya we can clean up the map later if needed. There's a call for it also

@camfairchild
Copy link
Contributor

We should maybe pays::yes for this though. Or have a base fee. Just not percentage-wise. To prevent DoS

@gztensor gztensor added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jul 11, 2025
sam0x17
sam0x17 previously approved these changes Jul 15, 2025
.saturating_add(T::DbWeight::get().reads(0))
.saturating_add(T::DbWeight::get().writes(1)),
DispatchClass::Operational,
Pays::No
Copy link

Choose a reason for hiding this comment

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

why is this Pays:No when add is yes?

Copy link

Choose a reason for hiding this comment

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

then unstake all is Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sudo_set_tx_childkey_take_rate_limit is a root-only transaction. No spam risk.

@sam0x17 sam0x17 merged commit 00aaaad into devnet-ready Jul 16, 2025
54 of 56 checks passed
This was referenced Jul 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-cargo-audit This PR fails cargo audit but needs to be merged anyway

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants