From 3eba7b99f8640e54b089ec1a4a3dd1f996a44519 Mon Sep 17 00:00:00 2001 From: moebius <0xmoebius@tutanota.com> Date: Thu, 26 Oct 2023 11:10:51 -0300 Subject: [PATCH] perf: delete response improvement --- solidity/contracts/Oracle.sol | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/solidity/contracts/Oracle.sol b/solidity/contracts/Oracle.sol index e483326..7f3b5a3 100644 --- a/solidity/contracts/Oracle.sol +++ b/solidity/contracts/Oracle.sol @@ -206,8 +206,8 @@ contract Oracle is IOracle { /// @inheritdoc IOracle function deleteResponse(bytes32 _responseId) external { - Response memory _response = _responses[_responseId]; - Request memory _request = _requests[_response.requestId]; + Response storage _response = _responses[_responseId]; + Request storage _request = _requests[_response.requestId]; if (disputeOf[_responseId] != bytes32(0)) { revert Oracle_CannotDeleteWhileDisputing(_responseId); @@ -217,11 +217,10 @@ contract Oracle is IOracle { } _request.responseModule.deleteResponse(_response.requestId, _responseId, msg.sender); - - delete _responses[_responseId]; _responseIds[_response.requestId].remove(_responseId); emit ResponseDeleted(_response.requestId, msg.sender, _responseId); + delete _responses[_responseId]; } /// @inheritdoc IOracle