filecoin-shipyard / browser-retrieval

A p2p network of Filecoin content retrievers
21 stars 8 forks source link

Download failed: Key not found in database #114

Closed ghost closed 3 years ago

ghost commented 4 years ago
Filecoin_Retrieval

Steps to Reproduce

  1. Get the current browser extension and make sure to use wsEndpoint = "wss://retrievalproxy.browser-retrieval.filecoin.io:443"

  2. Retrieve this from storage miner:

    • CID: bafykbzacecp5ijz6n2hoy6nwferyxajnnftfny52kntbmqv5ywo734yivekw4
    • Miner: f019243
  3. The retrieval should not take too long since it will be in the files cache on retrievalproxy.browser-retrieval.filecoin.io. The total bytes of this CID are 4194304.

  4. However, the blue download arrow will not work and will give the message shown above Download failed: Key not found in database

ghost commented 4 years ago

The file is ~4 MB and I get multiple blocks in the IndexedDB after downloading:

Screen Shot 2020-11-04 at 5 44 16 PM
brunolm commented 4 years ago

CID with different parameters than what we have hard coded: https://cid.ipfs.io/#bafykbzacecp5ijz6n2hoy6nwferyxajnnftfny52kntbmqv5ywo734yivekw4

Source code of this website above that decodes the CID: https://github.com/multiformats/cid-utils-website

Hard coded part that needs to receive parameters from the decoded CID: https://github.com/filecoin-shipyard/browser-retrieval/blob/57360727c142399f0560df10848c9a1787ab0c49/src/background/socket-client/SocketClient.js#L105

We need:

{
  cidVersion: 1 | 0,
  hashAlg: 'blake2b-256' | 'sha256',
  rawLeaves: true | undefined
}

UPDATE:

format = decoded.codec
rawLeaves = decoded.codec === 'raw'

this.datastore.putContent(this.importSink, { cidVersion: decode.version, hashAlg: decode.hashAlg, format, rawLeaves });
ghost commented 3 years ago

We're still broken on dag-pb CIDs. Examples: bafykbzaceb7xzlm65omwugcavfxxcxclhnwamjbcodz5rz4kbyhenq7m4pivg, bafykbzacecp5ijz6n2hoy6nwferyxajnnftfny52kntbmqv5ywo734yivekw4

Screen Shot 2020-11-09 at 8 07 20 AM
ghost commented 3 years ago

@aistoc Here are some CIDs that do work:

Here are some CIDs that do not work:

When I say that it "works" or not, I am talking about the blue download arrow after the transfer finishes. You can see in the code how we are generating the link for that icon.