The ConfidencePool calculates a time-weighted bonus using a formula. To maintain precision, intermediate multiplications expand token amounts (userEligible, amount) by the square of the timestamp (T * T) before dividing by the global score using OpenZeppelin's Math.mulDiv.
While Math.mulDiv handles precision robustly, the preceding raw multiplication T * T * userEligible (and its equivalent during staking for sumStakeTimeSq) scales into uint256. Since T (the expiry or observation timestamp) can theoretically reach uint32.max (), T^2 scales up to . If a pool is initialized with an allowed token having an astronomical supply (greater than ), the multiplication overflows the 256-bit threshold (1.15e77), permanently blocking deposits or trapping users from claiming their funds.
The factory owner explicitly whitelists a highly-diluted or extreme-decimal token (e.g., meme coins with $10^{36}$ supplies) via allowedStakeToken.
A user attempts to stake a volume of those tokens that brings their raw wei amount above the $6.3 \times 10^{57}$ threshold.
If an extreme supply token is permitted, claims and withdrawals for massive whales will revert with arithmetic panics.
It forces the protocol to restrict the token whitelist exclusively to standard supply models, limiting composability with hyper-inflated tokens.
Create a new test file test/unit/POCTest.t.sol inheriting from BaseConfidencePoolTest, paste the following code inside the contract body, and run it using the command forge test --match-test test_POC_MathOverflowExtremeSupply -vvv.
Since the arithmetic panic stems from the intermediate T * T * amount calculation natively overflowing the uint256 maximum, we recommend adding explicit NatSpec documentation to the allowedStakeToken mapping. This warns sponsors and factory owners to avoid whitelisting extreme-supply tokens (e.g., meme coins with supplies exceeding 6.3e57) which would otherwise trap user funds.
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.