Skip to content

Commit

Permalink
feat: fetch only the root block (#48)
Browse files Browse the repository at this point in the history
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š <[email protected]>
  • Loading branch information
bajtos authored Dec 13, 2023
1 parent a609849 commit a3ddc5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions lib/spark.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
})
Expand Down
4 changes: 3 additions & 1 deletion test/spark.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import Spark from '../lib/spark.js'
import { test } from 'zinnia:test'
import { assertInstanceOf, assertEquals, assertArrayIncludes } from 'zinnia:assert'
import { SPARK_VERSION, MAX_CAR_SIZE } from '../lib/constants.js'
import { SPARK_VERSION } from '../lib/constants.js'

test('getRetrieval', async () => {
const round = {
Expand Down Expand Up @@ -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 => {
Expand Down Expand Up @@ -110,6 +111,7 @@ test('fetchCAR exceeding MAX_CAR_SIZE', async () => {
assertEquals(stats.carChecksum, null)
assertEquals(stats.statusCode, 200)
})
*/

test('submitRetrieval', async () => {
const requests = []
Expand Down

0 comments on commit a3ddc5d

Please sign in to comment.