Skip to content

feat: add Sui chain info #3489

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

Merged
merged 5 commits into from
Feb 7, 2025
Merged

feat: add Sui chain info #3489

merged 5 commits into from
Feb 7, 2025

Conversation

lumtis
Copy link
Member

@lumtis lumtis commented Feb 6, 2025

Description

Closes #3472

Don't set the real mainnet chain id for now, will not be necessary until mainnet integration

Summary by CodeRabbit

  • New Features

    • Extended blockchain support by introducing additional options for consensus mechanisms, network types, and virtual machine configurations.
    • Added new configurations for the Sui network, enabling Mainnet, Testnet, and Localnet environments.
  • Documentation

    • Updated API documentation to reflect these enhanced blockchain configuration options and new Sui network details.

@lumtis lumtis requested a review from a team as a code owner February 6, 2025 14:43
Copy link
Contributor

coderabbitai bot commented Feb 6, 2025

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

📝 Walkthrough

Walkthrough

The pull request updates the OpenAPI specification by adding new options for consensus, network, and virtual machine types (sui_consensus, sui, and mvm_sui). It also introduces new SUI chain definitions—SuiMainnet, SuiTestnet, and SuiLocalnet—in the chains package and updates associated tests to validate the new parameters. Additionally, the proto definitions are expanded with corresponding enum values to maintain consistency across the codebase.

Changes

Files Change Summary
docs/openapi/openapi.swagger.yaml Added new options: sui_consensus in consensus, sui in Network, and mvm_sui in Vm definitions.
pkg/chains/chains.go, pkg/chains/chain_test.go, pkg/chains/chains_test.go Introduced new chain definitions (SuiMainnet, SuiTestnet, SuiLocalnet) and updated test cases to validate new SUI network, consensus, and VM options.
proto/zetachain/.../chains.proto Updated enums by adding: sui = 12 in Network, mvm_sui = 4 in Vm, and sui_consensus = 8 in Consensus.

Assessment against linked issues

Objective Addressed Explanation
Add SUI chain information in the chains package (#3472)

Possibly related PRs

Suggested labels

breaking:proto

Suggested reviewers

  • skosito
  • brewmaster012
  • fbac
  • kingpinXD

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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
pkg/chains/chains.go (1)

332-341: Consider using sequential chain IDs for better maintainability

The current chain IDs for Sui networks (101, 103, 104) use non-sequential numbering. Consider using a more systematic approach:

// SuiTestnet
-		ChainId:     103,
+		ChainId:     1002,

// SuiLocalnet
-		ChainId:     104,
+		ChainId:     1003,

Also applies to: 458-467

proto/zetachain/zetacore/pkg/chains/chains.proto (1)

1-154: Overall Protobuf File Enhancements: Maintain Consistency

The updates across the enums in this file effectively integrate new SUI chain information into the codebase. Ensure that all documentation, client specifications, and test cases are updated accordingly. This holistic improvement aids in maintaining consistency and future compatibility.

🧰 Tools
🪛 Buf (1.47.2)

4-4: import "gogoproto/gogo.proto": file does not exist

(COMPILE)

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2bcd4f5 and 25f3d9f.

⛔ Files ignored due to path filters (2)
  • pkg/chains/chains.pb.go is excluded by !**/*.pb.go, !**/*.pb.go
  • typescript/zetachain/zetacore/pkg/chains/chains_pb.d.ts is excluded by !**/*_pb.d.ts
📒 Files selected for processing (5)
  • docs/openapi/openapi.swagger.yaml (3 hunks)
  • pkg/chains/chain_test.go (3 hunks)
  • pkg/chains/chains.go (4 hunks)
  • pkg/chains/chains_test.go (7 hunks)
  • proto/zetachain/zetacore/pkg/chains/chains.proto (3 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
`**/*.proto`: Review the Protobuf definitions, point out iss...

**/*.proto: Review the Protobuf definitions, point out issues relative to compatibility, and expressiveness.

  • proto/zetachain/zetacore/pkg/chains/chains.proto
`**/*.go`: Review the Go code, point out issues relative to ...

**/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

  • pkg/chains/chain_test.go
  • pkg/chains/chains_test.go
  • pkg/chains/chains.go
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: start-e2e-test / e2e
  • GitHub Check: build-and-test
🔇 Additional comments (8)
pkg/chains/chain_test.go (1)

76-76: LGTM!

The test cases have been correctly updated to validate against the new Sui-related enum values.

Also applies to: 104-104, 118-118

pkg/chains/chains_test.go (1)

43-43: LGTM!

The test cases have been comprehensively updated to include the new Sui chains across all relevant test functions.

Also applies to: 66-66, 78-78, 152-156, 202-204, 248-250

docs/openapi/openapi.swagger.yaml (3)

58823-58829: New Consensus Option Added
The addition of sui_consensus in the consensus mechanisms list aligns well with the corresponding proto definitions. Please ensure that any backend or client components consuming this OpenAPI specification are updated to recognize and handle the new consensus mechanism correctly.


58847-58853: New Network Option Introduced
The inclusion of sui as a valid option in the Network definition is consistent with the intended updates from the PR. Verify that this new network mapping is properly integrated across all services and that documentation reflects this addition uniformly.


58883-58889: New Virtual Machine Type Added
The new entry mvm_sui under the Vm definition is correctly added to support the updated SUI chain configurations. Confirm that all corresponding service logic and proto definitions are synchronized with this change to maintain consistency throughout the system.

proto/zetachain/zetacore/pkg/chains/chains.proto (3)

70-70: New Enum Value in Network: Ensure Seamless Backwards Compatibility

The new enum value sui = 12; within the Network enum extends the supported networks by appending to the previous value (worldchain = 11). Please verify that all systems consuming this enum correctly handle the new SUI network type and that there is no conflict with existing values.


91-91: New Enum Value in Vm: Validate SUI Virtual Machine Integration

The addition of mvm_sui = 4; to the Vm enum introduces support for the SUI virtual machine. Ensure that any components or services relying on VM type information are updated to account for this new value and that corresponding tests validate its proper usage.


107-107: New Enum Value in Consensus: Confirm Consensus Mechanism Support

The inclusion of sui_consensus = 8; in the Consensus enum extends the consensus algorithm options to support SUI. Confirm that the OpenAPI specifications, business logic, and tests in the chains package reflect this new consensus type to avoid integration issues.

Copy link

codecov bot commented Feb 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.42%. Comparing base (2bcd4f5) to head (946795b).
Report is 2 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3489   +/-   ##
========================================
  Coverage    65.41%   65.42%           
========================================
  Files          442      442           
  Lines        30522    30525    +3     
========================================
+ Hits         19967    19970    +3     
  Misses        9700     9700           
  Partials       855      855           
Files with missing lines Coverage Δ
pkg/chains/chains.go 100.00% <100.00%> (ø)

@lumtis lumtis added this pull request to the merge queue Feb 7, 2025
Merged via the queue into develop with commit 5bd636c Feb 7, 2025
46 checks passed
@lumtis lumtis deleted the chains/sui-info-2 branch February 7, 2025 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add SUI chain information in the chains package
4 participants