Skip to content
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

feat: use @helia/verified-fetch #63

Merged
merged 25 commits into from
Mar 11, 2024
Merged

feat: use @helia/verified-fetch #63

merged 25 commits into from
Mar 11, 2024

Conversation

SgtPooki
Copy link
Member

@SgtPooki SgtPooki commented Jan 24, 2024

This PR is a start on the work required to adopt the new @helia/verified-fetch library currently in PR at ipfs/helia#392

Tasks

Preview Give feedback

Comment on lines 225 to 227
if (isDnsLabel(address)) {
address = dnsLinkLabelDecoder(address)
}
Copy link
Member

@lidel lidel Feb 14, 2024

Choose a reason for hiding this comment

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

@SgtPooki small nit: (unless we check before) we should check if address is a valid CID (with ipns name) first, and apply this normalization only if it is not a valid CID – see some prior art in https://github.com/ipfs/ipfs-companion/blob/7ca6433418909d43ec8801f27e417514614a164c/add-on/src/lib/ipfs-path.js#L71

(better safe than sorry, there could be a multibase encoding which uses . and -)

Copy link
Member Author

Choose a reason for hiding this comment

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

since helia-verified-fetch handles this entirely now, we should be able to remove this code

package.json Outdated Show resolved Hide resolved
.aegir.js Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
src/getCustomHelia.ts Outdated Show resolved Hide resolved
src/getCustomHelia.ts Outdated Show resolved Hide resolved
@@ -54,6 +54,7 @@ $ docker run -it -p 8080:8080 -e DEBUG="helia-http-gateway*" helia-http-gateway:
| `TRUSTLESS_GATEWAYS` | Comma separated list of trusted gateways to fetch content from | [Defined in Helia](https://github.com/ipfs/helia/blob/main/packages/helia/src/block-brokers/trustless-gateway/index.ts) |
| `USE_LIBP2P` | Whether to use libp2p networking | `true` |
Copy link
Member

@achingbrain achingbrain Mar 6, 2024

Choose a reason for hiding this comment

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

I wonder if we couldn't just merge the USE_BITSWAP and USE_LIBP2P vars to just be use @helia/http or use helia?

Like, USE_HTTP_GATEWAYS_ONLY or something to select @helia/http.

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm down with finagling the configs in another PR once we get verified-fetch in

Copy link
Member Author

Choose a reason for hiding this comment

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

moved to #65

src/getCustomLibp2p.ts Outdated Show resolved Hide resolved
src/getCustomLibp2p.ts Outdated Show resolved Hide resolved
src/heliaServer.ts Outdated Show resolved Hide resolved
@achingbrain
Copy link
Member

@SgtPooki what's the status of this PR? It'd be great to land it to test the integration of things like bitswap sessions, etc.

src/getCustomHelia.ts Outdated Show resolved Hide resolved
src/getCustomHelia.ts Outdated Show resolved Hide resolved
src/getCustomLibp2p.ts Outdated Show resolved Hide resolved
src/heliaServer.ts Outdated Show resolved Hide resolved
src/heliaServer.ts Outdated Show resolved Hide resolved
src/heliaServer.ts Outdated Show resolved Hide resolved
@SgtPooki
Copy link
Member Author

@SgtPooki what's the status of this PR? It'd be great to land it to test the integration of things like bitswap sessions, etc.

@achingbrain I need to update to the latest verified-fetch. most of my focus has been on service-worker-gateway, but I can get this up to date

@SgtPooki SgtPooki self-assigned this Mar 11, 2024
@SgtPooki SgtPooki marked this pull request as ready for review March 11, 2024 20:35
@SgtPooki
Copy link
Member Author

playwright test is failing for drand. so i removed it. see probe-lab/tiros#11 for more details

@SgtPooki SgtPooki merged commit 55530cf into main Mar 11, 2024
3 checks passed
@SgtPooki SgtPooki deleted the feat/helia-verified-fetch branch March 11, 2024 21:02
while (!done) {
const { done: _done, value } = await reader.read()
if (value != null) {
reply.raw.write(Buffer.from(value))
Copy link
Member

Choose a reason for hiding this comment

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

This ignores backpressure. reply.raw.write returns a boolean value - if it's false we should wait for the stream to emit the 'drain' event before continuing to write to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Status: 🎉 Done
Development

Successfully merging this pull request may close these issues.

3 participants