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

panic in merkle's verify_batch #200

Open
themighty1 opened this issue May 15, 2023 · 1 comment
Open

panic in merkle's verify_batch #200

themighty1 opened this issue May 15, 2023 · 1 comment

Comments

@themighty1
Copy link

As is currently implemented, if a malicious prover lies about the depth of their Merkle tree, it will cause the verifier to panic.

The panic can be reproduced by replacing this line in the test (

let proof = tree.prove_batch(&[1, 2]).unwrap();
)
with

let mut proof = tree.prove_batch(&[1, 2]).unwrap();
proof.depth = proof.depth + 100;

is this an inherent limitation or can this be worked around?

@irakliyk
Copy link
Collaborator

Thank you for catching this! This shouldn't be too difficult to fix. Basically, we should detect an invalid depth (probably during deserialization) and just return an error.

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

2 participants