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

Use IPLD-prime: target merge branch #67

Merged
merged 19 commits into from
Aug 12, 2021
Merged

Use IPLD-prime: target merge branch #67

merged 19 commits into from
Aug 12, 2021

Conversation

hannahhoward
Copy link
Contributor

superseeds #64

  • switch to go-codec-dagpb
  • switch to go-ipld-prime linksystem branch

node.go Show resolved Hide resolved
@warpfork
Copy link
Member

warpfork commented Aug 3, 2021

Probably known, but noting out loud: this needs a rebase onto master (or some manual merging, owner's choice).

However, it doesn't look like it should be too nasty.

  • most of the changes are to CI infra, which hopefully won't conflict in interesting ways.
  • chore: downgrade blockstore #72 might be a little scary (it downgrades a dep?)... but it looks like the deps it changed are not changed for load-bearing reasons in this PR (afaict), so while it creates a conflict in go.mod, hopefully it's just a manual resolve in that file only.

merkledag.go Show resolved Hide resolved
node.go Outdated Show resolved Hide resolved
prime.go Show resolved Hide resolved
@warpfork
Copy link
Member

warpfork commented Aug 4, 2021

I think I'm mostly okay with this?

Per reasoning in the big review of repos and goalposts for this mergeparty I made over in go-path, the aim here is moving forward, and getting new code to do more load-bearing... and while focusing on that, we are conserving scope by leaving stuff in this repo as facades, and are specifically not polishing these APIs in any way. So the result is not going to be pretty, yet. And that's okay. We're just trying to be in a better place for the next work cycle.

AFAICT, checklist to get this ready for mergeparty:

  • Rebase onto master (or merge master in and resolve).
  • Some kind of doc comment on ProtoNode type to disambiguate vs the other similarly-named types in other repos, please
  • Should we... update the README to talk about alternatives folks should look to? Or does that remain unclear? (I just now noticed how much of it is a TODO section already, and it does even already say "deprecate this package"(!) so we can... keep with tradition, heh.)

.travis.yml Outdated Show resolved Hide resolved
Copy link

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

Not many blocking issues, but this code is fairly tricky so I've asked for clarification in a number of places. Also, we need to rebase on master since we're out of date

coding.go Show resolved Hide resolved
coding.go Show resolved Hide resolved
coding_test.go Outdated Show resolved Hide resolved
coding_test.go Show resolved Hide resolved
coding_test.go Outdated Show resolved Hide resolved
merkledag.go Show resolved Hide resolved
node.go Show resolved Hide resolved
node_test.go Show resolved Hide resolved
node_test.go Show resolved Hide resolved
raw.go Outdated Show resolved Hide resolved
hannahhoward and others added 14 commits August 5, 2021 22:30
Fix functionality for decode function -- was using incorrect decoder and not handling maybe cases
Points worth noting:

1) go-ipld-prime-proto contains a raw codec, but go-codec-dagpb does
   not. We're adding one such codec to go-ipld-prime, so for now, just
   add one here to keep the tests passing.

2) dagpb uses a slightly different schema. In particular, the Data field
   is optional, but a link's Hash is not.

3) As per the dag-pb spec, and following the above, links must contain
   hashes. This required updating a number of tests. Note that
   TestStableCID gets its CID changed because of this.
   go-ipld-prime-proto arrives at the same new CID with the new node.

dagutils.TestInsertNode still fails, because it arrives at a different
CID hash, but it's not clear why just yet.
to make merkeldag work with linksystem, update ipld-prime, go-codec-dagpb, and ipld-legacy
Allocate all the underlying links at once. This means one alloc per
call, instead of one alloc per link.

	name         old time/op    new time/op    delta
	Roundtrip-8    5.34µs ± 1%    5.20µs ± 1%  -2.61%  (p=0.002 n=6+6)

	name         old alloc/op   new alloc/op   delta
	Roundtrip-8    7.50kB ± 0%    7.44kB ± 0%  -0.85%  (p=0.002 n=6+6)

	name         old allocs/op  new allocs/op  delta
	Roundtrip-8       148 ± 0%       139 ± 0%  -6.08%  (p=0.002 n=6+6)
It's unclear to me why we did the Bytes+Cast dance for each cid.Cid in
the links list. Perhaps to do a copy, but that wouldn't make sense as
dagpb only reads the CIDs when marshaling.

We can use the same Cid value directly, which shaves off a significant
amount of allocation overhead.

	name         old time/op    new time/op    delta
	Roundtrip-8    5.20µs ± 1%    4.81µs ± 0%   -7.53%  (p=0.004 n=6+5)

	name         old alloc/op   new alloc/op   delta
	Roundtrip-8    7.44kB ± 0%    7.14kB ± 0%   -4.09%  (p=0.002 n=6+6)

	name         old allocs/op  new allocs/op  delta
	Roundtrip-8       139 ± 0%       119 ± 0%  -14.39%  (p=0.002 n=6+6)
Cutting out the bytes.Buffer middleman saves a non-trivial amount of
work, it turns out.

	name         old time/op    new time/op    delta
	Roundtrip-8    3.24µs ± 3%    4.07µs ± 0%  +25.72%  (p=0.002 n=6+6)

	name         old alloc/op   new alloc/op   delta
	Roundtrip-8    4.94kB ± 0%    6.38kB ± 0%  +29.13%  (p=0.002 n=6+6)

	name         old allocs/op  new allocs/op  delta
	Roundtrip-8       109 ± 0%       103 ± 0%   -5.50%  (p=0.002 n=6+6)
@hannahhoward
Copy link
Contributor Author

@aschmahmann I believe I've addressed most comments and this is ready for re-review

Comment on lines 300 to 304
func (n *ProtoNode) UnmarshalJSON(b []byte) error {
s := struct {
Data []byte `json:"data"`
Links []*ipld.Link `json:"links"`
Data []byte `json:"data"`
Links []*format.Link `json:"links"`
}{}

Choose a reason for hiding this comment

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

@warpfork @rvagg @willscott does this need to be changed to Data and Links? Perhaps relatedly will this code be used anywhere anymore?

@willscott willscott merged commit 8794146 into master Aug 12, 2021
IPLD-Prime-in-IPFS automation moved this from For Review to Done Aug 12, 2021
@aschmahmann aschmahmann mentioned this pull request Aug 23, 2021
62 tasks
Jorropo pushed a commit to ipfs/boxo that referenced this pull request Mar 15, 2023
Use IPLD-prime: target merge branch

This commit was moved from ipfs/go-merkledag@8794146
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants