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

fix: cherry pick athens3 hotfixes #3253

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

ws4charlie
Copy link
Contributor

@ws4charlie ws4charlie commented Dec 6, 2024

Description

This PR includes two zetaclient hotfixes in Athens3:

How Has This Been Tested?

  • Tested CCTX in localnet
  • Tested in development environment
  • Go unit tests
  • Go integration tests
  • Tested via GitHub Actions

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new telemetry endpoint /systemtime in the ZetaChain client.
  • Bug Fixes

    • Enhanced handling of unsupported transaction versions for Solana.
    • Improved validation for inbound vote message processing.
    • Implemented separate database file naming for Bitcoin signet and testnet4.
    • Adjusted the TSS keysigning process for better operational flow.
  • Tests

    • Added a new test for retrieving signatures for Solana addresses, improving testing coverage.
  • Refactor

    • Revamped the TSS package for better structure and functionality, along with various code quality improvements.

Copy link
Contributor

coderabbitai bot commented Dec 6, 2024

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

Walkthrough

The pull request introduces multiple enhancements and fixes to the ZetaChain node, including the addition of a new telemetry endpoint /systemtime in the zetaclient. It improves error handling for Solana transaction processing, particularly for unsupported versions, and refines the TSS keysigning process. The testing framework has been updated with new tests, and several refactoring efforts have been made to enhance code quality. The changelog has been updated to reflect these changes, ensuring comprehensive documentation of the updates across various versions.

Changes

File Path Change Summary
changelog.md Updated to include new features, tests, refactors, and fixes, notably the /systemtime endpoint, improvements in transaction handling for Solana, and TSS package revamp.
zetaclient/chains/solana/observer/inbound_tracker.go Enhanced error handling for transaction retrieval; replaced Solana RPC package with a custom one; introduced logging for unsupported transaction versions.
zetaclient/chains/solana/rpc/rpc.go Updated GetTransaction to include a default Commitment parameter; refined error handling for unsupported transaction versions in GetSignaturesForAddressUntil.
zetaclient/chains/solana/rpc/rpc_live_test.go Added LiveTest_GetSignaturesForAddressUntil_Version0 to validate signature retrieval for version "0"; modified existing tests to include the new test case.
zetaclient/chains/solana/signer/signer.go Duplicated relayer key check in TryProcessOutbound method to enhance error handling; no changes to method signatures or transaction logic.
zetaclient/keys/relayer_key.go Added logging for missing relayer key file in LoadRelayerKey function to improve error feedback; no changes to method signatures or functionality.

Possibly related PRs

Suggested labels

no-changelog, V2_TESTS

Suggested reviewers

  • fbac
  • kingpinXD
  • skosito
  • lumtis
  • brewmaster012
  • swift1337

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 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.

@ws4charlie ws4charlie added zetaclient Issues related to ZetaClient chain:solana SOLANA_TESTS Run make start-solana-test bug Something isn't working labels Dec 6, 2024
@ws4charlie ws4charlie marked this pull request as ready for review December 6, 2024 04:23
@ws4charlie ws4charlie requested a review from a team as a code owner December 6, 2024 04:23
Copy link

codecov bot commented Dec 6, 2024

Codecov Report

Attention: Patch coverage is 13.33333% with 13 lines in your changes missing coverage. Please review.

Project coverage is 61.75%. Comparing base (bc1d8ae) to head (bf28edf).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
...taclient/chains/solana/observer/inbound_tracker.go 0.00% 6 Missing ⚠️
zetaclient/chains/solana/signer/signer.go 0.00% 4 Missing ⚠️
zetaclient/chains/solana/rpc/rpc.go 0.00% 3 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##           develop    #3253   +/-   ##
========================================
  Coverage    61.74%   61.75%           
========================================
  Files          431      431           
  Lines        30772    30772           
========================================
+ Hits         19001    19004    +3     
+ Misses       10914    10911    -3     
  Partials       857      857           
Files with missing lines Coverage Δ
zetaclient/keys/relayer_key.go 90.32% <100.00%> (+0.32%) ⬆️
zetaclient/chains/solana/rpc/rpc.go 0.00% <0.00%> (ø)
zetaclient/chains/solana/signer/signer.go 23.23% <0.00%> (+0.09%) ⬆️
...taclient/chains/solana/observer/inbound_tracker.go 0.00% <0.00%> (ø)

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: 3

🧹 Outside diff range and nitpick comments (2)
zetaclient/chains/solana/observer/inbound_tracker.go (1)

67-67: Enhance warning message with transaction context

The warning message could be more helpful for debugging by including additional context.

