SSSwap

First Flight #41
Beginner FriendlyRust
100 EXP
View results
Submission Details
Impact: low
Likelihood: medium
Invalid

Missing Zero-Amount Check in `provide_liquidity` instruction

Description:

In the provide_liquidity instruction, users can deposit amount_a (Token A) without any check to ensure it’s greater than zero.

Right now, someone could call this function with amount_a = 0, which doesn’t make sense—you shouldn’t be able to provide "zero liquidity" and still trigger pool changes.

Impact:

  • Wasted Gas & Clutter: Users (or bots) could spam transactions with amount_a = 0, bloating the blockchain with useless operations.

  • Unexpected Behavior: Some parts of the contract might assume deposits are always positive, leading to weird edge cases.

  • Potential Exploits: While not directly stealing funds, attackers could abuse this to create fake LP positions or disrupt pool accounting.

How to Fix It

require!(amount_a > 0, AmmError::ZeroDepositNotAllowed);

This ensures nobody can deposit zero tokens.

Updates

Lead Judging Commences

0xtimefliez Lead Judge 5 days ago
Submission Judgement Published
Invalidated
Reason: Too generic

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.