-
Notifications
You must be signed in to change notification settings - Fork 25
feat(synapse-core): add SP-to-SP piece pull functionality #544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
synapse-dev | 59e576b | Commit Preview URL Branch Preview URL |
Feb 06 2026, 02:02 PM |
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". |
caebe09 to
2f8c0ca
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: - fetchPieces: Initiate pull requests with EIP-712 signed authorization - waitForFetchStatus: 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.
2f8c0ca to
59e576b
Compare
hugomrdias
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
im not the biggest fan of this idempotent POST endpoint, left some comment inline.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you are pre signing (still need to figure out why), why dont you use PDP.addPieces directly ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think this should be inside the sp folder
| /** Minimum time between poll attempts in milliseconds (default: 4000). */ | ||
| minTimeout?: number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** Minimum time between poll attempts in milliseconds (default: 4000). */ | |
| minTimeout?: number | |
| /** The timeout in milliseconds. Defaults to 5 minutes. */ | |
| timeout?: number | |
| /** The polling interval in milliseconds. Defaults to 4 seconds. */ | |
| pollInterval?: number |
changed to this pattern in the other waitFor* helps in the tests
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this, fixes body being consumed ?
|
|
||
| beforeEach(() => { | ||
| server.resetHandlers() | ||
| SP.setTimeout(1000) // Short timeout for tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, needs rebasing into the other branch, there no setTimeout method anymore you can pass the max timeout as an option
| const result = await SP.waitForPullStatus({ | ||
| ...baseOptions(), | ||
| minTimeout: 10, | ||
| onStatus: (response) => statusUpdates.push(response.status), | ||
| }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Ref: filecoin-project/curio#864
Part of #494