Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:defi-wonderland/prophet-core into fe…
Browse files Browse the repository at this point in the history
…at/pure-to-view
  • Loading branch information
ashitakah committed Jul 22, 2024
2 parents c1dd58a + 8b25c6d commit c98e0a8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
4 changes: 2 additions & 2 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ contract Oracle is IOracle {
) external returns (bytes32 _disputeId) {
_disputeId = _validateDispute(_request, _response, _dispute);

if (_dispute.disputer != msg.sender) {
if (_dispute.proposer != _response.proposer) {
revert Oracle_InvalidDisputeBody();
}

if (createdAt[_dispute.requestId] == 0) {
if (_dispute.disputer != msg.sender || createdAt[_dispute.requestId] == 0) {
revert Oracle_InvalidDisputeBody();
}

Expand Down
2 changes: 1 addition & 1 deletion solidity/interfaces/IModule.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {IOracle} from '../interfaces/IOracle.sol';
import {IOracle} from './IOracle.sol';

/**
* @title Module
Expand Down
17 changes: 17 additions & 0 deletions solidity/test/unit/Oracle.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,23 @@ contract Oracle_Unit_DisputeResponse is BaseTest {
}
}

/**
* @notice Reverts if the dispute proposer and response proposer are not same
*/
function test_disputeResponse_revertIfProposerIsNotValid(address _otherProposer) public {
vm.assume(_otherProposer != proposer);
oracle.mock_setCreatedAt(_getId(mockRequest), 0);

// Check: revert?
vm.expectRevert(IOracle.Oracle_InvalidDisputeBody.selector);

mockDispute.proposer = _otherProposer;

// Test: try to dispute the response
vm.prank(disputer);
oracle.disputeResponse(mockRequest, mockResponse, mockDispute);
}

/**
* @notice Reverts if the request doesn't exist
*/
Expand Down

0 comments on commit c98e0a8

Please sign in to comment.