From 0607e9b5edabe0b6f59b61f272b6fce0e4846d16 Mon Sep 17 00:00:00 2001 From: Gas One Cent <86567384+gas1cent@users.noreply.github.com> Date: Mon, 6 Nov 2023 12:50:40 +0400 Subject: [PATCH] fix: fetch the creation time from oracle --- docs/src/content/modules/response/bonded_response_module.md | 2 +- .../contracts/modules/response/BondedResponseModule.sol | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/src/content/modules/response/bonded_response_module.md b/docs/src/content/modules/response/bonded_response_module.md index b8c98800..5d5b3221 100644 --- a/docs/src/content/modules/response/bonded_response_module.md +++ b/docs/src/content/modules/response/bonded_response_module.md @@ -10,7 +10,7 @@ The Bonded Response Module is a contract that allows users to propose a response ### Key Methods -- `decodeRequestData(bytes32 _requestId)`: Returns the decoded data for a request. +- `decodeRequestData(bytes calldata _data)`: Returns the decoded data for a request. - `propose(bytes32 _requestId, address _proposer, bytes calldata _responseData)`: Proposes a response for a request, bonding the proposer's tokens. - `deleteResponse(bytes32 _requestId, bytes32 _responseId, address _proposer)`: Allows a user to delete an undisputed response they proposed before the deadline, releasing the bond. - `finalizeRequest(bytes32 _requestId, address _finalizer)`: Finalizes the request. diff --git a/solidity/contracts/modules/response/BondedResponseModule.sol b/solidity/contracts/modules/response/BondedResponseModule.sol index 25050415..a1bf213c 100644 --- a/solidity/contracts/modules/response/BondedResponseModule.sol +++ b/solidity/contracts/modules/response/BondedResponseModule.sol @@ -70,8 +70,10 @@ contract BondedResponseModule is Module, IBondedResponseModule { revert BondedResponseModule_TooEarlyToFinalize(); } - if (ORACLE.createdAt[_getId(_response)] != 0) { - if (!_isModule && block.timestamp < _response.createdAt + _params.disputeWindow) { + uint256 _responseCreatedAt = ORACLE.createdAt(_getId(_response)); + + if (_responseCreatedAt != 0) { + if (!_isModule && block.timestamp < _responseCreatedAt + _params.disputeWindow) { revert BondedResponseModule_TooEarlyToFinalize(); }