Skip to content

Conversation

vasco-santos
Copy link
Member

@vasco-santos vasco-santos commented May 23, 2025

Add support for provider query parameter

Description

This PR propagates provider from query parameters as described in https://github.com/vasco-santos/provider-hinted-uri/blob/main/EXPLORATION.md#-uri-design to be used as Hints by Helia's blockBrokers.

Regarding changes, it simply changes parseUrlString util function to verify if valid multiaddrs are in the query parameters and also returns them. They are then simply propagated to the options parameter that makes its way to the plugins pipeline, where a broker session is created and is used.

These feature is currently behind a feature flag while it is in experimental stage (allowProviderParameter)

const url = `ipfs://${cid}?${query}`
const resp = await verifiedFetch.fetch(url, {
  allowProviderParameter: true
})

Notes & open questions

Currently does not embed proto in the multiaddrs (for instance /retrieval/bitswap/retrieval/http). We will as follow up discuss how to support something along these lines.

@achingbrain while this is more experimental, opted to not add example in Readme. Should I add though?

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation if necessary (this includes comments as well)
  • I have added tests that prove my fix is effective or that my feature works

@vasco-santos vasco-santos force-pushed the feat/support-provider-query-parameter branch 2 times, most recently from 9a4991e to 997cf3a Compare May 23, 2025 15:41
blockBrokerRetrieveCalledWithProviders.resolve(options.providers)

// attempt to read from the provider
// eslint-disable-next-line
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eslint complains there is too many nested callbacks 😬

@vasco-santos vasco-santos force-pushed the feat/support-provider-query-parameter branch 4 times, most recently from b7df559 to b7b8dc4 Compare May 23, 2025 19:40
@vasco-santos vasco-santos force-pushed the feat/support-provider-query-parameter branch from b7b8dc4 to c30629a Compare May 23, 2025 21:03
@vasco-santos vasco-santos marked this pull request as ready for review May 23, 2025 21:13
@vasco-santos vasco-santos requested a review from a team as a code owner May 23, 2025 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants