Skip to content

Conversation

@nitininhouse
Copy link

@nitininhouse nitininhouse commented Jul 21, 2025

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
Copy link
Member

@SgtPooki SgtPooki left a comment

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
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
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.

Copy link
Member

@achingbrain achingbrain left a comment

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
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
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
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
Member

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

@achingbrain achingbrain marked this pull request as draft October 8, 2025 07:06
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