feat(synapse-core): add SP-to-SP piece pull functionality#544
feat(synapse-core): add SP-to-SP piece pull functionality#544
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
synapse-dev | 70fa757 | Commit Preview URL Branch Preview URL |
Feb 13 2026, 03:18 AM |
c2011f6 to
7af205b
Compare
|
Added a temporary utils/example-sp-fetch-e2e.js testing file to test the sp-sp fetch flow. It stores pieces with one SP, confirms they are parked, then asks the second SP to fetch from the first and confirms they are parked. It's working currently on devnet using FilOzone/foc-devnet#34 👌. |
ac3552a to
3c5cdb9
Compare
0a20df0 to
a231d32
Compare
3c5cdb9 to
429c2e3
Compare
|
Rebased on top of the latest @hugomrdias stack #571 |
429c2e3 to
8ec5942
Compare
a5f8971 to
d75fb75
Compare
8ec5942 to
b6d3479
Compare
b221f97 to
ff14a1d
Compare
ff14a1d to
13ed974
Compare
13ed974 to
2d1a65e
Compare
|
latest fixup in here adds the ability to supply a pre-built |
2d1a65e to
caebe09
Compare
|
And another fix, I realised I still had a ton of "fetch" in here. Now all "pull". |
2f8c0ca to
59e576b
Compare
hugomrdias
left a comment
There was a problem hiding this comment.
im not the biggest fan of this idempotent POST endpoint, left some comment inline.
| const fetchWithFreshRequest: typeof globalThis.fetch = (input, init) => { | ||
| // iso-web passes the Request object as input, extract signal from it | ||
| const signal = input instanceof Request ? input.signal : init?.signal | ||
| return globalThis.fetch(url, { method: 'POST', body, headers, signal }) | ||
| } |
There was a problem hiding this comment.
how does this, fixes body being consumed ?
There was a problem hiding this comment.
request created once, reused repeatedly within the loop, body can't be re-read, so we just pick out what we want from request and implicitly make a new one
| const result = await SP.waitForPullStatus({ | ||
| ...baseOptions(), | ||
| minTimeout: 10, | ||
| onStatus: (response) => statusUpdates.push(response.status), | ||
| }) |
There was a problem hiding this comment.
yeah this is why you need to presign because you need it for the waitFor function, and you poll from a http POST endpoint.
this breaks the pattern of, do mutation, get status url to http poll from.
There was a problem hiding this comment.
no, it's not why we need to pre-sign. The pre-sign isn't a workaround forced by the polling pattern, it's required for the initial request itself. The extraData blob is the auth mechanism: Curio can eth_call to verify the client is setup and prepared to pay. The endpoint is idempotent by design, keyed on a hash of extraData, so re-posting the same signed request returns current status rather than creating a new fetch job.
i.e. we pre-sign because the endpoint needs auth for initiation. The idempotent POST design then gives status polling for free: same request, same response with updated status. Adding a separate GET status URL would mean either adding a second endpoint that also needs auth (more signing, more API surface), or returning a nonce/token from the POST that the GET uses (more state, same polling). We have extraData, it's a natural idempotency key already, so we just reuse it without inventing a new one to do the same job.
59e576b to
63c6170
Compare
|
Force pushed a gnarly rebase, now just one commit on top of master. 🤞 |
63c6170 to
2d43c4f
Compare
Add low-level Pull module for initiating piece pulls from external storage providers to the local SP via Curio's POST /pdp/piece/pull endpoint. Features: - pullPieces: Initiate pull requests with EIP-712 signed authorization - waitForPullStatus: Poll until completion with status callbacks - Support for both existing data sets (signAddPieces) and new data sets (signCreateDataSetAndAddPieces) - Configurable timeout and abort signal support The pull endpoint is idempotent - repeated calls with the same extraData return status updates rather than creating duplicates.
2d43c4f to
70fa757
Compare
|
I borked the rebase when I said this was done yesterday, didn't include the fixes I said I'd made! Should be good now though. And #593 is on top of this. They are both now on top of latest master. |
Ref: filecoin-project/curio#864
Part of #494