Skip to content

fix(oracle): clamp upscaled price to uint32-safe bounds#311

Open
0xCardiE wants to merge 1 commit into
masterfrom
fix/price-oracle-upscaled-bounds
Open

fix(oracle): clamp upscaled price to uint32-safe bounds#311
0xCardiE wants to merge 1 commit into
masterfrom
fix/price-oracle-upscaled-bounds

Conversation

@0xCardiE
Copy link
Copy Markdown
Contributor

Summary

  • Cast to uint64 before upscaling in setPrice to avoid overflow/truncation when shifting.
  • Add MAX_CURRENT_PRICE_UPSCALED and _clampPriceUpscaled so currentPrice() cannot disagree with currentPriceUpScaled or under-report vs minimumPrice().

Test plan

  • Run existing PriceOracle unit tests
  • Verify setPrice and round adjustment clamp to [minimumPriceUpscaled, MAX_CURRENT_PRICE_UPSCALED]
  • Confirm currentPrice() matches currentPriceUpScaled >> 10 at boundary values

Cast before upscaling and clamp to [minimum, MAX] so currentPrice()
cannot truncate or disagree with currentPriceUpScaled.
0xCardiE added a commit that referenced this pull request May 22, 2026
Move oracle clamp/cast fixes to #311; keep harness expectations aligned
with master PriceOracle until that PR lands.
@0xCardiE 0xCardiE self-assigned this May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant