Replace hash_tree_root(x) with hash(ssz_serialize(x))

This commit is contained in:
Hsiao-Wei Wang
2022-08-22 15:59:39 +08:00
parent eff79b2be7
commit 109250b963
2 changed files with 4 additions and 2 deletions

View File

@@ -586,6 +586,7 @@ class EIP4844SpecBuilder(BellatrixSpecBuilder):
return super().imports(preset_name) + f'''
from eth2spec.utils import kzg
from eth2spec.bellatrix import {preset_name} as bellatrix
from eth2spec.utils.ssz.ssz_impl import serialize as ssz_serialize
'''
@classmethod

View File

@@ -93,9 +93,10 @@ def is_data_available(slot: Slot, beacon_block_root: Root, blob_kzg_commitments:
```python
def hash_to_bls_field(x: Container) -> BLSFieldElement:
"""
This function is used to generate Fiat-Shamir challenges. The output is not uniform over the BLS field.
Compute 32-byte hash of serialized container and convert it to BLS field.
The output is not uniform over the BLS field.
"""
return int.from_bytes(hash_tree_root(x), "little") % BLS_MODULUS
return int.from_bytes(hash(ssz_serialize(x)), "little") % BLS_MODULUS
```
### `compute_powers`