lotus/build
Aarsh Shah d7076778e2
integrate DAG store and CARv2 in deal-making (#6671)
This commit removes badger from the deal-making processes, and
moves to a new architecture with the dagstore as the cental
component on the miner-side, and CARv2s on the client-side.

Every deal that has been handed off to the sealing subsystem becomes
a shard in the dagstore. Shards are mounted via the LotusMount, which
teaches the dagstore how to load the related piece when serving
retrievals.

When the miner starts the Lotus for the first time with this patch,
we will perform a one-time migration of all active deals into the
dagstore. This is a lightweight process, and it consists simply
of registering the shards in the dagstore.

Shards are backed by the unsealed copy of the piece. This is currently
a CARv1. However, the dagstore keeps CARv2 indices for all pieces, so
when it's time to acquire a shard to serve a retrieval, the unsealed
CARv1 is joined with its index (safeguarded by the dagstore), to form
a read-only blockstore, thus taking the place of the monolithic
badger.

Data transfers have been adjusted to interface directly with CARv2 files.
On inbound transfers (client retrievals, miner storage deals), we stream
the received data into a CARv2 ReadWrite blockstore. On outbound transfers
(client storage deals, miner retrievals), we serve the data off a CARv2
ReadOnly blockstore.

Client-side imports are managed by the refactored *imports.Manager
component (when not using IPFS integration). Just like it before, we use
the go-filestore library to avoid duplicating the data from the original
file in the resulting UnixFS DAG (concretely the leaves). However, the
target of those imports are what we call "ref-CARv2s": CARv2 files placed
under the `$LOTUS_PATH/imports` directory, containing the intermediate
nodes in full, and the leaves as positional references to the original file
on disk.

Client-side retrievals are placed into CARv2 files in the location:
`$LOTUS_PATH/retrievals`.

A new set of `Dagstore*` JSON-RPC operations and `lotus-miner dagstore`
subcommands have been introduced on the miner-side to inspect and manage
the dagstore.

Despite moving to a CARv2-backed system, the IPFS integration has been
respected, and it continues to be possible to make storage deals with data
held in an IPFS node, and to perform retrievals directly into an IPFS node.

NOTE: because the "staging" and "client" Badger blockstores are no longer
used, existing imports on the client will be rendered useless. On startup,
Lotus will enumerate all imports and print WARN statements on the log for
each import that needs to be reimported. These log lines contain these
messages:

- import lacks carv2 path; import will not work; please reimport
- import has missing/broken carv2; please reimport

At the end, we will print a "sanity check completed" message indicating
the count of imports found, and how many were deemed broken.

Co-authored-by: Aarsh Shah <aarshkshah1992@gmail.com>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>

Co-authored-by: Raúl Kripalani <raul@protocol.ai>
Co-authored-by: Dirk McCormick <dirkmdev@gmail.com>
2021-08-16 23:34:32 +01:00
..
bootstrap Reset interop network 2021-07-06 17:06:55 +00:00
genesis Add genesis for interop network 2021-07-06 17:06:55 +00:00
openrpc integrate DAG store and CARv2 in deal-making (#6671) 2021-08-16 23:34:32 +01:00
proof-params WIP: Integrate FIP0013 2021-05-11 22:10:29 -04:00
bootstrap.go use go:embed 2021-06-02 12:16:09 +02:00
clock.go first pass, ready for review 2020-08-03 12:20:04 -03:00
drand.go Drand: add cloudflare. Use HTTP for PL nodes. 2020-10-12 19:15:56 +02:00
flags.go provide an option to disable loading of built-in assets. 2020-06-22 19:42:04 +01:00
forks.go squash forks and use correct amt library everywhere 2020-02-04 18:26:42 -08:00
genesis.go use go:embed 2021-06-02 12:16:09 +02:00
isnearupgrade.go Add the missing file 2020-12-19 22:10:45 +01:00
openrpc_test.go OpenRPC Support (#5843) 2021-03-19 19:22:46 +01:00
openrpc.go use go:embed 2021-06-02 12:16:09 +02:00
parameters.go build: Use go embed for srs-inner-product.json 2021-06-02 15:12:26 +02:00
params_2k.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
params_butterfly.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
params_calibnet.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
params_debug.go fix debug and 2k mix 2021-01-22 11:27:05 +08:00
params_interop.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
params_mainnet.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
params_nerpanet.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
params_shared_funcs.go Add a whitelisted block 2021-04-10 02:12:38 -04:00
params_shared_vals.go test: genesis actors version 2021-08-11 13:30:15 -07:00
params_testground.go revert pricelist by version to pricelist by epoch 2021-08-11 09:49:23 -04:00
testing_flags.go sync tests passing, still no vm integration 2019-11-22 10:41:09 -06:00
tools.go implement MessagePool.CheckMessages 2021-05-07 15:30:04 +02:00
version.go set buildtype in nerpa and butterfly 2021-07-29 20:41:24 -07:00