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

test: unskip finalize request integration tests #56

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
85 changes: 18 additions & 67 deletions test/integration/arbitrum/FinalizeRequest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import './IntegrationBase.t.sol';

contract IntegrationFinalizeRequest is IntegrationBase {
bytes32 _requestId;

Check warning on line 7 in test/integration/arbitrum/FinalizeRequest.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Explicitly mark visibility of state
uint256 _requestCreatedAt;

Check warning on line 8 in test/integration/arbitrum/FinalizeRequest.t.sol

View workflow job for this annotation

GitHub Actions / Lint Commit Messages

Explicitly mark visibility of state

function setUp() public override {
super.setUp();
Expand Down Expand Up @@ -112,9 +112,6 @@
// Dispute the response
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);

// TODO: Request can be finalized without response here
// _finalizeRequest(_requestId, 0);

// Revert if the request is finalized with response with unresolved dispute
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
_finalizeRequest(_requestId, _responseId);
Expand Down Expand Up @@ -161,9 +158,6 @@
// Dispute the response
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);

// TODO: Request can be finalized without response here
// _finalizeRequest(_requestId, 0);

// Revert if the request is finalized with response with unresolved dispute
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
_finalizeRequest(_requestId, _responseId);
Expand Down Expand Up @@ -213,9 +207,6 @@
// Dispute the response
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);

// TODO: Request can be finalized without response here
// _finalizeRequest(_requestId, 0);

// Revert if the request is finalized with response with unresolved dispute
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
_finalizeRequest(_requestId, _responseId);
Expand Down Expand Up @@ -258,9 +249,6 @@
// Dispute the response
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);

// TODO: Request can be finalized without response here
// _finalizeRequest(_requestId, 0);

// Revert if the request is finalized with response with unresolved dispute
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
_finalizeRequest(_requestId, _responseId);
Expand Down Expand Up @@ -306,9 +294,6 @@
// Dispute the response
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);

// TODO: Request can be finalized without response here
// _finalizeRequest(_requestId, 0);

// Revert if the request is finalized with response with unresolved dispute
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
_finalizeRequest(_requestId, _responseId);
Expand Down Expand Up @@ -352,13 +337,10 @@
// Pass the response deadline
vm.warp(_requestCreatedAt + responseDeadline);

// TODO: What if the request is finalized without response, after a response has been disputed but before
// its bond escalation settlement or dispute arbitration?

// Finalize the request without response
_finalizeRequest(_requestId, 0);

// Revert if the unfinalizable response has unresolved dispute
// Revert if the unfinalizable response has an unresolved dispute
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);

Expand All @@ -375,18 +357,8 @@
// Settle the bond escalation
_settleBondEscalation(_requestId, _responseId, _disputeId);

vm.skip(true); // TODO: How does the proposer release the response bond?

// Release the unfinalizable response bond
_releaseUnfinalizableResponseBond(_requestId, _responseId);

// Assert HorizonAccountingExtension::release
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);

// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
// Revert if the unfinalizable response bond has already been released
vm.expectRevert();
// Revert if the unfinalizable response has a resolved dispute with `Won`
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);
}

Expand All @@ -401,15 +373,13 @@
// Dispute the response
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);

// TODO: What if the request is finalized without response, after a response has been disputed but before
// its bond escalation settlement or dispute arbitration?
// Pass the response deadline
vm.warp(_requestCreatedAt + responseDeadline);

// Finalize the request without response
_finalizeRequest(_requestId, 0);

// Revert if the unfinalizable response has unresolved dispute
// Revert if the unfinalizable response has an unresolved dispute
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);

Expand All @@ -426,16 +396,16 @@
// Settle the bond escalation
_settleBondEscalation(_requestId, _responseId, _disputeId);

vm.skip(true); // TODO: How does the proposer release the response bond?

// Release the unfinalizable response bond
_releaseUnfinalizableResponseBond(_requestId, _responseId);

// Assert HorizonAccountingExtension::release
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);

// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request,
// either as proposer or disputer?

