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

tree: allow batching new leaf nodes #363

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

Conversation

gballet
Copy link
Member

@gballet gballet commented Jun 7, 2023

Try again to run #349 with a different branch name...

@gballet gballet force-pushed the jsign-cowleaves2 branch 3 times, most recently from 7597228 to 9dbd43e Compare June 8, 2023 10:42
Copy link
Member Author

@gballet gballet left a comment

Choose a reason for hiding this comment

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

@jsign ok so it was weird, but it wasn't really github action's fault: CI will merge your PR branch with main during the test, making sure that the merge can work. It's something that needs to happen.

The problem is that if you rebase your branch on top of master, there are a few problems appearing. This is why it worked locally for both of us: we were not rebasing. I have fixed the first problem, but there is now one with a nil commitment.

tree.go Show resolved Hide resolved
@jsign jsign force-pushed the jsign-cowleaves2 branch from a5eab6a to 22e2491 Compare June 9, 2023 12:32
tree_test.go Outdated
valIdx := 42
values[valIdx] = testValue
ln := NewLeafNode(ffx32KeyTest[:StemSize], values)
Copy link
Collaborator

@jsign jsign Jun 9, 2023

Choose a reason for hiding this comment

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

We can't create "direct leaf node" now since all the internal data is lazily computed. This caused a crash later when doing ln.Hash() called (*LeafNode).Commitment(), which panicked since there wasn't any calculated commitment.

The solution is always to use the tree from a properly created tree, since before inspecting internals of things you should always call tree.Commit() to do all the pending calculations.

Another solution is making (*LeafNode).Commitment() not panicked if commitment == nil, so compute it if that's the case. Technically speaking, that would be my preferred solution since we shouldn't have panicked but considering that case should never happen...

Copy link
Member Author

@gballet gballet 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 fixing this, I rebased it and will merge it after we discuss your comment.

@gballet gballet force-pushed the jsign-cowleaves2 branch from 22e2491 to 1e7745d Compare June 16, 2023 08:25
@gballet
Copy link
Member Author

gballet commented Jun 30, 2023

Note to self when I revisit this: This PR is kept on hold for a little bit, as it needs to be rebased and it fill conflict with more upcoming PRs. It should not decrease performance, so it's safe to merge.

jsign and others added 8 commits June 30, 2023 10:07
Signed-off-by: Ignacio Hagopian <[email protected]>

tree: simplify batching of new leaves creation

Signed-off-by: Ignacio Hagopian <[email protected]>

tree: fix insert new leaves test and benchmark

Signed-off-by: Ignacio Hagopian <[email protected]>

remove comment

Signed-off-by: Ignacio Hagopian <[email protected]>

remove conversion file

Signed-off-by: Ignacio Hagopian <[email protected]>

remove unused method

Signed-off-by: Ignacio Hagopian <[email protected]>

tree: add comment to explain different strategies on leaf node value updating

Signed-off-by: Ignacio Hagopian <[email protected]>
Signed-off-by: Ignacio Hagopian <[email protected]>
@jsign jsign force-pushed the jsign-cowleaves2 branch from 1e7745d to 1dd8d33 Compare June 30, 2023 13:10
@jsign
Copy link
Collaborator

jsign commented Jun 30, 2023

Note to self when I revisit this: This PR is kept on hold for a little bit, as it needs to be rebased and it fill conflict with more upcoming PRs. It should not decrease performance, so it's safe to merge.

Update: rebased to master. Still agree we can keep it on hold, but hopefully will be less painful to keep rebasing if we keep merging more stuff in master.

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

Successfully merging this pull request may close these issues.

3 participants