feat(zetaclient): solana lead relayer
Allow a solana relayer to designate itself the lead relayer. The lead relayer will skip all preflight checks when submitting transactions and assume it's transactions will always succeed. So long as you are submitting your transactions to the same RPC server, it should be safe to submit them as fast as possible so long as they are in order. This is a simple demo for CI and feedback but it will require a few things:
- [x] lead relayer must submit transactions serially.
- [ ] do not increment backoff counter while waiting for next transaction
- [ ] mod nonce scheduling leads to higher nonce getting scheduled before lower nonce
- [ ] lead relayer should configure small priority fee. ref
- [x] non-lead relayer should ideally avoid submitting the transaction the first time to allow lead relayer to take priority and avoid conflicts
- [ ] replace static 2 second wait in current implementation. we should be able to determine if this is the first try based on observed block number and current block number.
- [ ] the lead relayer solana RPC must provide sticky load balancing and should only switch nodes on a failover
- [ ] the api call to load the pda nonce should be deduplicated
- [ ] connect a localnet to a live network to validate this actually works
Initial performance tests show 15-20% performance gain even without these checks.
Note: when you disable preflight checks some relayer funds will be burned if your transaction fails. This is why it's important that the preflight checks are normally enabled.
With most requirements minimally satisfied, we see a 50-60% performance increase which makes solana withdrawals as fast as ethereum 🎉
perf_sol_wit | Latency report:
perf_sol_wit | min: 18.70
perf_sol_wit | max: 23.11
perf_sol_wit | mean: 20.42
perf_sol_wit | std: 0.95
perf_sol_wit | p50: 20.18
perf_sol_wit | p75: 20.86
perf_sol_wit | p90: 21.79
perf_sol_wit | p95: 22.44
perf_sol_wit | all SOL withdrawals completed
perf_sol_wit | ✅ completed - stress_solana_withdraw (2m29.606121s)
perf_sol_wit | 🍾 solana withdraw performance test completed in 3m1.240450272s
Note: we can increase the schedule lookahead because we have signature caching now so TSS won't be spammed.
Related to https://github.com/zeta-chain/node/pull/3633
[!IMPORTANT]
Review skipped
Draft detected.
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.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
🪧 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
@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 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 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 generate docstringsto generate docstrings for this 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.
Codecov Report
Attention: Patch coverage is 27.27273% with 24 lines in your changes missing coverage. Please review.
Project coverage is 64.54%. Comparing base (
24290d1) to head (e6cbde6). Report is 111 commits behind head on develop.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| zetaclient/chains/solana/signer/signer.go | 20.68% | 23 Missing :warning: |
| zetaclient/chains/solana/solana.go | 0.00% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #3708 +/- ##
===========================================
- Coverage 64.58% 64.54% -0.04%
===========================================
Files 469 469
Lines 32918 32939 +21
===========================================
+ Hits 21259 21260 +1
- Misses 10694 10714 +20
Partials 965 965
| Files with missing lines | Coverage Δ | |
|---|---|---|
| zetaclient/config/types.go | 47.56% <ø> (ø) |
|
| zetaclient/orchestrator/v2_bootstrap.go | 60.00% <100.00%> (ø) |
|
| zetaclient/orchestrator/v2_orchestrator.go | 71.61% <100.00%> (ø) |
|
| zetaclient/chains/solana/solana.go | 54.71% <0.00%> (ø) |
|
| zetaclient/chains/solana/signer/signer.go | 11.20% <20.68%> (-0.30%) |
:arrow_down: |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
This PR will be simplified and replaced by https://github.com/zeta-chain/node/pull/3940 @skosito @lumtis