feat: add Solana RPC status check and some refactor around RPC status check
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.
[!IMPORTANT]
Review skipped
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the
.coderabbit.yamlfile in this repository. To trigger a single review, invoke the@coderabbitai reviewcommand.You can disable this status message by setting the
reviews.review_statustofalsein 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?
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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere 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.
!!!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.
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.
Additional details and impacted files
@@ 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 |
What is the status on this one @ws4charlie ?