Closed code423n4 closed 11 months ago
Picodes changed the severity to 2 (Med Risk)
The given test passes. Perhaps the warden is mistaken?
asselstine requested judge review
Picodes marked the issue as unsatisfactory: Insufficient proof
I don't see the issue: it seems normal as the distribution is exponential: the formula is the same if you replace with t
with t^d(old)
, so the remaining amount of another draw so as long as amounts are updated it seems correct
Lines of code
https://github.com/GenerationSoftware/pt-v5-prize-pool/blob/4bc8a12b857856828c018510b5500d722b79ca3a/src/libraries/DrawAccumulatorLib.sol#L64-L112
Vulnerability details
Impact
In documentation protocol states that : To compute the allocated contribution for a draw
d
we'd compute the integral of curvec(d)=−t∗ln(α)∗α^d
from lastdraw d(old) to d(new), and which is equal to−t∗ α^d(old) + t∗ α^d(new)
. Which clearly shows that contribution only does not depend the interval of lastdraw to new draw while it also depends the current draw.Now Coming to actual implementation , the implemented code does not depend on the current drawId, it only depends on the interval between new draw and completed draw.
if vaults are not producing high yields and new contributions are not good enough This calculation can break protocol and will consume reserve continuously as it will calculate balance based on the interval between draws[most probably high area region of contribution curve].
Proof of Concept
we have 2 identical
accumulator
,accumulator1 & accumulator2
. Both have no balance in starting. Now suppose after different scenarios of contribution both accumulators have same available balance i.e after x1 draw in accumulator1 and x2 draw in accumulator2 both have same available balance and now for next draw both accumulators have same interval gap [newdraw-lastcompletedDraw]https://github.com/GenerationSoftware/pt-v5-prize-pool/blob/4bc8a12b857856828c018510b5500d722b79ca3a/src/libraries/DrawAccumulatorLib.sol#L64C1-L112C4
This is simple demonstration that shows claimed issue. In General contribution is not dependent on draw it only depends on the interval between draw.
Tools Used
Foundry Testing
Recommended Mitigation Steps
With the current implementation do the origin shifting of contribution curve properly to lastDraw or Find other way to implement it
Assessed type
Math