Commit Graph

431 Commits

Author SHA1 Message Date
Eric Mastro dcd7a9ac5e
bump questionable to main 2023-02-14 15:42:09 +11:00
Eric Mastro 3ab13125d3
bump questionable
`main` not supports tuple binding
2023-02-14 15:40:13 +11:00
Eric Mastro 340122be33
[marketplace] persist slot index
For loading the sales state from chain, the slot index was not previously persisted in the contract.

This commit will retrieve the slot index from the contract when the sales state is loaded.
2023-02-13 17:49:22 +11:00
Eric Mastro 1588c923b9
[marketplace] compilation fix for nim 1.2 2023-02-08 15:40:27 +11:00
Eric Mastro d5fcc779dd
[marketplace] clean up 2023-02-08 15:40:27 +11:00
Eric Mastro 9c50682bac
[marketplace] bring forward changes from 4f205f56b96f4c16edb944c78ff6f22046c14816 2023-02-08 15:40:27 +11:00
Eric Mastro 39fc92ed43
[marketplace] remove custom error type
Custom error type was introduced to use an `innerException` property. This is not needed as the `parent` property on `Exception` works.

Remove the custom error and restore use of questionable throughout the Reservations module
2023-02-08 15:39:02 +11:00
Eric Mastro 8444b1b967
[marketplace] fix tests
Fix tests based from two changes:
 - Addition of the Reservations module
 - ContractInteractions split into ClientInteractions and HostInteractions
2023-02-08 15:39:02 +11:00
Eric Mastro cff2ca93d8
[marketplace] split ContractInteractions
Split ContractInteractions into:
 - ClientInteractions (with purchasing)
 - HostInteractions (with sales and proving)
2023-02-08 15:39:02 +11:00
Eric Mastro 9f02f90f68
[marketplace] WIP: remove dedicated reservations datastore
- remove dedicated reservations metadata store and use the metadata store from the repo instead

- remove reservations start/stop as the repo start/stop is being managed by the node
2023-02-08 15:39:02 +11:00
Eric Mastro 79fdfabb5c
[marketplace] fix REST availability api 2023-02-08 15:39:02 +11:00
Eric Mastro 1a0012e80a
[marketplace] add reservations tests, and get/exists to api 2023-02-08 15:39:01 +11:00
Eric Mastro ffe3b4511b
[repostore] fix started flag, add tests 2023-02-08 15:26:24 +11:00
Eric Mastro 77d89ded7a
[marketplace] WIP: reservation api implemented
The reservation api should be mostly implemented, but there are a few things left todo.

Still needs tests
2023-02-08 15:26:23 +11:00
Eric Mastro 139a1957bb
[marketplace] WIP reservations
- add de/serialization for Availability
- add markUsed/markUnused in persisted availability
- add query for unused
- add contains
- Reservations compiles, but callers need work
- need to support findAvailability: query reservations and find matches
- needs testing
2023-02-08 15:26:23 +11:00
Eric Mastro 3acb702c1d
[marketplace] WIP reservations basic reserve/release and put/delete 2023-02-08 15:26:23 +11:00
Eric Mastro 065f89eebb
[marketplace] WIP prototype 2023-02-08 15:26:23 +11:00
Eric Mastro 0efdb3aad3
bump dagger-contracts 2023-02-08 15:26:23 +11:00
Eric Mastro cd05cc8154
[marketplace] clean up 2023-02-08 15:25:55 +11:00
Eric Mastro 59f6423bff
[marketplace] sales state machine: use slotState
Use `slotState` instead of `requestState` for sales state machine.
2023-02-07 17:26:34 +11:00
Eric Mastro f4d5361ca8
[marketplace] support slotIndex no longer optional
Previously, SalesAgent.slotIndex had been moved to not optional. However, there were still many places where optionality was assumed. This commit removes those assumuptions.
2023-02-07 17:12:00 +11:00
Eric Mastro c2a8cea91b
[marketplace] use async subscription event handlers 2023-02-07 16:13:05 +11:00
Eric Mastro b2ca17af5b
Rebase and update NBS commit
Rebase on top of main and update NBS commit to the CI fix.
2023-02-07 11:45:09 +11:00
Mark Spanbroek 313c23177b
[sales] make slotIndex non-optional 2023-02-07 11:43:32 +11:00
Mark Spanbroek feae3960b7
[sales] fix: do not crash when fetching state fails 2023-02-07 11:43:32 +11:00
Mark Spanbroek cd6661142c
[sales] cleanup 2023-02-07 11:43:32 +11:00
Mark Spanbroek cdd877a1b1
[config] remove unused imports 2023-02-07 11:43:31 +11:00
Eric Mastro 359d25af37
[marketplace] bump codex-contracts-eth 2023-02-07 11:43:31 +11:00
Eric Mastro 0bfb324b7d
[marketplace] add missing file 2023-02-07 11:43:31 +11:00
Eric Mastro aaf1c53e69
[marketplace] align with contract changes
- getState / state > requestState
- getSlot > getRequestFromSlotId
- support MarketplaceConfig
- support slotState, remove unneeded Slot type
- collateral > config.collateral.initialAmount
- remove proofPeriod contract call
- Revert reason “Slot empty” > “Slot is free”
- getProofEnd > read SlotState

