Target pool bandwidth incorrectly calculated when decreasing weight #29
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-766
edited-by-warden
satisfactory
satisfies C4 submission criteria; eligible for awards
upgraded by judge
Original issue severity upgraded from QA/Gas by judge
Lines of code
https://github.com/code-423n4/2023-05-maia/blob/ccc9a39240dbd8eab22299737370996b2b833efd/src/ulysses-amm/UlyssesPool.sol#L269
Vulnerability details
Impact
Target pool bandwidth calculation is incorrect, which leads to incorrect pool balancing.
Proof of Concept
In
setWeights
of UlyssesPool.sol, theleftOverBandwidth
gets added to the targetpoolState.bandwidth
. As discussed with the Sponsor, this is incorrect because when weight is decreased, the bandwidth should decrease to distribute to the other pools.This PoC uses a new test file:
UlyssesFactoryTest.t.sol
. Run the test by callingforge test --match-test testReduceWeightIncreasesBandwidth
Tools Used
Manual
Recommended Mitigation Steps
Consider changing this line to:
Assessed type
Math
The text was updated successfully, but these errors were encountered: