Skip to content
This repository was archived by the owner on Jun 1, 2026. It is now read-only.

Add SolanaChainSigner and sign_swap - #939

Merged
0xh3rman merged 7 commits into
mainfrom
solana-signer
Feb 11, 2026
Merged

0xh3rman merged 7 commits into
mainfrom
solana-signer

Conversation

@0xh3rman

Copy link
Copy Markdown
Collaborator

Migrate Solana swap tx signing to Rust, much easier than working with trust wallet core

@semanticdiff-com

semanticdiff-com Bot commented Feb 10, 2026 •

Copy link
Copy Markdown

Review changes with  SemanticDiff

Changed Files
File Status
  gemstone/src/models/gateway.rs  84% smaller
  crates/primitives/src/gas_price_type.rs  62% smaller
  crates/gem_solana/src/provider/preload_mapper.rs  59% smaller
  crates/primitives/src/signer_error.rs  4% smaller
  bin/gas-bench/src/solana_client.rs  3% smaller
  Cargo.lock Unsupported file format
  crates/gem_evm/src/provider/preload.rs  0% smaller
  crates/gem_hypercore/src/signer/core_signer.rs  0% smaller
  crates/gem_rewards/src/transfer_provider/evm/provider.rs  0% smaller
  crates/gem_solana/Cargo.toml Unsupported file format
  crates/gem_solana/src/lib.rs  0% smaller
  crates/gem_solana/src/models/jito.rs  0% smaller
  crates/gem_solana/src/signer/chain_signer.rs  0% smaller
  crates/gem_solana/src/signer/mod.rs  0% smaller
  crates/gem_stellar/src/provider/preload.rs  0% smaller
  crates/gem_sui/src/provider/preload.rs  0% smaller
  crates/gem_sui/src/signer/chain_signer.rs  0% smaller
  crates/gem_ton/src/provider/preload.rs  0% smaller
  crates/primitives/src/chain_signer.rs  0% smaller
  crates/primitives/src/testkit/transaction_load_input_mock.rs  0% smaller
  crates/primitives/src/transaction_input_type.rs  0% smaller
  crates/swapper/Cargo.toml Unsupported file format
  gemstone/Cargo.toml Unsupported file format
  gemstone/android/gemstone/src/androidTest/java/com/gemwallet/gemstone/GemstoneTest.kt Unsupported file format
  gemstone/src/lib.rs  0% smaller
  gemstone/src/models/transaction.rs  0% smaller
  gemstone/src/signer/chain.rs  0% smaller
  gemstone/src/solana/mod.rs  0% smaller

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @0xh3rman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the Solana integration by migrating the swap transaction signing logic to a native Rust implementation. This change introduces a dedicated SolanaChainSigner to handle the complexities of Solana transaction signing, including setting compute unit prices and adding Jito tips. The refactoring aims to streamline the signing process, improve maintainability, and reduce reliance on external libraries, ultimately making Solana swap operations more robust and efficient within the system.

Highlights

  • Solana Swap Transaction Signing in Rust: Introduced a new SolanaChainSigner struct and its implementation for signing Solana swap transactions directly in Rust, moving away from external dependencies like Trust Wallet Core for this functionality.
  • Enhanced Solana Transaction Customization: The SolanaChainSigner now supports dynamic adjustment of compute unit prices and the inclusion of Jito tips for Solana transactions, providing more control over transaction execution and priority.
  • Signer Error Refactoring: Refactored the SignerError enum by renaming UnsupportedOperation to SigningError across multiple crates (gem_hypercore, gem_sui, primitives, gemstone), improving clarity and consistency in error handling.
  • Dependency Updates and Feature Integration: Updated the solana-primitives dependency to version 0.2.3 and integrated the new Solana signer functionality into the gemstone project via a new signer feature in gem_solana.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • Cargo.lock
    • Added new dependencies 'signer' and 'solana-primitives'.
    • Updated 'solana-primitives' version from 0.2.2 to 0.2.3.
  • crates/gem_hypercore/src/signer/core_signer.rs
    • Replaced SignerError::UnsupportedOperation with SignerError::SigningError for consistency.
  • crates/gem_solana/Cargo.toml
    • Added a new signer feature that includes signer and solana-primitives as optional dependencies.
  • crates/gem_solana/src/lib.rs
    • Added a new signer module, conditionally compiled under the signer feature.
  • crates/gem_solana/src/signer/chain_signer.rs
    • Added new file implementing SolanaChainSigner for Solana swap transaction signing.
    • Implemented logic to set compute unit price and add Jito tips to Solana transactions.
    • Included utility functions to detect existing Jito tips in transactions.
  • crates/gem_solana/src/signer/mod.rs
    • Added new file to declare and export the SolanaChainSigner.
  • crates/gem_sui/src/signer/chain_signer.rs
    • Replaced SignerError::UnsupportedOperation with SignerError::SigningError for unsupported staking operations.
  • crates/primitives/src/chain_signer.rs
    • Updated default implementations of ChainSigner methods to return SignerError::SigningError instead of SignerError::UnsupportedOperation.
  • crates/primitives/src/signer_error.rs
    • Renamed SignerError::UnsupportedOperation to SignerError::SigningError.
    • Added helper constructors invalid_input and signing_error for SignerError.
  • crates/swapper/Cargo.toml
    • Updated 'solana-primitives' version from 0.2.2 to 0.2.3.
  • gemstone/Cargo.toml
    • Enabled the signer feature for the gem_solana dependency.
  • gemstone/src/signer/chain.rs
    • Imported SolanaChainSigner.
    • Integrated SolanaChainSigner into the GemChainSigner factory for the Solana chain.
    • Updated error handling to use SignerError::SigningError instead of SignerError::UnsupportedOperation.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a SolanaChainSigner for handling swap transaction signing in Rust and refactors the SignerError enum across several crates. The migration to a Rust-based signer for Solana is a positive step for code consistency and maintainability. My review has identified a few issues in the new implementation, including a critical compile error, a potential panic, and opportunities for performance optimization. I have also raised a high-severity concern regarding the error enum refactoring, which currently leads to a loss of error specificity and could result in misleading error messages. Addressing these points will significantly improve the quality and robustness of the changes.

Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/primitives/src/signer_error.rs
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
Comment thread crates/gem_solana/src/signer/chain_signer.rs Outdated
@0xh3rman
0xh3rman merged commit 0b355e8 into main Feb 11, 2026
5 of 6 checks passed
@0xh3rman
0xh3rman deleted the solana-signer branch February 11, 2026 08:48
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants