refactor(pkg/chains): add Avalanche, Arbitrum and World Chain in chain info#3379
refactor(pkg/chains): add Avalanche, Arbitrum and World Chain in chain info#3379
Conversation
📝 WalkthroughWalkthroughThis pull request introduces comprehensive support for three new blockchain networks: Avalanche, Arbitrum, and World Chain. The changes span multiple files across the Zeta Chain project, systematically updating protocol definitions, test cases, and documentation to incorporate these new networks. The modifications include expanding network and consensus enumerations, adding new chain configurations, and ensuring test coverage reflects the updated network landscape. Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
✨ 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
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (2)
docs/openapi/openapi.swagger.yaml (1)
57080-57081: Fix indentation in description section.The indentation of the snowman mapping is inconsistent with other entries.
description: |- - catchain_consensus: ton - - snowman: avalanche + - snowman: avalancheproto/zetachain/zetacore/pkg/chains/chains.proto (1)
Line range hint
1-150: Consider adding reserved ranges for future network and consensus types.While the current additions maintain backward compatibility, it would be beneficial to reserve number ranges for different categories of networks (L1s, L2s, etc.) and consensus mechanisms. This would make the protocol more maintainable as new chains are added.
Example modification:
enum Network { option (gogoproto.goproto_enum_stringer) = true; + reserved 12 to 20; // Reserved for future L1 networks + reserved 21 to 30; // Reserved for future L2 networks eth = 0; // ... existing entries ... worldchain = 11; } enum Consensus { option (gogoproto.goproto_enum_stringer) = true; + reserved 8 to 15; // Reserved for future L1 consensus mechanisms + reserved 16 to 25; // Reserved for future L2 consensus mechanisms ethereum = 0; // ... existing entries ... arbitrum_nitro = 7; }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
pkg/chains/chains.pb.gois excluded by!**/*.pb.go,!**/*.pb.gotypescript/zetachain/zetacore/pkg/chains/chains_pb.d.tsis excluded by!**/*_pb.d.ts
📒 Files selected for processing (6)
changelog.md(1 hunks)docs/openapi/openapi.swagger.yaml(2 hunks)pkg/chains/chain_test.go(2 hunks)pkg/chains/chains.go(3 hunks)pkg/chains/chains_test.go(5 hunks)proto/zetachain/zetacore/pkg/chains/chains.proto(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- changelog.md
🧰 Additional context used
📓 Path-based instructions (4)
pkg/chains/chain_test.go (1)
Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
pkg/chains/chains.go (1)
Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
pkg/chains/chains_test.go (1)
Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
proto/zetachain/zetacore/pkg/chains/chains.proto (1)
Pattern **/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.
⏰ Context from checks skipped due to timeout of 90000ms (1)
- GitHub Check: start-e2e-test / e2e
🔇 Additional comments (17)
pkg/chains/chains.go (7)
101-111: LGTM! Avalanche C-Chain configuration is accurate.The chain ID and consensus mechanism (Snowman) are correctly specified for the Avalanche C-Chain.
113-123: LGTM! Arbitrum One configuration is accurate.The chain ID and consensus mechanism (Arbitrum Nitro) are correctly specified for Arbitrum One.
283-293: LGTM! Avalanche Fuji testnet configuration is accurate.The chain ID and consensus mechanism match the Avalanche Fuji testnet specifications.
295-305: LGTM! Arbitrum Sepolia testnet configuration is accurate.The chain ID and consensus mechanism match the Arbitrum Sepolia testnet specifications.
504-509: LGTM! Default chains list updated correctly.The new chains are added in a consistent order, maintaining the pattern of mainnet chains followed by their testnet counterparts.
125-135: Verify World Chain configuration.While the configuration follows the standard pattern, please verify the chain ID and consensus mechanism for World Chain, as it's a relatively new network.
✅ Verification successful
World Chain configuration verified.
The configuration is correct and follows the established pattern:
- Chain ID 480 (mainnet) and 4801 (testnet) are properly configured
- Uses OP Stack consensus mechanism, consistent with other L2 chains
- Recently added through PR #3379 alongside Avalanche and Arbitrum
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any references to World Chain's configuration rg -i "world.*chain.*480"Length of output: 27
Script:
#!/bin/bash # Search for World Chain references echo "=== World Chain references ===" rg -i "world.*chain" -A 5 -B 5 echo -e "\n=== Chain ID 480 references ===" rg "480" -A 5 -B 5 echo -e "\n=== OP Stack consensus references ===" rg "op_stack" -A 5 -B 5 echo -e "\n=== Documentation files mentioning World Chain ===" fd -e md -e txt | xargs rg -i "world.*chain" -lLength of output: 85532
307-317: Verify World Chain testnet configuration.While the configuration follows the standard pattern, please verify the chain ID and consensus mechanism for World Chain testnet.
✅ Verification successful
World Chain testnet configuration verified successfully.
The configuration is correct with chain ID 4801 and OP Stack consensus mechanism. This follows the established pattern for testnet configurations and aligns with the chain's architecture.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for any references to World Chain testnet's configuration rg -i "world.*testnet.*4801"Length of output: 30
Script:
#!/bin/bash # Search for World Chain references echo "=== World Chain References ===" rg -i "world.*chain" -A 2 -B 2 echo -e "\n=== Chain ID 4801 References ===" rg "4801" echo -e "\n=== Documentation Files with World Chain ===" fd -e md -e txt | xargs rg -i "world.*chain" || true echo -e "\n=== OP Stack Consensus References ===" rg "op_stack|op stack" -iLength of output: 107210
pkg/chains/chain_test.go (2)
76-76: LGTM! Invalid network test case updated correctly.The test case now uses the new upper bound (Network_worldchain + 1) for testing invalid networks.
118-118: LGTM! Invalid consensus test case updated correctly.The test case now uses the new upper bound (Consensus_arbitrum_nitro + 1) for testing invalid consensus mechanisms.
pkg/chains/chains_test.go (4)
40-42: LGTM! TestChainListByNetworkType updated correctly.The test cases for both mainnet and testnet chains are updated to include the new chains in the correct order.
Also applies to: 62-64
188-193: LGTM! TestDefaultChainList updated correctly.The test case is updated to include all new chains in the same order as defined in DefaultChainsList.
231-236: LGTM! TestChainListByGateway updated correctly.The observers gateway test case is updated to include all new chains.
283-288: LGTM! TestExternalChainList updated correctly.The test case is updated to include all new external chains.
docs/openapi/openapi.swagger.yaml (2)
57098-57100: LGTM! Network additions are well-structured.The new network entries are consistent with the existing naming pattern and align with the PR objectives of adding new EVM chains.
57076-57081: 🛠️ Refactor suggestionAdd mapping for arbitrum_nitro in the description.
The description section maps consensus algorithms to their respective chains, but the mapping for
arbitrum_nitrois missing. Please add it to maintain documentation completeness.description: |- - catchain_consensus: ton - snowman: avalanche + - arbitrum_nitro: arbitrumLikely invalid or redundant comment.
proto/zetachain/zetacore/pkg/chains/chains.proto (2)
67-69: Network enum additions follow best practices.The new network values are correctly added with sequential numbering, maintaining backward compatibility. The naming convention is consistent with existing entries.
103-104: Consensus enum additions are well-documented.The new consensus values are properly added with sequential numbering and include helpful comments explaining their purpose (e.g., "snowman" for Avalanche).
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #3379 +/- ##
========================================
Coverage 63.22% 63.23%
========================================
Files 436 436
Lines 30639 30645 +6
========================================
+ Hits 19372 19378 +6
Misses 10432 10432
Partials 835 835
|
Description
Add new EVM chains considered from:
#3361
#3362
#3365
Summary by CodeRabbit
New Features
Documentation
Refactor