-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
repo/fsrepo/migrations: verified HTTP migrations #10324
Conversation
3667161
to
a17a6cc
Compare
192066a
to
e3f026d
Compare
I can't figure out a way of "fixing" the Docker test that checks if Docker downloads the correct version. The problem here is that uses the hardcoded distribution CIDs in the code. But I don't have that CAR file to just serve with socat. And the file would be massive nevertheless. I would suggest removing this test unless someone has a very good idea. |
@hacdias removing that test (or reworking it to not use docker) might be reasonable. However, if you wanted to keep this test working roughly as is you might be able to work around the large CAR issue by setting the kubo/repo/fsrepo/migrations/fetcher.go Line 19 in 4d3cc96
|
@aschmahmann I think the test uses docker on purpose: the idea seems to be that the Docker image fetches the correct migration for the correct arch and platform. I will try what you said and see how it goes. Otherwise, I will just remove it. |
75aa3c5
to
5414b16
Compare
@aschmahmann the environment variable seems to do the trick 😄 |
func carStreamToFileBytes(ctx context.Context, r io.ReadCloser, imPath path.ImmutablePath) ([]byte, error) { | ||
defer r.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should extract this code into either of:
- As a Boxo example on "how to download a CAR from the gateway and verify its contents"; or
- Make a package that does it, or perhaps just inside
gateway
. There's a lot of "bootstrap" code here that feels a bit annoying to write and having an exported function that does this somewhere in Boxo could be very helpful. Maybegateway.Fetcher
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Creating an example is good enough, but this is so popular use case we should have a high level boxo lib/API.
Unsure about putting this in gateway package, feels like something that deserves own.
Given we have https://www.npmjs.com/package/@helia/verified-fetch that basically is a similar abstraction, maybe we could have boxo/fetch
and VerifiedFetch
that works in similar way?
We don't have to do it now, ok to do example now + fill issue for the API.
f575d30
to
6a92350
Compare
4e71219
to
29bc821
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, works as expected, thank you for making migrations fully trustless. ❤️
Merge when it feels appropriate.
ps. @hacdias I've been thinking about reusing the CAR fetch code, and turning it into a utility.
Filled issues for follow-up work in:
- Implement trustless and verified HTTP retrieval ipfs-update#179
- Implement trustless and verified HTTP retrieval fs-repo-migrations#188
Doing these is a good opportunity to flesh out how Fetch API library in go should look like.
Closes #9159. This changes the current
HttpFetcher
to use CAR files. Because we have/ipns/dist.ipfs.tech
as default (even though not used), I also implemented DNSLink resolution, as well as IPNS record fetching and verification.Go tests were updated such that the test server now uses a CAR file backed gateway. This CAR file is generated on the fly before the tests begin. The reasoning behind this versus a static CAR is that the migration file names depend on the platform that they are being run on.
You can also test this locally by spawning a repository, downgrading the version, and running the migrations: