-
-
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
Use standard IPLD codec names across the CLI/HTTP API #8471
Comments
👍 + when this is done we should also do a quick grep over content at https://docs.ipfs.io and https://proto.school |
Looking into this. |
@aschmahmann Looking at the Should the added |
@schomatis I suspect there are some changes to be made both in go-ipfs and in interface-go-ipfs-core. Generally interface-go-ipfs-core is meant as an abstraction that can be used without coupling too tightly to the underlying IPFS implementation (e.g. https://github.com/ipfs/go-ipfs-http-client uses it as well). Some things that are probably needed here:
|
go-multicodec currently does not have a way to enumerate all known codecs, but we could certainly look into that. I've raised multiformats/go-multicodec#58 It's worth noting that the |
Thanks for the flag here. I wonder if it's worth adding any more differentiating information into the type? Probably not a big deal since we can just manually ignore the CID codes for now, but using
Yep, this is fine. I'm thinking there's some value in figuring out what's a valid IPLD codec separate from what's available. This is what go-cid currently does https://github.com/ipfs/go-cid/blob/28f4a5eab6c28351e4c0c3769a258dd779531ac7/cid.go#L85. Separately we'll want to list what codecs are available, but those can be pulled from the go-ipld-prime registry (whether global or a local one). |
I assume you mean altering the multicodec table in some form. I don't think we should teach go-multicodec about extra information that isn't on the table, because then we'd start getting into the Go implementation having out-of-spec information that other languages might not have or might differ on. |
@aschmahmann Why didn't we use the |
Got delayed with sharding, resuming this. Will start pushing some code annotations to evaluate how to move forward with this. There are still some rough edges around the multicodec table I'm wrapping my head around. |
@aschmahmann Follow-up to #8471 (comment): it seems |
Yes, we were forced to make sufficient breaking changes there that this made sense.
No, since we don't have to make any breaking changes to |
@mvdan perhaps a gotcha in this plan is that 0x0200 is Some options:
|
@rvagg and @vmx touched a bit on I don't think we want to change As for your options - I think it depends on what you want. Do you want to allow all known IPLD codecs? Then filter by Going full manual is always an option, and might be the best in terms of "only accept codec multicodecs that we implement". Again this depends on what go-ipfs wants :) But I think we'd all like to avoid the manual approach in the name of not having to keep a separate list up to date, especially as ipld-prime or other modules might register more codec implementations in the future. |
TL;DR if you do indeed want to allow |
Aside: I think I disagree with @vmx on this particular point, IMO if it can meaningfully go in a CID then we could (not "should") call it an |
@rvagg good point, consider me convinced. I'd love for us to reach an agreement there this week and merge a few tiny PRs into the multicodec table, so we can unblock this thread :) |
Nope. We agree here :) I also think |
If either of you send a multicodec PR, I'll approve that. Are there any other |
Update 11/19 (@schomatis): Working in draft branch with working notes and annotated code. First attempt at adding the multicodec option for |
As soon as multiformats/multicodec#244 is merged, I'll update go-multicodec as per multiformats/go-multicodec#58 (comment). That should be what go-ipfs needs here, I think. |
This change moves us toward the "ipld" tag meaning something like "can logically be used as a codec code in a CID"; with the recognition that this is a bit squishy and there is some amount of gentle abuse around the edges of CIDs which we willingly turn a blind eye to. Ref: #242 Ref: ipfs/kubo#8471
PR now up at multiformats/go-multicodec#59; reviews welcome. |
Update 11/26 (@schomatis): For review: #8568. |
TODO: Let's deprecate the codec maps in go-cid and create aliases to the newer functions in go-multicodec since they can be updated automatically by codegen. |
2022-01-05: there is a PR to look at (#8568 ) and the request to make sure the description is accurate (#8471 (comment) ) |
2022-03-11 conversation: we need to decide on the approach especially in light of the 0.12 migration. @aschmahmann will give input here. That may mean doing something different than ipfs/interface-go-ipfs-core#80, but we'll wait for Adin comments. |
|
Update 11/26 (@schomatis):
For review: #8568.
Working in draft branch with working notes and annotated code.
First attempt at adding the multicodec option for
block put
in ipfs/interface-go-ipfs-core#80.Need to confirm this issue's description is in sync with conclusions from thread here and other multicodec issues.
While the recent #7976 related changes were a big step forwards in terms of both using the standardized codec names from https://github.com/multiformats/multicodec/blob/master/table.csv and making better use of the codecs they've left a couple of our APIs as confusing.
ipfs dag put
andipfs dag get
both use codec names correctly as pulled from the table above. However,ipfs block put
andipfs cid codecs
both use the older set of names defined in https://github.com/ipfs/go-cid/blob/5640b0169f6284562b1b8636b10e32dd85ea0a8a/cid.go#L85-L112.We should switch both of those commands to use the correct names.
Some recommendations for particulars about the changes:
ipfs cid codecs
should contain a--supported
flag that lists which codecs are known to go-ipfs per Enumerate available encodings for dag get #8171 (review). This has some tradeoffs if different commands support different subsets of codecs, but for now this seems reasonable.ipfs block put --format
should probably be kept and deprecated alongside a newipfs block put --store-codec
and if both flags are used the user should receive an error. This would allow us to not break existing users, but still move forward.ipfs dag put
where there was a backwards compatible changes anyway it seems useful to not break users here since we shouldn't have to.The text was updated successfully, but these errors were encountered: