From 0f6ae7ba193bd52d37cc2a5e5ad435fe30f32fbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 12 Dec 2023 15:26:56 +0100 Subject: [PATCH] feat: fetch only the root block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SPARK is about retrieval testing not load testing. Currently, more than 90% of retrievals fail on timeout or server errors. There is little value in checking whether we can download the entire CAR file, it's more important to know whether SPs are advertising FIL+ deals to IPNI and accept HTTP-based retrieval requests. SPARK is also not able to fetch and verify CAR files larger than 200MB, which further reduced the value of fetching full CAR files. Let's fetch the root block for the time being. - This should significantly reduce the load on "good" SPs. - It provides enough data allowing "bad" SPs to fix their setup. Signed-off-by: Miroslav Bajtoš --- lib/spark.js | 3 +++ test/spark.js | 2 ++ 2 files changed, 5 insertions(+) diff --git a/lib/spark.js b/lib/spark.js index af72878..ce0e30a 100644 --- a/lib/spark.js +++ b/lib/spark.js @@ -140,6 +140,9 @@ export default class Spark { statusCode: null } const searchParams = new URLSearchParams({ + // See https://github.com/filecoin-project/lassie/blob/main/docs/HTTP_SPEC.md#dag-scope-request-query-parameter + // Only the root block at the end of the path is returned after blocks required to verify the specified path segments. + 'dag-scope': 'block', protocols: retrieval.protocol, providers: retrieval.providerAddress }) diff --git a/test/spark.js b/test/spark.js index 8556ec0..411ca8e 100644 --- a/test/spark.js +++ b/test/spark.js @@ -82,6 +82,7 @@ test('fetchCAR', async () => { assertEquals(requests, [{ url: URL }]) }) +/* Disabled as long as we are fetching the top-level block only test('fetchCAR exceeding MAX_CAR_SIZE', async () => { const URL = 'url' const fetch = async url => { @@ -110,6 +111,7 @@ test('fetchCAR exceeding MAX_CAR_SIZE', async () => { assertEquals(stats.carChecksum, null) assertEquals(stats.statusCode, 200) }) +*/ test('submitRetrieval', async () => { const requests = []