-
Notifications
You must be signed in to change notification settings - Fork 110
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
fix(pkg/chains
): check if VM is EVM for IsEVMChain
check
#2801
Conversation
WalkthroughWalkthroughThe changes involve modifications to the Changes
Assessment against linked issues
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
Documentation and Community
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2801 +/- ##
===========================================
- Coverage 66.65% 66.62% -0.04%
===========================================
Files 370 370
Lines 20680 20735 +55
===========================================
+ Hits 13784 13814 +30
- Misses 6261 6283 +22
- Partials 635 638 +3
|
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
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (3)
- pkg/chains/chain.go (2 hunks)
- pkg/chains/chain_test.go (2 hunks)
- x/crosschain/keeper/refund_test.go (1 hunks)
Additional context used
Path-based instructions (3)
pkg/chains/chain.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.pkg/chains/chain_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.x/crosschain/keeper/refund_test.go (1)
Pattern
**/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
Additional comments not posted (5)
pkg/chains/chain.go (2)
89-89
: RefactorIsEVMChain
method to check VM type.The change from checking the consensus mechanism to checking the VM type (
Vm_evm
) aligns with the PR objectives to more accurately determine EVM compatibility. This is a crucial update for the functionality of systems that rely on the VM type rather than the consensus mechanism.
112-120
: Enhanced error handling inIsEVMChain
function.The update to first retrieve the chain using
GetChainFromChainID
and then check if it's an EVM chain using the updatedIsEVMChain
method improves the robustness of this function. This ensures that the function operates on a valid chain object, enhancing error handling by returningfalse
if the chain is not found.pkg/chains/chain_test.go (2)
225-225
: Updated test case forZeta Mainnet
.The test case update for "Zeta Mainnet" to return
true
forIsEVMChain
reflects the updated logic in the main codebase. This ensures that the test is aligned with the new classification of "Zeta Mainnet" as an EVM chain.
334-334
: Consistency in test cases forIsEVMChain
.The addition of "Zeta Mainnet" with a return value of
true
in the standaloneIsEVMChain
function test case maintains consistency with the method test case and the updated logic in the main codebase.x/crosschain/keeper/refund_test.go (1)
219-224
: Dynamic assignment ofSenderChainId
in test case.The update to dynamically assign the
SenderChainId
usinggetValidBtcChainID()
enhances the flexibility and accuracy of the test case. This ensures that theSenderChainId
reflects a valid chain ID, improving the relevance of the test scenario.
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.
Can you explain why we need to distinguish EVM from let's say OP Stack? Any difference from Zeta's point of view?
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.
lgtm ,
While reviewing the usages of IsEVMChain function , I released that some logic in would be refactored to use network instead . Created an issue and will work on it
#2803.
Does not need any changes on this pr though
Description
IsEVMChain
used to check if the chain consensus is Ethereum, which is invalid, the components usingIsEVMChain
don't perform logic that relies on consensus used by Ethereum.Example: Base doesn't use Ethereum consensus as a L2 but comply with logic using isEVMChain.
This PR change the check.
All EVM chains so far had the value
ConsensusEthereum
except Base where we made a patch in the chain info. Therefore changing this check in theory doesn't bring any change in the workflowClose: #2752
Summary by CodeRabbit
New Features
IsEVMChain
function for better reliability.Bug Fixes
Tests
SenderChainId
in cross-chain transactions, improving accuracy.