Commit Graph

66 Commits

Author SHA1 Message Date
Andrea Franz 29f39d52c7
chore(certora): slot's missed periods count should be equal to the count of slot's missing periods set to true (#155) 2024-08-15 12:51:14 +02:00
Eric ed428767b3
chore: add `downtimeProduct` configuration parameter (#138)
* add `downtimeProduct` configuration parameter

* formatting
2024-08-14 15:50:32 +10:00
Adam Uhlíř fe8da1013d
docs: proofs comments (#118)
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
Co-authored-by: markspanbroek <mark@spanbroek.net>
2024-08-08 09:35:35 +00:00
Mark Spanbroek 70b22b241f Refactor verifier contract: remove unnecessary conversions 2024-01-25 13:08:10 +01:00
Mark Spanbroek c0ca508a6b Refactor verifier contract: public input as dynamic array 2024-01-25 13:08:10 +01:00
Mark Spanbroek f3e2186ec2 Update solidity to 0.8.23 2024-01-25 13:08:10 +01:00
Mark Spanbroek 33614ee218 Calculate public inputs for ZK proof verificition 2024-01-25 13:08:10 +01:00
Mark Spanbroek 38411c27ca Move submitProof() function to Marketplace 2024-01-25 13:08:10 +01:00
Mark Spanbroek e6a918fed9 Submit proof as Groth16Proof struct 2024-01-25 13:08:10 +01:00
Mark Spanbroek ae03690d51 Submit proof as field elements, not bytes 2024-01-25 13:08:10 +01:00
Mark Spanbroek 1af40f1790 Read proof from file in test 2024-01-25 13:08:10 +01:00
Mark Spanbroek e59f0f961e Submit proofs as array of bytes 2024-01-25 13:08:10 +01:00
Mark Spanbroek 327ae14112 Formatting with prettier 2024-01-25 13:08:10 +01:00
Mark Spanbroek db124ddbd9 Re-arrange marketplace constructor parameters
first configuration, then contracts that we depend on
2024-01-25 13:08:10 +01:00
Adam Uhlíř 0d9b67bb31 feat: verifier integration 2024-01-25 13:08:10 +01:00
Eric b5f33992b6
Increase pointer by 67 blocks each time the period is increased (#75)
* Increase pointer by 67 instead of 64 for each period

Use a prime number to ensure that we don't get cycles
where we're looking at the same hash four periods
from now.

---------

Co-authored-by: Mark Spanbroek <mark@spanbroek.net>
2023-12-15 10:02:03 +11:00
Mark Spanbroek 03e5546121 [marketplace] formatting 2023-06-19 14:58:47 +02:00
Adam Uhlíř 8b39ef8f4a
fix: reset missed counter when slot is freed (#48) 2023-03-08 17:19:49 +01:00
Mark Spanbroek c9b51695aa [proofs] support probability 1 (proofs always required) 2023-01-30 14:47:37 +01: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 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 b62eeb564a [marketplace] test & fix slotState() 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 7aa162b526 [marketplace] move proofPeriod() getter to Proofs.sol 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 c8dda37300 [marketplace] introduce SlotState
- replace proofEnd() by slotState()
- replace _slotAcceptsProofs() by slotState()
- remove _stopRequiringProofs()
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 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
Mark Spanbroek f8e9f3c848 [Proofs] Remove double administration of request end
The timestamp when proofs no longer are 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 ce335d0568 [Proofs] Improved naming
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-10 12:15:22 +01:00
Mark Spanbroek afad73d588 [Markeplace] Linting 2023-01-10 12:15:22 +01:00
Mark Spanbroek 39da450c2a [Storage] Move submitProof() to Proofs 2023-01-10 12:15:22 +01:00
Mark Spanbroek c9cf47f327 [Storage] Move missingProofs() to Proofs 2023-01-10 12:15:22 +01:00
Mark Spanbroek d5d99515fc [Proofs] Remove ProofId and EndId, use SlotId and RequestId
Rationale: in practice, a ProofId was always a slot id, and
an EndId was always a request id. Now that the definitons
of SlotId and RequestId are separated from the Marketplace,
we can import and use them.
2023-01-10 12:15:22 +01:00
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