Skip to content
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

feat(zetaclient): SUI observer–signer setup #3516

Merged
merged 26 commits into from
Feb 12, 2025
Merged

Conversation

swift1337
Copy link
Contributor

@swift1337 swift1337 commented Feb 11, 2025

This is an initial work in zetaclient regarding support for SUI

  • Observer-signer boilerplate
  • Observer-signer bootstrapping
  • Configs
  • Basic SUI client
  • Healthchecks
  • GasPrice observation
  • Establish testing framework & mocks

Based on #3500
Closes #3473

Summary by CodeRabbit

  • New Features

    • Introduced comprehensive SUI blockchain support, including enhanced confirmation parameters and modes.
    • Added a new tool command for tracking cross-chain transactions.
    • Enabled RPC access on port 9000 for SUI connectivity.
  • Documentation

    • Streamlined changelog organization for clearer version tracking and improved usability.

These updates expand cross-chain capabilities and improve system configuration, providing a smoother and more robust user experience.

@swift1337 swift1337 self-assigned this Feb 11, 2025
Copy link
Contributor

coderabbitai bot commented Feb 11, 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

This pull request introduces extensive modifications to expand support for the SUI blockchain. The changes include a reorganization of the changelog with duplicated fix entries, additions of new features (such as ConfirmationParams, ConfirmationMode, and a track-cctx command), and updates to configuration files and docker-compose. New packages, files, and methods have been added for SUI gateway functionality, inbound event parsing, client, observer, signer, and integration within the orchestrator. Additionally, comprehensive unit and live tests along with SUI-specific mocks and RPC test servers have been introduced.

Changes

Files Change Summary
changelog.md Duplicated fix entry removed; reorganization with added ConfirmationParams, ConfirmationMode, and new track-cctx command.
contrib/localnet/docker-compose.yml Added port mapping 9000:9000 for the sui service (RPC access).
e2e/runner/setup_sui.go, e2e/utils/sui/gateway.go Updated import and function call for gateway module in setup_sui.go; removed redundant sui gateway embedding in utils/gateway.go.
pkg/chains/chain.go Added IsSUIChain function to determine SUI chain membership.
pkg/contracts/sui/gateway.go, pkg/contracts/sui/gateway_test.go, pkg/contracts/sui/inbound.go, pkg/contracts/sui/inbound_test.go Introduced SUI gateway and inbound event parsing functionality with accompanying test coverage.
zetaclient/chains/sui/client/client.go, client_live_test.go, observer/observer.go, observer/observer_test.go, signer/signer.go, sui.go Added new SUI client, observer, signer, and observer-signer integration with live and unit tests.
zetaclient/config/config_chain.go, zetaclient/config/types.go Integrated new SUI configuration, including suiConfigLocalnet() and SUIConfig type with a getter method.
zetaclient/context/chain.go Added IsSUI method to determine SUI chain within application context.
zetaclient/orchestrator/v2_bootstrap.go, v2_bootstrap_test.go, v2_orchestrator.go, v2_orchestrator_test.go Enhanced orchestrator with SUI bootstrap logic and updated chain synchronization tests to support SUI.
zetaclient/testutils/mocks/sui_client.go, sui_gen.go, testrpc/rpc_sui.go Introduced SUI client mock implementations and a test RPC server for SUI.

Sequence Diagram(s)

sequenceDiagram
    participant Orchestrator
    participant AppContext
    participant Config
    participant BaseObserver
    participant SUIClient
    participant SUIObserver
    participant SUISigner
    participant SUIIntegration
    participant Scheduler

    Orchestrator->>AppContext: Verify chain type (IsSUI())
    AppContext->>Config: Retrieve SUIConfig
    Config-->>AppContext: Return endpoint details
    AppContext->>BaseObserver: Initialize base observer
    AppContext->>SUIClient: Create client with endpoint
    AppContext->>SUIObserver: Instantiate observer with BaseObserver & SUIClient
    AppContext->>SUISigner: Create signer (via base signer)
    AppContext->>SUIIntegration: Construct SUI integration (scheduler, observer, signer)
    SUIIntegration->>Scheduler: Start scheduling tasks
