Skip to content

fix: decompress compress_only amount check#2235

Merged
ananas-block merged 1 commit intomainfrom
jorrit/fix-decompress-compress-only-amount-check
Feb 6, 2026
Merged

fix: decompress compress_only amount check#2235
ananas-block merged 1 commit intomainfrom
jorrit/fix-decompress-compress-only-amount-check

Conversation

@ananas-block
Copy link
Contributor

@ananas-block ananas-block commented Feb 5, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced token decompression validation to ensure amounts are consistently verified across all transaction paths, improving operation reliability and preventing potential amount mismatches.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

The decompression validation logic in the compressed token program has been simplified by removing a conditional check. Amount validation is now performed unconditionally for all decompression operations, ensuring compression_amount always equals input_amount regardless of the destination path.

Changes

Cohort / File(s) Summary
Decompression Validation
programs/compressed-token/program/src/compressed_token/transfer2/compression/ctoken/decompress.rs
Amount validation made unconditional; removed path-specific restriction (ATA or compress_to_pubkey). Compression_amount now always validated against input_amount with DecompressAmountMismatch error on mismatch.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • SwenSchaeferjohann

Poem

✨ No more conditional dancing,
Validation stands firm and true,
Every token counted fairly,
Amounts must align—no matter what path they pursue! 🎯

🚥 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 'fix: decompress compress_only amount check' directly addresses the main change: making amount validation unconditional in the decompress function, specifically fixing the compress_only code path.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 70.00%.

✏️ 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 jorrit/fix-decompress-compress-only-amount-check

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.

@ananas-block ananas-block merged commit 01a7c1e into main Feb 6, 2026
31 checks passed
@ananas-block ananas-block deleted the jorrit/fix-decompress-compress-only-amount-check branch February 6, 2026 07:48
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