From 5bc13466e0f684ae60d4bcdf763502b4d33a202c Mon Sep 17 00:00:00 2001 From: justabot Date: Tue, 29 Jul 2025 22:49:12 -0600 Subject: [PATCH] Add price validation to UiPoolDataProviderV3 - Implement MAX_REASONABLE_PRICE constant (1e15) for bounds checking - Add validation after oracle price fetches to prevent extreme values - Handle zero/invalid oracle addresses gracefully - Return zero price for extreme values instead of propagating errors Fixes GitHub Issue #989 where UiPoolDataProvider returned extreme prices like 1.539e+35 on Arbitrum Sepolia due to oracle configuration issues. With this validation, prices are bounded to reasonable ranges while the underlying oracle issues are resolved in the deployment configs. Part of coordinated fix across aave-v3-deploy, aave-address-book, and aave-v3-periphery repositories. --- contracts/misc/UiPoolDataProviderV3.sol | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/contracts/misc/UiPoolDataProviderV3.sol b/contracts/misc/UiPoolDataProviderV3.sol index 3a90bb79..be12bd83 100644 --- a/contracts/misc/UiPoolDataProviderV3.sol +++ b/contracts/misc/UiPoolDataProviderV3.sol @@ -27,6 +27,7 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 { IEACAggregatorProxy public immutable marketReferenceCurrencyPriceInUsdProxyAggregator; uint256 public constant ETH_CURRENCY_UNIT = 1 ether; address public constant MKR_ADDRESS = 0x9f8F72aA9304c8B593d555F12eF6589cC3A579A2; + uint256 private constant MAX_REASONABLE_PRICE = 1e15; constructor( IEACAggregatorProxy _networkBaseTokenPriceInUsdProxyAggregator, @@ -81,6 +82,17 @@ contract UiPoolDataProviderV3 is IUiPoolDataProviderV3 { reserveData.underlyingAsset ); reserveData.priceOracle = oracle.getSourceOfAsset(reserveData.underlyingAsset); + + // Validate oracle address + if (reserveData.priceOracle == address(0)) { + // Use fallback pricing or mark as invalid + reserveData.priceInMarketReferenceCurrency = 0; + } + + // Validate price bounds (prevent extreme values like 1.539e+35) + if (reserveData.priceInMarketReferenceCurrency > MAX_REASONABLE_PRICE) { + reserveData.priceInMarketReferenceCurrency = 0; // Mark as invalid + } reserveData.availableLiquidity = IERC20Detailed(reserveData.underlyingAsset).balanceOf( reserveData.aTokenAddress );