* [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>
Support storage contract parameters to free slots after too many proofs missed, as well as fail a contract after too many slots have been freed.
# Conflicts:
# vendor/dagger-contracts
- rename `ContractId` to `SlotId`
- add `RequestId`, `PurchaseId`, `Nonce` types as aliases of `array[32, byte]`
- rename `Proving.contracts` to `Proving.slots`
- change signatures of `isSlotCancelled` and `isCancelled` to use `SlotId` and `RequestId` types, respectively.
- change all references to `RequestId`, `SlotId`, and `PurchaseId`
Integrate dagger contracts from `nim-dagger-contracts` repo.
Add `dagger-contracts`, `nim-web3`, and all of `nim-web3`’s transitive deps as submodule deps to `nim-dagger`. Note: `nim-web3` and its transitive deps may no longer be needed when we switch to `nim-ethers`.
Add a `testContracts` nimble task to test all of the contracts functionality. Namely, this spins up an ethereum simulator, deploys the contracts (in `dagger-contracts`), runs the contract tests, and finally, regardless of success/error, kills the ethereum sim processes. The nimble task can be run with `./env.sh nimble testContracts`.
We also tested `nim-dagger-contracts` as a submodule dep of `nim-dagger`, and while the tests run as expected, the preference is to merge `nim-dagger-contracts` inside of `nim-dagger` for ease of parallel development. There’s also a high probability that `nim-dagger-contracts` is not being used as a dep by other projects. Are there any strong objections to this?
Co-authored-by: Michael Bradley <michaelsbradleyjr@gmail.com>