Skip to content

Commit

Permalink
test: fix a part of oracle unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gas1cent committed Nov 18, 2023
1 parent 15a6638 commit d255f0d
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 301 deletions.
11 changes: 6 additions & 5 deletions solidity/contracts/Oracle.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';

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

import {IRequestModule} from '../interfaces/modules/request/IRequestModule.sol';
Expand All @@ -9,8 +11,6 @@ import {IDisputeModule} from '../interfaces/modules/dispute/IDisputeModule.sol';
import {IResolutionModule} from '../interfaces/modules/resolution/IResolutionModule.sol';
import {IFinalityModule} from '../interfaces/modules/finality/IFinalityModule.sol';

import {EnumerableSet} from '@openzeppelin/contracts/utils/structs/EnumerableSet.sol';

contract Oracle is IOracle {
using EnumerableSet for EnumerableSet.Bytes32Set;

Expand Down Expand Up @@ -130,7 +130,7 @@ contract Oracle is IOracle {
_responseIds[_requestId] = abi.encodePacked(_responseIds[_requestId], _responseId);
createdAt[_responseId] = uint128(block.number);

emit ResponseProposed(_requestId, _response, _responseId, block.number);
emit ResponseProposed(_requestId, _responseId, _response, block.number);
}

/// @inheritdoc IOracle
Expand Down Expand Up @@ -208,7 +208,8 @@ contract Oracle is IOracle {
}

// Revert if the dispute is not active nor escalated
if (disputeStatus[_disputeId] > DisputeStatus.Escalated) {
DisputeStatus _currentStatus = disputeStatus[_disputeId];
if (_currentStatus != DisputeStatus.Active && _currentStatus != DisputeStatus.Escalated) {
revert Oracle_CannotResolve(_disputeId);
}

Expand Down Expand Up @@ -376,8 +377,8 @@ contract Oracle is IOracle {
if (_requestNonce != _request.nonce || msg.sender != _request.requester) revert Oracle_InvalidRequestBody();

_requestId = _getId(_request);
createdAt[_requestId] = uint128(block.number);
_requestIds[_requestNonce] = _requestId;
createdAt[_requestId] = uint128(block.number);

_allowedModules[_requestId] = abi.encodePacked(

Check failure on line 383 in solidity/contracts/Oracle.sol

View workflow job for this annotation

GitHub Actions / Run Linters (16.x)

Missing named parameters. Max unnamed parameters value is 4
_request.requestModule,
Expand Down
4 changes: 2 additions & 2 deletions solidity/interfaces/IOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ interface IOracle {
* @notice Emitted when a request is created
* @param _requestId The id of the created request
*/
event RequestCreated(bytes32 indexed _requestId, IOracle.Request _request, uint256 _blockNumber);
event RequestCreated(bytes32 indexed _requestId, Request _request, uint256 _blockNumber);

/**
* @notice Emitted when a response is proposed
* @param _requestId The id of the request
* @param _responseId The id of the proposed response
*/
event ResponseProposed(
bytes32 indexed _requestId, Response _response, bytes32 indexed _responseId, uint256 _blockNumber
bytes32 indexed _requestId, bytes32 indexed _responseId, Response _response, uint256 _blockNumber
);

/**
Expand Down
Loading

0 comments on commit d255f0d

Please sign in to comment.