rename to kzg_commitment_inclusion_proof

This commit is contained in:
dapplion 2023-11-01 15:57:41 +02:00
parent 7f63f003c0
commit 4a609cec57
4 changed files with 7 additions and 7 deletions

View File

@ -82,7 +82,7 @@ class BlobSidecar(Container):
kzg_commitment: KZGCommitment
kzg_proof: KZGProof # Allows for quick verification of kzg_commitment
signed_block_header: SignedBeaconBlockHeader
commitment_inclusion_proof: Vector[Bytes32, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH]
kzg_commitment_inclusion_proof: Vector[Bytes32, KZG_COMMITMENT_INCLUSION_PROOF_DEPTH]
```
#### `BlobIdentifier`
@ -104,7 +104,7 @@ def verify_blob_sidecar_inclusion_proof(blob_sidecar: BlobSidecar) -> bool:
gindex = get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments', blob_sidecar.index)
return is_valid_merkle_branch(
leaf=blob_sidecar.kzg_commitment.hash_tree_root(),
branch=blob_sidecar.commitment_inclusion_proof,
branch=blob_sidecar.kzg_commitment_inclusion_proof,
depth=floorlog2(gindex),
index=get_subtree_index(gindex),
root=blob_sidecar.signed_block_header.message.body_root,

View File

@ -162,7 +162,7 @@ def get_blob_sidecars(signed_block: SignedBeaconBlock,
kzg_commitment=block.body.blob_kzg_commitments[index],
kzg_proof=blob_kzg_proofs[index],
signed_block_header=signed_block_header,
commitment_inclusion_proof=compute_merkle_proof(
kzg_commitment_inclusion_proof=compute_merkle_proof(
block.body,
get_generalized_index(BeaconBlockBody, 'blob_kzg_commitments', index),
),

View File

@ -30,16 +30,16 @@ def test_blob_kzg_commitment_merkle_proof(spec, state):
blob_sidecar = blob_sidecars[blob_index]
yield "object", block.body
commitment_inclusion_proof = blob_sidecar.commitment_inclusion_proof
kzg_commitment_inclusion_proof = blob_sidecar.kzg_commitment_inclusion_proof
gindex = spec.get_generalized_index(spec.BeaconBlockBody, 'blob_kzg_commitments', blob_index)
yield "proof", {
"leaf": "0x" + blob_sidecar.kzg_commitment.hash_tree_root().hex(),
"leaf_index": gindex,
"branch": ['0x' + root.hex() for root in commitment_inclusion_proof]
"branch": ['0x' + root.hex() for root in kzg_commitment_inclusion_proof]
}
assert spec.is_valid_merkle_branch(
leaf=blob_sidecar.kzg_commitment.hash_tree_root(),
branch=blob_sidecar.commitment_inclusion_proof,
branch=blob_sidecar.kzg_commitment_inclusion_proof,
depth=spec.floorlog2(gindex),
index=spec.get_subtree_index(gindex),
root=blob_sidecar.signed_block_header.message.body_root,

View File

@ -64,5 +64,5 @@ def test_blob_sidecar_inclusion_proof_incorrect_wrong_proof(spec, state):
for blob_sidecar in blob_sidecars:
# wrong proof
blob_sidecar.commitment_inclusion_proof = spec.compute_merkle_proof(spec.BeaconBlockBody(), 0)
blob_sidecar.kzg_commitment_inclusion_proof = spec.compute_merkle_proof(spec.BeaconBlockBody(), 0)
assert not spec.verify_blob_sidecar_inclusion_proof(blob_sidecar)