Fix test
This commit is contained in:
parent
de3b6a24dc
commit
b7e0b88cb1
|
@ -101,10 +101,12 @@ class BlobIdentifier(Container):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
def verify_blob_sidecar_inclusion_proof(blob_sidecar: BlobSidecar) -> bool:
|
def verify_blob_sidecar_inclusion_proof(blob_sidecar: BlobSidecar) -> bool:
|
||||||
return is_valid_merkle_path(
|
gindex = get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments', blob_sidecar.index)
|
||||||
|
return is_valid_merkle_branch(
|
||||||
leaf=blob_sidecar.kzg_commitment.hash_tree_root(),
|
leaf=blob_sidecar.kzg_commitment.hash_tree_root(),
|
||||||
branch=blob_sidecar.commitment_inclusion_proof,
|
branch=blob_sidecar.commitment_inclusion_proof,
|
||||||
gindex=get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments', blob_sidecar.index),
|
depth=floorlog2(gindex),
|
||||||
|
index=get_subtree_index(gindex),
|
||||||
root=blob_sidecar.signed_block_header.message.body_root,
|
root=blob_sidecar.signed_block_header.message.body_root,
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
|
@ -55,5 +55,5 @@ def test_blob_sidecar_inclusion_proof_incorrect(spec, state):
|
||||||
|
|
||||||
for blob_sidecar in blob_sidecars:
|
for blob_sidecar in blob_sidecars:
|
||||||
block = blob_sidecar.signed_block_header.message
|
block = blob_sidecar.signed_block_header.message
|
||||||
block = block.body_root = hash_tree_root(block.body_root) # mutate body root to break proof
|
block.body_root = spec.hash(block.body_root) # mutate body root to break proof
|
||||||
assert not spec.verify_blob_sidecar_inclusion_proof(blob_sidecar)
|
assert not spec.verify_blob_sidecar_inclusion_proof(blob_sidecar)
|
||||||
|
|
Loading…
Reference in New Issue