-
Notifications
You must be signed in to change notification settings - Fork 37
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 mutable data #14
base: master
Are you sure you want to change the base?
Fix mutable data #14
Conversation
Make node length definition more clearly
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.
Thanks for this; a couple of requests.
@@ -43,7 +43,12 @@ func (f parameterFunc) apply(p *parameters) { | |||
// WithData sets the data for the merkle tree. |
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.
Please could you add a note here that this copies the data?
@@ -37,14 +37,14 @@ func TestMultiProofWithIndices(t *testing.T) { | |||
|
|||
// Test proof for all combinations of data. | |||
var proof *MultiProof | |||
combinations := 1<<len(test.data) - 1 | |||
combinations := 1<<len(tree.Data) - 1 |
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.
There are other tests that use test.data
in a similar fashion, please could you update those as well?
It's safer to use copy of data while constructing the tree. Found this bug because I failed to pass
NewTree
test separately whilego test ./...
passed. So there are also some problems with unittest answer.