fix(lib): move DecimalsTooLarge guard into LibFtsoCurrentPriceUsd (#79)#188
fix(lib): move DecimalsTooLarge guard into LibFtsoCurrentPriceUsd (#79)#188thedavidmeister wants to merge 4 commits into
Conversation
Any direct caller of LibFtsoCurrentPriceUsd.ftsoCurrentPriceUsd that forgets to bound the returned decimals before feeding them to a fixed- decimal scaler could silently mishandle a malicious FTSO. Moving the guard to the library enforces the bound at the trust boundary for every caller, and narrows the return type to (uint256, uint8) so Solidity makes the invariant machine-checkable at the call site. The op layer no longer needs its own DecimalsTooLarge check or import. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Walkthrough
ChangesDecimals guard relocation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…ters + bound testRunStale decimals Regenerate FlareFtsoWords.pointers.sol after guard moved to library changes function pointer offsets. Bound testRunStale decimals to uint8 range so the test exclusively exercises the staleness path (DecimalsTooLarge is separately covered by testRunDecimalOverflow). Co-Authored-By: Claude <noreply@anthropic.com>
…nkr fork flakes; local meta matches committed)
…e after DecimalsTooLarge guard move CI reported expected 0xa30dc38f...; prior attempt committed hash from wrong nix shell.
Summary
DecimalsTooLargeguard fromLibOpFtsoCurrentPriceUsd.run()intoLibFtsoCurrentPriceUsd.ftsoCurrentPriceUsd(), enforcing the bound at the library trust boundary for every caller.(uint256, uint256)to(uint256, uint8)— Solidity now enforces the decimals invariant at every call site.DecimalsTooLargeimport from the op layer.Closes #79
Test plan
DecimalsTooLargerevert (tested intestRunDecimalOverflowandtestRunDecimalsBoundary) is still raised with the same selector and args, just sourced from the library rather than the op.🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests