Repository navigation
Round toRange() bounds outward at every step - #1315
Conversation
FixLib.mul(x, y) now rounds down by default, so the inner products of toRange() rounded the high bound down. Round every product down for low and up for high. Only affects future plugin deployments. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Reverts ab3d74a on this branch. The guard and its test now come in with refreshBasket(bool skipTradingDelay), which rewrites the same lines. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Reverts fed7a77. The guard stays in its own PR after all. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Summary
PoolTokens.toRange()andAerodromePoolTokens.toRange()now pass an explicit rounding mode to every multiplication: down forlow, up forhigh.Stacked on #1314.
Why
Trust audit finding "Assessment of changed rounding directions" (QA).
Since #1283,
FixLib.mul(x, y)rounds down by default. IntoRange()that made two of the three products of thehighbound round down:The audit flagged the inner
y.mul(FIX_ONE + yErr)term. The leftx.mul(FIX_ONE + xErr)term has the same problem, so this PR fixes both. Thelowbound was already correct and is only made explicit.The effect is far below oracle error: each inner product moves by at most one unit of
1e-18, and the outer product scales that difference by the other price. It only applies to plugins deployed from these sources; no deployed plugin changes.The audit found the other two-argument
mul()calls in plugins acceptable in either direction, so they are left alone.Changes
contracts/plugins/assets/curve/PoolTokens.sol,contracts/plugins/assets/aerodrome/AerodromePoolTokens.sol: explicitFLOOR/CEILintoRange().CHANGELOG.md: the rounding section no longer liststoRange()under the default-rounding change, and notes the explicit rounding.Verification
crv,cvx,stakedao): 416 passing, 87 pending (skipped in the suite).toRange()is private, and the change is a last-digit rounding direction.🤖 Generated with Claude Code
Summary by CodeRabbit