fix app operate with zero allocations#401
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @dimast-x, 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 addresses an issue where the application's 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
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Code Review
This pull request correctly fixes an issue where operate intents with zero-value allocations would fail. The changes in app_session_service.go and rpc_router_private.go properly handle these zero allocations by allowing them during balance verification, as long as they don't introduce new non-zero balances for unlisted assets. A new test case has been added to cover this scenario, which is excellent for ensuring the fix is robust. I've pointed out a small improvement in the new test to handle errors explicitly, which will make the test more reliable.
| appBalA, _ := GetWalletLedger(db, userAddressA).Balance(sessionAccountID, "usdc") | ||
| appBalB, _ := GetWalletLedger(db, userAddressB).Balance(sessionAccountID, "usdc") | ||
| assert.True(t, appBalA.IsZero()) | ||
| assert.True(t, appBalB.IsZero()) |
There was a problem hiding this comment.
The errors returned from the Balance calls are being ignored. The Balance function returns decimal.Zero on error, which could cause this test to pass silently even if there's an issue with retrieving the balance. It's safer to check for errors explicitly using require.NoError(t, err).
appBalA, errA := GetWalletLedger(db, userAddressA).Balance(sessionAccountID, "usdc")
require.NoError(t, errA)
appBalB, errB := GetWalletLedger(db, userAddressB).Balance(sessionAccountID, "usdc")
require.NoError(t, errB)
assert.True(t, appBalA.IsZero())
assert.True(t, appBalB.IsZero())
No description provided.