You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browse filesBrowse the repository at this point in the historyBrowse files
authored
feat!: confirm indexing via Curio piece-status (#689)
* feat: confirm indexing via Curio piece-status instead of filecoinpin.contact
- poll Curio's per-provider piece-status endpoint until synced, then a single
bounded cid.contact check to confirm the advertisement is actually indexed
- treat a Curio-synced-but-cid.contact-disagrees case as a distinct mismatch,
not a plain timeout
- checkIpniIndexer's ipniIndexerUrl is now required (previously defaulted to
filecoinpin.contact, which is being retired)
* fix indexing confirmation gaps found in review
* fix indexer failure classification and provider validation
* fix(ipni): make retry waits abort-aware
* fix(ipni): fail fast on pre-v1.28.6 piece status
* test(ipni): drop alias identity assertion
* refactor(ipni)!: drop waitForIpniProviderResults alias
* refactor(ipni): carry mismatch details on the error
* chore: lint:fix
* Update documentation/content-routing-faq.md
Co-authored-by: Steve Loeppky <biglep@filoz.org>
* Update documentation/content-routing-faq.md
Co-authored-by: Steve Loeppky <biglep@filoz.org>
* Update documentation/behind-the-scenes-of-adding-a-file.md
Co-authored-by: Steve Loeppky <biglep@filoz.org>
* chore: drop orphaned deprecated JSDoc
---------
Co-authored-by: Russell Dempsey <1173416+SgtPooki@users.noreply.github.com>
Co-authored-by: Steve Loeppky <biglep@filoz.org>
Copy file name to clipboardExpand all lines: documentation/behind-the-scenes-of-adding-a-file.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -113,9 +113,9 @@ This is a function of the CAR size and the throughput between the client and the
113
113
114
114
*What/why:*
115
115
116
-
At some point after receiving the uploaded [CAR](glossary.md#car), an SP indexing task processes the CAR and creates a local mapping of CIDs to offsets within the CAR so it can serve IPFS style retrievals. Following that, an SP [IPNI](glossary.md#ipni) tasks picks up the local index, makes and IPNI advertisement chain, and then announces the advertisement chain to IPNI indexers like filecoinpin.contact and cid.contact so they know to come and get the advertisement chain to build up their own index.
116
+
At some point after receiving the uploaded [CAR](glossary.md#car), an SP indexing task processes the CAR and creates a local mapping of CIDs to offsets within the CAR so it can serve IPFS style retrievals. Following that, an SP [IPNI](glossary.md#ipni) tasks picks up the local index, makes and IPNI advertisement chain, and then announces the advertisement chain to IPNI indexers like cid.contact so they know to come and get the advertisement chain to build up their own index.
117
117
118
-
Filecoin Pin validates the IPNI advertisement process by polling `https://filecoinpin.contact/cid/$cid`(NOT cid.contact due to [negative caching issues discussed below](#how-long-does-an-ipni-indexer-cache-results)).
118
+
Filecoin Pin validates the IPNI advertisement process in two steps: first it polls the SP's `GET /pdp/piece/{pieceCid}/status` endpoint until it reports `synced: true`. (Behind the scenes, the SP checks the IPNI instance's own sync-status endpoint on Filecoin Pin's behalf. This was added in [curio#1450](https://github.com/filecoin-project/curio/pull/1450)). Then, once synced, Filecoin Pin makes a single confirming query to `https://cid.contact/cid/$cid`to verify the expected provider actually shows up. Querying cid.contact directly before that confirmation is avoided due to [negative caching issues](content-routing-faq.md#how-long-does-an-ipni-indexer-cache-results).
Copy file name to clipboardExpand all lines: documentation/content-routing-faq.md
+3-12Lines changed: 3 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -23,16 +23,7 @@ In the event that an SP wipes their existing index state, the previously announc
23
23
24
24
## How long does an IPNI indexer cache results?
25
25
26
-
This depends on both the [IPNI](glossary.md#ipni) indexer instance (e.g., cid.contact, filecoinpin.contact) and whether there is a cache hit or cache miss.
26
+
[cid.contact](http://cid.contact) tends to cache hits for multiple hours and cache misses (negative cache) for minutes. (cid.contact caching teraform is [here](https://github.com/ipni/storetheindex/blob/main/deploy/infrastructure/prod/us-east-2/cloudfront.tf).) As a result of this, there are "gotchas" we have to be careful to avoid or can unavoidably fall into.
27
27
28
-
[cid.contact](http://cid.contact) for example tends to cache hits for multiple hours and cache misses (negative cache) for minutes. As a result of this, there are "gotchas" we have to be careful to avoid or can unavoidably fall into.
29
-
30
-
-[cid.contact](http://cid.contact) cache miss "gotcha" - Because cid.contact caches misses (i.e., negative cache), it's important for Filecoin Pin to not poll cid.contact after an advertisement has been announced. The act of polling could cause the empty result set to get cached for minutes. Instead, Filecoin Pin polls [filecoinpin.contact](http://filecoinpin.contact) which doesn't have negative caching. Once Filecoin Pin sees the expected results from filecoinpin.contact it then proceeds to give IPFS Mainnet retrieval URLs since it should be safe to invoke a request path that hits cid.contact because cid.contact should now not get a non-empty result.
31
-
-[cid.contact](http://cid.contact) cache hit "gotcha" - If cid.contact has a provider record(s) for CID X, but CID X is not currently from any of those provider(s), then cid.contact could be caching non-retrievable result for hours even though filecoinpin.contact has a provider that makes CID X retrievable. We currently don't have a workaround for this…
32
-
33
-
## Why is there filecoinpin.contact and cid.contact?
34
-
35
-
[filecoinpin.contact](http://filecoinpin.contact) serves two purposes currently:
36
-
37
-
1. Serve as a fallback in case [cid.contact](http://cid.contact) has issues keeping its global index updated. To help with availability, cid.contact has the ability to delegate requests to other [IPNI](glossary.md#ipni) indexers like [filecoinpin.contact](http://filecoinpin.contact) in case they have results.
38
-
2. Validate IPNI announcing/advertising independently of [cid.contact](http://cid.contact). Per the "[cid.contact](http://cid.contact) cache miss gotcha" above, the act of polling cid.contact can actually delay how long it takes before cid.contact returns a non-empty result for a given CID. [filecoinpin.contact](http://filecoinpin.contact) has different caching configuration so that polling can be done safely.
28
+
- cid.contact cache miss "gotcha" - Because cid.contact caches misses (i.e., negative cache), it's important for Filecoin Pin to not poll `GET /cid/{cid}` before the advertisement has actually been processed. The act of polling could cause the empty result set to get cached for minutes. Instead, Filecoin Pin first polls the storage provider's `GET /pdp/piece/{pieceCid}/status` until it reports `synced: true`. The SP checks the IPNI instance's own sync-status endpoint on Filecoin Pin's behalf, which isn't a CID lookup and isn't subject to the same negative caching, so it's safe for the SP to do that patiently. Only once the SP confirms sync does Filecoin Pin make a single confirming `GET /cid/{cid}` query, to confirm the expected provider's record actually shows up. If a provider never reports `synced: true`, Filecoin Pin reports failure without ever falling back to `GET /cid/{cid}`. The SP already did the patient, safe check on its end, so a further `/cid/{cid}` fallback would be redundant and risk the exact negative-cache problem this whole flow exists to avoid.
29
+
- cid.contact cache hit "gotcha" - If cid.contact has a provider record(s) for CID X, but CID X is not currently retrievable from any of those provider(s), then cid.contact could be caching a non-retrievable result for hours. We currently don't have a workaround for this…
Copy file name to clipboardExpand all lines: documentation/glossary.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -124,7 +124,7 @@ As a "trustless" protocol, retrieval of IPFS data using this mechanism provides
124
124
125
125
See https://docs.ipfs.tech/concepts/glossary/#ipni.
126
126
127
-
IPNI is the content routing system that [Filecoin Pin](#filecoin-pin) relies upon for retrieval to work for [standard IPFS tooling](#standard-ipfs-tooling). [Service Providers](#service-provider) announce their advertisement changes to IPNI indexer like[filecoinpin.contact](http://filecoinpin.contact) and cid.contact, and the advertised CIDs become discoverable for IPFS Standard tooling.
127
+
IPNI is the content routing system that [Filecoin Pin](#filecoin-pin) relies upon for retrieval to work for [standard IPFS tooling](#standard-ipfs-tooling). [Service Providers](#service-provider) announce their advertisement changes to IPNI indexers like cid.contact, and the advertised CIDs become discoverable for IPFS Standard tooling.
128
128
129
129
## Metadata
130
130
@@ -196,7 +196,7 @@ See [Retrieving Your Data](retrieval.md) for how to use each CID to fetch your c
196
196
197
197
[IPNI](#ipni) advertisements include a `ContextID` that encodes the [Piece CID](#piece-cid). You can use this to reverse-map an IPFS CID back to the Piece it lives in.
198
198
199
-
1. Look up the IPFS CID in an IPNI indexer, e.g. `https://cid.contact/cid/<ipfs-cid>` (or use [filecoinpin.contact](https://filecoinpin.contact) for data stored via Filecoin Pin).
199
+
1. Look up the IPFS CID in an IPNI indexer, e.g. `https://cid.contact/cid/<ipfs-cid>`.
200
200
2. Find the `ContextID` field in one of the provider records. It is base64-encoded.
201
201
3. Decode the base64, drop the first byte (a version prefix), and treat the remaining bytes as a CID:
0 commit comments