Loading

Possibly related PRs

Suggested labels

breaking:cli, PERFORMANCE_TESTS

Suggested reviewers

  • gartnera
  • ws4charlie
  • lumtis
  • brewmaster012

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.

@gartnera gartnera added the SUI_TESTS Run make start-sui-tests label Feb 11, 2025
@swift1337 swift1337 changed the title feat(zetaclient): SUI observer–signer [WIP] feat(zetaclient): SUI observer–signer setup Feb 12, 2025
@swift1337 swift1337 added the no-changelog Skip changelog CI check label Feb 12, 2025
@swift1337 swift1337 marked this pull request as ready for review February 12, 2025 13:24
@swift1337 swift1337 requested a review from a team as a code owner February 12, 2025 13:24
Copy link

codecov bot commented Feb 12, 2025

Codecov Report

Attention: Patch coverage is 50.33113% with 75 lines in your changes missing coverage. Please review.

Project coverage is 65.46%. Comparing base (be5964c) to head (5ea7b3a).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
zetaclient/chains/sui/observer/observer.go 41.02% 18 Missing and 5 partials ⚠️
zetaclient/chains/sui/client/client.go 0.00% 22 Missing ⚠️
zetaclient/orchestrator/v2_bootstrap.go 50.00% 8 Missing and 4 partials ⚠️
zetaclient/chains/sui/sui.go 81.25% 6 Missing and 3 partials ⚠️
zetaclient/config/types.go 0.00% 5 Missing ⚠️
pkg/chains/chain.go 0.00% 2 Missing ⚠️
zetaclient/context/chain.go 0.00% 2 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3516      +/-   ##
===========================================
- Coverage    65.52%   65.46%   -0.07%     
===========================================
  Files          445      449       +4     
  Lines        30606    30757     +151     
===========================================
+ Hits         20055    20134      +79     
- Misses        9697     9758      +61     
- Partials       854      865      +11     
Files with missing lines Coverage Δ
zetaclient/chains/sui/signer/signer.go 100.00% <100.00%> (ø)
zetaclient/config/config_chain.go 100.00% <100.00%> (ø)
zetaclient/orchestrator/v2_orchestrator.go 71.61% <100.00%> (+0.25%) ⬆️
pkg/chains/chain.go 81.45% <0.00%> (-1.10%) ⬇️
zetaclient/context/chain.go 68.57% <0.00%> (-1.34%) ⬇️
zetaclient/config/types.go 47.56% <0.00%> (-3.09%) ⬇️
zetaclient/chains/sui/sui.go 81.25% <81.25%> (ø)
zetaclient/orchestrator/v2_bootstrap.go 59.24% <50.00%> (+0.41%) ⬆️
zetaclient/chains/sui/client/client.go 0.00% <0.00%> (ø)
zetaclient/chains/sui/observer/observer.go 41.02% <41.02%> (ø)

pkg/chains/chain.go Outdated Show resolved Hide resolved
pkg/chains/chain.go Outdated Show resolved Hide resolved
zetaclient/config/types.go Outdated Show resolved Hide resolved
zetaclient/orchestrator/v2_bootstrap.go Outdated Show resolved Hide resolved
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: 6

🔭 Outside diff range comments (1)
changelog.md (1)

17-26: ⚠️ Potential issue

Remove duplicate "Fixes" section.

There is a duplicate "Fixes" section containing the same entry about fixing E2E test failure caused by nil ConfirmationParams. This redundancy should be removed to avoid confusion.

Apply this diff to remove the duplicate section:

### Fixes

