InvalidAmount error prevents integrators from distinguishing four distinct failure conditionsCustom errors are meant to let callers and front-ends react to the specific reason a call reverted.
The single InvalidAmount error is reverted from seven sites for four semantically different conditions — a zero input amount, "nothing to withdraw", "already claimed", and "nothing eligible to claim" — so an integrator cannot tell them apart from the revert alone.
Likelihood:
Triggered on every occurrence of these common user paths (re-claim, empty withdraw, zero-amount input).
Impact:
A front-end or integrating contract cannot distinguish "you already claimed" from "you passed amount 0", degrading error handling and UX. No funds are at risk.
The test file ConfidencePool.qa.t.sol includes a characterization test test_QA1_invalidAmountIsOverloaded that explicitly reproduces the four distinct failure scenarios and confirms they all revert with the identical IConfidencePool.InvalidAmount.selector custom error.
Zero Input Amount (stake(0)):
alice tries to stake 0 tokens. The transaction reverts with IConfidencePool.InvalidAmount.selector because amount == 0.
Empty Withdraw (withdraw()):
alice (who has not staked anything) calls withdraw(). The transaction reverts with IConfidencePool.InvalidAmount.selector because the staker's eligible balance is zero.
Nothing Eligible to Claim (claimSurvived()):
The registry moves to PRODUCTION, the pool is flagged as SURVIVED, and bob (who never staked) calls claimSurvived(). The transaction reverts with IConfidencePool.InvalidAmount.selector because his userEligible stake is zero.
Already Claimed (claimSurvived()):
carol stakes and claims her funds successfully in a survived pool. When she tries to claim a second time, the transaction reverts with the exact same IConfidencePool.InvalidAmount.selector because hasClaimed[carol] is true.
Run the test suite using forge:
The test passes, confirming that all four distinct and independent failure conditions revert with the exact same InvalidAmount error selector, making it impossible for frontends or on-chain integrations to differentiate between them programmatically.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.
The contest is complete and the rewards are being distributed.