Commit Graph

27 Commits

Author SHA1 Message Date
Eric Mastro 2478e36aba add back proof end mappings 2022-10-25 12:47:50 +11:00
Eric Mastro cfb70897f8 [marketplace] alias bytes32 types
`RequestId`, `SlotId`, `LockId`, `ProofId`, `EndId` types were created to avoid confusion and enforce compiler restrictions.
2022-10-25 12:47:50 +11:00
Eric Mastro bac2675bb2 set proof end when storage requested
1. set proof end to now + duration when storage is requested
2. set proof end to past when contract is failed
3. add back proof end mappings
2022-10-25 12:38:19 +11:00
Eric Mastro fd74268a8a Remove proof extension, test clean up
1. Remove proof extension as it is not needed. Host are required to provide proofs from the moment they fill a slot, for the duration specified by the contract. This means that the ending of their requirements will be staggered at the end, as they were at the start, but this is more predicable for determining the cost of a request.
2. The proof end time was modified so that if the request state is not accepting proofs, it takes the min of the slot proof end time, the request end time, or block.timestamp - 1, which ensures that it returns a time in the past. If the slot is accepting proofs, it returns the slot end time.
3. Modify marketplace tests so that `waitUntilFinished` advances time to the proof ending of the last slot filled.
2022-10-25 12:38:19 +11:00
Eric Mastro ad040cfee6 [marketplace] extend proof ending
Allow proof ending to be extending once a contract is started, so that all filled slots share an ending time that is equal to the contract end time. Added tests.

Add a mapping for proof id to endId so that proof expectations can be extended for all proofs that share a given endId.

Add function modifiers that require the request state to allow proofs, with accompanying tests.

General clean up of each function’s request state context, with accompanying tests.

General clean up of all tests, including state change “wait” functions and normalising the time advancement functions.
2022-10-25 12:38:19 +11:00
Eric Mastro 1fff2f7295 [marketplace] add isFinished
Add function `isFinished` that checks whethere the state has been set to `RequestState.Finished` (which is not being set yet) or if the contract was started (`RequestState.Started`) and the contract duration has lapsed.

To facilitate `isFinished`, the contract start time (`startedAt`) was added to calculate the contract end time.
2022-10-25 12:38:19 +11:00
Eric Mastro 0ffe5d7697 [marketplace] free slot after too many proofs missed
Needs tests
2022-10-25 12:38:19 +11:00
Eric Mastro 980647876f [marketplace] update contract state to failed
Update contract state to failed when too many slots have been freed.
2022-09-21 20:52:44 +10:00
Eric Mastro 7487663534 [marketplace] free slot after too many proofs missed
Needs tests
2022-09-21 20:52:44 +10:00
Mark Spanbroek 2bf01da728 [proofs] Submitting proof emits event containing proof 2022-04-12 09:04:29 +02:00
Mark Spanbroek 29b5775951 [proofs] willProofBeRequired() predicts proof requirement 2022-04-05 11:36:31 +02:00
Mark Spanbroek 3fd7c756d9 Fix flaky tests
By ensuring that there's enough blocks left
for submitting a proof.
2022-03-15 10:01:12 +01:00
Mark Spanbroek f8ddc4a2f6 Add getChallenge() to Storage contract 2022-03-15 10:01:12 +01:00
Mark Spanbroek fd55afcc5a Make pointer downtime configurable 2022-03-15 10:01:12 +01:00
Mark Spanbroek 476956c4d5 Replace pointer duos with pointer downtime design 2022-03-15 10:01:12 +01:00
Mark Spanbroek 6d726fc2cc Require a block height of at least 256 2022-03-15 10:01:12 +01:00
Mark Spanbroek 78eaaa7812 Replace Proof implementation with new design
More info: https://github.com/status-im/dagger-research/pull/66
2022-03-15 10:01:12 +01:00
Mark Spanbroek 036a214427 Proof period and proof timeout are network constants now 2022-03-15 10:01:12 +01:00
Mark Spanbroek f7af18eb2d Lint with solhint 2022-02-10 07:46:03 +01:00
Mark Spanbroek 78755ecaa2 Format using prettier 2022-02-10 07:46:03 +01:00
Mark Spanbroek c0fb0c725c Do not require proofs before start of contract 2021-11-03 17:15:03 +01:00
Mark Spanbroek 8efa9fe162 Stop requiring proofs when contract has ended 2021-11-03 17:02:12 +01:00
Mark Spanbroek 2784800c3e Add end time to proofs based on contract duration 2021-11-03 17:01:11 +01:00
Mark Spanbroek 3326c4fe74 Make isProofRequired() work for the current block
The block hash of the current block is not known yet, so
we use the block hash of the previous block to determine
whether a proof is required for a block.
2021-11-03 13:20:40 +01:00
Mark Spanbroek 3b6ec4126d Fix comments 2021-11-02 11:22:34 +01:00
Mark Spanbroek aa0def1127 Move timeout validity check to Proofs contract 2021-11-01 15:28:22 +01:00
Mark Spanbroek d1f5ce0786 Extract logic around proofs into separate contract 2021-11-01 15:12:05 +01:00