Commit Graph

23 Commits

Author SHA1 Message Date
Łukasz Magiera
95b128b7bc chain: Cleanup consensus logic 2021-09-02 18:09:37 +02:00
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
Peter Rabbitson
25a77d905d Centralize everything on ipfs/go-log/v2
I am not entirely sure this is right, but everything seems to build...
2021-04-06 15:04:32 +02:00
Łukasz Magiera
26399dba70 Update markets, cbor-gen with soft map decoding 2021-02-19 20:11:43 +01:00
Ruslan Tushov
f9aca39caf
Buffered stream for chainxchg response 2020-12-25 16:03:46 +03:00
vyzo
ef444676c2 combine add and remove evts and use a single emitter
to reduce likelihood of races
2020-11-20 16:15:44 +02:00
vyzo
7aec500384 emit event for peer disconnectionsa and act upon them in the blocksync peer tracker 2020-11-20 15:58:27 +02:00
Łukasz Magiera
6742a74260
Merge pull request #4814 from filecoin-project/feat/rw-close
update libp2p for stream interface changes
2020-11-13 00:23:29 +01:00
Steven Allen
5f1737379a update libp2p for stream interface changes 2020-11-12 13:57:19 -08:00
Łukasz Magiera
9270ac6358 Make some logs quieter 2020-11-03 13:28:41 +01:00
whyrusleeping
bd0633ff90 add a command to view block space utilization 2020-10-05 14:06:03 -07:00
Aayush Rajasekaran
e09d291e5d
Merge pull request #3939 from filecoin-project/fix/chain-sync-validation
Validate chain sync response indices when fetching messages
2020-09-23 17:35:14 -04:00
Łukasz Magiera
a2278e26af
Merge pull request #3887 from filecoin-project/feat/parallel-sync
Parallel fetch for chain sync
2020-09-23 19:24:54 +02:00
Lucas Molas
dcf2735836 move validation from protocol to API 2020-09-22 20:19:31 -03:00
vyzo
5663b2d697 change GetChainMessages api to include tipsets for validation 2020-09-21 18:58:52 +03:00
vyzo
44b52941f7 add option to validate messages against expected tipset 2020-09-21 18:50:41 +03:00
vyzo
58a85f378c refactor response compressed index validation into its own function 2020-09-21 18:33:31 +03:00
Łukasz Magiera
82b95e34b7 cbor gen 2020-09-17 17:37:16 +02:00
vyzo
2a428f09e6 increase exchange ShufflePeersPrefix to 16, use that as the value of concurrent sync requests 2020-09-17 18:07:01 +03:00
vyzo
61c0b8c3db properly close streams in blocksync
we were leaking streams right and left...
2020-09-17 18:07:01 +03:00
Raúl Kripalani
b33db9c1ab Merge branch 'master' into blocksync-refactor 2020-09-08 14:22:43 +01:00
Raúl Kripalani
453e826a0f rename p2p protocol to /fil/chain/xchg/0.0.1 (backwards-compatible); rename more. 2020-09-07 19:45:34 +01:00
Raúl Kripalani
55b1456d45 blocksync: introduce interfaces; rename to chainexchange. 2020-09-07 19:31:43 +01:00