From 3a0bd8f614c4442ca3384498b9ca0ee5f4014c07 Mon Sep 17 00:00:00 2001 From: Reinis Martinsons Date: Mon, 17 Jun 2024 14:18:21 +0000 Subject: [PATCH] fix[oval-audit-l-06]: use max age in coinbase source adapter Signed-off-by: Reinis Martinsons --- src/adapters/source-adapters/CoinbaseSourceAdapter.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/adapters/source-adapters/CoinbaseSourceAdapter.sol b/src/adapters/source-adapters/CoinbaseSourceAdapter.sol index 928a186..67a003c 100644 --- a/src/adapters/source-adapters/CoinbaseSourceAdapter.sol +++ b/src/adapters/source-adapters/CoinbaseSourceAdapter.sol @@ -83,8 +83,8 @@ abstract contract CoinbaseSourceAdapter is DiamondRootOval { // Attempt traversing historical round data backwards from roundId. (int256 historicalAnswer, uint256 historicalUpdatedAt) = _searchRoundDataAt(timestamp, roundId, maxTraversal); - // Validate returned data. If it is uninitialized, fall back to returning the current latest round data. - if (historicalUpdatedAt > 0) { + // Validate returned data. If it is uninitialized or too old, fall back to returning the current latest round data. + if (historicalUpdatedAt > block.timestamp - maxAge()) { return (historicalAnswer, historicalUpdatedAt); }