-
Notifications
You must be signed in to change notification settings - Fork 50
Conversation
Codecov Report
@@ Coverage Diff @@
## master #39 +/- ##
==========================================
- Coverage 87.47% 86.36% -1.11%
==========================================
Files 6 6
Lines 455 462 +7
==========================================
+ Hits 398 399 +1
- Misses 31 36 +5
- Partials 26 27 +1
Continue to review full report at Codecov.
|
@@ -59,3 +59,68 @@ func (dsmst *DeepSparseMerkleSubTree) AddBranch(proof SparseMerkleProof, key []b | |||
|
|||
return nil | |||
} | |||
|
|||
// GetDescend gets the value of a key from the tree by descending it. | |||
// Use if a key was _not_ previously added with AddBranch, otherwise use Get. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why would someone try to get a key that wasn't added with AddBranch? In what circumstances would that succeed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From #39 (comment)
the code wasn't able to get a key that is expected to have a [non-default] value.
☝️ that exact case. When a key in the original SMT has a non-default value, but wasn't added via AddBranch
to the DSMST, then was queried. This happens when a malicious fraud proof doesn't provide enough pre-state. You don't want to return defaultValue
in that case because the key doesn't actually have default value; it has a non-default value but that value wasn't proven.
In other words, with an untrusted fraud proof, only GetDescend
and HasDescend
should be used with the DSMST.
Make updates as per #37 (comment).
Fixes #8 #14.
Get/HasForRoot
.AddBranch
.