GitHub issue: https://github.com/filecoin-station/spark/issues/40
Introduction
In the long term, we want Spark checkers running in Filecoin Station to sample all active Filecoin deals to pick a retrieval check to perform.
Currently, we have a manual process to scan the active deals and resolve them into task templates defined as (cid, address, protocol) and stored in our Postgres DB. This has several downsides:
- The process is rather inefficient and consumes many resources, as we have to make one IPNI query for every FIL+ LDN deal. Since there are ~8.7m deals and our network checks ~4k CIDs per hour, it takes ~90 days for our network to test all task templates. We run the manual process every month or two, and so many IPNI queries are wasted because we never use their responses.
- We cannot measure how the rate of deals advertised to IPNI evolves over time. Our “retrieval success rate” is calculated only for CIDs advertised to IPNI.
- Because there are very few deals that advertise HTTP transport to IPNI, and because Spark checkers currently cannot check deals that are not advertised to IPNI, we have to include Graphsync protocol in the retrievals we test. Otherwise, we would have an extremely small sample set and put too much load on the few SPs with HTTP retrievals correctly configured. (We already experienced this in December '23.) Graphsync is not well supported; we shouldn’t be testing it.
Proposal
- Let Spark checkers query IPNI to resolve a
cid from a FIL+ LDN deal into the (cid, provider_address, protocol) task.
- Test retrievals using the HTTP protocol only; drop Graphsync.
- Introduce a new Measurement field called
indexerResult. This field will store the result of the IPNI query and allow us to introduce two new retrieval check results - “not advertised at all” and “http not advertised”.
Step 1: spark checkers
- Rework the task-picking code to take only the
cid field from the task definition picked from retrievalTasks and ignore providerAddress and protocol fields.
- Rework the code executing a task to start with an IPNI query to resolve the CID into the provider address. IPNI query is a simple HTTP GET request with the CID provided in the request path. IPNI returns 404 when no advertisements are found. Example URL: https://cid.contact/cid/bafybeibhsqlh4phj3r3seetqvbq4xebwzz4tvkpckrc4icoeztdxnipbam
- No advertisement found → report result “not advertised at all”
- No advertisement offering HTTP protocol → report result “http not advertised”
- Pick the first advertisement for the HTTP protocol
In the future, we will look for an advertisement matching the FIL deal we are testing.
- Pick the first address provided in this advertisement
- Hardcode the protocol to
http
- When submitting the result of the retrieval check (a new measurement) to SPARK API, include a new field in the request body:
indexerResult.
In the future, we will rework the check to drop Lassie and fetch directly over HTTP(s), but let’s do this one step at a time.
Step 2: spark-evaluate (fraud detection)
When checking whether a measurement is for a valid task in the evaluated round, compare only the field cid. Ignore provider_address and protocol.
After we implement honest-majority committees, we should add cross-checks for IPNI resolution - add the following tasks to the relevant GH issue (https://github.com/filecoin-station/roadmap/issues/59):
- All measurements in the majority should report the same
indexerResult