-
Notifications
You must be signed in to change notification settings - Fork 20
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
MemForest::prove
can panic in certain cases
#59
Comments
Thanks for reporting this @optout21 . I'll push a fix soon |
I've managed to add an extra check which prevents the I suspect somehow the internal representation becomes inconsistent. I'm not sure whether this issue affects the Go
|
After a lot of debugging, the problem seems to originate in Btw, pretty cool way to test it. Would you mind if I reuse some of it to test rustreexo? |
Thanks for looking into this! Of course you are free to use the test code! I did this to test Utreexo library, by simulating blocks & transactions, using reproducible (pseudo)random numbers. For reproducing this particular problem, I thought of just recording the hashes added/deleted in the sample code, and generate a test just replaying those. But I didn't got to do that, and that would have been specific to this particular reproduction of this issue. I am not sure how heavy usage MemForest gets 'in production', as Floresta uses only compressed accumulator, while currently I don't know of a Rust-based bridge (full node) Utreexo implementation (utreexod uses the Go library). |
Fix in |
I ran into this issue while driving
MemForest
with some simulated data.The code in question is:
With certain input combinations (state), the inner
unwrap()
on line 329 causes a panic. That is,get_proof_positions()
returns a position for whichget_hash()
returnsNone
.The inner error could be returned as a proper error, but that does not solve the conceptual problem.
I was not able to find the conceptual root cause, but I can reliably reproduce it. I post a sample cleaned-up Rust code to reproduce. Probably it could be reproduced in a simpler way, this program does on the order of 100 additions and some deletions, deterministically (always the same data).
The program produces some incorrect inputs, but that still should not cause a panic.
The attached sample program should be straighforward to run.
It is against current version (
{ git = "https://github.com/mit-dci/rustreexo.git", rev = "1ee240f" }
).I observed similar behavior for v
0.3.0
(MemTree
isPollard
there).rustreexo-issue.zip
Some relevant output:
The text was updated successfully, but these errors were encountered: