-
Notifications
You must be signed in to change notification settings - Fork 110
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: update Solana last scanned block more frequently #3314
fix: update Solana last scanned block more frequently #3314
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 Walkthrough📝 WalkthroughWalkthroughThis pull request introduces significant enhancements to the ZetaChain system, focusing primarily on Solana chain integration and observability. The changes encompass improvements in telemetry, transaction handling, testing frameworks, and system robustness. Key modifications include adding a new Changes
Possibly related PRs
Suggested Labels
Suggested Reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #3314 +/- ##
===========================================
- Coverage 61.77% 61.75% -0.02%
===========================================
Files 440 440
Lines 31163 31171 +8
===========================================
Hits 19251 19251
- Misses 11049 11057 +8
Partials 863 863
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
zetaclient/chains/solana/observer/inbound.go (3)
84-89
: Consider enhancing error handling for last slot queryThe error from
GetSlot
is logged but not propagated, which could mask underlying RPC connectivity issues. Consider propagating this error or implementing a retry mechanism for critical RPC calls.lastSlot, errSlot := ob.solClient.GetSlot(ctx, rpc.CommitmentFinalized) if errSlot != nil { - ob.Logger().Inbound.Err(errSlot).Msg("unable to get last slot") + ob.Logger().Inbound.Error().Err(errSlot).Msg("unable to get last slot") + // Consider implementing exponential backoff retry for RPC calls + // return errors.Wrap(errSlot, "failed to get last finalized slot") }
Line range hint
1-11
: Consider making MaxSignaturesPerTicker configurableWhile 100 signatures per ticker is a reasonable default, this critical parameter affects system performance and resource usage. Consider making it configurable through chain parameters to allow runtime tuning.
Line range hint
150-300
: Consider refactoring FilterInboundEvents for better maintainabilityWhile the function is well-documented, its length and complexity make it harder to maintain. Consider:
- Extracting deposit parsing logic into separate methods
- Creating a common logging helper for duplicate patterns
- Using a strategy pattern for different deposit types
+ // Example refactored structure: + func (ob *Observer) parseDeposit(tx *solana.Transaction, i int, slot uint64) (*Deposit, error) + func (ob *Observer) parseDepositSPL(tx *solana.Transaction, i int, slot uint64) (*Deposit, error) + func (ob *Observer) logDepositEvent(sig string, i int, depositType string)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
changelog.md
(1 hunks)zetaclient/chains/solana/observer/inbound.go
(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
zetaclient/chains/solana/observer/inbound.go (1)
Pattern **/*.go
: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.
🔇 Additional comments (2)
zetaclient/chains/solana/observer/inbound.go (1)
98-103
: LGTM: Well-structured metrics update logic
The implementation correctly updates the last scanned block metric even when no new signatures are found, which aligns with the PR objective to update metrics more frequently. The error check before updating metrics prevents incorrect updates.
changelog.md (1)
31-31
: LGTM: Changes properly documented in changelog
The changelog entry accurately reflects the implementation changes for more frequent updates of the last_scanned_block_number
metrics.
Description
The
last_scanned_block_number
metrics in Solana is updated only when there are new gateway transactions detected. In a low traffic period of time, the value of the metrics won't be increasing and reflecting the actual progress of inbound scanner.Fix:
last_scanned_block_number
.How Has This Been Tested?
Summary by CodeRabbit
/systemtime
in the application.last_scanned_block_number
for more frequent updates.