turbofish-org / merk

High-performance Merkle key/value store
Apache License 2.0
226 stars 36 forks source link

Add function to return root of a proof that can later be verified via a signing scheme. #51

Closed QuantumExplorer closed 3 years ago

QuantumExplorer commented 3 years ago

Using verify query on light clients would require them to be supplied with the expected root hash, in addition to the proof, keys and signature. Since the proof already contains the root_hash, and any other root hash wouldn't match for the signature, it would be optimal not to send it.

The change requested decomposes verify_query into a new function query_proof_root that returns the root hash as well as the result of querying the keys.

codecov-commenter commented 3 years ago

Codecov Report

Merging #51 (806d873) into develop (2b31f6f) will increase coverage by 0.04%. The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop      #51      +/-   ##
===========================================
+ Coverage    89.90%   89.94%   +0.04%     
===========================================
  Files           23       23              
  Lines         2555     2557       +2     
===========================================
+ Hits          2297     2300       +3     
+ Misses         258      257       -1     
Impacted Files Coverage Δ
src/proofs/verify.rs 94.97% <100.00%> (+0.50%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 2b31f6f...806d873. Read the comment docs.

QuantumExplorer commented 3 years ago

Closing this, and will make a new PR potentially eventually with the same idea.

mappum commented 3 years ago

@QuantumExplorer cool, might make sense to do it by adding a root_hash method to Map