Skip to content

fix(programs): reject rent_payment < 2 for CMint decompression (L-10)#2267

Merged
ananas-block merged 3 commits intomainfrom
jorrit/fix-certora-l10-rent-payment-zero
Feb 9, 2026
Merged

fix(programs): reject rent_payment < 2 for CMint decompression (L-10)#2267
ananas-block merged 3 commits intomainfrom
jorrit/fix-certora-l10-rent-payment-zero

Conversation

@ananas-block
Copy link
Contributor

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

Summary

  • Certora audit L-10: rent_payment = 0 was accepted for CMint decompression, but only rent_payment = 1 was rejected. A CMint with 0 epochs of rent prepayment would immediately be eligible for reclamation.
  • Fix: Require at least 2 epochs of rent prepayment by rejecting rent_payment < 2.

Changes

  • decompress_mint.rs: Changed validation from rent_payment == 1 to rent_payment < 2, updated error to InvalidRentPayment.

Summary by CodeRabbit

  • Changes

    • Increased minimum rent prepayment for mint creation to 2 epochs.
    • Compression becomes available only after a 2-epoch waiting period.
    • Validation now rejects rent payments less than 2 epochs.
  • Tests

    • Updated tests to advance the clock by 2 epochs and reflect the new timing and assertions.

CMints are always compressible and need minimum 2 epochs of rent
prepayment. Previously only rent_payment == 1 was rejected, allowing
rent_payment == 0 which could enable DoS by creating underfunded CMints.
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 9, 2026

📝 Walkthrough

Walkthrough

The pull request raises the required rent prepayment for mint compression operations from 0 to 2 epochs, updates program-side validation to enforce the >=2 requirement, and adjusts tests to warp the clock and assert compressibility only after the 2-epoch rent period elapses.

Changes

Cohort / File(s) Summary
Tests
forester/tests/test_compressible_mint.rs, forester/tests/test_indexer_interface.rs
Rent prepayment values changed from 0 to 2 epochs. Tests now import SLOTS_PER_EPOCH and warp the clock forward by 2 epochs before asserting compressibility; assertions and comments updated to reflect the delayed compressibility timing.
Validation Logic
programs/compressed-token/program/src/compressed_token/mint_action/actions/decompress_mint.rs
Replaced the special-case rejection for exactly 1 epoch with a generic minimum check requiring rent_payment >= 2. Error returned changed from OneEpochPrefundingNotAllowed to InvalidRentPayment; docs/comments updated accordingly.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • chore: clean load client helpers #2173 — touches mint decompression rent prepayment handling and introduces client-side APIs / DEFAULT_RENT_PAYMENT that align with the program-side >=2-epoch validation.

Suggested reviewers

  • sergeytimoshin
  • SwenSchaeferjohann

Poem

🕰️ Two epochs wait, then the mint may breathe,
Locks loosen slowly, not one tick too brief,
Tests march time-forward, clocks bend to the rule,
Validation tightened, crisp as a tool,
Compression waits patient — steady and chief.

🚥 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 accurately and specifically describes the main change: rejecting rent_payment < 2 for CMint decompression, addressing the Certora audit finding L-10.
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-certora-l10-rent-payment-zero

No actionable comments were generated in the recent review. 🎉

Warning

Review ran into problems

🔥 Problems

Git: Failed to clone repository. Please run the @coderabbitai full review command to re-trigger a full review. If the issue persists, set path_filters to include or exclude specific files.


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 changed the title fix(L-10): reject rent_payment < 2 for CMint decompression fix(programs): reject rent_payment < 2 for CMint decompression (L-10) Feb 9, 2026
Update tests to use rent_payment=2 (new minimum) and warp slots
forward past the rent period before checking compressibility.
@ananas-block ananas-block merged commit d2e5003 into main Feb 9, 2026
31 checks passed
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