Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a PoC of bitswap retrieval from Boost #348

Closed
jacobheun opened this issue Mar 21, 2022 · 1 comment
Closed

Create a PoC of bitswap retrieval from Boost #348

jacobheun opened this issue Mar 21, 2022 · 1 comment
Assignees

Comments

@jacobheun
Copy link
Contributor

jacobheun commented Mar 21, 2022

This is a followup from the work started at filecoin-project/lotus#7990.

The goal of this is to add support for retrieval of data on Filecoin via an IPFS node without something like an autoretrieve bridge.

This issue aims to capture the current state of the work to support IPFS retrievals from Boost.

Update
We now have a working POC for IPFS retrievals from Filecoin by instantiating a Bitswap server in Boost with a Read-Only blockstore that can return blocks for all cids across all free and unsealed deals. Note that even though Boost publishes content routing records for Bitswap to the network Indexer, we tested the POC by ensuring that the Bitswap client was already connected to SPs that could serve the cids the client wanted. This is because the hydra ingestion of Filecoin content routing records is still being worked upon.

The following PRs were raised to implement the POC:

  • DAGStore PR to implement a blockstore that can return blocks for all cids across all (Boost + legacy market deals) that are free and unsealed. This PR is implemented in the dagstore and constitutes the backbone of this work. Here's how it works at a high level:

    • On being asked for a cid, the blockstore refers to the top level index in the dagstore to lookup all deals(henceforth referred to as a "shard") containing the given cid.
    • It runs the shards through a "shard selector function" that selects a shard to serve the cid from. This shard selector function is injected into the blockstore during instantiation. For the purpose of the POC, we configure the shard selector function to select a free and unsealed deal. We use the dynamic retrieval pricing feature implemented in go-fil-markets to determine if a deal is free or paid.
    • The blockstore than opens the CARv2 index for the selected shard to identify the offset of the requested cid in the CARv1 payload of the shard. (Note: The CARv2 indices for all deals are persisted in the configured dagstore repository and the dagstore runs as a library in the Boost process).
    • The blockstore then makes a http range request to the lotus sector storage subsystem using the offset it gets from the CARv2 index to fetch the block from the CARv1 payload for the deal and returns it to the caller. (Note that no unsealing happens for this as we only make these requests for deals that we've already identified as being unsealed). This http range request is accomplished by using the Lotus Mount configured for the shard at the time of registering a shard with the dagstore.
  • Boost PR to instantiate a Bitswap server

    • We instantiate a Bitswap server in Boost that uses the Blockstore described above. The blockstore is instantiated with a "shard selector function" which limits the blockstore to only returning blocks that exist in free and unsealed deals.
    • Boost announces cid manifests for all deals as being available for retrieval on both Bitswap & Graphsync to the network Indexer.
  • Markets PR to expose an API to determine if a deal is free and unsealed.

Future work based on feedback

  • Run Bitswap retrievals in a separate process.
  • Implement Graphsync-esque hooks, controls and rate limiting in Bitswap so SPs have more fine grain control over what cids to serve and which clients to serve to.
  • IPFS nodes need to start ingesting Filecoin network Indexer records.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants