Skip to content

Commit

Permalink
fix: add check based on last submission time
Browse files Browse the repository at this point in the history
  • Loading branch information
nick-bisonai committed May 20, 2024
1 parent 6fb7915 commit 3a83231
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion contracts/v0.2/src/SubmissionProxy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand All @@ -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];
}
}

Expand Down

0 comments on commit 3a83231

Please sign in to comment.