-
Notifications
You must be signed in to change notification settings - Fork 161
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
tests: add E2E tests for IBC-OnRecvPacket Memo Handler #2446
Conversation
WalkthroughThe recent updates introduce enhanced testing for the Inter-Blockchain Communication (IBC) protocol, specifically focusing on token transfers with memo functionality and the handling of IBC packets. These changes aim to ensure the robustness of token transfers across blockchains, including various memo scenarios and packet data types. Additionally, the updates bring new utility functions and modifications to existing ones to support these tests, alongside enabling Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Review Status
Actionable comments generated: 4
Configuration used: CodeRabbit UI
Files selected for processing (3)
- x/uibc/gmp/gmp_middleware_test.go (1 hunks)
- x/uibc/uics20/ibc_module_mocks_test.go (1 hunks)
- x/uibc/uics20/ibc_module_test.go (1 hunks)
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2446 +/- ##
==========================================
- Coverage 75.38% 69.38% -6.01%
==========================================
Files 100 185 +85
Lines 8025 10909 +2884
==========================================
+ Hits 6050 7569 +1519
- Misses 1589 2712 +1123
- Partials 386 628 +242 |
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- x/uibc/gmp/gmp_middleware_test.go (1 hunks)
- x/uibc/uics20/ibc_module_mocks_test.go (1 hunks)
- x/uibc/uics20/ibc_module_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (3)
- x/uibc/gmp/gmp_middleware_test.go
- x/uibc/uics20/ibc_module_mocks_test.go
- x/uibc/uics20/ibc_module_test.go
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- x/uibc/uics20/ibc_module_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/uibc/uics20/ibc_module_test.go
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.
for integration tests I suggest to:
- use gomock for bank keeper
- use real ibc keeper
- use real or gomock for x/leverage (note: we already have gomock of x/leverage keeper defined)
And the integration test should verify:
- The bank balances are updated
- The leverage LP are set correctly.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (3)
- tests/e2e/e2e_ibc_memo_test.go (1 hunks)
- tests/e2e/e2e_ibc_test.go (6 hunks)
- tests/e2e/setup/utils.go (3 hunks)
Check Runs (12)
test-unit-cover completed (1)
liveness-test completed (1)
install-tparse completed (1)
umeed linux-arm64 completed (1)
umeed darwin-arm64 completed (1)
umeed linux-amd64 completed (1)
umeed darwin-amd64 completed (1)
test-app-non-determinism completed (1)
Run golangci-lint completed (12)
install-dependencies completed (1)
Run govulncheck completed (11)
buf-lint completed (1)
Additional comments: 8
tests/e2e/e2e_ibc_memo_test.go (1)
- 16-83: The test function
testIBCTokenTransferWithMemo
is well-structured and covers various scenarios for IBC token transfers with different memo types (valid, invalid with fallback address, invalid without fallback address). It ensures that the system behaves as expected in each case, validating memo handling, packet processing, and data deserialization. The use of assertions to check conditions and the logging of important information are good practices that enhance the test's readability and debuggability.tests/e2e/e2e_ibc_test.go (4)
- 14-14: Adding the
util/coin
package import is appropriate for leveraging utility functions related to coin operations within the test suite. Ensuring that imported packages are utilized effectively is crucial for maintainability and avoiding unnecessary dependencies.- 85-102: The addition of the
checkLeverageAccountBalance
function is a valuable enhancement to the test suite, allowing for more granular verification of account balances in leverage scenarios. This function improves the test coverage by ensuring that collateral and supplied amounts are correctly accounted for in the leverage module. It's important to ensure that the function is called with the correct parameters in all relevant test cases to maximize its utility.- 72-80: Modifying the
checkSupply
function to include a more detailed logging message in case of a failure is a good practice. It enhances the debuggability of the tests by providing clearer insights into the nature of any issues encountered. Including the expected and actual supply amounts, along with the error message, can significantly aid in troubleshooting.- 69-149: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [105-271]
The updates to the
TestIBCTokenTransfer
function, including the addition of new test scenarios and the refinement of existing ones, significantly enhance the test suite's coverage and robustness. The detailed scenarios test various aspects of IBC token transfers, including quota management and memo handling. It's important to ensure that all edge cases are considered and that the tests are comprehensive enough to catch potential issues in the IBC transfer logic.tests/e2e/setup/utils.go (3)
- 91-101: > 📝 NOTE
This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [58-96]
The modification to the
SendIBC
function to include amemo
parameter is a necessary enhancement for testing IBC transfers with various memo scenarios. This change allows for more comprehensive testing of the IBC transfer functionality, including the handling of memos. It's important to ensure that the memo is correctly formatted and used in all relevant test cases to fully leverage this functionality.
- 206-214: The addition of the
QueryLeverageAccountBalances
function is a valuable enhancement to the test suite's utility functions. It enables querying leverage account balances, which is crucial for verifying the state of accounts in tests involving the leverage module. This function improves the test suite's ability to validate the correctness of leverage operations and account states.- 98-98: Logging the execution command for Hermes in the
SendIBC
function is a good practice that enhances the debuggability of the tests. It provides visibility into the exact commands being executed, which can be invaluable for troubleshooting issues related to IBC transfers. Ensuring that logs are informative and relevant is important for maintaining the usefulness of test output.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- tests/e2e/setup/setup.go (1 hunks)
Additional comments: 1
tests/e2e/setup/setup.go (1)
- 291-292: The change to enable
ics20
hooks for memo handling in theuibcGenState.Params
is correctly implemented. This is crucial for testing the IBC-OnRecvPacket functionality, especially for scenarios involving memo handling.Please ensure to verify if enabling these hooks has any unintended side effects on other integration tests within the suite.
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.
old comments are not solved
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.
Review Status
Actionable comments generated: 2
Configuration used: CodeRabbit UI
Files selected for processing (2)
- tests/e2e/e2e_ibc_memo_test.go (1 hunks)
- x/uibc/uics20/ibc_module_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- tests/e2e/e2e_ibc_memo_test.go
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- x/uibc/uics20/ibc_module_test.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/uibc/uics20/ibc_module_test.go
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.
Description
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
Summary by CodeRabbit
ics20
hooks for improved memo management during token transfers.