-
Notifications
You must be signed in to change notification settings - Fork 6
fix: IPNI validation confirms provider in indexer response #231
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
Merged
SgtPooki
merged 35 commits into
master
from
217-give-validateipniadvertisement-the-ability-to-confirm-a-given-sp-is-showing-up-as-an-ipni-provider
Nov 13, 2025
Merged
Changes from 29 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
1f41cd9
fix: validateIpniAdvertisement checks provider
SgtPooki 1e6e823
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki afb18ae
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 7df9efd
fix: fine-tune logic, remove dead branches
SgtPooki 20364d6
fix: allow ipniIndexer override, default to filecoinpin.contact
SgtPooki b62441f
fix: use only current provider serviceURL
SgtPooki 1f95e4d
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 4c0c1c2
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki fa10f75
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki ad90c71
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 31c6097
chore: more logic cleanup
SgtPooki 915e7e9
fix: display received + expected multiaddrs
SgtPooki a2df72f
refactor: inline simple maps and filters
SgtPooki 0484671
chore: more code cleanup
SgtPooki 35e989b
fix: PDP definition
SgtPooki e5ea86d
chore: cleanup validateIpni options set in executeUpload
SgtPooki 540da6e
fix: last error message
SgtPooki a89a445
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 1ff3746
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki c0302d3
Update src/test/unit/validate-ipni-advertisement.test.ts
SgtPooki d092307
Update src/test/unit/validate-ipni-advertisement.test.ts
SgtPooki ea21fc7
Update src/test/unit/validate-ipni-advertisement.test.ts
SgtPooki 8d5d654
Update src/test/unit/validate-ipni-advertisement.test.ts
SgtPooki 6a55fef
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 623bf87
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 23cab56
fix: remove expectedProviderMultiaddrs
SgtPooki 7bd2632
refactor: validateIPNIadvertisement -> waitForIpniProviderResults
SgtPooki 6ea2930
fix: use set operations, finish move to waitForIpniProviderResults
SgtPooki 33f1ae9
fix: update terminology, ipniAdvertisement -> ipni provider results
SgtPooki c1edc16
fix: include Set operations in typescript
SgtPooki 3ae6b18
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki 83177bc
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki edb047a
Update src/core/utils/validate-ipni-advertisement.ts
SgtPooki bcc6b8a
chore: lint fix
SgtPooki 6f595e1
test: fix tests after error msg change
SgtPooki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,9 +13,9 @@ import { | |
| import { isSessionKeyMode, type SynapseService } from '../synapse/index.js' | ||
| import type { ProgressEvent, ProgressEventHandler } from '../utils/types.js' | ||
| import { | ||
| type ValidateIPNIAdvertisementOptions, | ||
| type ValidateIPNIProgressEvents, | ||
| validateIPNIAdvertisement, | ||
| type WaitForIpniProviderResultsOptions, | ||
| waitForIpniProviderResults, | ||
| } from '../utils/validate-ipni-advertisement.js' | ||
| import { type SynapseUploadResult, type UploadProgressEvents, uploadToSynapse } from './synapse.js' | ||
|
|
||
|
|
@@ -195,7 +195,7 @@ export interface UploadExecutionOptions { | |
| * @default: true | ||
| */ | ||
| enabled?: boolean | ||
| } & Omit<ValidateIPNIAdvertisementOptions, 'onProgress'> | ||
| } & Omit<WaitForIpniProviderResultsOptions, 'onProgress'> | ||
| } | ||
|
|
||
| export interface UploadExecutionResult extends SynapseUploadResult { | ||
|
|
@@ -230,13 +230,31 @@ export async function executeUpload( | |
| case 'onPieceAdded': { | ||
| // Begin IPNI validation as soon as the piece is added and parked in the data set | ||
| if (options.ipniValidation?.enabled !== false && ipniValidationPromise == null) { | ||
| const { enabled: _enabled, ...rest } = options.ipniValidation ?? {} | ||
| ipniValidationPromise = validateIPNIAdvertisement(rootCid, { | ||
| ...rest, | ||
| const { enabled: _enabled, expectedProviders, ...restOptions } = options.ipniValidation ?? {} | ||
|
|
||
| // Build validation options | ||
| const validationOptions: WaitForIpniProviderResultsOptions = { | ||
| ...restOptions, | ||
| logger, | ||
| ...(options?.onProgress != null ? { onProgress: options.onProgress } : {}), | ||
| }).catch((error) => { | ||
| logger.warn({ error }, 'IPNI advertisement validation promise rejected') | ||
| } | ||
|
|
||
| // Forward progress events to caller if they provided a handler | ||
| if (options?.onProgress != null) { | ||
| validationOptions.onProgress = options.onProgress | ||
| } | ||
|
|
||
| // Determine which providers to expect in IPNI | ||
| // Priority: user-provided expectedProviders > current provider > none (generic validation) | ||
| // Note: If expectedProviders is explicitly [], we respect that (no provider expectations) | ||
| if (expectedProviders != null) { | ||
| validationOptions.expectedProviders = expectedProviders | ||
| } else if (synapseService.providerInfo != null) { | ||
| validationOptions.expectedProviders = [synapseService.providerInfo] | ||
| } | ||
|
Comment on lines
+248
to
+253
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BigLep most folks will call through this method, which will set expectedProviders to the correct thing (and to the multi-providers for multi-provider uploads once synapse-sdk is updated) |
||
|
|
||
| // Start validation (runs in parallel with other operations) | ||
| ipniValidationPromise = waitForIpniProviderResults(rootCid, validationOptions).catch((error) => { | ||
| logger.warn({ error }, 'IPNI provider results check was rejected') | ||
| return false | ||
| }) | ||
| } | ||
|
|
@@ -270,7 +288,7 @@ export async function executeUpload( | |
| try { | ||
| ipniValidated = await ipniValidationPromise | ||
| } catch (error) { | ||
| logger.error({ error }, 'Could not validate IPNI advertisement') | ||
| logger.error({ error }, 'Could not validate IPNI provider records') | ||
| ipniValidated = false | ||
| } | ||
| } | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.