Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Update to IPLD Prime #32

Merged
merged 5 commits into from
Aug 12, 2021
Merged

Update to IPLD Prime #32

merged 5 commits into from
Aug 12, 2021

Conversation

willscott
Copy link
Contributor

Continuation of #30

This reverts commit 46797b1.

Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just a few small nits. @warpfork you may want to take a look at this PR mostly to see if you like the emerging patterns here since they'll likely start recurring in go-ipfs.

go.mod Outdated
github.com/libp2p/go-libp2p-core v0.2.2
github.com/libp2p/go-libp2p-testing v0.1.0
github.com/multiformats/go-multihash v0.0.13
github.com/ipld/go-ipld-prime v0.9.1-0.20210402181957-7406578571d1
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not a released version of go-ipld-prime?

Copy link
Contributor

Choose a reason for hiding this comment

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

will update when we do the final merge push once the whole stack is approved

go.mod Outdated Show resolved Hide resolved
go.mod Outdated Show resolved Hide resolved
offline "github.com/ipfs/go-ipfs-exchange-offline"
mock "github.com/ipfs/go-ipfs-routing/mock"
cbor "github.com/ipfs/go-ipld-cbor"
merkledag "github.com/ipfs/go-merkledag"
_ "github.com/ipld/go-ipld-prime/codec/dagcbor"
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this because our test objects are constructed using go-ipld-cbor instead of go-ipld-prime's dagcbor codec? Can we just drop go-ipld-cbor as a dependency here?

Copy link
Member

Choose a reason for hiding this comment

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

This is probably fine and correct. The current way we handle registration of codec implementations is by side-effecting imports (the init method in the package registers a multicodec in a global table).

I'm not "thrilled" with this per se, because it's very side-effect heavy (and I'm definitely a functional programmer at heart), but it's a race-condition-free way to solve a problem, and seems to be one of the least-bad options available to us.

Copy link
Contributor

Choose a reason for hiding this comment

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

good news, we can drop the blank import now since we already import dagcbor and we're importing twice now.

@willscott
Copy link
Contributor Author

@aschmahmann - i don't see any requests here except for module versions, so can we mark this as you ready for it to merge in the merge party where we go through and merge everything while tagging versions of the deps?

@aschmahmann
Copy link
Contributor

Yep, although it'd be great if this function could be rewritten to use go-ipld-prime's cbor codec so we can drop the dependency as well as the empty import. From the outside it seems like it should be pretty simple for someone familiar with the go-ipld-prime libraries (lmk if I'm wrong though).

@willscott
Copy link
Contributor Author

until we have bind-node as an option for one-off construction in ipld-prime, i think the current setup of the test in this library is going to be more direct and simpler to understand than rewrite you suggest.

Copy link
Member

@warpfork warpfork left a comment

Choose a reason for hiding this comment

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

This seems fine to me.

(I might nit that I don't think some of the names of functions in the fetcherhelper package auto-unpack themselves to me, but A) that's a nit, and B) that's not originated from this diff anyway.)

I don't think there's much that's useful to do about the dag-cbor dependency. If one wants any CIDs used in tests, even indirectly, one has to have some codec in the dependency tree. I think either dag-cbor and/or dag-json are generally reasonable as the "batteries included" ones.

Copy link
Member

@warpfork warpfork left a comment

Choose a reason for hiding this comment

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

Wait, sorry, re-read Adin's comment about cbor -- it's about the old generation go-ipld-cbor repo still being in the deps. Yeah, that we can fix easily, I think:

I can't comment on it in the diff, because github UI Reasons, but looks to me like there's just two bits that need to change: two uses of cbor.WrapObject in simple/reprovide_test.go -> can probably change them to fluent.Reflect, or even just assemble the stuff manually. It's a pretty small amount of test data using this.

@hannahhoward
Copy link
Contributor

hannahhoward commented Jul 30, 2021

@warpfork I away from using go-ipld-cbor. Interesting thing I learned about fluent.Reflect in the process -- it does not handle cid.Cid's -- which one might infer would convert to Link nodes.

@aschmahmann I removed the indirect depedencies as well. As for the tagged version of go-ipld-prime, we will probably do that once that whole stack is approved and we are merging all at once (by propogating several tagged versions).

This should be ready for rereview.

Copy link
Member

@warpfork warpfork left a comment

Choose a reason for hiding this comment

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

Looks all good to me. 🚢

Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

LGTM.

Two things:

  1. nit: comment above about removing the duplicated import of go-ipld-prime/dagcbor
  2. We're waiting on the final merge for the merge party 🎉 where all the dependencies are updated

@aschmahmann aschmahmann added the status/blocked Unable to be worked further until needs are met label Aug 3, 2021
It has an explicit import now too, so the anonymous one is redundant.
@warpfork
Copy link
Member

warpfork commented Aug 3, 2021

Patched out the duplicated import. AFAICT this is now purely pending the merge party. 👍

@willscott willscott merged commit 681975a into master Aug 12, 2021
@aschmahmann aschmahmann mentioned this pull request Aug 23, 2021
62 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/blocked Unable to be worked further until needs are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants