Commit Graph

279 Commits

Author SHA1 Message Date
Eric Mastro e96d2b244b
clean up 2023-06-13 17:16:12 +10:00
Eric Mastro 440cc398a3
feat: update StorageRequest params emitted
Params emitted were not suitable for sorting the RequestQueue, but after this change, should be.
2023-06-13 17:13:34 +10:00
Adam Uhlíř 8b39ef8f4a
fix: reset missed counter when slot is freed (#48) 2023-03-08 17:19:49 +01:00
Adam Uhlíř dfdbd16d5b
feat: collateral per slot (#44) 2023-03-08 12:02:34 +01:00
Mark Spanbroek fcc28b3931 [readme] update readme with slots, add references 2023-02-01 11:20:27 +01:00
Mark Spanbroek 7c9ebb3c31 [test] tweak test settings
- stop on first failure (quick feedback)
- do not warn about slow test before 100 ms
  (solidity tests are inherently slow)
- set test timeout to 30 seconds
2023-01-30 14:48:03 +01:00
Mark Spanbroek 24ef30bd2a [proofs] improve test to check proof probability
- avoid bias due to pointer downtime
- use statistical binomial test
2023-01-30 14:47:37 +01:00
Mark Spanbroek e89bfcbaae [build] add library for statistical binomial tests 2023-01-30 14:47:37 +01:00
Mark Spanbroek c9b51695aa [proofs] support probability 1 (proofs always required) 2023-01-30 14:47:37 +01:00
Eric Mastro cde5436262
get request from slot id (#34)
* 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
2023-01-24 15:59:56 +11:00
Mark Spanbroek be38c54622 [style] enforce `_` prefix for private names
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-23 15:10:23 +01:00
Mark Spanbroek b81e6e6532 [marketplace] better wording
Avoids the word 'expired' which is associated
with cancelling a request

Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-23 15:10:23 +01:00
Mark Spanbroek b3855c4ba3 [style] Use _ for private and internal functions
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-23 15:10:23 +01:00
Mark Spanbroek 3bb077db7a [marketplace] reordering
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-23 15:10:23 +01:00
Mark Spanbroek 019c1c34c0 [marketplace] rewrite slot freeing test
To make it independent of values chosen in exampleRequest().
Uses the recently introduced slotState().
2023-01-23 15:10:23 +01:00
Mark Spanbroek b62eeb564a [marketplace] test & fix slotState() 2023-01-23 15:10:23 +01:00
Mark Spanbroek 70d8967f26 [deployment] use new configuration struct 2023-01-23 15:10:23 +01:00
Mark Spanbroek 334da1144d [marketplace] renaming and reshuffling of request state test 2023-01-23 15:10:23 +01:00
Mark Spanbroek ae70fd7c6f [marketplace] introduce MarketplaceConfiguration struct
Container for all configuration values, replaces separate
constructor parameters and getters.
2023-01-23 15:10:23 +01:00
Mark Spanbroek 91ccc82d49 [proofs] remove dead code 2023-01-23 15:10:23 +01:00
Mark Spanbroek bd284acce3 [examples] remove dead code 2023-01-23 15:10:23 +01:00
Mark Spanbroek 2dbdd0028d [marketplace] move price calculations to Requests.sol 2023-01-23 15:10:23 +01:00
Mark Spanbroek 7aa162b526 [marketplace] move proofPeriod() getter to Proofs.sol 2023-01-23 15:10:23 +01:00
Mark Spanbroek 8c6891f1e2 [marketplace] slotIsNotFree() modifier
Replaces _slot getter
2023-01-23 15:10:23 +01:00
Mark Spanbroek 944e9c9da2 [marketplace] requestIsKnown() modifier
Replaces _request() getter
2023-01-23 15:10:23 +01:00
Mark Spanbroek 6eab9fee9a [marketplace] remove wrappers around proof functions
No longer required; slot state is checked in Proofs.sol
2023-01-23 15:10:23 +01:00
Mark Spanbroek 55ef97687e [proofs] Remove outdated comment 2023-01-23 15:10:23 +01:00
Mark Spanbroek 97af6f7484 [marketplace] remove dead code 2023-01-23 15:10:23 +01:00
Mark Spanbroek 32b137a427 [marketplace] inline _context() 2023-01-23 15:10:23 +01:00
Mark Spanbroek e828529e90 [marketplace] inline the requestAcceptsProofs() function
It was only used in one place
2023-01-23 15:10:23 +01:00
Mark Spanbroek 1316682a6f [marketplace] remove slotMustAcceptProofs modifier
Replaced by checks on slot state
2023-01-23 15:10:23 +01:00
Mark Spanbroek 7d377a3739 [marketplace] remove requestMustAcceptProofs modifier
Is already covered by the slot state check later on
2023-01-23 15:10:23 +01:00
Mark Spanbroek dd65133576 [marketplace] replace Slot.hostPaid with SlotState.Paid 2023-01-23 15:10:23 +01:00
Mark Spanbroek 5eeac8a782 [marketplace] remove unused import 2023-01-23 15:10:23 +01:00
Mark Spanbroek c8dda37300 [marketplace] introduce SlotState
- replace proofEnd() by slotState()
- replace _slotAcceptsProofs() by slotState()
- remove _stopRequiringProofs()
2023-01-23 15:10:23 +01:00
Mark Spanbroek de0595edb3 [marketplace] rename state(id) -> requestState(id) 2023-01-23 15:10:23 +01:00
Mark Spanbroek 10f88a62a7 [marketplace] Move RequestState enum to Requests.sol 2023-01-23 15:10:23 +01:00
Mark Spanbroek bb0302afcb [marketplace] inline function _notEqual 2023-01-23 15:10:23 +01:00
Mark Spanbroek e496ac3550 [marketplace] remove _isCancelled and _isFinished 2023-01-23 15:10:23 +01:00
Mark Spanbroek 9aa4773392 [marketplace] remove unused _isSlotCancelled() 2023-01-23 15:10:23 +01:00
Mark Spanbroek fffd0dcb86 [marketplace] remove dead code 2023-01-23 15:10:23 +01:00
Mark Spanbroek de368708b2 [marketplace, proofs] simplify proofTimeout getter 2023-01-23 15:10:23 +01:00
Mark Spanbroek 6aa76257f8 [Marketplace] Move `slotId()` to `Requests` library
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-12 13:57:44 +01:00
Mark Spanbroek 07e9043b30 [Marketplace] Remove dead code
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-12 13:57:44 +01:00
Mark Spanbroek 2bfed21584 [Marketplace] Extract myRequests() and mySlots() 2023-01-12 13:57:44 +01:00
Mark Spanbroek af08a72d7d Fix: use slot start instead of request start
Proofs should be required from the moment a slot is filled,
not from the moment a request is submitted.

This reverts commit f224cb8eda.
2023-01-12 13:49:08 +01:00
Mark Spanbroek ad155be5a1 [Proofs] Extract period related types and function 2023-01-11 10:32:58 +01:00
Mark Spanbroek c0690cd5d1 [Proofs] rename expectProofs -> startRequiringProofs 2023-01-11 10:27:08 +01:00
Mark Spanbroek f224cb8eda [Proofs] Remove double administration of request start
The timestamp when proofs start to be required was
stored in both the Marketplace and Proofs. It is now
only stored in the Marketplace.
2023-01-11 10:27:08 +01:00
Mark Spanbroek 527c21e103 [Proofs] Remove dead code 2023-01-11 10:27:08 +01:00