fix: _isPriceStable fallback interval can still revert on pools with very short history (#610)
Wrap the fallback pool.observe() call in a try/catch so that pools with insufficient observation history for both the primary (30s) and fallback (6000s) intervals return false (price unstable) instead of reverting with an opaque Uniswap V3 error. This prevents recenter() from failing for unpermissioned callers on newly created pools. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1691128f91
commit
db1c26838d
2 changed files with 18 additions and 3 deletions
|
|
@ -228,6 +228,15 @@ contract PriceOracleTest is Test {
|
|||
assertTrue(isStable, "Price stability should work with negative ticks");
|
||||
}
|
||||
|
||||
function testDoubleFailureReturnsFalse() public {
|
||||
// When pool has < 6000 seconds of history, both observe() calls fail.
|
||||
// _isPriceStable should return false (safe default) instead of reverting.
|
||||
mockPool.setShouldRevert(true);
|
||||
|
||||
bool isStable = priceOracle.isPriceStable(1000);
|
||||
assertFalse(isStable, "Double observe failure should return false, not revert");
|
||||
}
|
||||
|
||||
// ========================================
|
||||
// PRICE MOVEMENT VALIDATION TESTS
|
||||
// ========================================
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue