SpinResearch / merkle.rs

:christmas_tree: Merkle tree in Rust
BSD 3-Clause "New" or "Revised" License
129 stars 23 forks source link

Proof.valdidate doesn't check value #50

Open ethanfrey opened 5 years ago

ethanfrey commented 5 years ago

While the repeated hashing of nodes looks very correct, I cannot see anywhere that the client can verify what the actual value that was included in the proof.

The last Lemma will have the node_hash of the LeafNode. However, there is no check in Proof.verify to check that proof.Value has any relationship to the Lemma that was Valid.

I don't see a reason I cannot construct a valid proof for some data in the tree, then change the Value and present it to you as a valid proof of some fake data.