-
Notifications
You must be signed in to change notification settings - Fork 8
Enhance Solana transaction support and add new dependencies #78
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
base: main
Are you sure you want to change the base?
Conversation
- 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.
WalkthroughAdds 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
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 }
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Pre-merge checks and finishing touches✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
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: 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.
⛔ Files ignored due to path filters (1)
Cargo.lockis 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.
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 (2)
server/src/main.rs (2)
63-64: Consider cloningiaw_clienton line 64 for consistency.Line 63 uses
iaw_client.clone()forEoaSigner, but line 64 movesiaw_clientforSolanaSigner. While moving is more efficient sinceiaw_clientisn't used afterward, using.clone()on both lines would improve consistency with the established pattern (including inqueue/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
SolanaRpcCachewith identical configuration is also created inqueue/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 howauthorization_cacheis handled (line 91).To consolidate, modify
QueueManager::new()to acceptsolana_rpc_cacheas 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::newsignature inqueue/manager.rsto 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.
📒 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_signerandsolana_rpc_cacheare correctly added toEngineServerStatefollowing the established pattern for shared resources, with appropriateArccloning for thread-safe access.
SolanaSignerto the engine core for improved Solana transaction handling.base64,bincode,solana-client, andsolana-sdkas dependencies inCargo.toml.solana_signerand added new route for signing Solana transactions.Summary by CodeRabbit
New Features
Chores