Store slotIndex in slot struct and expose the slot via getActiveSlot. This is to be used when restoring state in the sales module after a node restart.
* get request from slot id
- Add public function to get request from slot id.
- Add chai test assertion that compares requests. Usage: `expect(await marketplace.getRequestFromSlotId(slotId(slot))).to.be.request(request)`
This is used when restoring active sales, and a node calls `mySlots`, then iterates the slots and needs originating request details.
* merge upstream changes
Proofs should be required from the moment a slot is filled,
not from the moment a request is submitted.
This reverts commit f224cb8eda74a166f0bb3020032026a8dec26466.
Rationale: it was already a very thin wrapper
around Marketplace, and now that its remaining
functionality has been moved to Proofs and
Marketplace, we no longer need it.
Rationale: in practice, a ProofId was always a slot id, and
an EndId was always a request id. Now that the definitons
of SlotId and RequestId are separated from the Marketplace,
we can import and use them.
- Marketplace tests for requestsForHost, and additional tests for myRequests and mySlots
- Added Utils lib with tests
- Added additional Bytes32AddressSetMap.keys expectations
Reinstate the index mapping for `activeSlots`, however with a modified data structure. The main difference comes from a change in `mySlots`: it now requires a `RequestId` as a parameter (which can be obtained using `myRequests`. This allowed for the `activeSlots` mapping to be keyed on `RequestId`, which gives a mapping of `ActiveSlotId => EnumerableSet.Bytes32`. `ActiveSlotId` is a keccak hash of `address + activeSlotIdx`, which not only allows retrieval of all active slot ids per request, but also allows clearing of all active slot ids for a request by incrementing the `activeSlotIdx`.
```
requestId => [ keccak(address + activeSlotIdx) => EnumerableSet.Bytes32 ]
```
Instead, iterate all active slots and remove them individually, only if they are part of a specific request. This is only for the case of request failure.
Allow for clearing of active slots by host, by incrementing an mapping index. The new index points to a fresh instance of EnumerableSet, effectively wiping it clean.