Add merkle_parial_from_paths
This commit is contained in:
parent
ced6208d55
commit
b91dfd6244
|
@ -158,26 +158,32 @@ def verify_multi_proof(root, indices, leaves, proof):
|
||||||
|
|
||||||
We define:
|
We define:
|
||||||
|
|
||||||
#### `MerklePartialLeaf`
|
|
||||||
|
|
||||||
```python
|
|
||||||
{
|
|
||||||
"path": ["uint64"],
|
|
||||||
"value": "bytes32"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
#### `MerklePartial`
|
#### `MerklePartial`
|
||||||
|
|
||||||
|
|
||||||
```python
|
```python
|
||||||
{
|
{
|
||||||
"root": "bytes32",
|
"root": "bytes32",
|
||||||
"values": [MerklePartialLeaf],
|
"indices": ["uint64"],
|
||||||
|
"values": ["bytes32"],
|
||||||
"proof": ["bytes32"]
|
"proof": ["bytes32"]
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### `merkle_partial_from_paths`
|
||||||
|
|
||||||
|
```python
|
||||||
|
def merkle_partial_from_paths(obj, paths):
|
||||||
|
indices = set()
|
||||||
|
for path in paths:
|
||||||
|
indices = indices.union(get_generalized_indices(obj, path))
|
||||||
|
return MerklePartial(
|
||||||
|
root=hash_tree_root(obj),
|
||||||
|
indices=indices,
|
||||||
|
values= mk_multi_proof
|
||||||
|
)
|
||||||
|
```
|
||||||
|
|
||||||
#### Proofs for execution
|
#### Proofs for execution
|
||||||
|
|
||||||
We define `MerklePartial(f, arg1, arg2..., focus=0)` as being a `MerklePartial` object wrapping a Merkle multiproof of the set of nodes in the hash tree of the SSZ object `arg[focus]` that is needed to authenticate the parts of the object needed to compute `f(arg1, arg2...)`.
|
We define `MerklePartial(f, arg1, arg2..., focus=0)` as being a `MerklePartial` object wrapping a Merkle multiproof of the set of nodes in the hash tree of the SSZ object `arg[focus]` that is needed to authenticate the parts of the object needed to compute `f(arg1, arg2...)`.
|
||||||
|
|
Loading…
Reference in New Issue