Skip to content

Introduce ZeroMaxAmount error for add_stake_limit extrinsic.#1577

Merged
sam0x17 merged 8 commits intodevnet-readyfrom
add-stake-limit-fix
May 5, 2025
Merged

Introduce ZeroMaxAmount error for add_stake_limit extrinsic.#1577
sam0x17 merged 8 commits intodevnet-readyfrom
add-stake-limit-fix

Conversation

@shamil-gadelshin
Copy link
Collaborator

Description

It was possible to have a successful add_stake_limit extrinsic with zero stake added. This PR fixes this error.
Here is the example: https://taostats.io/extrinsic/5338471-0009?network=finney

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 PR introduces a new possible error.

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

Additional Notes

move_stake extrinsic shares the same logic get_max_amount_add within its get_max_amount_move method but the PR kept the previous logic.

@shamil-gadelshin shamil-gadelshin added breaking-change This PR introduces a noteworthy breaking change skip-cargo-audit This PR fails cargo audit but needs to be merged anyway labels Apr 29, 2025
@github-actions
Copy link
Contributor

@opentensor/cerebrum / @opentensor/gyrus / @opentensor/cortex breaking change detected! Please prepare accordingly!

@shamil-gadelshin
Copy link
Collaborator Author

The recent changes refactor get_max_amount_move using ZeroMaxStakeAmount error that affects additional extrinsics like move_stake or swap_stake.

@shamil-gadelshin
Copy link
Collaborator Author

The recent changes update the benchmark version to V2.

CustomTransactionError::ServingRateLimitExceeded => 12,
CustomTransactionError::InvalidPort => 13,
CustomTransactionError::BadRequest => 255,
CustomTransactionError::ZeroMaxAmount => 14,
Copy link
Contributor

Choose a reason for hiding this comment

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

@MichaelTrestman
Should add this to the docs

camfairchild
camfairchild previously approved these changes May 2, 2025
l0r1s
l0r1s previously approved these changes May 5, 2025
@shamil-gadelshin shamil-gadelshin dismissed stale reviews from l0r1s and camfairchild via 3d3796c May 5, 2025 12:54
@shamil-gadelshin shamil-gadelshin requested a review from l0r1s May 5, 2025 12:54
@sam0x17 sam0x17 merged commit b4acaf8 into devnet-ready May 5, 2025
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking-change This PR introduces a noteworthy breaking change 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