filecoin-project / go-fil-markets

Shared Implementation of Storage and Retrieval Markets for Filecoin Node Implementations
Other
78 stars 59 forks source link

feat: handle retrieval queries for unindexed identity payload CIDs #747

Closed rvagg closed 2 years ago

rvagg commented 2 years ago

There are valid cases where a CAR may have an identity CID as its root that is not represented as a 'block' within the CAR body and therefore isn't indexed by the dagstore. In this case, we inspect the identity CID content and treat the query as a query for the intersection of all of the links within the block.

Ref: https://github.com/filecoin-project/boost/pull/715

rvagg commented 2 years ago

TestHandleQueryStream/When_payload_CID_not_found failing:

                             (retrievalmarket.QueryResponse) {
                            - Status: (retrievalmarket.QueryResponseStatus) 1,
                            + Status: (retrievalmarket.QueryResponseStatus) 2,
                              PieceCIDFound: (retrievalmarket.QueryItemStatus) 1,
                            @@ -15,3 +15,3 @@
                              MaxPaymentIntervalIncrease: (uint64) 0,
                            - Message: (string) (len=69) "piece info for cid not found (deal has not been added to a piece yet)",
                            + Message: (string) (len=121) "failed to fetch piece to retrieve from: getting pieces for cid QmfM8NQMc9bGY37wa9FwrVJtw5YT66ut7jjLFVha6aeFST: %!w(<nil>)",
                              UnsealPrice: (big.Int) {

I'll need to restore that if we proceed with this.

rvagg commented 2 years ago

New commits added to make this work properly, reasonably and efficiently:

Some trade-offs that I judged worth it:

Aside: Why, if we have selected a piece to make a deal on, does the dynamic-ask operate over all deals that contain the pieces that have the payload? Why aren't we just doing dynamic-ask for the one piece?

hannahhoward commented 2 years ago

alternativelty, run the integration test change in Boost with this PR to verify.

rvagg commented 2 years ago

Updated to:

Also verified this works with https://github.com/filecoin-project/boost/pull/715 and it does, so 🥳

rvagg commented 2 years ago

btw this branch is based off v1.23.2 which is the tag boost is currently using; there's breaking libp2p dep changes between there and master to be able to use anything later and have it play ball with lotus

rvagg commented 2 years ago

rebased this to master since lotus has caught up already, we just need to get boost done too