From a7dd840eaabb46a7ed0b774fded8912003b1e44d Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Tue, 30 May 2023 14:46:56 +0200 Subject: [PATCH] [fuzzing] transfers out of the contract should always pass When a transfer of tokens from the contract fails, then the fuzzer has found a bug. Changing `require` to `assert` ensures that the fuzzer considers this a test failure. --- contracts/Marketplace.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/Marketplace.sol b/contracts/Marketplace.sol index 4a09c31..b98d03c 100644 --- a/contracts/Marketplace.sol +++ b/contracts/Marketplace.sol @@ -203,7 +203,7 @@ contract Marketplace is Proofs, StateRetrieval { slot.currentCollateral; _marketplaceTotals.sent += amount; slot.state = SlotState.Paid; - require(token.transfer(slot.host, amount), "Payment failed"); + assert(token.transfer(slot.host, amount)); } /// @notice Withdraws storage request funds back to the client that deposited them. @@ -228,7 +228,7 @@ contract Marketplace is Proofs, StateRetrieval { // deducted from the price. uint256 amount = request.price(); _marketplaceTotals.sent += amount; - require(token.transfer(msg.sender, amount), "Withdraw failed"); + assert(token.transfer(msg.sender, amount)); } function getActiveSlot(