diff --git a/contracts/L1GlobalForkRequester.sol b/contracts/L1GlobalForkRequester.sol index ecfc69c0..ed1bf63c 100644 --- a/contracts/L1GlobalForkRequester.sol +++ b/contracts/L1GlobalForkRequester.sol @@ -60,12 +60,9 @@ contract L1GlobalForkRequester { token ); - // If for some reason we've already got part of a payment, include it. - uint256 initialBalance = failedRequests[token][beneficiary][requestId] - .amount; - - uint256 transferredBalance = initialBalance + - IForkonomicToken(token).balanceOf(moneyBox); + uint256 transferredBalance = IForkonomicToken(token).balanceOf( + moneyBox + ); if (moneyBox.code.length == 0) { new MoneyBox{salt: salt}(token); @@ -90,10 +87,6 @@ contract L1GlobalForkRequester { transferredBalance >= forkingManager.arbitrationFee() && !forkingManager.isForkingInitiated() ) { - if (initialBalance > 0) { - delete (failedRequests[token][beneficiary][requestId]); - } - IForkonomicToken(token).approve( address(forkingManager), transferredBalance diff --git a/contracts/L2ForkArbitrator.sol b/contracts/L2ForkArbitrator.sol index b24199d3..edc6f7a4 100644 --- a/contracts/L2ForkArbitrator.sol +++ b/contracts/L2ForkArbitrator.sol @@ -145,6 +145,10 @@ contract L2ForkArbitrator is IBridgeMessageReceiver { revert ForkInProgress(); // Forking over something else } + if (msg.sender != arbitrationRequests[question_id].payer) { + revert WrongSender(); + } + RequestStatus status = arbitrationRequests[question_id].status; if ( status != RequestStatus.QUEUED && @@ -280,6 +284,10 @@ contract L2ForkArbitrator is IBridgeMessageReceiver { revert ForkInProgress(); } + if (msg.sender != arbitrationRequests[question_id].payer) { + revert WrongSender(); + } + RequestStatus status = arbitrationRequests[question_id].status; if (status != RequestStatus.FORK_REQUEST_FAILED) { revert StatusNotForkRequestFailed(); diff --git a/test/AdjudicationIntegration.t.sol b/test/AdjudicationIntegration.t.sol index 48737457..2d563db0 100644 --- a/test/AdjudicationIntegration.t.sol +++ b/test/AdjudicationIntegration.t.sol @@ -712,6 +712,13 @@ contract AdjudicationIntegrationTest is Test { "Not in forking state" ); + vm.expectRevert(L2ForkArbitrator.WrongSender.selector); + l2ForkArbitrator.requestActivateFork(removalQuestionId); + + vm.expectRevert(L2ForkArbitrator.WrongSender.selector); + l2ForkArbitrator.cancelArbitration(removalQuestionId); + + vm.prank(user2); l2ForkArbitrator.cancelArbitration(removalQuestionId); assertEq(forkFee, l2ForkArbitrator.refundsDue(user2));