ConfidencePool distributes the bonus pool using a k=2 time-weighted formula. The intended score for a staker is based on the elapsed at-risk time:
where T is the resolved outcome timestamp and entryTime is the staker's effective entry timestamp.
The issue is that the implementation computes this value using expanded absolute timestamp-squared terms. With a sufficiently large but valid ERC20 stake amount, the intermediate absolute terms can overflow before the subtraction/cancellation happens. As a result, a valid staker can be unable to claim after the pool resolves, permanently locking their principal and bonus.
Likelihood:
This occurs when a pool uses a standard ERC20 with a very large supply/decimals and a staker deposits an amount large enough for the absolute timestamp-squared terms to approach type(uint256).max.
This occurs after the pool resolves as SURVIVED or EXPIRED, when affected users call claimSurvived() or claimExpired() and _bonusShare() is evaluated.
Impact:
Affected stakers cannot claim their principal or bonus because the claim reverts with Solidity arithmetic panic.
Funds can remain stuck in the pool because sweepUnclaimedBonus() reserves outstanding principal and bonus for unclaimed stakers.
The PoC stakes an extremely large ERC20 amount that is still accepted by stake(). The pool then opens the risk window, waits
one second, contributes a small bonus, and resolves as SURVIVED.
When Alice calls claimSurvived(), _bonusShare() tries to compute T * T * userEligible + userSumStakeTimeSq[u] using absolute
timestamp-squared values. That intermediate addition overflows before the formula can cancel down to the true small elapsed-
time score, so the claim reverts with Solidity arithmetic panic.
Add the following import to test/unit/ConfidencePool.k2Bonus.t.sol:
Then add this test inside ConfidencePoolK2BonusTest:
Run:
Expected result:
The test passes because claimSurvived() reverts with Solidity arithmetic panic, confirming the overflow in _bonusShare().
Cap the maximum tracked stake so the timestamp-squared accounting cannot overflow.
Alternatively, refactor the score accounting to store risk-window-relative offsets instead of absolute timestamp-squared values.
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.