-
Notifications
You must be signed in to change notification settings - Fork 14
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
test: add sendToFxClaim unit test #955
Conversation
WalkthroughThis pull request introduces modifications across several files in the crosschain module, focusing on improving token handling, event unpacking, and test coverage. The changes primarily involve updates to the Changes
Sequence DiagramsequenceDiagram
participant User
participant CrosschainContract
participant ExecuteClaim
participant BridgeModule
User->>CrosschainContract: Send Token
CrosschainContract->>ExecuteClaim: Trigger ExecuteClaim
ExecuteClaim->>ExecuteClaim: Unpack Event
ExecuteClaim->>BridgeModule: Transfer Token
BridgeModule-->>User: Confirm Transfer
Possibly related PRs
Suggested Labels
Suggested Reviewers
Poem
✨ Finishing Touches
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration 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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
precompiles/crosschain/execute_claim_test.go (1)
47-132
: LGTM! Well-structured test cases with comprehensive coverage.The test suite effectively covers various token scenarios with clear setup and assertions.
Consider adding negative test cases to validate error handling, such as:
- Invalid event nonce
- Non-existent bridge token
- Insufficient balance
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
precompiles/crosschain/contract_test.go
(1 hunks)precompiles/crosschain/execute_claim.go
(2 hunks)precompiles/crosschain/execute_claim_test.go
(2 hunks)x/crosschain/keeper/keeper_test.go
(0 hunks)x/crosschain/keeper/many_to_one.go
(1 hunks)
💤 Files with no reviewable changes (1)
- x/crosschain/keeper/keeper_test.go
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: test
- GitHub Check: lint
- GitHub Check: analyze
- GitHub Check: main
- GitHub Check: Mergify Merge Protections
- GitHub Check: Summary
🔇 Additional comments (4)
precompiles/crosschain/execute_claim.go (1)
97-106
: LGTM! Clean implementation of event unpacking.The
UnpackEvent
method is well-implemented with proper error handling and follows Go idioms.precompiles/crosschain/contract_test.go (1)
119-136
: LGTM! Improved token denomination handling.The changes improve maintainability by:
- Adding clear handling for legacy FX denomination
- Better scoping of variables in conditional blocks
- Clearer separation between native coins and ERC20 tokens
precompiles/crosschain/execute_claim_test.go (1)
134-191
: LGTM! Thorough test execution and verification.The test execution includes comprehensive verification of:
- Event emission and content
- Module balances
- Receiver balances
- ERC20 token balances
x/crosschain/keeper/many_to_one.go (1)
37-37
: LGTM! Consistent bridge token denomination usage.The change to use
BridgeDenom()
aligns with the bridge token handling pattern used throughout the codebase.
Summary by CodeRabbit
New Features
UnpackEvent
method for parsing Ethereum log events in crosschain moduleExecuteClaim
functionality with new test casesTests
ExecuteClaim
methodRefactor
SwapBridgeToken
methodChores