diff --git a/solidity/contracts/Oracle.sol b/solidity/contracts/Oracle.sol index 11e84ca..459333a 100644 --- a/solidity/contracts/Oracle.sol +++ b/solidity/contracts/Oracle.sol @@ -253,11 +253,11 @@ contract Oracle is IOracle { revert Oracle_CannotTamperParticipant(); } + emit ResponseDisputed(msg.sender, _responseId, _disputeId); + if (_dispute.status != DisputeStatus.Active) { _request.disputeModule.onDisputeStatusChange(_disputeId, _dispute); } - - emit ResponseDisputed(msg.sender, _responseId, _disputeId); } /// @inheritdoc IOracle @@ -277,12 +277,12 @@ contract Oracle is IOracle { // Notify the dispute module about the escalation _request.disputeModule.disputeEscalated(_disputeId); + emit DisputeEscalated(msg.sender, _disputeId); + if (address(_request.resolutionModule) != address(0)) { // Initiate the resolution _request.resolutionModule.startResolution(_disputeId); } - - emit DisputeEscalated(msg.sender, _disputeId); } /// @inheritdoc IOracle @@ -309,8 +309,8 @@ contract Oracle is IOracle { function updateDisputeStatus(bytes32 _disputeId, DisputeStatus _status) external { Dispute storage _dispute = _disputes[_disputeId]; Request memory _request = _requests[_dispute.requestId]; - if (msg.sender != address(_request.resolutionModule)) { - revert Oracle_NotResolutionModule(msg.sender); + if (msg.sender != address(_request.disputeModule) && msg.sender != address(_request.resolutionModule)) { + revert Oracle_NotDisputeOrResolutionModule(msg.sender); } _dispute.status = _status; _request.disputeModule.onDisputeStatusChange(_disputeId, _dispute); diff --git a/solidity/interfaces/IOracle.sol b/solidity/interfaces/IOracle.sol index fba4bd6..51b2145 100644 --- a/solidity/interfaces/IOracle.sol +++ b/solidity/interfaces/IOracle.sol @@ -83,7 +83,7 @@ interface IOracle { * @notice Thrown when an unauthorized caller is trying to change a dispute's status * @param _caller The caller of the function */ - error Oracle_NotResolutionModule(address _caller); + error Oracle_NotDisputeOrResolutionModule(address _caller); /** * @notice Thrown when an unauthorized caller is trying to propose a response diff --git a/solidity/test/unit/Oracle.t.sol b/solidity/test/unit/Oracle.t.sol index b57bc90..ed68e19 100644 --- a/solidity/test/unit/Oracle.t.sol +++ b/solidity/test/unit/Oracle.t.sol @@ -1041,7 +1041,7 @@ contract Unit_UpdateDisputeStatus is BaseTest { _mockRequest(); // Check: revert? - vm.expectRevert(abi.encodeWithSelector(IOracle.Oracle_NotResolutionModule.selector, proposer)); + vm.expectRevert(abi.encodeWithSelector(IOracle.Oracle_NotDisputeOrResolutionModule.selector, proposer)); // Test: try to update the status from an EOA vm.prank(proposer);