* [3501](https://github.com/zeta-chain/node/pull/3501) - fix E2E test failure caused by nil `ConfirmationParams` for Solana and TON
* [3509](https://github.com/zeta-chain/node/pull/3509) - schedule Bitcoin TSS keysign on interval to avoid TSS keysign spam
* [3517](https://github.com/zeta-chain/node/pull/3517) - remove duplicate gateway event appending to fix false positive on multiple events in same tx

-### Fixes
-
-* [3501](https://github.com/zeta-chain/node/pull/3501) - fix E2E test failure caused by nil `ConfirmationParams` for Solana and TON
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

23-23: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

🧹 Nitpick comments (15)
zetaclient/chains/sui/observer/observer.go (2)

36-47: Consider storing the returned block time for diagnostic or monitoring.
After calling HealthCheck, caching the block timestamp or height locally might help track RPC status trends or perform advanced diagnostic checks.


62-88: Validate potential edge cases for gas price or epoch values.
While you handle errors for invalid checkpoints and gas prices, consider logging or retrying if the values returned by RPC are unexpectedly zero or negative (if ever possible).

zetaclient/chains/sui/sui.go (3)

35-85: Refine task registration logic for improved manageability.
Centralizing or grouping the scheduler tasks (e.g., inbound/outbound observation, block subscription) under a cohesive framework could ease maintenance.


87-91: Stopping tasks is effective, but confirm graceful shutdown.
Ensure that Stop() logic provides enough time for ongoing tasks to finalize, preventing abrupt interruptions.


97-101: Implement or remove the placeholder for outbound CCTX scheduling.
This stub currently returns nil. If scheduling is still in design, consider a TODO reference with details. Otherwise, provide an implementation or remove the method.

zetaclient/testutils/testrpc/rpc_sui.go (1)

23-23: Address the TODO comment.

The TODO comment should be addressed or removed before merging.

Would you like me to help implement the missing functionality or open an issue to track this task?

zetaclient/chains/sui/client/client_live_test.go (1)

12-14: Consider using testnet for live tests.

Using mainnet RPC endpoint for tests might lead to rate limiting or unnecessary load on production infrastructure.

-	RpcMainnet = "https://sui-mainnet.public.blastapi.io"
+	RpcTestnet = "https://sui-testnet.public.blastapi.io"
pkg/contracts/sui/inbound_test.go (1)

10-42: Consider adding edge cases to the test suite.

While the current test cases cover basic scenarios, consider adding edge cases:

  • Empty CoinType
  • Zero amount
  • Empty sender/receiver addresses
 		},
+		{
+			name: "empty coin type",
+			d: &sui.Inbound{
+				TxHash:     "0x123",
+				EventIndex: 1,
+				CoinType:   "",
+				Amount:     100,
+				Sender:     "0x456",
+				Receiver:   sample.EthAddress(),
+				Payload:    nil,
+			},
+			want: false,
+		},
 	}
zetaclient/chains/sui/client/client.go (2)

36-39: Use constant for base in ParseInt.

Define a constant for the base parameter in strconv.ParseInt to improve code readability and maintainability.

+const (
+    base10 = 10
+)

-ts, err := strconv.ParseInt(checkpoint.TimestampMs, 10, 64)
+ts, err := strconv.ParseInt(checkpoint.TimestampMs, base10, 64)

52-54: Use strconv.FormatInt for better performance.

Replace fmt.Sprintf with strconv.FormatInt for converting sequence number to string, as it's more efficient for integer conversions.

-return c.SuiGetCheckpoint(ctx, models.SuiGetCheckpointRequest{
-    CheckpointID: fmt.Sprintf("%d", seqNum),
-})
+return c.SuiGetCheckpoint(ctx, models.SuiGetCheckpointRequest{
+    CheckpointID: strconv.FormatInt(seqNum, 10),
+})
e2e/runner/setup_sui.go (1)

69-70: Address TODO comment about saving IDs.

The TODO comment indicates missing functionality for saving IDs in config and configuring the chain. I can help implement this requirement.

Would you like me to help implement the ID saving functionality or create an issue to track this task?

pkg/contracts/sui/inbound.go (2)

46-53: Add validation for zero amounts.

The amount parsing logic should validate that the amount is greater than zero to prevent processing of zero-value transactions.

 amount, err := strconv.ParseUint(parsedAmount, 10, 64)
 if err != nil {
   return Inbound{}, errors.Wrap(err, "failed to parse amount")
 }
+if amount == 0 {
+  return Inbound{}, errors.New("amount cannot be zero")
+}

98-99: Add function documentation.

The convertPayload function lacks documentation explaining its purpose and parameters.

-// convertPayload
+// convertPayload converts a slice of interface{} to a byte slice.
+// Each element in the input slice must be a float64 representing a byte value (0-255).
+// Returns an error if any element is not a float64 or is outside the valid byte range.
pkg/contracts/sui/gateway.go (1)

65-88: Return nil slice with error.

When returning an error, it's idiomatic in Go to return a nil slice rather than an empty slice.

-    return []Inbound{}, err
+    return nil, err
pkg/contracts/sui/gateway_test.go (1)

18-18: Move RPC endpoint to configuration.

The testnet RPC endpoint is hardcoded. Consider moving it to a configuration file or environment variable for better maintainability.

Apply this diff:

-const rpcTestnet = "https://sui-testnet-endpoint.blockvision.org"
+var rpcTestnet = getEnvOrDefault("SUI_TESTNET_RPC", "https://sui-testnet-endpoint.blockvision.org")
+
+func getEnvOrDefault(key, defaultValue string) string {
+    if value := os.Getenv(key); value != "" {
+        return value
+    }
+    return defaultValue
+}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 8eb28e6 and e39953a.

📒 Files selected for processing (25)
  • changelog.md (1 hunks)
  • contrib/localnet/docker-compose.yml (1 hunks)
  • e2e/runner/setup_sui.go (2 hunks)
  • e2e/utils/sui/gateway.go (0 hunks)
  • pkg/chains/chain.go (1 hunks)
  • pkg/contracts/sui/gateway.go (1 hunks)
  • pkg/contracts/sui/gateway_test.go (1 hunks)
  • pkg/contracts/sui/inbound.go (1 hunks)
  • pkg/contracts/sui/inbound_test.go (1 hunks)
  • zetaclient/chains/sui/client/client.go (1 hunks)
  • zetaclient/chains/sui/client/client_live_test.go (1 hunks)
  • zetaclient/chains/sui/observer/observer.go (1 hunks)
  • zetaclient/chains/sui/observer/observer_test.go (1 hunks)
  • zetaclient/chains/sui/signer/signer.go (1 hunks)
  • zetaclient/chains/sui/sui.go (1 hunks)
  • zetaclient/config/config_chain.go (2 hunks)
  • zetaclient/config/types.go (3 hunks)
  • zetaclient/context/chain.go (1 hunks)
  • zetaclient/orchestrator/v2_bootstrap.go (2 hunks)
  • zetaclient/orchestrator/v2_bootstrap_test.go (2 hunks)
  • zetaclient/orchestrator/v2_orchestrator.go (1 hunks)
  • zetaclient/orchestrator/v2_orchestrator_test.go (2 hunks)
  • zetaclient/testutils/mocks/sui_client.go (1 hunks)
  • zetaclient/testutils/mocks/sui_gen.go (1 hunks)
  • zetaclient/testutils/testrpc/rpc_sui.go (1 hunks)
💤 Files with no reviewable changes (1)
  • e2e/utils/sui/gateway.go
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.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.

  • zetaclient/testutils/mocks/sui_gen.go
  • pkg/chains/chain.go
  • zetaclient/context/chain.go
  • zetaclient/orchestrator/v2_orchestrator.go
  • e2e/runner/setup_sui.go
  • zetaclient/testutils/testrpc/rpc_sui.go
  • zetaclient/chains/sui/signer/signer.go
  • zetaclient/config/types.go
  • pkg/contracts/sui/inbound_test.go
  • zetaclient/chains/sui/observer/observer_test.go
  • zetaclient/chains/sui/client/client_live_test.go
  • zetaclient/chains/sui/observer/observer.go
  • zetaclient/orchestrator/v2_bootstrap.go
  • pkg/contracts/sui/inbound.go
  • zetaclient/chains/sui/sui.go
  • zetaclient/chains/sui/client/client.go
  • zetaclient/orchestrator/v2_orchestrator_test.go
  • zetaclient/config/config_chain.go
  • pkg/contracts/sui/gateway_test.go
  • zetaclient/orchestrator/v2_bootstrap_test.go
  • pkg/contracts/sui/gateway.go
  • zetaclient/testutils/mocks/sui_client.go
🪛 markdownlint-cli2 (0.17.2)
changelog.md

23-23: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: start-e2e-test / e2e
  • GitHub Check: build-and-test
🔇 Additional comments (27)
changelog.md (1)

1-893: LGTM!

The changelog follows good practices with:

  • Clear categorization of changes (Features, Fixes, Refactor, etc.)
  • PR references for each change
  • Detailed descriptions of changes
  • Breaking changes clearly highlighted
  • Version history well maintained
🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

23-23: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


163-163: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


167-167: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


169-169: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


175-175: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


177-177: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


179-179: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


180-180: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


184-184: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


186-186: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


190-190: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


192-192: Unordered list style
Expected: asterisk; Actual: dash

(MD004, ul-style)


600-600: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


602-602: Bare URL used
null

(MD034, no-bare-urls)


647-647: Multiple headings with the same content
null

(MD024, no-duplicate-heading)


703-703: Multiple headings with the same content
null

(MD024, no-duplicate-heading)

zetaclient/chains/sui/observer/observer.go (3)

14-18: Struct design looks clean and concise.
The Observer struct embeds base.Observer and holds an RPC client. This design cleanly separates base logic from SUI-specific logic.


49-61: Documentation clarity is commendable.
The extended block comments thoroughly highlight the intricacies of gas price dynamics in SUI, giving future developers a solid reference.


90-97: Robust utility for parsing string to uint64.
Wrapping the error ensures clarity when troubleshooting invalid input values.

zetaclient/chains/sui/sui.go (1)

18-23: Structured approach to observer-signer integration.
The SUI struct’s fields are succinctly organized, enabling seamless interplay between scheduler, observer, and signer.

zetaclient/chains/sui/signer/signer.go (2)

6-8: Inheritance from base signer is straightforward.
Embedding base.Signer fosters reuse of core features without code duplication.


10-13: Consider validating the base signer instance.
If baseSigner can be nil, adding a check or returning an error would prevent potential runtime panics.

zetaclient/testutils/testrpc/rpc_sui.go (2)

9-13: LGTM! Well-structured server definition.

The SUIServer struct is well-designed with clear field definitions and appropriate embedding of the base Server type.


15-21: LGTM! Clean constructor implementation.

The NewSUIServer function follows good practices:

  • Clear parameter and return types
  • Proper initialization of all fields
  • Returns both server and config for convenience
zetaclient/testutils/mocks/sui_gen.go (2)

10-15: LGTM! Well-documented mock generation setup.

The interface documentation and mock generation directives are clear and follow best practices:

  • Purpose of unexported interface is explained
  • Proper use of go:generate directive
  • Appropriate linter directive

15-21: LGTM! Comprehensive interface definition.

The interface includes all essential SUI client methods with proper context support and error handling.

zetaclient/chains/sui/client/client_live_test.go (2)

23-36: LGTM! Well-structured test implementation.

The test follows best practices:

  • Clear AAA pattern (Arrange, Act, Assert)
  • Proper error handling and assertions
  • Helpful logging of results

38-49: LGTM! Clean test suite implementation.

The test suite is well-designed:

  • Proper encapsulation of test dependencies
  • Clear constructor function
  • Good use of context
pkg/contracts/sui/inbound_test.go (1)

43-52: LGTM! Clean test implementation.

The test implementation follows best practices:

  • Clear table-driven test pattern
  • Good use of subtests
  • Proper assertions using require
zetaclient/config/config_chain.go (1)

53-57: LGTM!

The SUI configuration follows the established pattern for other chains and maintains consistency with existing localnet configurations.

e2e/runner/setup_sui.go (1)

10-11: LGTM!

The import path change to use the new zetasui package is appropriate and follows good package organization practices.

zetaclient/chains/sui/observer/observer_test.go (1)

64-65: Clarify TODO comment about zctx.

The TODO comment about zctx with chain & params needs more context. Consider adding a detailed explanation or linking to relevant issues/PRs.

Could you provide more context about the planned changes for zctx in future PRs?

zetaclient/testutils/mocks/sui_client.go (1)

1-145: LGTM! Auto-generated mock implementation.

The mock implementation is complete and follows the standard mockery patterns.

zetaclient/context/chain.go (1)

177-179: LGTM! Clean implementation following existing patterns.

The IsSUI method is well-integrated and follows the established pattern of other chain type checks.

zetaclient/config/types.go (2)

58-61: Update comment style to match project conventions.

Based on past review feedback, "Sui" is preferred over "SUI" in comments.

Apply this diff to fix the comment:

-// SUIConfig is the config for SUI chain
+// SuiConfig is the config for Sui chain

158-164: LGTM! Thread-safe implementation.

The GetSUIConfig method correctly implements thread-safe access using read locks and follows the established pattern of other getter methods.

pkg/chains/chain.go (1)

167-170: Update function name and comment style to match project conventions.

Based on past review feedback, "Sui" is preferred over "SUI" in function names and comments.

Apply this diff to fix the naming:

-// IsSUIChain returns true if the chain is SUI chain.
-func IsSUIChain(chainID int64, additionalChains []Chain) bool {
+// IsSuiChain returns true if the chain is Sui chain.
+func IsSuiChain(chainID int64, additionalChains []Chain) bool {
zetaclient/orchestrator/v2_orchestrator.go (1)

172-174: LGTM! Consistent implementation.

The SUI case follows the established pattern of other chain types and maintains consistent error handling.

zetaclient/orchestrator/v2_bootstrap_test.go (2)

159-195: LGTM! Comprehensive test coverage.

The SUI test case follows the established pattern and includes thorough assertions for observer signer bootstrapping, scheduler tasks, and logging.


307-313: Implement mock functions for comprehensive testing.

Both mock functions have TODO comments without implementation, which may affect test coverage.

  1. Implement the mock functions to ensure thorough testing.
  2. Consider removing the unused client parameter from mockSolanaCalls.

Apply this diff to fix the unused parameter:

-func mockSolanaCalls(_ *testSuite, _ *testrpc.SolanaServer) {
+func mockSolanaCalls(_ *testSuite) {
pkg/contracts/sui/gateway_test.go (1)

20-22: LGTM! Well-documented test setup.

The comment clearly documents the test setup and provides a reference to the deployed gateway.

contrib/localnet/docker-compose.yml (1)

259-260: LGTM! Proper port mapping for SUI RPC.

The port mapping correctly exposes the SUI RPC endpoint on port 9000, which aligns with the service configuration.

zetaclient/chains/sui/client/client_live_test.go Outdated Show resolved Hide resolved
pkg/contracts/sui/gateway.go Show resolved Hide resolved
zetaclient/orchestrator/v2_bootstrap.go Show resolved Hide resolved
zetaclient/orchestrator/v2_bootstrap.go Show resolved Hide resolved
zetaclient/orchestrator/v2_orchestrator_test.go Outdated Show resolved Hide resolved
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

Looks good as a setup

pkg/contracts/sui/gateway.go Outdated Show resolved Hide resolved
changelog.md Outdated Show resolved Hide resolved
Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

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

looks good to me. left a minor question

@gartnera gartnera dismissed their stale review February 12, 2025 20:22

resolved

@swift1337 swift1337 added this pull request to the merge queue Feb 12, 2025
Merged via the queue into develop with commit b9b0687 Feb 12, 2025
44 of 45 checks passed
@swift1337 swift1337 deleted the feat/sui-observer branch February 12, 2025 22:00
@coderabbitai coderabbitai bot mentioned this pull request Feb 17, 2025
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chain:sui no-changelog Skip changelog CI check SUI_TESTS Run make start-sui-tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Initialize SUI client in ZetaClient
4 participants