From 9aa477339236e77d6bb9f4cda2d879314a02d563 Mon Sep 17 00:00:00 2001 From: Mark Spanbroek Date: Mon, 16 Jan 2023 13:58:30 +0100 Subject: [PATCH] [marketplace] remove unused _isSlotCancelled() --- contracts/Marketplace.sol | 9 --------- contracts/TestMarketplace.sol | 4 ---- test/Marketplace.test.js | 13 ------------- 3 files changed, 26 deletions(-) diff --git a/contracts/Marketplace.sol b/contracts/Marketplace.sol index 865b0e4..4357ab8 100644 --- a/contracts/Marketplace.sol +++ b/contracts/Marketplace.sol @@ -261,15 +261,6 @@ contract Marketplace is Collateral, Proofs, StateRetrieval { return slot.requestId; } - /// @notice Return true if the request state the slot belongs to is RequestState.Cancelled or if the request expiry time has elapsed and the request was never started. - /// @dev Handles the case when a request may have been cancelled, but the client has not withdrawn its funds yet, and therefore the state has not yet been updated. - /// @param slotId the id of the slot - /// @return true if request is cancelled - function _isSlotCancelled(SlotId slotId) internal view returns (bool) { - RequestId requestId = _getRequestIdForSlot(slotId); - return _isCancelled(requestId); - } - function getHost(SlotId slotId) public view returns (address) { return slots[slotId].host; } diff --git a/contracts/TestMarketplace.sol b/contracts/TestMarketplace.sol index d53a5a1..6a32e6d 100644 --- a/contracts/TestMarketplace.sol +++ b/contracts/TestMarketplace.sol @@ -34,10 +34,6 @@ contract TestMarketplace is Marketplace { return _isCancelled(requestId); } - function isSlotCancelled(SlotId slotId) public view returns (bool) { - return _isSlotCancelled(slotId); - } - function forciblyFreeSlot(SlotId slotId) public { _forciblyFreeSlot(slotId); } diff --git a/test/Marketplace.test.js b/test/Marketplace.test.js index c12d381..470eb4a 100644 --- a/test/Marketplace.test.js +++ b/test/Marketplace.test.js @@ -659,19 +659,6 @@ describe("Marketplace", function () { await expect(await marketplace.isCancelled(slot.request)).to.be.true }) - it("rejects isSlotCancelled when slot is empty", async function () { - await expect( - marketplace.isSlotCancelled(slotId(slot)) - ).to.be.revertedWith("Slot empty") - }) - - it("changes isSlotCancelled to true once request is cancelled", async function () { - await marketplace.fillSlot(slot.request, slot.index, proof) - await expect(await marketplace.isSlotCancelled(slotId(slot))).to.be.false - await waitUntilCancelled(request) - await expect(await marketplace.isSlotCancelled(slotId(slot))).to.be.true - }) - it("changes proofEnd to the past when request is cancelled", async function () { await marketplace.fillSlot(slot.request, slot.index, proof) await expect(await marketplace.proofEnd(slotId(slot))).to.be.gt(