From 3a83231941cfb663e654b55c7f015e3da8281937 Mon Sep 17 00:00:00 2001 From: nick Date: Mon, 20 May 2024 15:26:47 +0900 Subject: [PATCH] fix: add check based on last submission time --- contracts/v0.2/src/SubmissionProxy.sol | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/contracts/v0.2/src/SubmissionProxy.sol b/contracts/v0.2/src/SubmissionProxy.sol index 8d2d2ba79..44baa219f 100644 --- a/contracts/v0.2/src/SubmissionProxy.sol +++ b/contracts/v0.2/src/SubmissionProxy.sol @@ -38,6 +38,7 @@ contract SubmissionProxy is Ownable { mapping(address => OracleInfo) public whitelist; mapping(bytes32 feedHash => uint8 threshold) thresholds; mapping(bytes32 feedHash => IFeed feed) feeds; + mapping(bytes32 feedHash => uint256 lastSubmissionTime) lastSubmissionTimes; event OracleAdded(address oracle, uint256 expirationTime); event OracleRemoved(address oracle); @@ -358,7 +359,7 @@ contract SubmissionProxy is Ownable { uint256 feedsLength_ = _feedHashes.length; for (uint256 i = 0; i < feedsLength_; i++) { - if (_timestamps[i] <= block.timestamp - dataFreshness) { + if (_timestamps[i] <= block.timestamp - dataFreshness || lastSubmissionTimes[_feedHashes[i]] >= _timestamps[i]) { // answer is too old -> do not submit! continue; } @@ -383,6 +384,7 @@ contract SubmissionProxy is Ownable { if (validateProof(_feedHashes[i], message_, proofs_)) { feeds[_feedHashes[i]].submit(_answers[i]); } + lastSubmissionTimes[_feedHashes[i]] = _timestamps[i]; } }