Skip to content

feat(zetaclient): process first solana transaction faster#3433

Merged
gartnera merged 1 commit intodevelopfrom
solana-first-tx-faster
Feb 2, 2025
Merged

feat(zetaclient): process first solana transaction faster#3433
gartnera merged 1 commit intodevelopfrom
solana-first-tx-faster

Conversation

@gartnera
Copy link
Contributor

@gartnera gartnera commented Jan 29, 2025

Apply a slight optimization to solana processing so that we initiate the first pending outbound transaction immediately rather than waiting for the OutboundScheduleInterval. OutboundScheduleInterval is 15 on testnet and mainnet so we could end up pointlessly waiting around in quite a few cases. And we really can't reduce that parameter since otherwise TSS will be spammed.

There should be little to no change in the performance test results in localnet since we set OutboundScheduleInterval: 2

Mark as consensus breaking since this would need to be deployed with coordination on testnet/mainnet to avoid signer desync.

Conflicts with #3438

Summary by CodeRabbit

  • New Features

    • Enhanced cross-chain transaction (CCTX) processing logic to improve responsiveness and handling of newly created transactions
    • Introduced more flexible scheduling mechanism for transaction processing
  • Improvements

    • Updated transaction processing conditions to allow more immediate handling of new cross-chain transactions
    • Refined keysign scheduling strategy

@gartnera gartnera added the PERFORMANCE_TESTS Run make start-e2e-performance-test label Jan 29, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 29, 2025

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

The pull request introduces refined logic for processing cross-chain transactions (CCTXs) in the Solana orchestrator. The primary modification involves enhancing the ScheduleCctxSolana method to more dynamically handle transaction scheduling. A new counter needsProcessingCtr tracks pending transactions, and new boolean conditions isCCTXNewlyCreated and shouldProcessCCTXImmedately provide more granular control over immediate transaction processing.

Changes

File Change Summary
zetaclient/orchestrator/orchestrator.go Added needsProcessingCtr to track pending cross-chain transactions; introduced new boolean conditions for more responsive CCTX processing

Possibly related PRs

Suggested Labels

UPGRADE_LIGHT_TESTS

Suggested Reviewers

  • kingpinXD
  • swift1337
  • fbac
  • ws4charlie
  • lumtis
  • skosito

The modifications represent a nuanced approach to transaction scheduling, providing more flexible and responsive handling of cross-chain transactions within the Solana orchestrator's workflow.


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>, 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. (Beta)
  • @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.

@gartnera gartnera added the no-changelog Skip changelog CI check label Jan 29, 2025
@codecov
Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 16 lines in your changes missing coverage. Please review.

Project coverage is 64.40%. Comparing base (1375375) to head (e28320a).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
zetaclient/chains/solana/solana.go 20.00% 16 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop    #3433      +/-   ##
===========================================
- Coverage    64.42%   64.40%   -0.03%     
===========================================
  Files          436      436              
  Lines        30368    30379      +11     
===========================================
+ Hits         19565    19566       +1     
- Misses        9962     9972      +10     
  Partials       841      841              
Files with missing lines Coverage Δ
zetaclient/chains/solana/solana.go 56.32% <20.00%> (-3.54%) ⬇️

@gartnera gartnera added the CONSENSUS_BREAKING_ACK Acknowledge a consensus breaking change label Jan 29, 2025
@gartnera gartnera marked this pull request as ready for review January 29, 2025 21:11
@gartnera gartnera requested a review from a team as a code owner January 29, 2025 21:11
Copy link
Contributor

@ws4charlie ws4charlie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks good

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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/orchestrator/orchestrator.go (3)

449-450: Consider a more descriptive variable name.

Rename needsProcessingCtr to pendingTransactionCount to better convey its purpose of tracking the number of pending transactions that need processing.

-       needsProcessingCtr := 0
+       pendingTransactionCount := 0

483-491: Fix typo in variable name and approve the immediate processing logic.

The logic for immediate processing is well-structured and aligns with the PR objectives. However, there's a typo in the variable name.

-       shouldProcessCCTXImmedately := isCCTXNewlyCreated && needsProcessingCtr == 0
+       shouldProcessCCTXImmediately := isCCTXNewlyCreated && needsProcessingCtr == 0

498-506: Fix grammar in variable name and approve the scheduling implementation.

The scheduling logic effectively combines immediate and interval-based processing, aligning with the PR objectives. However, the variable name needs grammatical improvement.

-       shouldScheduledProcess := nonce%interval == zetaHeight%interval
+       shouldScheduleProcess := nonce%interval == zetaHeight%interval

-       if shouldProcessCCTXImmedately || shouldScheduledProcess {
+       if shouldProcessCCTXImmediately || shouldScheduleProcess {
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 084100a and ecbc773.

📒 Files selected for processing (1)
  • zetaclient/orchestrator/orchestrator.go (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
zetaclient/orchestrator/orchestrator.go (1)

Pattern **/*.go: Review the Go code, point out issues relative to principles of clean code, expressiveness, and performance.

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: start-e2e-test / e2e
  • GitHub Check: start-e2e-performance-test / e2e
  • GitHub Check: build-and-test
🔇 Additional comments (1)
zetaclient/orchestrator/orchestrator.go (1)

Line range hint 449-506: Approve the optimization implementation.

The implementation successfully achieves faster processing of the first Solana transaction while maintaining the existing scheduling interval and TSS spam prevention. The code is well-structured, properly commented, and thread-safe.

@lumtis
Copy link
Contributor

lumtis commented Jan 30, 2025

Curious, why using CONSENSUS_BREAKING_ACK if it's a ZetaClient change?

@gartnera
Copy link
Contributor Author

Curious, why using CONSENSUS_BREAKING_ACK if it's a ZetaClient change?

Because if you try to run an old version of zetaclient and this one together they will not agree on when to sign the first transaction.

I'm trying to make it clear that I don't think this is safe to backport directly to the release branch without some additional coordination mechanism.

@gartnera gartnera force-pushed the solana-first-tx-faster branch from ecbc773 to e28320a Compare February 1, 2025 00:03
@gartnera gartnera added this pull request to the merge queue Feb 2, 2025
Merged via the queue into develop with commit 6802bf2 Feb 2, 2025
43 of 44 checks passed
@gartnera gartnera deleted the solana-first-tx-faster branch February 2, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CONSENSUS_BREAKING_ACK Acknowledge a consensus breaking change no-changelog Skip changelog CI check PERFORMANCE_TESTS Run make start-e2e-performance-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants