From 17d5b19e35b1fa78cc4705391387c1ea23671f8d Mon Sep 17 00:00:00 2001 From: nick Date: Tue, 12 Nov 2024 10:35:53 +0900 Subject: [PATCH] fix: separated error cases --- contracts/v0.2/src/SubmissionProxy.sol | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contracts/v0.2/src/SubmissionProxy.sol b/contracts/v0.2/src/SubmissionProxy.sol index 8d4fdf036..4b23d4c88 100644 --- a/contracts/v0.2/src/SubmissionProxy.sol +++ b/contracts/v0.2/src/SubmissionProxy.sol @@ -61,7 +61,8 @@ contract SubmissionProxy is Ownable { error InvalidSignatureLength(); error InvalidFeed(); error ZeroAddressGiven(); - error AnswerTooOld(); + error AnswerOutdated(); + error AnswerSuperseded(); error InvalidProofFormat(); error InvalidProof(); error FeedHashNotFound(); @@ -416,8 +417,12 @@ contract SubmissionProxy is Ownable { } function submitSingle(bytes32 _feedHash, int256 _answer, uint256 _timestamp, bytes calldata _proof) public { - if (_timestamp <= (block.timestamp - dataFreshness) * 1000 || lastSubmissionTimes[_feedHash] >= _timestamp) { - revert AnswerTooOld(); + if (_timestamp <= (block.timestamp - dataFreshness) * 1000 ) { + revert AnswerOutdated(); + } + + if (lastSubmissionTimes[_feedHash] >= _timestamp) { + revert AnswerSuperseded(); } (bytes[] memory proofs_, bool success_) = splitProofs(_proof);