node icon indicating copy to clipboard operation
node copied to clipboard

feat: add Solana RPC status check and some refactor around RPC status check

Open ws4charlie opened this issue 1 year ago • 3 comments

Description

  • [x] Add RPC status check for Solana chain.
  • [x] Refactor EVM/Bitcoin RPC status check.

How Has This Been Tested?

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

Summary by CodeRabbit

  • New Features

    • Introduced real-time RPC status monitoring for Solana and Bitcoin chains.
    • Added functionality for checking RPC status and retrieving block time for the Solana chain.
  • Bug Fixes

    • Enhanced logging for better monitoring of RPC connections.
  • Documentation

    • Updated changelog to reflect new features and improvements.
  • Tests

    • Expanded test suite with new functions for checking RPC status for Bitcoin and Solana chains.

ws4charlie avatar Aug 20 '24 05:08 ws4charlie

[!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 update introduces significant enhancements to the RPC monitoring capabilities across multiple blockchain chains, including Bitcoin, Ethereum, and Solana. Key features include the addition of new methods for checking RPC statuses, improved latency thresholds, and the restructuring of observer functionalities. These changes aim to enhance real-time monitoring, interoperability, and operational transparency within the ecosystem, ultimately improving the reliability of blockchain interactions.

Changes

File Path Change Summary
zetaclient/chains/bitcoin/observer/... Removed WatchRPCStatus method; updated comments in GetSenderAddressByVin.
zetaclient/chains/bitcoin/rpc/... Added rpcLatencyThreshold constant and CheckRPCStatus function for enhanced RPC monitoring.
zetaclient/chains/bitcoin/rpc/rpc_live_test.go Introduced LiveTestCheckRPCStatus for testing RPC status.
zetaclient/chains/evm/observer/... Removed WatchRPCStatus method; adjusted observer functionality.
zetaclient/chains/evm/rpc/... Added rpcLatencyThreshold and CheckRPCStatus function.
zetaclient/chains/evm/rpc/rpc_live_test.go New function LiveTest_CheckRPCStatus for testing.
zetaclient/chains/interfaces/interfaces.go Added GetBlockTime method to SolanaRPCClient interface.
zetaclient/chains/solana/observer/... Introduced background worker for monitoring RPC status; added WatchRPCStatus method.
zetaclient/chains/solana/rpc/... Added rpcLatencyThreshold and CheckRPCStatus function for health checks.
zetaclient/chains/solana/rpc/rpc_live_test.go Introduced LiveTest_CheckRPCStatus.
zetaclient/common/constant.go Added RPCStatusCheckInterval constant for status checks.
zetaclient/testutils/mocks/solana_rpc.go New GetBlockTime method in the SolanaRPCClient mock implementation.

Sequence Diagram(s)

sequenceDiagram
    participant Observer as Observer
    participant RPCClient as RPC Client
    participant Logger as Logger

    Observer->>RPCClient: CheckRPCStatus()
    RPCClient-->>Observer: Return status
    Observer->>Logger: Log RPC status
    Note over Observer: Periodic checks based on RPCStatusCheckInterval

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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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.

coderabbitai[bot] avatar Aug 20 '24 05:08 coderabbitai[bot]

!!!WARNING!!! nosec detected in the following files: zetaclient/chains/evm/rpc/rpc.go

Be very careful about using #nosec in code. It can be a quick way to suppress security warnings and move forward with development, it should be employed with caution. Suppressing warnings with #nosec can hide potentially serious vulnerabilities. Only use #nosec when you're absolutely certain that the security issue is either a false positive or has been mitigated in another way.

Only suppress a single rule (or a specific set of rules) within a section of code, while continuing to scan for other problems. To do this, you can list the rule(s) to be suppressed within the #nosec annotation, e.g: /* #nosec G401 */ or //#nosec G201 G202 G203 Broad #nosec annotations should be avoided, as they can hide other vulnerabilities. The CI will block you from merging this PR until you remove #nosec annotations that do not target specific rules.

Pay extra attention to the way #nosec is being used in the files listed above.

github-actions[bot] avatar Aug 20 '24 05:08 github-actions[bot]

Codecov Report

Attention: Patch coverage is 17.69231% with 107 lines in your changes missing coverage. Please review.

Project coverage is 66.89%. Comparing base (75a4189) to head (a7fee2c). Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
zetaclient/chains/bitcoin/observer/rpc_status.go 0.00% 18 Missing :warning:
zetaclient/chains/solana/observer/rpc_status.go 0.00% 18 Missing :warning:
zetaclient/chains/evm/observer/rpc_status.go 0.00% 17 Missing :warning:
zetaclient/chains/bitcoin/rpc/rpc.go 0.00% 16 Missing :warning:
zetaclient/chains/evm/rpc/rpc.go 0.00% 12 Missing :warning:
zetaclient/chains/solana/rpc/rpc.go 0.00% 12 Missing :warning:
zetaclient/config/config_chain.go 0.00% 10 Missing :warning:
zetaclient/chains/bitcoin/observer/observer.go 50.00% 1 Missing :warning:
zetaclient/chains/evm/observer/observer.go 50.00% 1 Missing :warning:
zetaclient/chains/solana/observer/observer.go 50.00% 1 Missing :warning:
... and 1 more
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #2751      +/-   ##
===========================================
- Coverage    66.94%   66.89%   -0.05%     
===========================================
  Files          373      377       +4     
  Lines        21032    21082      +50     
===========================================
+ Hits         14080    14103      +23     
- Misses        6288     6315      +27     
  Partials       664      664              
Files with missing lines Coverage Δ
zetaclient/chains/base/observer.go 86.93% <100.00%> (+0.83%) :arrow_up:
zetaclient/config/types.go 11.62% <ø> (ø)
zetaclient/orchestrator/bootstrap.go 58.95% <100.00%> (+0.54%) :arrow_up:
zetaclient/chains/bitcoin/observer/observer.go 38.31% <50.00%> (+5.42%) :arrow_up:
zetaclient/chains/evm/observer/observer.go 74.50% <50.00%> (+12.42%) :arrow_up:
zetaclient/chains/solana/observer/observer.go 40.62% <50.00%> (+0.30%) :arrow_up:
zetaclient/common/env.go 83.33% <83.33%> (ø)
zetaclient/config/config_chain.go 12.00% <0.00%> (-0.77%) :arrow_down:
zetaclient/chains/evm/rpc/rpc.go 0.00% <0.00%> (ø)
zetaclient/chains/solana/rpc/rpc.go 0.00% <0.00%> (ø)
... and 4 more

codecov[bot] avatar Aug 20 '24 05:08 codecov[bot]

What is the status on this one @ws4charlie ?

lumtis avatar Sep 02 '24 08:09 lumtis