Tests for changes
2023-02-07 11:43:31 +11:00
Eric Mastro c83f6ff8c8
[marketplace] clean up 2023-02-07 11:43:31 +11:00
Eric Mastro 7eba2f46b3
[marketplace] update to work with latest contracts 2023-02-07 11:43:31 +11:00
Eric Mastro 7a85350fad
[marketplace] infer slot index from slotid
prevents reassigning a random slot index when restoring state from chain
2023-02-07 11:43:31 +11:00
Eric Mastro 23448fe486
[marketplace] use requestId for mySlots 2023-02-07 11:43:30 +11:00
Eric Mastro 41b422ccca
[marketplace] handle slot filled by other host
Handle the case when in the downloading, proving, or filling states, that another host fills the slot.
2023-02-07 11:43:30 +11:00
Eric Mastro 45526a21ef
PR comments
- add slotIndex to `SalesAgent` constructor
- remove `SalesAgent.init`
- rename `SalesAgent.init` to `start` and `SalesAgent.deinit` to `stop`.
- rename `SalesAgent. populateRequest` to `SalesAgent.retreiveRequest`.
- move availability removal to the downloading state. once availability is persisted to disk, it should survive node restarts.
-
2023-02-07 11:43:30 +11:00
Eric Mastro 18e7240b61
[marketplace] fix ci issue with chronicles output 2023-02-07 11:43:30 +11:00
Eric Mastro e83c32aee0
bump dagger-contracts 2023-02-07 11:43:30 +11:00
Eric Mastro 3b76933c99
[marketplace] sales state machine tests 2023-02-07 11:43:17 +11:00
Eric Mastro 47ec667d2a
[marketplace] move sale process to async state machine 2023-02-07 11:43:17 +11:00
Eric Mastro 7bb874c998
[marketplace] add async state machine
Allows for `enterAsync` to be cancelled.
2023-02-07 11:43:16 +11:00
Eric Mastro 88220ddaae
[marketplace] make availability optional for node restart
# Conflicts:
#	tests/codex/testsales.nim
2023-02-07 11:43:16 +11:00
Eric Mastro fa15b0cafe
[marketplace] make on chain event callbacks async
# Conflicts:
#	tests/codex/helpers/mockmarket.nim
2023-02-07 11:43:16 +11:00
Eric Mastro f7dbcc23e8
[marketplace] get active slots from chain
# Conflicts:
#	codex/contracts/market.nim
2023-02-07 11:43:16 +11:00
markspanbroek 82e7a2dde6
Fix CI (#339)
* [ci] Use Nim version 1.6.10 instead of version-1-6

* [ci] use nimbus-build-system branch support-shallow-checkout
2023-02-06 17:15:02 +01:00
Eric Mastro df729be261
[marketplace] support latest contracts changes (#327)
* [marketplace] support removal of Storage contract

* [marketplace] change submod dep dagger-contracts to codex-contracts-eth
2023-01-19 16:58:04 +11:00
markspanbroek b1cf8e5239
[build] update nimbus-build-system (#329) 2023-01-12 15:11:31 +01:00
Dmitriy Ryajov 8481e301d5
add missed repo store test (#324) 2022-12-05 09:00:13 -06:00
Dmitriy Ryajov 7907d67797
don't crash on shutdown (#323)
* don't crash on shutdown

* cleanup
2022-12-05 09:00:02 -06:00
Dmitriy Ryajov 0beeefd760
Repo limits (#319)
* initial implementation of repo store

* allow isManifest on multicodec

* rework with new blockstore

* add raw codec

* rework listBlocks

* remove fsstore

* reworking with repostore

* bump datastore

* fix listBlocks iterator

* adding store's common tests

* run common store tests

* remove fsstore backend tests

* bump datastore

* add `listBlocks` tests

* listBlocks filter based on block type

* disabling tests in need of rewriting

* allow passing block type

* move BlockNotFoundError definition

* fix tests

* increase default advertise loop sleep to 10 mins

* use `self`

* add cache quota functionality

* pass meta store and start repo

* add `CacheQuotaNamespace`

* pass meta store

* bump datastore to latest master

* don't use os `/` as key separator

* Added quota limits support

* tests for quota limits

* add block expiration key

* remove unnesesary space

* use idleAsync in listBlocks

* proper test name

* re-add contrlC try/except

* add storage quota and block ttl config options

* clarify comments

* change expires key format

* check for block presence before storing

* bump datastore

* use dht with fixed datastore `has`

* bump datastore to latest master

* bump dht to latest master
2022-12-02 18:00:55 -06:00