Skip to content

Commit

Permalink
test: dispute window is a timestamp window
Browse files Browse the repository at this point in the history
  • Loading branch information
xorsal committed Sep 25, 2024
1 parent ae76ae2 commit 06ef255
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions solidity/test/integration/BondEscalation.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ contract Integration_BondEscalation is IntegrationBase {
assertEq(_bondEscalationAccounting.balanceOf(disputer, usdc), 0, 'Mismatch: Disputer balance');

// Step 8: Finalize request and check balances again
vm.roll(_expectedDeadline + 1 days);
vm.warp(_expectedDeadline + 1 days);
oracle.finalize(mockRequest, mockResponse);

// Test: The requester has no balance because he has paid the proposer
Expand Down Expand Up @@ -248,7 +248,7 @@ contract Integration_BondEscalation is IntegrationBase {
_responseId = oracle.proposeResponse(mockRequest, _thirdResponse);

// Step 11: It goes undisputed for three days, therefore it's deemed correct and final
vm.roll(_expectedDeadline + 1);
vm.warp(_expectedDeadline + 1);
oracle.finalize(mockRequest, _thirdResponse);

// Test: The requester has paid out the reward
Expand Down Expand Up @@ -283,7 +283,7 @@ contract Integration_BondEscalation is IntegrationBase {

// Step 12: Two days after the deadline, the resolution module says that Another proposer's answer was correct
// So Another proposer gets paid Disputer's bond
vm.roll(_expectedDeadline + 2 days);
vm.warp(_expectedDeadline + 2 days);
_mockArbitrator.setAnswer(IOracle.DisputeStatus.Lost);
oracle.resolveDispute(mockRequest, _secondResponse, _secondDispute);

Expand Down
10 changes: 5 additions & 5 deletions solidity/test/integration/Finalization.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ contract Integration_Finalization is IntegrationBase {
_proposeResponse();

// Traveling to the end of the dispute window
vm.roll(_expectedDeadline + 1 + _baseDisputeWindow);
vm.warp(_expectedDeadline + 1 + _baseDisputeWindow);

// Check: all external calls are made?
vm.expectCall(address(_mockCallback), abi.encodeWithSelector(IProphetCallback.prophetCallback.selector, _calldata));
Expand Down Expand Up @@ -69,13 +69,13 @@ contract Integration_Finalization is IntegrationBase {
/**
* @notice Finalizing a request with a ongoing dispute reverts.
*/
function test_revertFinalizeInDisputeWindow(uint256 _block) public {
_block = bound(_block, block.timestamp, _expectedDeadline - _baseDisputeWindow - 1);
function test_revertFinalizeInDisputeWindow(uint256 _timestamp) public {
_timestamp = bound(_timestamp, block.timestamp, _expectedDeadline - _baseDisputeWindow - 1);

_createRequest();
_proposeResponse();

vm.roll(_block);
vm.warp(_timestamp);

// Check: reverts if called during the dispute window?
vm.expectRevert(IBondedResponseModule.BondedResponseModule_TooEarlyToFinalize.selector);
Expand All @@ -96,7 +96,7 @@ contract Integration_Finalization is IntegrationBase {
_proposeResponse();

// Traveling to the end of the dispute window
vm.roll(_expectedDeadline + 1 + _baseDisputeWindow);
vm.warp(_expectedDeadline + 1 + _baseDisputeWindow);

vm.expectCall(address(_mockCallback), abi.encodeWithSelector(IProphetCallback.prophetCallback.selector, _calldata));
vm.prank(_finalizer);
Expand Down
4 changes: 2 additions & 2 deletions solidity/test/integration/Payments.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ contract Integration_Payments is IntegrationBase {
assertEq(_accountingExtension.bondedAmountOf(proposer, usdc, _requestId), _bondSize);

// Warp to finalization time.
vm.roll(_expectedDeadline + _baseDisputeWindow);
vm.warp(_expectedDeadline + _baseDisputeWindow);

// Finalize request/response
oracle.finalize(mockRequest, mockResponse);
Expand Down Expand Up @@ -66,7 +66,7 @@ contract Integration_Payments is IntegrationBase {
assertEq(_accountingExtension.bondedAmountOf(proposer, weth, _requestId), _bondSize);

// Warp to finalization time.
vm.roll(_expectedDeadline + _baseDisputeWindow);
vm.warp(_expectedDeadline + _baseDisputeWindow);
// Finalize request/response.
oracle.finalize(mockRequest, mockResponse);

Expand Down
2 changes: 1 addition & 1 deletion solidity/test/integration/ResponseDispute.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ contract Integration_ResponseDispute is IntegrationBase {
* @notice Disputing a finalized response should revert
*/
function test_disputeResponse_alreadyFinalized() public {
vm.roll(_expectedDeadline + _baseDisputeWindow);
vm.warp(_expectedDeadline + _baseDisputeWindow);
oracle.finalize(mockRequest, mockResponse);

vm.expectRevert(abi.encodeWithSelector(IOracle.Oracle_AlreadyFinalized.selector, _getId(mockRequest)));
Expand Down
2 changes: 1 addition & 1 deletion solidity/test/integration/RootVerification.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ contract Integration_RootVerification is IntegrationBase {
vm.prank(proposer);
oracle.proposeResponse(mockRequest, mockResponse);

vm.roll(_expectedDeadline + _baseDisputeWindow);
vm.warp(_expectedDeadline + _baseDisputeWindow);

oracle.finalize(mockRequest, mockResponse);
}
Expand Down

0 comments on commit 06ef255

Please sign in to comment.