Skip to content

Conversation

@d4mr
Copy link
Member

@d4mr d4mr commented Nov 4, 2025

  • Introduced SolanaSigner to the engine core for improved Solana transaction handling.
  • Added base64, bincode, solana-client, and solana-sdk as dependencies in Cargo.toml.
  • Updated server state to include solana_signer and added new route for signing Solana transactions.

Summary by CodeRabbit

  • New Features

    • Added Solana transaction signing API: submit a transaction request and receive a signature plus a base64-encoded signed transaction.
    • Supports execution options (compute unit limits and optional pricing) when preparing transactions.
    • API surfaced in OpenAPI docs and router for straightforward discovery.
  • Chores

    • Wired Solana signer and RPC caching into the server so signing requests use cached RPC endpoints.

- Introduced `SolanaSigner` to the engine core for improved Solana transaction handling.
- Added `base64`, `bincode`, `solana-client`, and `solana-sdk` as dependencies in `Cargo.toml`.
- Updated server state to include `solana_signer` and added new route for signing Solana transactions.
@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Walkthrough

Adds Solana transaction signing: new workspace dependencies, a route module implementing signing (builds, signs, serializes transactions), and Solana signer + RPC cache wired into server state and initialization.

Changes

Cohort / File(s) Summary
Dependency additions
server/Cargo.toml
Added workspace dependencies: engine-solana-core (path "../solana-core"), base64, bincode, solana-sdk, solana-client.
Routes module index
server/src/http/routes/mod.rs
Declared new public module sign_solana_transaction.
Solana signing route
server/src/http/routes/sign_solana_transaction.rs
New Axum route handler sign_solana_transaction with request/response types; resolves RPC client, fetches blockhash, builds versioned transaction, signs via SolanaSigner, serializes signed transaction to base64, returns signature and signed transaction.
Server state & router
server/src/http/server.rs
EngineServerState extended with pub solana_signer: Arc<SolanaSigner> and pub solana_rpc_cache: Arc<SolanaRpcCache>; registers the signing route in the v1 router.
Server initialization
server/src/main.rs
Initialized SolanaSigner, SolanaRpcUrls, and SolanaRpcCache; wired solana_signer and solana_rpc_cache into EngineServerState; updated EoaSigner construction to clone iaw_client.

Sequence Diagram(s)

sequenceDiagram
    actor Client
    participant Handler as sign_solana_transaction
    participant RpcCache as SolanaRpcCache/RPC
    participant Signer as SolanaSigner

    Client->>Handler: POST /solana/sign/transaction\n(request + credentials)
    Handler->>Handler: Extract chain_id & signer_address\nparse request & exec options
    Handler->>RpcCache: Get RPC client for chain_id
    RpcCache-->>Handler: RPC client
    Handler->>RpcCache: Fetch latest blockhash
    RpcCache-->>Handler: blockhash
    Handler->>Handler: Build versioned transaction\n(set blockhash, compute units/price)
    Handler->>Signer: Sign versioned transaction (credentials)
    Signer-->>Handler: Signed transaction + signature
    Handler->>Handler: Serialize (bincode) -> base64
    Handler-->>Client: 200 OK\n{ signature, signed_transaction }
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Review transaction construction and use of compute unit options in sign_solana_transaction.rs.
  • Verify blockhash retrieval/error mapping and serialization (bincode -> base64).
  • Check correct initialization and lifetimes of solana_signer, solana_rpc_cache, and cloned iaw_client in main.rs.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding Solana transaction signing capabilities and new dependencies.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch pb/solana-sign-transaction

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between a1b60c4 and 92871e4.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (5)
  • server/Cargo.toml (2 hunks)
  • server/src/http/routes/mod.rs (1 hunks)
  • server/src/http/routes/sign_solana_transaction.rs (1 hunks)
  • server/src/http/server.rs (3 hunks)
  • server/src/main.rs (3 hunks)
🧰 Additional context used
🧬 Code graph analysis (4)
server/src/http/routes/mod.rs (1)
server/src/http/routes/sign_solana_transaction.rs (1)
  • sign_solana_transaction (66-144)
server/src/main.rs (3)
server/src/http/server.rs (1)
  • new (48-116)
core/src/signer.rs (2)
  • new (211-216)
  • new (561-566)
server/src/queue/manager.rs (1)
  • new (52-318)
server/src/http/routes/sign_solana_transaction.rs (1)
server/src/http/server.rs (1)
  • new (48-116)
server/src/http/server.rs (1)
server/src/http/routes/sign_solana_transaction.rs (1)
  • sign_solana_transaction (66-144)

- Introduced `SolanaRpcCache` to manage RPC URLs for Solana transactions.
- Updated server state to include `solana_rpc_cache` for efficient RPC client retrieval.
- Refactored transaction signing logic to utilize the new RPC cache, improving performance and reliability.
Copy link

@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 (2)
server/src/main.rs (2)

63-64: Consider cloning iaw_client on line 64 for consistency.

Line 63 uses iaw_client.clone() for EoaSigner, but line 64 moves iaw_client for SolanaSigner. While moving is more efficient since iaw_client isn't used afterward, using .clone() on both lines would improve consistency with the established pattern (including in queue/manager.rs).

Apply this diff for consistency:

 let eoa_signer = Arc::new(EoaSigner::new(vault_client.clone(), iaw_client.clone()));
-let solana_signer = Arc::new(SolanaSigner::new(vault_client.clone(), iaw_client));
+let solana_signer = Arc::new(SolanaSigner::new(vault_client.clone(), iaw_client.clone()));

75-82: Consider consolidating duplicated Solana RPC cache creation.

A separate SolanaRpcCache with identical configuration is also created in queue/manager.rs (lines 66-69 of the relevant snippet). This results in two independent cache instances serving different parts of the system (HTTP routes vs queue workers), which can lead to:

  • Wasted memory maintaining duplicate caches
  • Configuration drift if URLs are updated in one place but not the other
  • Inconsistent cache state

Consider creating the cache once here and passing it as a parameter to QueueManager::new(), similar to how authorization_cache is handled (line 91).

To consolidate, modify QueueManager::new() to accept solana_rpc_cache as a parameter instead of creating it internally:

 let queue_manager = QueueManager::new(
     redis_client.clone(),
     &config.queue,
     &config.solana,
     chains.clone(),
     signer.clone(),
     eoa_signer.clone(),
     authorization_cache.clone(),
     kms_client_cache.clone(),
+    solana_rpc_cache.clone(),
 )
 .await?;

Then update the QueueManager::new signature in queue/manager.rs to accept the cache instead of creating it.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 92871e4 and fb90893.

📒 Files selected for processing (3)
  • server/src/http/routes/sign_solana_transaction.rs (1 hunks)
  • server/src/http/server.rs (3 hunks)
  • server/src/main.rs (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • server/src/http/server.rs
  • server/src/http/routes/sign_solana_transaction.rs
🧰 Additional context used
🧬 Code graph analysis (1)
server/src/main.rs (3)
server/src/http/server.rs (1)
  • new (50-118)
core/src/signer.rs (2)
  • new (211-216)
  • new (561-566)
server/src/queue/manager.rs (1)
  • new (52-318)
🔇 Additional comments (2)
server/src/main.rs (2)

3-4: LGTM!

The new imports for Solana support are appropriate and all are used in the initialization flow.


137-138: LGTM!

The solana_signer and solana_rpc_cache are correctly added to EngineServerState following the established pattern for shared resources, with appropriate Arc cloning for thread-safe access.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants