fix: treat priceTimestamp+timeout overflow as stale, not a panic - #147
fix: treat priceTimestamp+timeout overflow as stale, not a panic#147thedavidmeister wants to merge 4 commits into
Conversation
priceTimestamp + timeout in checked arithmetic reverts with Panic(0x11) when a misbehaving FTSO reports a near-uint256-max timestamp; the callers receive an opaque panic instead of the intended StalePrice domain error. Use unchecked arithmetic and check deadline < priceTimestamp to detect the overflow, reverting cleanly with StalePrice in that case. Adds testRunStaleOverflow fuzz test to cover the overflow boundary. Closes #105 Co-Authored-By: Claude <noreply@anthropic.com>
|
Warning Review limit reached
More reviews will be available in 55 minutes and 6 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
✨ 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 |
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…e unchecked [3b-attempt]
slither-disable-next-line only suppresses the line it precedes (unchecked {),
not the block.timestamp comparison inside the unchecked block. Switch to
disable-start/disable-end so the timestamp detector is suppressed for the
entire unchecked region.
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
|
🤖 ai:vetter |
|
Closing in favor of #125 (kept). #125 fixes the same overflow via subtraction ( |
priceTimestamp + timeoutinLibFtsoCurrentPriceUsd.ftsoCurrentPriceUsduses checked arithmetic (Solidity 0.8 default). A misbehaving or compromised
FTSO that reports a near-
type(uint256).maxtimestamp causesPanic(0x11)instead of the intended
StalePricedomain error, making the failure harder todiagnose.
The fix uses
uncheckedarithmetic and checksdeadline < priceTimestampas the overflow sentinel, converting the overflow into a clean
StalePricerevert that callers already handle.
A new
testRunStaleOverflowfuzz test covers the overflow boundary(
priceTimestamp > type(uint256).max - timeout) and verifiesStalePriceis emitted rather than a panic.
Closes #105
Co-Authored-By: Claude noreply@anthropic.com