-
Notifications
You must be signed in to change notification settings - Fork 54
Fix reserved fee info text display for zero amounts in staking #1271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Summary of ChangesHello @DRadmir, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an issue where the reserved fee information text was inappropriately displayed even when a user entered a zero amount for staking or freezing. The changes ensure that this warning message is only presented for valid, non-zero input amounts that would actually trigger a fee reservation, thereby enhancing the user interface's clarity and relevance. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request fixes an issue where the reserved fee info text was displayed for zero amounts during staking. The change adds a check to ensure the input value is non-zero before showing the text, and adds a test case to cover this scenario. While the fix is correct for the reported issue, it appears to cause a regression in a related scenario, which will likely make an existing test case fail. I've left a comment with details on how to address this.
| guard let inputValue = try? formatter.inputNumber(from: amountInputModel.text, decimals: asset.decimals.asInt), | ||
| !inputValue.isZero, inputValue >= availableBalanceForStaking, inputValue <= availableValue | ||
| else { return nil } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change correctly prevents the info text from showing when the user types '0'. However, it seems to introduce a regression in a related scenario, which will likely cause the stakingMaxWithInsufficientBalance test to fail. In that test, the user has a balance smaller than the reserved fee. Pressing the 'Max' button sets the input to '0', and the test expects the info text to be shown to explain why the max amount is zero. With your change, it will be hidden.
Please consider if this change in behavior is intended. If so, the test should be updated to expect infoText == nil. Otherwise, the logic here might need to be adjusted to handle this edge case differently.
Previously, the reserved fee info text would display even when the input amount was zero. This change adds a check to ensure the info text only appears when the user has entered a non-zero amount that would trigger the reserved fee warning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
71740e1 to
a055974
Compare
Previously, the reserved fee info text would display even when the input amount was zero. This change adds a check to ensure the info text only appears when the user has entered a non-zero amount that would trigger the reserved fee warning.