Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: bond escalation tests #67

Merged
merged 8 commits into from
Oct 24, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions solidity/test/integration/EscalateDispute.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ contract Integration_EscalateDispute is IntegrationBase {
_disputeId = oracle.disputeResponse(mockRequest, mockResponse, mockDispute);
vm.stopPrank();

// Simulate the time passing
vm.roll(1 days);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed this one. It's confusing to use vm.roll with a time constant


_disputeCreatedAt = oracle.disputeCreatedAt(_disputeId);
}

Expand Down Expand Up @@ -123,7 +126,7 @@ contract Integration_EscalateDispute is IntegrationBase {
vm.expectRevert(IBondEscalationModule.BondEscalationModule_BondEscalationOver.selector);
_bondEscalationModule.pledgeForDispute(mockRequest, mockDispute);

// Roll back the blocks because we need to simulate the custom error "break tie during tying buffer" and "bond escalation over"
// Roll back the timestamp because we need to simulate the custom error "break tie during tying buffer" and "bond escalation over"
vm.warp(block.timestamp - _tyingBuffer - 1);

// Pledge second time for dispute
Expand Down Expand Up @@ -306,7 +309,7 @@ contract Integration_EscalateDispute is IntegrationBase {
vm.expectRevert(IBondEscalationModule.BondEscalationModule_NotEscalatable.selector);
oracle.escalateDispute(mockRequest, mockResponse, mockDispute);

// Roll back the blocks because we need to simulate the custom error "not escalatable"
// Roll back the timestamp because we need to simulate the custom error "not escalatable"
vm.warp(block.timestamp - (_disputeCreatedAt + _blocksDeadline + 1));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead you could rollback the timestamp doing vm.warp(_disputeCreatedAt)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its true, however as I know that this logic is more complex I decided to do like this in order to clarify that we are doing something "triky" and is not the natural flow


// Pledge against dispute
Expand Down
Loading