Skip to content

Conversation

@gomesalexandre
Copy link
Contributor

@gomesalexandre gomesalexandre commented Jan 28, 2026

Description

This fixes yield.xyz unsignedTransaction field in /enter and /exit which is not a base64 string anymore but a hex-encoded string without 0x prefix for Solana transactions.

Before: The code used viem's isHex() to detect hex encoding, but isHex() requires a 0x prefix. Since yield.xyz returns bare hex (e.g. 01000000...), the code fell through to the base64 decode branch, producing a corrupted buffer. VersionedTransaction.deserialize then failed with "Reached end of buffer unexpectedly".

After: The code now checks both isHex(unsignedTransaction) and isHex(0x${unsignedTransaction}) to handle bare hex. Base64 strings are unaffected since they contain characters (=, +, /) that fail isHex even with a 0x prefix prepended.

Changes:

  • Extracted decodeSolanaTransaction helper to handle hex (with/without 0x prefix) and base64 encodings
  • Exported toHexOrDefault and toHexData helpers for testability
  • Added comprehensive unit tests covering Solana, EVM (plasma-usdt0 vault, ETH rETH liquid staking, AVAX sAVAX liquid staking), and Cosmos (ATOM native staking) transaction formats

Risk

Low risk — the fix is scoped entirely to the Solana code path (executeSolanaTransaction). EVM, Cosmos, Sui, Near, and Tron paths are completely separate and unaffected.

Solana yield.xyz staking transactions (enter/exit)

Testing

Engineering

  • yarn test -- src/lib/yieldxyz/executeTransaction.test.ts — 21 tests passing
  • Can enter/exit Solana native staking with yield

Operations

  • Can enter Solana native staking via yield.xyz
  • Can exit Solana native staking via yield.xyz
  • EVM staking (e.g. ETH rETH, AVAX sAVAX) still works as before

Screenshots (if applicable)

https://jam.dev/c/051720a1-f1e1-4faa-9b21-0e2661df58fc

Summary by CodeRabbit

  • New Features

    • Exposed public utilities for converting values to hex format and decoding Solana transactions from multiple encoding formats (hex with/without prefix, base64).
  • Tests

    • Added comprehensive test suite validating transaction decoding, encoding normalization, and field conversions across multiple blockchain formats.

✏️ Tip: You can customize this high-level summary in your review settings.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@gomesalexandre gomesalexandre requested a review from a team as a code owner January 28, 2026 05:00
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 28, 2026

📝 Walkthrough

Walkthrough

Exposes three utility functions (toHexOrDefault, toHexData, decodeSolanaTransaction) from internal implementation to public API and refactors Solana transaction handling to use the new decoder. Adds comprehensive test suite validating encoding normalization and field conversions across multiple blockchain transaction formats (Solana, EVM, Cosmos).

Changes

Cohort / File(s) Summary
Implementation & Tests
src/lib/yieldxyz/executeTransaction.ts, src/lib/yieldxyz/executeTransaction.test.ts
Promotes three internal utility functions to public exports: toHexOrDefault (handles fallbacks and numeric/hex conversions), toHexData (normalizes hex data strings), and decodeSolanaTransaction (supports hex with/without 0x prefix and base64 formats). Refactors Solana transaction path to use new decoder. Adds 177 lines of test coverage validating encoding consistency, field parsing across Solana, EVM/plasma (ETH rETH, AVAX sAVAX), and Cosmos ATOM transaction formats.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested reviewers

  • NeOMakinG

Poem

🐰 Encoding hops and decoding runs,
Three helpers born, now see the sun!
From Solana chains to Cosmos dust,
Hex and base64—encode we must!
Tests are thorough, logic's sound,
Yield.xyz transactions glory-bound! 🌟

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically identifies the main change: fixing Solana unsignedTransaction breaking changes in yield integration, which aligns with the core problem and solution described in the PR objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 fix_solana_yield

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

Copy link
Contributor

@kaladinlight kaladinlight left a comment

Choose a reason for hiding this comment

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

Look at those tests!

Image

@kaladinlight kaladinlight enabled auto-merge (squash) January 28, 2026 18:19
@kaladinlight kaladinlight merged commit 4757280 into develop Jan 28, 2026
4 checks passed
@kaladinlight kaladinlight deleted the fix_solana_yield branch January 28, 2026 18:29
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.

3 participants