Skip to content

Commit fff3f01

Browse files
authored
test: unskip finalize request integration tests (#56)
# 🤖 Linear Closes GRT-224 Closes GRT-249
1 parent 2db351c commit fff3f01

File tree

1 file changed

+18
-67
lines changed

1 file changed

+18
-67
lines changed

test/integration/arbitrum/FinalizeRequest.t.sol

Lines changed: 18 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,6 @@ contract IntegrationFinalizeRequest is IntegrationBase {
112112
// Dispute the response
113113
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);
114114

115-
// TODO: Request can be finalized without response here
116-
// _finalizeRequest(_requestId, 0);
117-
118115
// Revert if the request is finalized with response with unresolved dispute
119116
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
120117
_finalizeRequest(_requestId, _responseId);
@@ -161,9 +158,6 @@ contract IntegrationFinalizeRequest is IntegrationBase {
161158
// Dispute the response
162159
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);
163160

164-
// TODO: Request can be finalized without response here
165-
// _finalizeRequest(_requestId, 0);
166-
167161
// Revert if the request is finalized with response with unresolved dispute
168162
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
169163
_finalizeRequest(_requestId, _responseId);
@@ -213,9 +207,6 @@ contract IntegrationFinalizeRequest is IntegrationBase {
213207
// Dispute the response
214208
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);
215209

216-
// TODO: Request can be finalized without response here
217-
// _finalizeRequest(_requestId, 0);
218-
219210
// Revert if the request is finalized with response with unresolved dispute
220211
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
221212
_finalizeRequest(_requestId, _responseId);
@@ -258,9 +249,6 @@ contract IntegrationFinalizeRequest is IntegrationBase {
258249
// Dispute the response
259250
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);
260251

261-
// TODO: Request can be finalized without response here
262-
// _finalizeRequest(_requestId, 0);
263-
264252
// Revert if the request is finalized with response with unresolved dispute
265253
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
266254
_finalizeRequest(_requestId, _responseId);
@@ -306,9 +294,6 @@ contract IntegrationFinalizeRequest is IntegrationBase {
306294
// Dispute the response
307295
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);
308296

309-
// TODO: Request can be finalized without response here
310-
// _finalizeRequest(_requestId, 0);
311-
312297
// Revert if the request is finalized with response with unresolved dispute
313298
vm.expectRevert(IOracle.Oracle_InvalidFinalizedResponse.selector);
314299
_finalizeRequest(_requestId, _responseId);
@@ -352,13 +337,10 @@ contract IntegrationFinalizeRequest is IntegrationBase {
352337
// Pass the response deadline
353338
vm.warp(_requestCreatedAt + responseDeadline);
354339

355-
// TODO: What if the request is finalized without response, after a response has been disputed but before
356-
// its bond escalation settlement or dispute arbitration?
357-
358340
// Finalize the request without response
359341
_finalizeRequest(_requestId, 0);
360342

361-
// Revert if the unfinalizable response has unresolved dispute
343+
// Revert if the unfinalizable response has an unresolved dispute
362344
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
363345
_releaseUnfinalizableResponseBond(_requestId, _responseId);
364346

@@ -375,18 +357,8 @@ contract IntegrationFinalizeRequest is IntegrationBase {
375357
// Settle the bond escalation
376358
_settleBondEscalation(_requestId, _responseId, _disputeId);
377359

378-
vm.skip(true); // TODO: How does the proposer release the response bond?
379-
380-
// Release the unfinalizable response bond
381-
_releaseUnfinalizableResponseBond(_requestId, _responseId);
382-
383-
// Assert HorizonAccountingExtension::release
384-
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
385-
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);
386-
387-
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
388-
// Revert if the unfinalizable response bond has already been released
389-
vm.expectRevert();
360+
// Revert if the unfinalizable response has a resolved dispute with `Won`
361+
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
390362
_releaseUnfinalizableResponseBond(_requestId, _responseId);
391363
}
392364

@@ -401,15 +373,13 @@ contract IntegrationFinalizeRequest is IntegrationBase {
401373
// Dispute the response
402374
bytes32 _disputeId = _disputeResponse(_requestId, _responseId);
403375

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

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

412-
// Revert if the unfinalizable response has unresolved dispute
382+
// Revert if the unfinalizable response has an unresolved dispute
413383
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
414384
_releaseUnfinalizableResponseBond(_requestId, _responseId);
415385

@@ -426,16 +396,16 @@ contract IntegrationFinalizeRequest is IntegrationBase {
426396
// Settle the bond escalation
427397
_settleBondEscalation(_requestId, _responseId, _disputeId);
428398

429-
vm.skip(true); // TODO: How does the proposer release the response bond?
430-
431399
// Release the unfinalizable response bond
432400
_releaseUnfinalizableResponseBond(_requestId, _responseId);
433401

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

438-
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
406+
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request,
407+
// either as proposer or disputer?
408+
439409
// Revert if the unfinalizable response bond has already been released
440410
vm.expectRevert();
441411
_releaseUnfinalizableResponseBond(_requestId, _responseId);
@@ -455,13 +425,10 @@ contract IntegrationFinalizeRequest is IntegrationBase {
455425
// Pass the response deadline
456426
vm.warp(_requestCreatedAt + responseDeadline);
457427

458-
// TODO: What if the request is finalized without response, after a response has been disputed but before
459-
// its bond escalation settlement or dispute arbitration?
460-
461428
// Finalize the request without response
462429
_finalizeRequest(_requestId, 0);
463430

464-
// Revert if the unfinalizable response has unresolved dispute
431+
// Revert if the unfinalizable response has an unresolved dispute
465432
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
466433
_releaseUnfinalizableResponseBond(_requestId, _responseId);
467434

@@ -479,18 +446,8 @@ contract IntegrationFinalizeRequest is IntegrationBase {
479446
// Arbitrate and resolve the dispute, and finalize the request without response
480447
_arbitrateDispute(_disputeId, IOracle.DisputeStatus.Won);
481448

482-
vm.skip(true); // TODO: How does the proposer release the response bond?
483-
484-
// Release the unfinalizable response bond
485-
_releaseUnfinalizableResponseBond(_requestId, _responseId);
486-
487-
// Assert HorizonAccountingExtension::release
488-
assertEq(horizonAccountingExtension.bondedForRequest(_proposer, _requestId), 0);
489-
assertEq(horizonAccountingExtension.totalBonded(_proposer), 0);
490-
491-
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
492-
// Revert if the unfinalizable response bond has already been released
493-
vm.expectRevert();
449+
// Revert if the unfinalizable response has a resolved dispute with `Won`
450+
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
494451
_releaseUnfinalizableResponseBond(_requestId, _responseId);
495452
}
496453

@@ -510,13 +467,10 @@ contract IntegrationFinalizeRequest is IntegrationBase {
510467
// Pass the response deadline
511468
vm.warp(_requestCreatedAt + responseDeadline);
512469

513-
// TODO: What if the request is finalized without response, after a response has been disputed but before
514-
// its bond escalation settlement or dispute arbitration?
515-
516470
// Finalize the request without response
517471
_finalizeRequest(_requestId, 0);
518472

519-
// Revert if the unfinalizable response has unresolved dispute
473+
// Revert if the unfinalizable response has an unresolved dispute
520474
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
521475
_releaseUnfinalizableResponseBond(_requestId, _responseId);
522476

@@ -537,16 +491,16 @@ contract IntegrationFinalizeRequest is IntegrationBase {
537491
// Arbitrate and resolve the dispute, and finalize the request with response
538492
_arbitrateDispute(_disputeId, IOracle.DisputeStatus.Lost);
539493

540-
vm.skip(true); // TODO: How does the proposer release the response bond?
541-
542494
// Release the unfinalizable response bond
543495
_releaseUnfinalizableResponseBond(_requestId, _responseId);
544496

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

549-
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
501+
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request,
502+
// either as proposer or disputer?
503+
550504
// Revert if the unfinalizable response bond has already been released
551505
vm.expectRevert();
552506
_releaseUnfinalizableResponseBond(_requestId, _responseId);
@@ -566,13 +520,10 @@ contract IntegrationFinalizeRequest is IntegrationBase {
566520
// Pass the response deadline
567521
vm.warp(_requestCreatedAt + responseDeadline);
568522

569-
// TODO: What if the request is finalized without response, after a response has been disputed but before
570-
// its bond escalation settlement or dispute arbitration?
571-
572523
// Finalize the request without response
573524
_finalizeRequest(_requestId, 0);
574525

575-
// Revert if the unfinalizable response has unresolved dispute
526+
// Revert if the unfinalizable response has an unresolved dispute
576527
vm.expectRevert(IBondedResponseModule.BondedResponseModule_InvalidReleaseParameters.selector);
577528
_releaseUnfinalizableResponseBond(_requestId, _responseId);
578529

@@ -590,16 +541,16 @@ contract IntegrationFinalizeRequest is IntegrationBase {
590541
// Arbitrate and resolve the dispute, and finalize the request without response
591542
_arbitrateDispute(_disputeId, IOracle.DisputeStatus.NoResolution);
592543

593-
vm.skip(true); // TODO: How does the proposer release the response bond?
594-
595544
// Release the unfinalizable response bond
596545
_releaseUnfinalizableResponseBond(_requestId, _responseId);
597546

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

602-
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request?
551+
// TODO: What if the release does not revert because the proposer had bonded multiple times for the same request,
552+
// either as proposer or disputer?
553+
603554
// Revert if the unfinalizable response bond has already been released
604555
vm.expectRevert();
605556
_releaseUnfinalizableResponseBond(_requestId, _responseId);

0 commit comments

Comments
 (0)