{"item": "core-pricer-feeds", "commit": "ff1c192b3798542997f600091f2dc73ff05e4c40", "forge": "forge 1.9.0 (6056c58). solc 0.8.38 NOT installed, so --use solar could not build bytecode. Tests ran in a scratch foundry project: the real src/feeds/*.sol and src/Pricer.sol copied unchanged except pragma 0.8.38 -> ^0.8.26, compiled with the installed solc 0.8.28 (no via_ir); Parameters/ParametersBase replaced by stubs with the same structs/selectors. Fuzz 2000 runs each.", "verdict": "findings", "findings": [{"id": "F1", "severity": "low", "title": "ProductFeed.latestValue panics (arithmetic overflow) on two legs that ChainlinkFeed reads as valid prices; isStale() stays false, so the revert reaches consumers with no try/catch", "property": "P1 / C2 / C3: a leg either prices or reads unpriced (0); ChainlinkFeed's own doc says the sanity cap exists so that an absurd answer 'reads as zero (unpriced) instead of panicking'", "claim": "C2/C3", "files": ["src/feeds/ProductFeed.sol:28", "src/feeds/ChainlinkFeed.sol:55", "src/Redeemer.sol:114", "src/Ledger.sol:476", "src/Liquidator.sol:228", "src/LedgerSettlement.sol:73", "src/LedgerSettlement.sol:118"], "sequence": "WBTC type (Ethereum): median = ProductFeed(BTC/USD cl 8 dec, WBTC/BTC cl 18-dec value). BTC/USD answers 1e26 (= the 1e18-USD sanity cap, passes) and WBTC/BTC answers 1e32 (cap 1e36, passes). Each ChainlinkFeed returns a fresh nonzero value (1e46 and 1e32); va*vb = 1e78 > 2^256 so ProductFeed.latestValue reverts with Panic(0x11). Same shape for Base WSTETH median (market x ETH/USD) only at far larger answers.", "expected": "(0,0) unpriced like every other garbage case, or the ChainlinkFeed cap sized so that products cannot overflow", "actual": "ProductFeed.latestValue reverts while isStale() returns false. Pricer.quote reverts. LedgerBase._quote, PricerOracle and Liquidator:198 catch it (unpriced, fails closed), but Redeemer:114, Ledger:476 and Liquidator:228 call pricer.quote without try, so those acts revert instead of reading unpriced. Repay/deposit use _quote (try/catch) and are not blocked. Needs a Chainlink answer around 1e31+ on a ratio feed, i.e. garbage that a broken aggregator must produce; impact is a revert on a path that is already refused for a garbage price, so low.", "reachableAtDeploy": "yes in code (WBTC type on Ethereum, Base WSTETH median); requires an absurd Chainlink answer", "fix": "in ProductFeed use Math.mulDiv(va,vb,1e18) in a try, or return (0,0) when va > type(uint256).max / vb; or lower MAX_PER_TOKEN so that two legs cannot overflow", "test": {"source": "contract Agg {\n    uint8 public decimals = 8; int256 public ans; uint256 public at; uint256 public cap;\n    bool public rev; bytes public raw;\n    function set(int256 a, uint256 t) external { ans = a; at = t; }\n    function setDec(uint8 d) external { decimals = d; }\n    function latestRoundData() external view returns (uint80, int256, uint256, uint256, uint80) { return (1, ans, at, at, 1); }\n}\n\n// finding: ProductFeed multiplication overflows (panic) for in-cap legs; consumers w/o try/catch revert\n    function test_productOverflowPanics() public {\n        Agg btc = new Agg(); Agg ratio = new Agg();\n        btc.set(1e26, block.timestamp);           // $1e18 per BTC: at the sanity cap, reads as a price\n        ratio.setDec(18); ratio.set(1e32, block.timestamp); // 1e14 BTC per WBTC: under its cap (1e36)\n        ChainlinkFeed fb = new ChainlinkFeed(address(btc), 8, 1 days);\n        ChainlinkFeed fr = new ChainlinkFeed(address(ratio), 18, 1 days);\n        (uint256 vb,) = fb.latestValue(); (uint256 vr,) = fr.latestValue();\n        assertGt(vb, 0); assertGt(vr, 0);\n        ProductFeed p = new ProductFeed(IFeed(address(fb)), IFeed(address(fr)));\n        vm.expectRevert(); p.latestValue();\n        assertFalse(p.isStale()); // isStale reads fine: only the price read panics\n    }", "ran": "yes, scratch project, forge 1.9.0, solc 0.8.28", "result": "[PASS] test_productOverflowPanics() (vb>0, vr>0, p.latestValue() reverts, p.isStale()==false)"}}], "claims": [{"id": "C1", "result": "holds", "evidence": "All Ethereum feeds in script/DeployConfig.sol:179-185 read on chain (RPC the task names for chain 1, block 26553727, via the task's proxy to it): ETH/USD, STETH/USD, BTC/USD, WBTC/BTC, cbBTC/USD, USDC/USD and USDS/USD all return the expected description() and decimals 8. Base (head 65799881): ETH/USD, BTC/USD, cbBTC/USD, USDC/USD (8), WSTETH/ETH (18), 'wstETH-stETH Exchange Rate' (18, latestAnswer 1.2508e18). No 0x7104/0x64c9 address appears in DeployConfig. 4663 addresses (CL_ETH_USD 0x78F3..., CL_USDG_USD 0x61B7...) NOT RUN: no 4663 read."}, {"id": "C2", "result": "holds", "evidence": "testFuzz_chainlink (2000 runs, any answer, updatedAt incl. 0/future, decimals change): value!=0 implies answer>0, 0<at<=now, decimals unchanged, answer<=1e26, at==updatedAt; value==0 implies at==0 and isStale. Source: ChainlinkFeed.sol:44-58. Min/max clamp covered by test/unit/ChainlinkFeed.t.sol, not re-fuzzed. Revert/short data paths by code reading (ok && length>=160). Only exception: dirty-word returndata reverts, as documented at ChainlinkFeed.sol:12. Consumer side: see F1 (product overflow), which is the only route to a panic."}, {"id": "C3", "result": "holds", "evidence": "testFuzz_product (2000 runs): either leg 0 -> (0,0); time = older leg's; isStale true if either leg stale. Pricer.quote requires m!=0 && !isStale on the median and s!=0 && !isStale on the spot (Pricer.sol:57-67). No product prices on a stale or zero leg. See F1 for the overflow edge."}, {"id": "C4", "result": "holds", "evidence": "[fork] PARTLY RUN: Ethereum block 26553727 (task's chain-1 RPC) all 7 proxies decimals 8, descriptions match config, latest updatedAt ages within maxAge (USDC 19.8h of 25h, WBTC/BTC 4.4h of 25h, ETH/BTC/stETH under 1h10m-gap at read). Base block 65799881: 6 feeds read, decimals match. Rate/product legs, 4663, round history and min/max clamps NOT RUN."}, {"id": "C5", "result": "holds", "evidence": "Base spot leg = RateFeed(latestAnswer) x ETH/USD (DeployConfig.sol:790-795). A negative answer decodes to a huge uint, but RateFeed.rate() = min(live, max(ckpt grown at 1.157e10/s, highRate)) (RateFeed.sol:68-77), so a huge rate is clamped to the capped ceiling and cannot price above capped rate x ETH/USD; a zero/short/reverting answer gives rate 0 and unpriced spot -> median alone, borrowable=false. testFuzz_rate (live in [1,1e24], gaps to 30d, pokes by anyone in any order): rate <= live and rate <= max(ckpt*(1+cap*dt), highRate) always. Stale rate (no updatedAt) can only make the spot leg HIGHER than market; low=min(median,spot) and borrow needs agreement within skew, so no extra borrow; a stale-high spot cannot liquidate; a rate fall is taken in full."}, {"id": "sheet-accuracy", "result": "holds", "evidence": "Every function the sheet names exists: Pricer.quote/_depegged, ChainlinkFeed.latestValue, RateFeed, ProductFeed, PricerOracle.priceOf/pricedAt, LedgerBase._quote (src/LedgerBase.sol:236). One check: P1 says no liquidation or redemption acts in grace; LedgerBase._quote only clears borrowable in grace (priced stays true), and the block is by Redeemer.sol:112, Liquidator.sol:224, LedgerSettlement.sol:212 (src/house/LedgerSettlement.sol:212) and house/Liquidator.sol:301. Sheet P1 holds through those readers, not through the Pricer."}], "holds": [{"property": "P1 (fresh Chainlink or unpriced)", "tried": "testFuzz_chainlink; testFuzz_pricer with stale/zero median and spot (priced=false, low=payout=0, borrowable=false). Writers of feed state: RateFeed.poke (anyone), ChainlinkFeed none (immutable); readers: Pricer.quote, PricerOracle, LedgerBase._quote, Redeemer, Liquidator, LedgerSettlement, LoopVault. Grace: borrowable cleared in _quote; redemption/liquidation/settlement revert while pulse.inGrace(). Chains without Pulse: Ethereum only (DeployConfig.sol:279 'no Pulse'), where the sequencer-grace is not relevant."}, {"property": "P2 (RateFeed cap)", "tried": "testFuzz_rate: random live-rate paths (including falls and returns), gaps up to 30 days, pokes at random points by any caller. rate() never above live (fall taken in full), never above max(checkpoint grown at cap, highRate). CAP in DeployConfig = 0.001e18/1 days = 1.157e10 per second on Ethereum (sUSDS, Steakhouse USDC, wstETH twice), 4663 (staked USDG) and Base (wstETH rate). Headroom while unpoked = README:1135 as written; a donation within accrued headroom is that known issue, no worse (checkpoint reset by poke is bounded by the capped rate). Constructor sets checkpoint at deploy rate."}, {"property": "P3 (side by side)", "tried": "testFuzz_pricer: borrow <= low <= min(median,spot) when legs agree; borrowable implies agree and low <= spot and high >= median; low==median when legs disagree or the spot is stale; borrow <= cap when cap set; payout >= high (Pricer.sol:76-80). Depeg breaker uses the same Chainlink aggregator as the median on every shipped stable type (CL_USDS_USD, CL_USDC_USD, CL_USDG_USD), so its lack of an updatedAt check (Pricer.sol:84-92) is shadowed by the median staleness gate at deploy; only a governance-added type with a separate peg aggregator would hit it (info only, not a deploy defect)."}], "notRun": ["[fork] 4663 feeds (CL_ETH_USD 0x78F3.., CL_USDG_USD 0x61B7..) and the stocks feeds: not read", "[fork] rate and product leg reads at head; round-history gap check; min/max clamp reads", "solc 0.8.38 build and --use solar: not available (copy-compiled with 0.8.28, pragma only change)", "src/house/Pricer.sol and src/house/LedgerBase.sol (the IMD house copy) not tested; outside the sheet's file list", "PricerOracle seal / setIlk ordering read but not fuzzed (setIlk is deployer-only until seal, then Parameters-only, new tokens only)"]}