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

ProveBatch() error when reorging #336

Open
kcalvinalvin opened this issue Jan 17, 2022 · 0 comments
Open

ProveBatch() error when reorging #336

kcalvinalvin opened this issue Jan 17, 2022 · 0 comments

Comments

@kcalvinalvin
Copy link
Member

kcalvinalvin commented Jan 17, 2022

I found a bug in ProveBatch() when I was trying to get multi-block proofs working.

When the forest has less than two leaves, you don't generate a BatchProof. This function is implemented with the following branch.

if f.data.size() < 2 {
return bp, nil
}

However, this doesn't take into consideration that f.data.size() returns the size of the allocated size of the forest, not the logical size. This is ok when you sync for the first time because f.data.size() will have the same value as the logical size. But when you resync after an undo, it returns an incorrect(bigger) value as you never reduce the allocated size during an undo.

forestproofs.go lines 145-147 should be modified to use the logical size, not the allocated size.

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

No branches or pull requests

1 participant