Skip to content

Commit

Permalink
feat: remove sequential resolution module and make some tests prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
moebius committed Dec 11, 2023
1 parent e8aec63 commit 6f71d2c
Show file tree
Hide file tree
Showing 12 changed files with 23 additions and 1,070 deletions.
287 changes: 0 additions & 287 deletions solidity/contracts/modules/resolution/SequentialResolutionModule.sol

This file was deleted.

18 changes: 9 additions & 9 deletions solidity/test/unit/extensions/AccountingExtension.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ contract AccountingExtension_Unit_DepositAndWithdraw is BaseTest {
extension.forTest_setBalanceOf(sender, token, _initialBalance);

// Check: does it revert if balance is insufficient?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_InsufficientFunds.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_InsufficientFunds.selector);
vm.prank(sender);
extension.withdraw(token, _amount);
}
Expand Down Expand Up @@ -186,7 +186,7 @@ contract AccountingExtension_Unit_Bond is BaseTest {
extension.forTest_setBalanceOf(_bonder, token, _initialBalance);

// Check: does it revert if balance is insufficient?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_InsufficientFunds.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_InsufficientFunds.selector);

vm.prank(_sender);
extension.bond({_bonder: _bonder, _requestId: _requestId, _token: token, _amount: _amount});
Expand All @@ -205,7 +205,7 @@ contract AccountingExtension_Unit_Bond is BaseTest {
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.allowedModule, (_requestId, _sender)), abi.encode(false));

// Check: does it revert if the module is not allowed?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_UnauthorizedModule.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_UnauthorizedModule.selector);

vm.prank(_sender);
extension.bond({_bonder: _bonder, _requestId: _requestId, _token: token, _amount: _amount});
Expand All @@ -227,7 +227,7 @@ contract AccountingExtension_Unit_Bond is BaseTest {
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.isParticipant, (_requestId, _bonder)), abi.encode(true));

// Check: does it revert if the module is not approved?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_InsufficientAllowance.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_InsufficientAllowance.selector);

vm.prank(_module);
extension.bond({_bonder: _bonder, _requestId: _requestId, _token: token, _amount: _amount});
Expand All @@ -249,7 +249,7 @@ contract AccountingExtension_Unit_Bond is BaseTest {
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.isParticipant, (_requestId, _bonder)), abi.encode(true));

// Check: does it revert if the caller is not approved?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_InsufficientAllowance.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_InsufficientAllowance.selector);

vm.prank(_sender);
extension.bond({_bonder: _bonder, _requestId: _requestId, _token: token, _amount: _amount, _sender: _sender});
Expand Down Expand Up @@ -322,7 +322,7 @@ contract AccountingExtension_Unit_Pay is BaseTest {
extension.forTest_setBondedBalanceOf(_requestId, _payer, token, _initialBalance);

// Check: does it revert if the payer has insufficient funds?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_InsufficientFunds.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_InsufficientFunds.selector);

vm.prank(_sender);
extension.pay({_requestId: _requestId, _payer: _payer, _receiver: _receiver, _token: token, _amount: _amount});
Expand All @@ -345,7 +345,7 @@ contract AccountingExtension_Unit_Pay is BaseTest {
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.allowedModule, (_requestId, _sender)), abi.encode(false));

// Check: does it revert if the module calling is not approved?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_UnauthorizedModule.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_UnauthorizedModule.selector);

vm.prank(_sender);
extension.pay({_requestId: _requestId, _payer: _payer, _receiver: _receiver, _token: token, _amount: _amount});
Expand Down Expand Up @@ -410,7 +410,7 @@ contract AccountingExtension_Unit_Release is BaseTest {
extension.forTest_setBondedBalanceOf(_requestId, _bonder, token, _initialBalance);

// Check: does it revert if calling with insufficient balance?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_InsufficientFunds.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_InsufficientFunds.selector);

vm.prank(_sender);
extension.release({_bonder: _bonder, _requestId: _requestId, _token: token, _amount: _amount});
Expand All @@ -429,7 +429,7 @@ contract AccountingExtension_Unit_Release is BaseTest {
_mockAndExpect(address(oracle), abi.encodeCall(IOracle.allowedModule, (_requestId, _sender)), abi.encode(false));

// Check: does it revert if the module is not approved?
vm.expectRevert(abi.encodeWithSelector(IAccountingExtension.AccountingExtension_UnauthorizedModule.selector));
vm.expectRevert(IAccountingExtension.AccountingExtension_UnauthorizedModule.selector);

vm.prank(_sender);
extension.release({_bonder: _bonder, _requestId: _requestId, _token: token, _amount: _amount});
Expand Down
4 changes: 2 additions & 2 deletions solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ contract BondedResponseModule_Unit_OnDisputeStatusChange is BaseTest {
vm.assume(_randomCaller != address(oracle));

// Check: revert if wrong caller
vm.expectRevert(abi.encodeWithSelector(IModule.Module_OnlyOracle.selector));
vm.expectRevert(IModule.Module_OnlyOracle.selector);

// Test: call disputeResponse from non-oracle address
vm.prank(_randomCaller);
Expand Down Expand Up @@ -247,7 +247,7 @@ contract BondedResponseModule_Unit_DisputeResponse is BaseTest {
vm.assume(_randomCaller != address(oracle));

// Check: revert if wrong caller
vm.expectRevert(abi.encodeWithSelector(IModule.Module_OnlyOracle.selector));
vm.expectRevert(IModule.Module_OnlyOracle.selector);

// Test: call disputeResponse from non-oracle address
vm.prank(_randomCaller);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ contract CircuitResolverModule_Unit_DisputeResponse is BaseTest {
vm.assume(_randomCaller != address(oracle));

// Check: does it revert if not called by the Oracle?
vm.expectRevert(abi.encodeWithSelector(IModule.Module_OnlyOracle.selector));
vm.expectRevert(IModule.Module_OnlyOracle.selector);

vm.prank(_randomCaller);
circuitResolverModule.disputeResponse(mockRequest, mockResponse, mockDispute);
Expand Down
Loading

0 comments on commit 6f71d2c

Please sign in to comment.