Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Erasure namespaces #235
Erasure namespaces #235
Changes from 29 commits
51d310d
ddbaa9c
ed06600
1ff8b30
a4c6eaf
a2f2ba1
dd6d65f
f390524
43ad1fa
9bec234
3d45d8a
964e8fc
3482ebb
4de5bb6
c8c4667
d9ce75b
772ae43
2724fe8
3f63b02
173ddd7
e4e0c74
001ada7
b1bc22d
d882848
b7bdfb7
d84fc3d
f708503
efdd4f0
43a6bd7
6baddea
64e5bfd
8bba9d9
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Nit: I'd recommend introducing a local var that gets assigned the result of
removeRandShares
. It slightly increases readability here I think.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.
the extra
-2
here is so that the msg shares don't unexpectedly split when adding the length delimiter.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.
We should test with really large messages (where the length delimiter will be longer than one byte) too.
This is probably orthogonal to this PR but:
generateRandomData
is confusing. It sounds like it will really create arbitraryBlock.Data
but it seems it only creates messages and these are already accounting for the length delimiter and the share reserved bytes. In reality, messages inBlock.Data
will often be longer than theMsgShareSize-2
.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 agree, we should definitely test with larger message sizes, random txs, and ISRs. The issue I ran into is that we need to have a power of two square size for the ipld plugin to use generate Cids as expected (ref #257), and we don't actually have a way to know how many shares a message takes up until after the shares are computed ref #77.
I've changed the name of
generateRandomData
togenerateRandomMsgOnlyData
to hopefully make things slightly clearer, but it does not address the underlying issue. 64e5bfdThere 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.
just as an update, Ismail and I figured out the issues, and it was the last copy-append bug. Everything works as expected now, and we are planning on adding robust testing for computing shares from block data later when completing #257
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.
had to add an extra copy here to stop another overwrite when appending bug. This one was super sneaky, as it only pops up when calling
ComputeShares
more than once. I went a head and added two more copies elsewhere, as they would become problems eventually.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.
IMO, we should use append correctly instead of copy. I think this is easier to grasp (also here it removes the need to introduce another variable for nid):
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.
That certainly makes it more readable, but I don't think it will work for our purposes https://play.golang.org/p/NN4V2gaLh8k
We can however use a new utility function
appendCopy
6baddeaThere 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.
That's my bad! There is a
0
missing in my suggested code. The created slice needs to have0
length and the exactly needed size allocated as capacity.This is how it should look like: https://play.golang.org/p/oorWoD02jZg
I've updated the comments accordingly.
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.
ahh okay, I should have guessed, makes sense!