diff --git a/solidity/test/integration/ResponseDispute.t.sol b/solidity/test/integration/ResponseDispute.t.sol index 5e1b76b..dc766ff 100644 --- a/solidity/test/integration/ResponseDispute.t.sol +++ b/solidity/test/integration/ResponseDispute.t.sol @@ -14,7 +14,7 @@ contract Integration_ResponseDispute is IntegrationBase { _expectedDeadline = block.timestamp + BLOCK_TIME * 600; _responseData = abi.encode('response'); - mockRequest.nonce = uint96(oracle.totalRequestCount()); + mockRequest.nonce = uint96(oracle.nextRequestNonce()); mockAccessControl.user = requester; _requestId = oracle.createRequest(mockRequest, _ipfsHash, mockAccessControl); diff --git a/solidity/test/integration/ResponseProposal.t.sol b/solidity/test/integration/ResponseProposal.t.sol index 77f37fb..a8df9de 100644 --- a/solidity/test/integration/ResponseProposal.t.sol +++ b/solidity/test/integration/ResponseProposal.t.sol @@ -9,7 +9,7 @@ contract Integration_ResponseProposal is IntegrationBase { function setUp() public override { super.setUp(); - mockRequest.nonce = uint96(oracle.totalRequestCount()); + mockRequest.nonce = uint96(oracle.nextRequestNonce()); address _badRequester = makeAddr('badRequester'); mockAccessControl.user = _badRequester; diff --git a/solidity/test/unit/Oracle.t.sol b/solidity/test/unit/Oracle.t.sol index 6034398..3f38ffe 100644 --- a/solidity/test/unit/Oracle.t.sol +++ b/solidity/test/unit/Oracle.t.sol @@ -66,8 +66,8 @@ contract MockOracle is Oracle { disputeCreatedAt[_disputeId] = _disputeCreatedAt; } - function mock_setTotalRequestCount(uint256 _totalRequestCount) external { - totalRequestCount = _totalRequestCount; + function mock_setNextRequestNonce(uint256 _nextRequestNonce) external { + nextRequestNonce = _nextRequestNonce; } function mock_addResponseId(bytes32 _requestId, bytes32 _responseId) external { @@ -156,7 +156,7 @@ contract Oracle_Unit_CreateRequest is BaseTest { bytes calldata _resolutionData, bytes calldata _finalityData ) public setResolutionAndFinality(_useResolutionAndFinality) happyPath { - uint256 _initialNonce = oracle.totalRequestCount(); + uint256 _initialNonce = oracle.nextRequestNonce(); // Create the request mockRequest.requestModuleData = _requestData; @@ -165,7 +165,7 @@ contract Oracle_Unit_CreateRequest is BaseTest { mockRequest.resolutionModuleData = _resolutionData; mockRequest.finalityModuleData = _finalityData; mockRequest.requester = requester; - mockRequest.nonce = uint96(oracle.totalRequestCount()); + mockRequest.nonce = uint96(oracle.nextRequestNonce()); // Compute the associated request id bytes32 _theoreticalRequestId = _getId(mockRequest); @@ -200,7 +200,7 @@ contract Oracle_Unit_CreateRequest is BaseTest { assertEq(_requestId, _theoreticalRequestId); // Check: nonce incremented? - assertEq(oracle.totalRequestCount(), _initialNonce + 1); + assertEq(oracle.nextRequestNonce(), _initialNonce + 1); } /** @@ -235,7 +235,7 @@ contract Oracle_Unit_CreateRequest is BaseTest { * @notice Check that creating a request with a nonce that already exists reverts */ function test_createRequest_revertsIfInvalidNonce(uint256 _nonce) public happyPath { - vm.assume(_nonce != oracle.totalRequestCount()); + vm.assume(_nonce != oracle.nextRequestNonce()); // Set the nonce mockRequest.nonce = uint96(_nonce); @@ -273,7 +273,7 @@ contract Oracle_Unit_CreateRequests is BaseTest { bytes calldata _responseData, bytes calldata _disputeData ) public { - uint256 _initialNonce = oracle.totalRequestCount(); + uint256 _initialNonce = oracle.nextRequestNonce(); uint256 _requestsAmount = 5; IOracle.Request[] memory _requests = new IOracle.Request[](_requestsAmount); bytes32[] memory _precalculatedIds = new bytes32[](_requestsAmount); @@ -290,7 +290,7 @@ contract Oracle_Unit_CreateRequests is BaseTest { mockRequest.responseModuleData = _responseData; mockRequest.disputeModuleData = _disputeData; mockRequest.requester = requester; - mockRequest.nonce = uint96(oracle.totalRequestCount() + _i); + mockRequest.nonce = uint96(oracle.nextRequestNonce() + _i); bytes32 _theoreticalRequestId = _getId(mockRequest); _requests[_i] = mockRequest; @@ -329,7 +329,7 @@ contract Oracle_Unit_CreateRequests is BaseTest { assertEq(oracle.nonceToRequestId(_requests[_i].nonce), _requestsIds[_i]); } - uint256 _newNonce = oracle.totalRequestCount(); + uint256 _newNonce = oracle.nextRequestNonce(); assertEq(_newNonce, _initialNonce + _requestsAmount); } @@ -341,7 +341,7 @@ contract Oracle_Unit_CreateRequests is BaseTest { bytes calldata _responseData, bytes calldata _disputeData ) public { - uint256 _initialNonce = oracle.totalRequestCount(); + uint256 _initialNonce = oracle.nextRequestNonce(); uint256 _requestsAmount = 5; IOracle.Request[] memory _requests = new IOracle.Request[](_requestsAmount); bytes32[] memory _precalculatedIds = new bytes32[](_requestsAmount); @@ -369,7 +369,7 @@ contract Oracle_Unit_CreateRequests is BaseTest { oracle.mock_setAccessModuleApproved(requester, address(accessModule), true); oracle.createRequests(_requests, _ipfsHashes, _accessControls); - uint256 _newNonce = oracle.totalRequestCount(); + uint256 _newNonce = oracle.nextRequestNonce(); assertEq(_newNonce, _initialNonce + _requestsAmount); } } @@ -391,7 +391,7 @@ contract Oracle_Unit_ListRequestIds is BaseTest { oracle.mock_setRequestId(_i, _requestId); } - oracle.mock_setTotalRequestCount(_numberOfRequests); + oracle.mock_setNextRequestNonce(_numberOfRequests); // Test: fetching the requests bytes32[] memory _requestsIds = oracle.listRequestIds(0, _numberOfRequests); @@ -421,7 +421,7 @@ contract Oracle_Unit_ListRequestIds is BaseTest { oracle.mock_setRequestId(_i, _requestId); } - oracle.mock_setTotalRequestCount(_numberOfRequests); + oracle.mock_setNextRequestNonce(_numberOfRequests); // Test: fetching 1 extra request bytes32[] memory _requestsIds = oracle.listRequestIds(0, _numberOfRequests + 1);