nim-codex/codex
markspanbroek 4175689745
Load purchase state from chain (#283)
* [purchasing] Simplify test

* [utils] Move StorageRequest.example up one level

* [purchasing] Load purchases from market

* [purchasing] load purchase states

* Implement myRequest() and getState() methods for OnChainMarket

* [proofs] Fix intermittently failing tests

Ensures that examples of proofs in tests are never of length 0;
these are considered invalid proofs by the smart contract logic.

* [contracts] Fix failing test

With the new solidity contracts update, a contract can only
be paid out after it started.

* [market] Add method to get request end time

* [purchasing] wait until purchase is finished

Purchase.wait() would previously wait until purchase
was started, now we wait until it is finished.

* [purchasing] Handle 'finished' and 'failed' states

* [marketplace] move to failed state once request fails

- Add support for subscribing to request failure events.
- Add supporting contract tests for subscribing to request failure events.
- Allow the PurchaseStarted state to move to PurchaseFailure once a request failure event is emitted
- Add supporting tests for moving from PurchaseStarted to PurchaseFailure
- Add state transition tests for PurchaseUnknown.

* [marketplace] Fix test with longer sleepAsync

* [integration] Add function to restart a codex node

* [purchasing] Set client address before requesting storage

To prevent the purchase id (which equals the request id)
from changing once it's been submitted.

* [contracts] Fix: OnChainMarket.getState()

Had the wrong method signature before

* [purchasing] Load purchases on node start

* [purchasing] Rename state 'PurchaseError' to 'PurchaseErrored'

Allows for an exception type called 'PurchaseError'

* [purchasing] Load purchases in background

No longer calls market.getRequest() for every purchase
on node start.

* [contracts] Add `$` for RequestId, SlotId and Nonce

To aid with debugging

* [purchasing] Add Purchasing.stop()

To ensure that all contract interactions have both a
start() and a stop() for

* [tests] Remove sleepAsync where possible

Use `eventually` loop instead, to make sure that we're
not waiting unnecessarily.

* [integration] Fix: handle non-json response in test

* [purchasing] Add purchase state to json

* [integration] Ensure that purchase is submitted before restart

Fixes test failure on slower CI

* [purchasing] re-implement `description` as method

Allows description to be set in the same module where the
state type is defined.

Co-authored-by: Eric Mastro <eric.mastro@gmail.com>

* [contracts] fix typo

Co-authored-by: Eric Mastro <eric.mastro@gmail.com>

* [market] Use more generic error type

Should we decide to change the provider type later

Co-authored-by: Eric Mastro <eric.mastro@gmail.com>

Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2022-11-08 08:10:17 +01:00
..
blockexchange track latest nim-libp2p's master branch (#248) 2022-11-02 11:40:28 -06:00
contracts Load purchase state from chain (#283) 2022-11-08 08:10:17 +01:00
erasure [stores] update getBlock return type 2022-08-22 20:52:51 -05:00
manifest Download files without padding (#218) 2022-08-24 15:15:59 +03:00
purchasing Load purchase state from chain (#283) 2022-11-08 08:10:17 +01:00
rest Load purchase state from chain (#283) 2022-11-08 08:10:17 +01:00
storageproofs Remove protobuf serialization (#289) 2022-10-27 07:41:34 -06:00
stores Remove protobuf serialization (#289) 2022-10-27 07:41:34 -06:00
streams track latest nim-libp2p's master branch (#248) 2022-11-02 11:40:28 -06:00
utils Fixes loading of private key on Windows (#299) 2022-11-07 15:54:24 +01:00
blockexchange.nim Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
blocktype.nim Remove protobuf serialization (#289) 2022-10-27 07:41:34 -06:00
chunker.nim Download files without padding (#218) 2022-08-24 15:15:59 +03:00
clock.nim [purchasing] Update to latest dagger-contracts 2022-07-20 13:43:20 +02:00
codex.nim setup and persist private key (#292) 2022-11-01 18:58:41 -06:00
conf.nim setup and persist private key (#292) 2022-11-01 18:58:41 -06:00
contracts.nim Cleanup: remove StorageOffer everywhere 2022-07-20 13:43:20 +02:00
discovery.nim track latest nim-libp2p's master branch (#248) 2022-11-02 11:40:28 -06:00
erasure.nim Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
errors.nim Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
formats.nim Remove protobuf serialization (#289) 2022-10-27 07:41:34 -06:00
manifest.nim Change every dagger to codex (#102) 2022-05-19 13:56:03 -06:00
market.nim Load purchase state from chain (#283) 2022-11-08 08:10:17 +01:00
namespaces.nim Persist Dht providers (#257) 2022-09-29 20:16:59 -06:00
node.nim Load purchase state from chain (#283) 2022-11-08 08:10:17 +01:00
proving.nim [marketplace] Remove `isSlotCancelled` and `isCancelled` 2022-10-25 15:10:35 +11:00
purchasing.nim Load purchase state from chain (#283) 2022-11-08 08:10:17 +01:00
rng.nim track latest nim-libp2p's master branch (#248) 2022-11-02 11:40:28 -06:00
sales.nim [marketplace] add/remove proofs for contract state 2022-10-25 15:10:35 +11:00
storageproofs.nim Upload authenticators (#108) 2022-05-25 20:29:31 -06:00
stores.nim Persist Dht providers (#257) 2022-09-29 20:16:59 -06:00
streams.nim adding AsyncStreamWrapper (#110) 2022-06-14 09:19:35 -06:00
utils.nim Download files without padding (#218) 2022-08-24 15:15:59 +03:00