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

fix(ipld/plugin): don't truncate a type byte when it's not in the data #1196

Merged
merged 2 commits into from
Oct 5, 2022

Conversation

Wondertan
Copy link
Member

@Wondertan Wondertan commented Oct 4, 2022

The code has a special case for the share data with type byte and without. However, it truncates the type byte like it is always there.
The #1139 is the first user of share data without a type byte, which uncovered the bug. The type byte causes issues for us again.

refactor(ipld/plugin): extract namespaceHasher into a separate file with some additional cleanups

In preparation for the upcoming test for the namespaceHasher, we extract it into a separate file. Also, some additional cosmetics were done
reducing the API surfuce of the pkg, hiding things that are not supposed to be used outside.

test(ipld/plugin): write dummy unit test for the namespaceHasher

docs(ipld/plugin): godocs for the namespaceHasher

perf(ipld/plugin): use sha256-simd to gain 40% speedup for hash computations

@Wondertan Wondertan added area:shares Shares and samples area:ipld IPLD plugin labels Oct 4, 2022
@Wondertan Wondertan self-assigned this Oct 4, 2022
@Wondertan Wondertan added the kind:fix Attached to bug-fixing PRs label Oct 4, 2022
@Wondertan Wondertan mentioned this pull request Oct 4, 2022
45 tasks
@renaynay
Copy link
Member

renaynay commented Oct 4, 2022

nice find

renaynay
renaynay previously approved these changes Oct 4, 2022
@renaynay
Copy link
Member

renaynay commented Oct 4, 2022

Should we have a test for this as well? we don't have coverage for Write in the current tests.

Copy link
Collaborator

@distractedm1nd distractedm1nd left a comment

Choose a reason for hiding this comment

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

I agree that we should add some test coverage - not only for having tests, but also as a sort of "secondary documentation" showing usage

@Wondertan
Copy link
Member Author

I'll add a simple test. Re "secondary documentation": this hasher is not supposed to be used outside.

@codecov-commenter
Copy link

codecov-commenter commented Oct 5, 2022

Codecov Report

Merging #1196 (90562fa) into main (21aed31) will decrease coverage by 4.56%.
The diff coverage is 73.20%.

❗ Current head 90562fa differs from pull request most recent head c9a3b99. Consider uploading reports for the commit c9a3b99 to get more accurate results

@@            Coverage Diff             @@
##             main    #1196      +/-   ##
==========================================
- Coverage   60.25%   55.68%   -4.57%     
==========================================
  Files         161      160       -1     
  Lines        9736     9509     -227     
==========================================
- Hits         5866     5295     -571     
- Misses       3337     3688     +351     
+ Partials      533      526       -7     
Impacted Files Coverage Δ
das/daser.go 66.27% <ø> (-2.33%) ⬇️
header/p2p/subscriber.go 61.81% <ø> (ø)
ipld/retriever.go 91.97% <ø> (ø)
nodebuilder/daser/daser.go 100.00% <ø> (ø)
nodebuilder/rpc/rpc.go 100.00% <ø> (ø)
nodebuilder/share/share.go 100.00% <ø> (ø)
nodebuilder/state/core.go 100.00% <ø> (ø)
service/rpc/availability.go 0.00% <0.00%> (-34.89%) ⬇️
service/rpc/handler.go 100.00% <ø> (ø)
service/rpc/share.go 0.00% <ø> (-52.75%) ⬇️
... and 92 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@Wondertan Wondertan force-pushed the hlib/fix-hasher-again branch from 4ada8c0 to 90562fa Compare October 5, 2022 13:33
The code has a special case for the share data with type byte and without. However, it truncates the type byte like it is always there.
The #1139 is the first user of share data without a type byte, which uncovered the bug. The type byte causes issues for us again.

refactor(ipld/plugin): extract namespaceHasher into a separate file with some additional cleanups

In preparation for the upcoming test for the namespaceHasher, we extract it into a separate file. Also, some additional cosmetics were done
reducing the API surfuce of the pkg, hiding things that are not supposed to be used outside.

test(ipld/plugin): write dummy unit test for the namespaceHasher

docs(ipld/plugin): godocs for the namespaceHasher

perf(ipld/plugin): use sha256-simd to gain 40% speedup for hash computations
@Wondertan Wondertan force-pushed the hlib/fix-hasher-again branch from 90562fa to c9a3b99 Compare October 5, 2022 13:38
@Wondertan Wondertan merged commit 069b47f into main Oct 5, 2022
@Wondertan Wondertan deleted the hlib/fix-hasher-again branch October 5, 2022 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:ipld IPLD plugin area:shares Shares and samples kind:fix Attached to bug-fixing PRs
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants