[marketplace] remove requestMustAcceptProofs modifier

Is already covered by the slot state check later on
This commit is contained in:
Mark Spanbroek 2023-01-16 17:26:11 +01:00 committed by markspanbroek
parent dd65133576
commit 7d377a3739
2 changed files with 8 additions and 16 deletions

View File

@ -74,7 +74,7 @@ contract Marketplace is Collateral, Proofs, StateRetrieval {
RequestId requestId,
uint256 slotIndex,
bytes calldata proof
) public requestMustAcceptProofs(requestId) marketplaceInvariant {
) public {
Request storage request = _request(requestId);
require(slotIndex < request.ask.slots, "Invalid slot");
@ -82,7 +82,7 @@ contract Marketplace is Collateral, Proofs, StateRetrieval {
Slot storage slot = slots[slotId];
slot.requestId = requestId;
require(slotState(slotId) == SlotState.Free, "Slot already filled");
require(slotState(slotId) == SlotState.Free, "Slot is not free");
require(balanceOf(msg.sender) >= collateral, "Insufficient collateral");
@ -411,14 +411,6 @@ contract Marketplace is Collateral, Proofs, StateRetrieval {
_;
}
/// @notice Modifier that requires the request state to be that which is accepting proof submissions from hosts occupying slots.
/// @dev Request state must be new or started, and must not be cancelled, finished, or failed.
/// @param requestId id of the request, for which to obtain state info
modifier requestMustAcceptProofs(RequestId requestId) {
require(_requestAcceptsProofs(requestId), "Request not accepting proofs");
_;
}
struct MarketplaceFunds {
uint256 balance;
uint256 received;

View File

@ -173,7 +173,7 @@ describe("Marketplace", function () {
await marketplace.fillSlot(slot.request, slot.index, proof)
await expect(
marketplace.fillSlot(slot.request, slot.index, proof)
).to.be.revertedWith("Slot already filled")
).to.be.revertedWith("Slot is not free")
})
it("is rejected when request is unknown", async function () {
@ -191,7 +191,7 @@ describe("Marketplace", function () {
switchAccount(host)
await expect(
marketplace.fillSlot(requestId(expired), slot.index, proof)
).to.be.revertedWith("Request not accepting proofs")
).to.be.revertedWith("Slot is not free")
})
it("is rejected when request is finished", async function () {
@ -199,7 +199,7 @@ describe("Marketplace", function () {
await waitUntilFinished(marketplace, requestId(request))
await expect(
marketplace.fillSlot(slot.request, slot.index, proof)
).to.be.revertedWith("Request not accepting proofs")
).to.be.revertedWith("Slot is not free")
})
it("is rejected when request is failed", async function () {
@ -207,7 +207,7 @@ describe("Marketplace", function () {
await waitUntilFailed(marketplace, request)
await expect(
marketplace.fillSlot(slot.request, slot.index, proof)
).to.be.revertedWith("Request not accepting proofs")
).to.be.revertedWith("Slot is not free")
})
it("is rejected when slot index not in range", async function () {
@ -224,7 +224,7 @@ describe("Marketplace", function () {
}
await expect(
marketplace.fillSlot(slot.request, lastSlot, proof)
).to.be.revertedWith("Slot already filled")
).to.be.revertedWith("Slot is not free")
})
})
@ -417,7 +417,7 @@ describe("Marketplace", function () {
}
await expect(
marketplace.fillSlot(slot.request, lastSlot, proof)
).to.be.revertedWith("Slot already filled")
).to.be.revertedWith("Slot is not free")
})
})