Conversation
Summary of ChangesHello @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 expands the cross-chain swap capabilities by integrating the Relay provider, allowing for more diverse asset and chain combinations. Concurrently, it improves the robustness of data handling within the serialization library by introducing more versatile deserialization functions for common data types. Highlights
🧠 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. Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new swapper provider, Relay, which involves adding new modules for the provider itself and for serde serialization helpers. The changes are well-structured and include integration tests.
My review focuses on improving the robustness and performance of the new code. I've pointed out a few areas where error handling can be improved to prevent silent failures, particularly in JSON serialization. I've also identified a potential correctness issue with unsafe type casting in a new deserializer and a fragile logic for extracting a router address. Addressing these points will make the new provider more reliable.
51d48ac to
212b6b8
Compare
Restructure and update the relay integration to support Relay v2 responses and richer swap metadata. Key changes: - Fix API wallet address comparison in referral handler. - Rename quote_data_mapper -> mapper and move mapping logic; add relay_currency_to_asset_id and map_swap_result to produce SwapResult with TransactionSwapMetadata. - Update RelayChain API: add to_chain() conversion and rename chain_from_id -> from_chain_id returning RelayChain. - Change client endpoints/types: use /requests/v2?hash= and return RelayRequestsResponse; update imports accordingly. - Update models to represent relay requests and metadata (RelayRequestsResponse, RelayRequest, RelayRequestMetadata, RelayCurrencyDetail), and adjust status mapping (Refunded treated as Failed). - Update provider to use new mapper and client methods; adapt get_swap_result to map first request from response. - Adjust and add integration tests to match new types, endpoints and mapping behavior. These changes align the codebase with the updated relay API and improve mapping of currency/chain data into internal AssetId/SwapResult representations.
Refactor and feature additions: - Move near_intents/fees.rs -> fees.rs and expose resolve_max_quote_amount which deducts reserved native tx fees (uses U256) and validates use_max_amount logic. - Register new fees module in lib and update providers/tests to use fees::resolve_max_quote_amount (replacing prior NearIntents::resolve_quote_amount logic). - Relay improvements: add relay/tx_builder.rs to build Solana v0 transactions (supports address lookup tables, compute-budget prepending, serialization), add RelayInstruction/RelayAccountMeta models and address_lookup_table_addresses on StepData. - Update mapper to expose get_step_data publicly, adjust step selection logic, and simplify Solana step data handling. - Update relay provider: simplify referrer resolution, include slippage_tolerance in requests, use resolved amount, and construct Solana transactions via tx_builder when instructions are provided. - Small test updates and a formatting fix in thorchain provider error return. These changes consolidate fee resolution logic and add robust Solana transaction building support for relay quotes.
Add Solana-specific flags and route limits to Relay quote requests, remove slippage tolerance, and simplify amount selection. Changes: - models.rs: remove Bitcoin and Solana from Relay's OmniChain list. - relay/model.rs: add disable_origin_swaps, include_compute_unit_limit, and max_route_length to RelayQuoteRequest. - relay/provider.rs: set slippage_tolerance to None, enable disable_origin_swaps and include_compute_unit_limit for Solana origins, set max_route_length to 6, and always use currency_out.amount (drop fallback to minimum_amount). These updates align the Relay integration with Solana-specific requirements and standardize quote amount handling.
No description provided.