Skip to content

fix: propagate provider option through session and broker to trustles… - #833

Closed
nitininhouse wants to merge 1 commit into
ipfs:mainfrom
nitininhouse:fix-provider-propagation
Closed

fix: propagate provider option through session and broker to trustles…#833
nitininhouse wants to merge 1 commit into
ipfs:mainfrom
nitininhouse:fix-provider-propagation

Conversation

@nitininhouse

@nitininhouse nitininhouse commented Jul 21, 2025

Copy link
Copy Markdown

Ensure the provider option is correctly propagated from the API, through the session and broker layers, down to the trustless gateway HTTP request.

Fixes #816

@nitininhouse
nitininhouse requested a review from a team as a code owner July 21, 2025 17:01

@SgtPooki SgtPooki left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I believe this can be replaced by #834?


try {
const block = await gateway.getRawBlock(cid, options)
const block = await gateway.getRawBlock(cid, { ...options, provider: options.provider })

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
const block = await gateway.getRawBlock(cid, { ...options, provider: options.provider })
const block = await gateway.getRawBlock(cid, options)

/**
* By default we will only connect to peers with HTTPS addresses, pass true
* to also connect to HTTP addresses.
* to also connect to HTTP addresses.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please don't change lines unnecessarily.

@achingbrain achingbrain left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for opening this.

Please address all comments and add tests to prevent regressions.

It cannot be merged without tests.

* @default 2_097_152 (2MiB)
*/
maxSize?: number
provider?: string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be providers?: string[] to better align with the option added in #834

Please also add a jsdoc comment explaining what this option does.

gwUrl.pathname = `/ipfs/${cid.toString()}`

// necessary as not every gateway supports dag-cbor, but every should support
// sending raw block as-is

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do not remove this comment

* @default 2_097_152
*/
maxSize?: number
provider?: string

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should be providers?: string[] to better align with the option added in #834

Please also add a jsdoc comment explaining what this option does.

@achingbrain

Copy link
Copy Markdown
Member

I'm converting this to a draft as it's blocked on ipfs/specs#504

@achingbrain

Copy link
Copy Markdown
Member

Superseded by #834

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.

bug: @helia/block-brokers session do not propagate provider option for http trustless gateway

3 participants