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 mutable data #14

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

exqlnet
Copy link
Contributor

@exqlnet exqlnet commented Mar 13, 2024

It's safer to use copy of data while constructing the tree. Found this bug because I failed to pass NewTree test separately while go test ./... passed. So there are also some problems with unittest answer.

@exqlnet exqlnet mentioned this pull request Mar 13, 2024
Copy link
Collaborator

@mcdee mcdee left a 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.
Copy link
Collaborator

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
Copy link
Collaborator

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants