Skip to content

Reenable alpha fees#2353

Open
gztensor wants to merge 76 commits intodevnet-readyfrom
feat/re-enable-alpha-fees
Open

Reenable alpha fees#2353
gztensor wants to merge 76 commits intodevnet-readyfrom
feat/re-enable-alpha-fees

Conversation

@gztensor
Copy link
Contributor

@gztensor gztensor commented Jan 16, 2026

Description

Summary

Allow paying transaction fees in alpha when no tao balance is available.
See issue #2336 for details.

Implementation

The share pool is re-implemented using SafeFloat type which utilizes bigmath crate for high precision. The SafeFloat type is a structure that stores safe_bigmath::SafeInt mantissa and an i64 exponent in a normalized form (SAFE_FLOAT_MAX <= mantissa < 10 * SAFE_FLOAT_MAX). It implements basic arithmetic that is needed for share pool operations: Comparisons (gt), addition, division, and mul_div operation that calculates self * a / b without loss of precision.

This PR allows the alpha to be unstaked precisely, no matter what the state of share pool is. There is no need to unstake the full amount in case of low precision anymore.

Related Issue(s)

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):

Breaking Change

The Alpha and TotalHotkeyShares maps will be deprecated in favor of high precision AlphaV2 and TotalHotkeySharesV2. The migration is lazy, so if any client must use Alpha and/or TotalHotkeyShares maps directly, it should read both maps and use a non-zero value, whichever is non-zero at the moment. Alpha and TotalHotkeyShares migrations are not synched and may occur separately for the same hotkey.

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 ./scripts/fix_rust.sh 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 added the skip-cargo-audit This PR fails cargo audit but needs to be merged anyway label Jan 16, 2026
@gztensor gztensor marked this pull request as ready for review February 13, 2026 16:58
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.

4 participants