From 506a40536ca12d9644b20906a6f6a18faef658c1 Mon Sep 17 00:00:00 2001 From: Gas One Cent <86567384+gas1cent@users.noreply.github.com> Date: Wed, 13 Nov 2024 12:13:28 +0400 Subject: [PATCH] fix: proposer's bond should not be released when dispute is lost --- .../contracts/modules/dispute/BondedDisputeModule.sol | 8 +------- solidity/test/integration/Arbitration.t.sol | 8 ++++---- .../test/unit/modules/dispute/BondedDisputeModule.t.sol | 7 ------- 3 files changed, 5 insertions(+), 18 deletions(-) diff --git a/solidity/contracts/modules/dispute/BondedDisputeModule.sol b/solidity/contracts/modules/dispute/BondedDisputeModule.sol index 42f8fd97..116e861b 100644 --- a/solidity/contracts/modules/dispute/BondedDisputeModule.sol +++ b/solidity/contracts/modules/dispute/BondedDisputeModule.sol @@ -83,7 +83,7 @@ contract BondedDisputeModule is Module, IBondedDisputeModule { _amount: _params.bondSize }); } else if (_status == IOracle.DisputeStatus.Lost) { - // Disputer lost, we pay the proposer and release their bond + // Disputer lost, we pay the proposer _params.accountingExtension.pay({ _requestId: _dispute.requestId, _payer: _dispute.disputer, @@ -91,12 +91,6 @@ contract BondedDisputeModule is Module, IBondedDisputeModule { _token: _params.bondToken, _amount: _params.bondSize }); - _params.accountingExtension.release({ - _bonder: _dispute.proposer, - _requestId: _dispute.requestId, - _token: _params.bondToken, - _amount: _params.bondSize - }); } emit DisputeStatusChanged({_disputeId: _disputeId, _dispute: _dispute, _status: _status}); diff --git a/solidity/test/integration/Arbitration.t.sol b/solidity/test/integration/Arbitration.t.sol index fc48ba9e..1c95db09 100644 --- a/solidity/test/integration/Arbitration.t.sol +++ b/solidity/test/integration/Arbitration.t.sol @@ -106,9 +106,9 @@ contract Integration_Arbitration is IntegrationBase { // Check: is the dispute updated as lost? assertEq(uint256(_disputeStatus), uint256(IOracle.DisputeStatus.Lost)); - // Check: does the disputer receive the disputer's bond? + // Check: does the proposer receive the disputer's bond? uint256 _proposerBalance = _accountingExtension.balanceOf(proposer, usdc); - assertEq(_proposerBalance, _expectedBondSize * 2); + assertEq(_proposerBalance, _expectedBondSize); // Check: does the disputer get its bond slashed? uint256 _disputerBondedAmount = _accountingExtension.bondedAmountOf(disputer, usdc, _getId(mockRequest)); @@ -139,9 +139,9 @@ contract Integration_Arbitration is IntegrationBase { // Check: is the dispute updated as lost? assertEq(uint256(_disputeStatus), uint256(IOracle.DisputeStatus.Lost)); - // Check: does the disputer receive the disputer's bond? + // Check: does the proposer receive the disputer's bond? uint256 _proposerBalance = _accountingExtension.balanceOf(proposer, usdc); - assertEq(_proposerBalance, _expectedBondSize * 2); + assertEq(_proposerBalance, _expectedBondSize); // Check: does the disputer get its bond slashed? uint256 _disputerBondedAmount = _accountingExtension.bondedAmountOf(disputer, usdc, _getId(mockRequest)); diff --git a/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol b/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol index 4066ac4f..2f7b1a7b 100644 --- a/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol +++ b/solidity/test/unit/modules/dispute/BondedDisputeModule.t.sol @@ -113,13 +113,6 @@ contract BondedDisputeModule_Unit_OnDisputeStatusChange is BaseTest { abi.encode() ); - // Mock and expect the call to release, to the disputer - _mockAndExpect( - address(accountingExtension), - abi.encodeCall(accountingExtension.release, (mockResponse.proposer, _requestId, _token, _bondSize)), - abi.encode() - ); - vm.prank(address(oracle)); bondedDisputeModule.onDisputeStatusChange(_getId(mockDispute), mockRequest, mockResponse, mockDispute); }