517 Commits

Author SHA1 Message Date
Dmitriy Ryajov
2e8dac7ab5
cleaning up merge 2023-11-13 21:01:02 -06:00
Dmitriy Ryajov
7c633e425c
bump deps 2023-11-13 20:47:45 -06:00
Dmitriy Ryajov
4802b91d07
add missed master changes 2023-11-13 20:47:45 -06:00
Dmitriy Ryajov
ac5ef27e84
add skipped master changes 2023-11-13 20:47:45 -06:00
Dmitriy Ryajov
0c704336e3
rename metrics 2023-11-13 20:47:45 -06:00
Tomasz Bekas
5edb142c32
Fix a comment 2023-11-13 20:47:45 -06:00
Tomasz Bekas
2ea84f9e6c
Storing proofs instead of trees 2023-11-13 20:47:43 -06:00
Tomasz Bekas
9c8d08681f
Rework erasure.nim to include recent cleanup 2023-11-13 20:47:22 -06:00
benbierens
baeb707097
Links the network store getTree to the local store. 2023-11-13 20:47:22 -06:00
Tomasz Bekas
7db3f1ac0b
Blockexchange uses merkle root and index to fetch blocks 2023-11-13 20:47:22 -06:00
Adam Uhlíř
e904ff39b0
docs(api): add note about nodes in request storage creation (#547) 2023-11-13 20:47:21 -06:00
Ben Bierens
94ac1f3cb0
Storage/purchases endpoint (#609)
* adds list of purchase ids to storage API

* adds list of purchase ids to storage API

* Updates openAPI

* fixes openAPI type
2023-11-13 20:47:21 -06:00
Tomasz Bekas
72940c996e
Merge branch 'master' into blockexchange-uses-merkle-tree 2023-11-13 11:59:50 +01:00
Ben Bierens
80e2ef4eb5
Debug/info shows announce addresses (#610)
* Shows announce addresses in debug/info endpoint.

* Shows announce addresses in debug/info endpoint.
2023-11-12 09:58:40 +01:00
Tomasz Bekas
eceebbff8f
Merge branch 'master' into blockexchange-uses-merkle-tree 2023-11-09 19:46:12 +01:00
Tomasz Bekas
41b5723554
Addressing PR comments 2023-11-09 19:29:00 +01:00
Tomasz Bekas
7b3a3a96d9
Fix for broken testerasure.nim 2023-11-09 14:24:40 +01:00
Ben Bierens
cb02962231
Adds endpoint for listing files (manifests) in node. Useful for demo UI. (#599)
* Adds endpoint for listing files (manifests) in node. Useful for demo UI.

* Moves upload/download/files into content API calls.

* Cleans up json serialization for manifest

* Cleans up some more json serialization

* Moves block iteration and decoding to node.nim

* Moves api methods into their own init procs.

* Applies RestContent api object.

* Replaces format methods with Rest objects in json.nim

* Unused import

* Review comments by Adam

* Fixes issue where content/local endpoint clashes with content/cid.

* faulty merge resolution

* Renames content API to data.

* Fixes faulty rebase

* Adds test for data/local API

* Renames local and download api.
2023-11-09 08:47:09 +00:00
Eric
7d4ea878d2
Support logging to file (#558)
* Support logging to file

* Log the entire config and fix build error

* Downgrade log level for "starting codex node" config output

* bump ethers to prevent nonce gaps

* fix tests
2023-11-09 16:35:55 +11:00
Tomasz Bekas
8e40cafdb9
Merge branch 'master' into blockexchange-uses-merkle-tree 2023-11-06 12:53:06 +01:00
Tomasz Bekas
b542cce7a0
Fix broken tests 2023-11-06 12:40:17 +01:00
Adam Uhlíř
c0bec2f899
feat: ensure block expiry (#597)
* feat: update block expiry

* chore: feedback implementation

* chore: feedback implementation

* chore: feedback implementation
2023-11-06 08:10:30 +00:00
Tomasz Bekas
5277a12d50
Fix a comment 2023-11-04 08:00:53 +01:00
Tomasz Bekas
67a0fb4df9
Merge branch 'master' into blockexchange-uses-merkle-tree 2023-11-04 07:55:26 +01:00
Tomasz Bekas
68f76c1246
Storing proofs instead of trees 2023-11-03 21:17:20 +01:00
Slava
11cd2c46ad
Rename metrics (#478) (#603) 2023-11-03 17:21:54 +02:00
Adam Uhlíř
0014ffdef5
test: integration tests listen on localhost (#596) 2023-10-24 16:52:06 +02:00
Adam Uhlíř
2fc71cf81b
feat: partial payouts for cancelled requests (#561) 2023-10-24 10:12:54 +00:00
Dmitriy Ryajov
8a7d74e6b2
removing old por proofs implementation (#593) 2023-10-23 07:58:07 -07:00
Tomasz Bekas
252b4451b7
Addressing review comments 2023-10-23 14:54:48 +02:00
markspanbroek
a77d0cdcec
[sales] Fix intermittently failing test (#591) 2023-10-19 15:46:21 +02:00
Adam Uhlíř
c28627d16f
chore(logging): purchases logging (#567) 2023-10-19 10:12:49 +02:00
Slava
5b30bfd427
Use token for coverage data upload to Codecov (#583)
Signed-off-by: Slava <20563034+veaceslavdoina@users.noreply.github.com>
2023-10-18 14:35:46 +03:00
Tomasz Bekas
ac2fc71c23
Revert accidential changes to lib versions 2023-10-18 11:17:31 +02:00
Tomasz Bekas
78a4d79cd4
Rework erasure.nim to include recent cleanup 2023-10-17 23:44:27 +02:00
Tomasz Bekas
85cef0ea1f
Update codex/stores/repostore.nim
Co-authored-by: Dmitriy Ryajov <dryajov@gmail.com>
Signed-off-by: Tomasz Bekas <tomasz.bekas@gmail.com>
2023-10-17 23:43:13 +02:00
benbierens
10d64561de
Links the network store getTree to the local store. 2023-10-17 23:43:13 +02:00
Tomasz Bekas
8c1d97d75c
Blockexchange uses merkle root and index to fetch blocks 2023-10-17 23:43:10 +02:00
Adam Uhlíř
5f4218ba1c
fix: use increaseAllowance for token approving (#565) 2023-10-16 13:09:54 +02:00
Ben Bierens
040434aa19
renames log properties named 'count' (#560) 2023-10-03 13:33:01 +02:00
Ben Bierens
fede106118
Numbered log entries (#559)
* add numbered log entries (hack)

* Changed from CLI argument to compiler define

* Use uint64 for counting

---------

Co-authored-by: gmega <giuliano.mega@gmail.com>
2023-10-03 11:53:58 +02:00
Eric
570a1f7b67
[marketplace] Availability improvements (#535)
## Problem
When Availabilities are created, the amount of bytes in the Availability are reserved in the repo, so those bytes on disk cannot be written to otherwise. When a request for storage is received by a node, if a previously created Availability is matched, an attempt will be made to fill a slot in the request (more accurately, the request's slots are added to the SlotQueue, and eventually those slots will be processed). During download, bytes that were reserved for the Availability were released (as they were written to disk). To prevent more bytes from being released than were reserved in the Availability, the Availability was marked as used during the download, so that no other requests would match the Availability, and therefore no new downloads (and byte releases) would begin. The unfortunate downside to this, is that the number of Availabilities a node has determines the download concurrency capacity. If, for example, a node creates a single Availability that covers all available disk space the operator is willing to use, that single Availability would mean that only one download could occur at a time, meaning the node could potentially miss out on storage opportunities.

## Solution
To alleviate the concurrency issue, each time a slot is processed, a Reservation is created, which takes size (aka reserved bytes) away from the Availability and stores them in the Reservation object. This can be done as many times as needed as long as there are enough bytes remaining in the Availability. Therefore, concurrent downloads are no longer limited by the number of Availabilities. Instead, they would more likely be limited to the SlotQueue's `maxWorkers`.

From a database design perspective, an Availability has zero or more Reservations.

Reservations are persisted in the RepoStore's metadata, along with Availabilities. The metadata store key path for Reservations is ` meta / sales / reservations / <availabilityId> / <reservationId>`, while Availabilities are stored one level up, eg `meta / sales / reservations / <availabilityId> `, allowing all Reservations for an Availability to be queried (this is not currently needed, but may be useful when work to restore Availability size is implemented, more on this later).

### Lifecycle
When a reservation is created, its size is deducted from the Availability, and when a reservation is deleted, any remaining size (bytes not written to disk) is returned to the Availability. If the request finishes, is cancelled (expired), or an error occurs, the Reservation is deleted (and any undownloaded bytes returned to the Availability). In addition, when the Sales module starts, any Reservations that are not actively being used in a filled slot, are deleted.

Having a Reservation persisted until after a storage request is completed, will allow for the originally set Availability size to be reclaimed once a request contract has been completed. This is a feature that is yet to be implemented, however the work in this PR is a step in the direction towards enabling this.

### Unknowns
Reservation size is determined by the `StorageAsk.slotSize`. If during download, more bytes than `slotSize` are attempted to be downloaded than this, then the Reservation update will fail, and the state machine will move to a `SaleErrored` state, deleting the Reservation. This will likely prevent the slot from being filled.

### Notes
Based on #514
2023-09-29 14:33:08 +10:00
Adam Uhlíř
2f1c778d02
fix: unknown state goes to payout when slot state is finished (#555) 2023-09-27 15:57:41 +02:00
Dmitriy Ryajov
25ea7fd0b2
Erasure cleanup (#545)
* cleanup erasure coding

* moar cleanup

* fix off by 1 issues in tests

* style

* consolidate decoding data code

* simplify tuple unpacking

* fix retrieve purchase

We don't support single blocks for now

* Apply suggestions from code review

Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
Signed-off-by: Dmitriy Ryajov <dryajov@gmail.com>

---------

Signed-off-by: Dmitriy Ryajov <dryajov@gmail.com>
Co-authored-by: Eric <5089238+emizzle@users.noreply.github.com>
2023-09-25 07:31:10 -07:00
Ben Bierens
13de6dc500
Adds script to inject private key for the purpose of testing. (#553) 2023-09-19 09:57:39 +02:00
markspanbroek
71cd35112b
Taiko L2 (#483)
* [docs] fix two client scenario: add missing collateral

* [integration] separate step to wait for node to be started

* [cli] add option to specify ethereum private key

* Remove unused imports

* Fix warnings

* [integration] move type definitions to correct place

* [integration] wait a bit longer for a node to start in debug mode

When e.g. running against Taiko test net rpc, the node start
takes longer

* [integration] simplify handling of codex node and client

* [integration] add Taiko integration test

* [contracts] await token approval confirmation before next tx

* [contracts] deployment address of marketplace on Taiko

* [cli] --eth-private-key now takes a file name

Instead of supplying the private key on the command line,
expect the private key to be in a file with the correct
permissions.

* [utils] Fixes undeclared `activeChroniclesStream` on Windows

* [build] update nim-ethers to include PR #52

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

* [cli] Better error messages when reading eth private key

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

* [integration] simplify reading of cmd line arguments

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

* [build] update to latest version of nim-ethers

* [contracts] updated contract address for Taiko L2

* [build] update codex contracts to latest version

---------

Co-authored-by: Eric Mastro <eric.mastro@gmail.com>
2023-09-13 16:17:56 +02:00
Vaclav Pavlin
d399290ba6
chore: move the docker-compose volume (#507) 2023-09-05 16:50:47 -07:00
Adam Uhlíř
ae89db1eea
fix: sales concurrency bug (#537) 2023-09-05 16:47:29 +02:00
markspanbroek
d3a22a7b7b
Fix slot queue push (#542)
* [sales] remove availability check before adding to slot queue

* [sales] add missing return statement

* [tests] remove 'eventuallyCheck' helper

* [sales] remove reservations from slot queue

* [tests] rename module `eventually` -> `always`

* [sales] increase slot queue size

Because it will now also hold items for which we haven't
checked availability yet.
2023-09-04 16:42:09 +02:00
Ben Bierens
d279eebd69
Start discovery after announce address is updated (#536)
* Start discovery after announce address is updated

* Moves switch start-stop to codex.nim. Adjusts timing to solve issue
2023-09-04 11:12:20 +02:00