From 59a5e3eee1a0fbe805b6d1f986480d26cf89add3 Mon Sep 17 00:00:00 2001 From: Gas One Cent <86567384+gas1cent@users.noreply.github.com> Date: Fri, 17 Nov 2023 19:07:36 +0300 Subject: [PATCH] feat: switch from timestamp to block number --- solidity/contracts/Oracle.sol | 8 ++++---- solidity/interfaces/IOracle.sol | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/solidity/contracts/Oracle.sol b/solidity/contracts/Oracle.sol index 20b8b0f..ef4e0a4 100644 --- a/solidity/contracts/Oracle.sol +++ b/solidity/contracts/Oracle.sol @@ -128,7 +128,7 @@ contract Oracle is IOracle { _participants[_requestId] = abi.encodePacked(_participants[_requestId], _response.proposer); IResponseModule(_request.responseModule).propose(_request, _response, msg.sender); _responseIds[_requestId] = abi.encodePacked(_responseIds[_requestId], _responseId); - createdAt[_responseId] = uint128(block.timestamp); + createdAt[_responseId] = uint128(block.number); emit ResponseProposed(_requestId, _response, _responseId, block.number); } @@ -164,7 +164,7 @@ contract Oracle is IOracle { _participants[_requestId] = abi.encodePacked(_participants[_requestId], msg.sender); disputeStatus[_disputeId] = DisputeStatus.Active; disputeOf[_responseId] = _disputeId; - createdAt[_disputeId] = uint128(block.timestamp); + createdAt[_disputeId] = uint128(block.number); IDisputeModule(_request.disputeModule).disputeResponse(_request, _response, _dispute); @@ -345,7 +345,7 @@ contract Oracle is IOracle { _finalizedResponses[_requestId] = _responseId; } - finalizedAt[_requestId] = uint128(block.timestamp); + finalizedAt[_requestId] = uint128(block.number); if (address(_request.finalityModule) != address(0)) { IFinalityModule(_request.finalityModule).finalizeRequest(_request, _response, msg.sender); @@ -376,7 +376,7 @@ contract Oracle is IOracle { if (_requestNonce != _request.nonce || msg.sender != _request.requester) revert Oracle_InvalidRequestBody(); _requestId = _getId(_request); - createdAt[_requestId] = uint128(block.timestamp); + createdAt[_requestId] = uint128(block.number); _requestIds[_requestNonce] = _requestId; _allowedModules[_requestId] = abi.encodePacked( diff --git a/solidity/interfaces/IOracle.sol b/solidity/interfaces/IOracle.sol index d0d274f..1c4931a 100644 --- a/solidity/interfaces/IOracle.sol +++ b/solidity/interfaces/IOracle.sol @@ -266,18 +266,18 @@ interface IOracle { function disputeStatus(bytes32 _disputeId) external view returns (DisputeStatus _status); /** - * @notice The creation timestamp of a request, response, or a dispute + * @notice The number of the block at which a request, response, or a dispute was created * * @param _id The request, response, or dispute id - * @return _createdAt The time of the creation + * @return _createdAt The block number */ function createdAt(bytes32 _id) external view returns (uint128 _createdAt); /** - * @notice The finalization timestamp of a request + * @notice The number of the block at which a request was finalized * * @param _requestId The request id - * @return _finalizedAt The time of the finalization + * @return _finalizedAt The block number */ function finalizedAt(bytes32 _requestId) external view returns (uint128 _finalizedAt);