You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Three oracle view/mutating functions have zero test coverage:
clear_prices (contracts/oracle/src/lib.rs:402) — batch-clears temporary price entries for multiple tokens. Only the single-token clear_price appears to be exercised; the batch version is never called by any test.
grep -rn "clear_prices\|get_stable_price\|get_price_with_stable_fallback" --include="*.rs".| grep -v oracle/src/lib.rs
# no output
Why it matters
#383's fix (rejecting a stable_price value that doesn't fit in i128) is exactly the kind of boundary condition that regresses silently without a dedicated test — a future refactor of either function could reintroduce the unchecked cast and nothing in CI would catch it. clear_prices's loop-based batch clearing is also untested, so an off-by-one or early-return bug in the loop would not be caught.
Suggested fix
Add tests: clear_prices with a multi-token vector, asserting each token's price is actually cleared from temporary storage; get_stable_price/get_price_with_stable_fallback with a stable_price value at/above i128::MAX asserting None/fallback-to-primary behavior, and with a normal in-range value asserting the stable price is returned.
Problem
Three
oracleview/mutating functions have zero test coverage:clear_prices(contracts/oracle/src/lib.rs:402) — batch-clears temporary price entries for multiple tokens. Only the single-tokenclear_priceappears to be exercised; the batch version is never called by any test.get_stable_price(line 321) andget_price_with_stable_fallback(line 341) — both contain the overflow guard added for issue oracle: get_stable_price / get_price_with_stable_fallback trust an unchecked u128->i128 cast as a valid price #383 (if price_u128 == 0 || price_u128 > i128::MAX as u128 { None }/ the equivalent inline check), but no test calls either function at all, so the guard itself is unverified by the test suite.Why it matters
#383's fix (rejecting a
stable_pricevalue that doesn't fit ini128) is exactly the kind of boundary condition that regresses silently without a dedicated test — a future refactor of either function could reintroduce the unchecked cast and nothing in CI would catch it.clear_prices's loop-based batch clearing is also untested, so an off-by-one or early-return bug in the loop would not be caught.Suggested fix
Add tests:
clear_priceswith a multi-token vector, asserting each token's price is actually cleared from temporary storage;get_stable_price/get_price_with_stable_fallbackwith astable_pricevalue at/abovei128::MAXassertingNone/fallback-to-primary behavior, and with a normal in-range value asserting the stable price is returned.