-			ob.Logger().Inbound.Warn().Stringer("tx.signature", signature).Msg("skip inbound tracker hash")
+			ob.Logger().Inbound.Warn().
+				Stringer("tx.signature", signature).
+				Str("chain_id", chainID.String()).
+				Msg("skipping inbound tracker: unsupported transaction version")
zetaclient/chains/solana/rpc/rpc_live_test.go (1)

93-95: Consider extracting test constants

The hardcoded signature could become invalid if the devnet state changes.

Consider moving test constants to a dedicated test constants file:

// testdata/constants.go
var DevnetTestSignatures = map[chains.Chain]string{
    chains.SolanaDevnet: "39fSgD2nteJCQRQP3ynqEcDMZAFSETCbfb61AUqLU6y7qbzSJL5rn2DHU2oM35zsf94Feb5C5QWd5L5UnncBsAay",
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 96099ee and 2463828.

📒 Files selected for processing (6)
  • changelog.md (1 hunks)
  • zetaclient/chains/solana/observer/inbound_tracker.go (2 hunks)
  • zetaclient/chains/solana/rpc/rpc.go (2 hunks)
  • zetaclient/chains/solana/rpc/rpc_live_test.go (3 hunks)
  • zetaclient/chains/solana/signer/signer.go (1 hunks)
  • zetaclient/keys/relayer_key.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
zetaclient/keys/relayer_key.go (1)

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

zetaclient/chains/solana/observer/inbound_tracker.go (1)

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

zetaclient/chains/solana/rpc/rpc_live_test.go (1)

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

zetaclient/chains/solana/rpc/rpc.go (1)

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

zetaclient/chains/solana/signer/signer.go (1)

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

🪛 GitHub Check: codecov/patch
zetaclient/chains/solana/observer/inbound_tracker.go

[warning] 64-69: zetaclient/chains/solana/observer/inbound_tracker.go#L64-L69
Added lines #L64 - L69 were not covered by tests

zetaclient/chains/solana/rpc/rpc.go

[warning] 88-89: zetaclient/chains/solana/rpc/rpc.go#L88-L89
Added lines #L88 - L89 were not covered by tests


[warning] 136-136: zetaclient/chains/solana/rpc/rpc.go#L136
Added line #L136 was not covered by tests

zetaclient/chains/solana/signer/signer.go

[warning] 166-169: zetaclient/chains/solana/signer/signer.go#L166-L169
Added lines #L166 - L169 were not covered by tests

🪛 LanguageTool
changelog.md

[style] ~22-~22: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ... version 0 queries and move tss keysign prior to relayer key checking ## v23.0.0 ### F...

(EN_WORDINESS_PREMIUM_PRIOR_TO)

🔇 Additional comments (4)
zetaclient/keys/relayer_key.go (1)

72-72: 🛠️ Refactor suggestion

Use structured logging consistently

The warning uses the global logger directly. Consider using structured logging for consistency.

-	log.Logger.Warn().Msgf("relayer key file not found: %s", fileName)
+	log.Warn().
+		Str("file", fileName).
+		Str("network", network.String()).
+		Msg("relayer key file not found")

Likely invalid or redundant comment.

zetaclient/chains/solana/rpc/rpc.go (2)

88-89: Improve test coverage for error handling logic.

The error handling for unsupported transaction versions is a critical path that should be covered by tests.

Run the following script to check existing test coverage:

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 88-89: zetaclient/chains/solana/rpc/rpc.go#L88-L89
Added lines #L88 - L89 were not covered by tests


136-136: Verify commitment level configuration.

The commitment level is hardcoded to rpc.CommitmentFinalized. Consider making this configurable through chain parameters if different commitment levels are needed for different scenarios.

🧰 Tools
🪛 GitHub Check: codecov/patch

[warning] 136-136: zetaclient/chains/solana/rpc/rpc.go#L136
Added line #L136 was not covered by tests

changelog.md (1)

22-22: LGTM! Changelog entry is accurate and complete.

The changelog entry correctly documents both changes:

  1. Fix for Solana inbound version 0 queries
  2. Moving TSS keysign prior to relayer key checking

These align with the code changes observed in rpc.go and signer.go.

🧰 Tools
🪛 LanguageTool

[style] ~22-~22: ‘prior to’ might be wordy. Consider a shorter alternative.
Context: ... version 0 queries and move tss keysign prior to relayer key checking ## v23.0.0 ### F...

(EN_WORDINESS_PREMIUM_PRIOR_TO)

@ws4charlie ws4charlie enabled auto-merge December 6, 2024 18:15
@ws4charlie ws4charlie added this pull request to the merge queue Dec 6, 2024
Merged via the queue into develop with commit 2cd0b73 Dec 6, 2024
40 of 41 checks passed
@ws4charlie ws4charlie deleted the cherry-pick-athens3-solana-fixes branch December 6, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working chain:solana SOLANA_TESTS Run make start-solana-test zetaclient Issues related to ZetaClient
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants