node icon indicating copy to clipboard operation
node copied to clipboard

feat(zetaclient): solana lead relayer

Open gartnera opened this issue 9 months ago • 2 comments

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

gartnera avatar Mar 13 '25 17:03 gartnera

[!IMPORTANT]

Review skipped

Draft detected.

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.


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.

❤️ 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 generate docstrings to generate docstrings for this 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 Mar 13 '25 17:03 coderabbitai[bot]

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

Impacted file tree graph

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

codecov[bot] avatar Mar 13 '25 17:03 codecov[bot]

This PR will be simplified and replaced by https://github.com/zeta-chain/node/pull/3940 @skosito @lumtis

ws4charlie avatar Jun 04 '25 22:06 ws4charlie