// Revert if the unfinalizable response bond has already been released
vm.expectRevert();
_releaseUnfinalizableResponseBond(_requestId, _responseId);
Expand All @@ -455,13 +425,10 @@
// Pass the response deadline
vm.warp(_requestCreatedAt + responseDeadline);

// TODO: What if the request is finalized without response, after a response has been disputed but before
// its bond escalation settlement or dispute arbitration?

// Finalize the request without response
_finalizeRequest(_requestId, 0);

// Revert if the unfinalizable response has unresolved dispute
// Revert if the unfinalizable response has an unresolved dispute
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);

Expand All @@ -479,18 +446,8 @@
// Arbitrate and resolve the dispute, and finalize the request without response
_arbitrateDispute(_disputeId, IOracle.DisputeStatus.Won);

vm.skip(true); // TODO: How does the proposer release the response bond?

// Release the unfinalizable response bond
_releaseUnfinalizableResponseBond(_requestId, _responseId);

// Assert HorizonAccountingExtension::release
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);

// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
// Revert if the unfinalizable response bond has already been released
vm.expectRevert();
// Revert if the unfinalizable response has a resolved dispute with `Won`
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);
}

Expand All @@ -510,13 +467,10 @@
// Pass the response deadline
vm.warp(_requestCreatedAt + responseDeadline);

// TODO: What if the request is finalized without response, after a response has been disputed but before
// its bond escalation settlement or dispute arbitration?

// Finalize the request without response
_finalizeRequest(_requestId, 0);

// Revert if the unfinalizable response has unresolved dispute
// Revert if the unfinalizable response has an unresolved dispute
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);

Expand All @@ -537,16 +491,16 @@
// Arbitrate and resolve the dispute, and finalize the request with response
_arbitrateDispute(_disputeId, IOracle.DisputeStatus.Lost);

vm.skip(true); // TODO: How does the proposer release the response bond?

// Release the unfinalizable response bond
_releaseUnfinalizableResponseBond(_requestId, _responseId);

// Assert HorizonAccountingExtension::release
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);

// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request,
// either as proposer or disputer?

// Revert if the unfinalizable response bond has already been released
vm.expectRevert();
_releaseUnfinalizableResponseBond(_requestId, _responseId);
Expand All @@ -566,13 +520,10 @@
// Pass the response deadline
vm.warp(_requestCreatedAt + responseDeadline);

// TODO: What if the request is finalized without response, after a response has been disputed but before
// its bond escalation settlement or dispute arbitration?

// Finalize the request without response
_finalizeRequest(_requestId, 0);

// Revert if the unfinalizable response has unresolved dispute
// Revert if the unfinalizable response has an unresolved dispute
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
_releaseUnfinalizableResponseBond(_requestId, _responseId);

Expand All @@ -590,16 +541,16 @@
// Arbitrate and resolve the dispute, and finalize the request without response
_arbitrateDispute(_disputeId, IOracle.DisputeStatus.NoResolution);

vm.skip(true); // TODO: How does the proposer release the response bond?

// Release the unfinalizable response bond
_releaseUnfinalizableResponseBond(_requestId, _responseId);

// Assert HorizonAccountingExtension::release
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);

// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request,
// either as proposer or disputer?

// Revert if the unfinalizable response bond has already been released
vm.expectRevert();
_releaseUnfinalizableResponseBond(_requestId, _responseId);
Comment on lines +551 to 556
Copy link
Member Author

Choose a reason for hiding this comment

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

⚠️

Copy link
Member

Choose a reason for hiding this comment

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

Will review it in another PR

Expand Down
4 changes: 2 additions & 2 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1684,9 +1684,9 @@ solhint-community@4.0.0:
optionalDependencies:
prettier "^2.8.3"

"solmate@git+https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c":
"solmate@https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c":
version "6.1.0"
resolved "git+https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c"
resolved "https://github.com/transmissions11/solmate.git#bfc9c25865a274a7827fea5abf6e4fb64fc64e6c"

sort-object-keys@^1.1.3:
version "1.1.3"
Expand Down
Loading