The claimSurvived() and claimExpired() functions correctly prevent double-claiming via the hasClaimed[msg.sender] state variable. When a staker attempts to claim a second time, the transaction reverts — which is correct behavior. However, the revert reason emitted is InvalidAmount(), which implies the caller passed an incorrect numerical parameter. The actual failure is a state conflict: the caller has already claimed their stake. The InvalidAmount error is overloaded across at least 4 distinct failure modes in the contract, making debugging and off-chain error handling imprecise.
Likelihood: High
Any staker who calls claimSurvived() or claimExpired() twice triggers this revert path
Front-end applications parsing revert reasons will display "Invalid Amount" to the user, when the real issue is "Already Claimed"
Error handling middleware that categorizes reverts by selector will conflate "already claimed" with "zero amount" and "no stake" — three semantically distinct failures sharing one selector
Impact: Low
No funds are lost or locked — the guard correctly prevents double-claims
Off-chain systems (indexers, dApps, monitoring) receive misleading error signals
Degraded developer experience when debugging failed transactions on block explorers
File: L2-InvalidAmount-AlreadyClaimed.poc.t.sol
Run with:
Introduce a dedicated AlreadyClaimed error and use it exclusively for the hasClaimed[msg.sender] guards in claimSurvived() and claimExpired(). The existing InvalidAmount error is retained for actual amount-validation failures (zero amount passed, below minStake, zero eligible stake in withdraw()), preserving backward compatibility for off-chain systems that already handle those cases. The new error is purely additive — existing callers who only check InvalidAmount continue to see it for amount-related reverts, while systems that want precise error handling can differentiate the "already claimed" case.
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.