Commit Graph

353 Commits

Author SHA1 Message Date
Slava d082dc71be
Update Docker workflow (#62) 2023-07-11 19:36:21 +03:00
Eric Mastro 230e7276e2
Support slot queue (#61)
* feat: add request expiry to StorageRequested event

* add slot index to SlotFreed event

* copy slotIndex before delete for emit

* Update tests
2023-06-22 06:18:33 +10:00
Mark Spanbroek 6801f2c009 [fuzzing] document `npm run fuzz` in readme 2023-06-19 14:58:47 +02:00
markspanbroek 96aa98c734 [fuzzing] Use correct hashbang
Co-authored-by: Adam Uhlíř <adam@uhlir.dev>
2023-06-19 14:58:47 +02:00
Mark Spanbroek f530bc5081 [fuzzing] Only use docker image on x86_64 machines
The echidna docker image does not support ARM
Macs, for example.
2023-06-19 14:58:47 +02:00
Mark Spanbroek b396f13359 [fuzzing] Fix CI 2023-06-19 14:58:47 +02:00
Mark Spanbroek 05ef48bf7f [fuzzing] Add suggestions for a long test run 2023-06-19 14:58:47 +02:00
Mark Spanbroek d4fc6bbf7c [fuzzing] update to Echidna 2.2.0 2023-06-19 14:58:47 +02:00
Mark Spanbroek a7dd840eaa [fuzzing] transfers out of the contract should always pass
When a transfer of tokens from the contract fails, then the
fuzzer has found a bug. Changing `require` to `assert`
ensures that the fuzzer considers this a test failure.
2023-06-19 14:58:47 +02:00
Mark Spanbroek 03e5546121 [marketplace] formatting 2023-06-19 14:58:47 +02:00
Mark Spanbroek 42d4778dcc [fuzzing] compile contracts before invoking docker
Ensures that `npm run fuzz` will succeed whether or
not the contracts were compiled beforehand.
2023-06-19 14:58:47 +02:00
Mark Spanbroek c1b412c589 [fuzzing] allow fuzz.sh to be called from any directory 2023-06-19 14:58:47 +02:00
Mark Spanbroek 25f52c72b1 [ci] Run fuzzing in CI 2023-06-19 14:58:47 +02:00
Mark Spanbroek 3390e21071 [fuzzing] Enable fuzzing for Marketplace
Replaces runtime invariant checks with fuzzing tests,
simplifying the contract code and lowering gas costs.
2023-06-19 14:58:47 +02:00
benbierens d57cfc69cd Fix "invalid value undefined" in hardhat configuration 2023-06-19 10:49:40 +02:00
Eric Mastro c7b69893a1 only mint tokens when on local hardhat network 2023-06-19 10:49:40 +02:00
benbierens 312a3eee55 Sets workdir, adds readme 2023-06-19 10:49:40 +02:00
benbierens ff6eb147c6 Waits for token mint transaction. 2023-06-19 10:49:40 +02:00
benbierens f69f9cf7fe debugging deployment of contract to geth node 2023-06-19 10:49:40 +02:00
benbierens a9a1882ed3 Setting up start script. 2023-06-19 10:49:40 +02:00
Slava ee70b64b15
Add Docker builds (#56) 2023-05-25 22:00:56 +03:00
Slava 7b7773c436
Update links to codex-storage organization (#55) 2023-05-25 12:56:04 +03:00
Adam Uhlíř 30affa0da8
build: make sure marketplace is on predefined address (#54) 2023-04-26 09:44:55 +02:00
Eric Mastro 6e66abbfcd
retreive active slot for sales state restoration (#51)
Store slotIndex in slot struct and expose the slot via getActiveSlot. This is to be used when restoring state in the sales module after a node restart.
2023-04-14 09:28:39 +10:00
Adam Uhlíř 63d8ec786a
build: funds localhost env. accounts (#52) 2023-04-03 10:39:48 +02:00
Adam Uhlíř 2b5d079882
feat: collateral fractions (#47)
Co-authored-by: Eric Mastro <github@egonat.me>
2023-03-30 11:11:21 +02:00
Adam Uhlíř 8b39ef8f4a
fix: reset missed counter when slot is freed (#48) 2023-03-08 17:19:49 +01:00
Adam Uhlíř dfdbd16d5b
feat: collateral per slot (#44) 2023-03-08 12:02:34 +01:00
Mark Spanbroek fcc28b3931 [readme] update readme with slots, add references 2023-02-01 11:20:27 +01:00
Mark Spanbroek 7c9ebb3c31 [test] tweak test settings
- stop on first failure (quick feedback)
- do not warn about slow test before 100 ms
  (solidity tests are inherently slow)
- set test timeout to 30 seconds
2023-01-30 14:48:03 +01:00
Mark Spanbroek 24ef30bd2a [proofs] improve test to check proof probability
- avoid bias due to pointer downtime
- use statistical binomial test
2023-01-30 14:47:37 +01:00
Mark Spanbroek e89bfcbaae [build] add library for statistical binomial tests 2023-01-30 14:47:37 +01:00
Mark Spanbroek c9b51695aa [proofs] support probability 1 (proofs always required) 2023-01-30 14:47:37 +01:00
Eric Mastro cde5436262
get request from slot id (#34)
* get request from slot id

- Add public function to get request from slot id.
- Add chai test assertion that compares requests. Usage: `expect(await marketplace.getRequestFromSlotId(slotId(slot))).to.be.request(request)`

This is used when restoring active sales, and a node calls `mySlots`, then iterates the slots and needs originating request details.

* merge upstream changes
2023-01-24 15:59:56 +11: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 b81e6e6532 [marketplace] better wording
Avoids the word 'expired' which is associated
with cancelling a request

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 3bb077db7a [marketplace] reordering
Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-01-23 15:10:23 +01:00
Mark Spanbroek 019c1c34c0 [marketplace] rewrite slot freeing test
To make it independent of values chosen in exampleRequest().
Uses the recently introduced slotState().
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 70d8967f26 [deployment] use new configuration struct 2023-01-23 15:10:23 +01:00
Mark Spanbroek 334da1144d [marketplace] renaming and reshuffling of request state test 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 91ccc82d49 [proofs] remove dead code 2023-01-23 15:10:23 +01:00
Mark Spanbroek bd284acce3 [examples] remove dead code 2023-01-23 15:10:23 +01:00
Mark Spanbroek 2dbdd0028d [marketplace] move price calculations to Requests.sol 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 8c6891f1e2 [marketplace] slotIsNotFree() modifier
Replaces _slot getter
2023-01-23 15:10:23 +01:00
Mark Spanbroek 944e9c9da2 [marketplace] requestIsKnown() modifier
Replaces _request() getter
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