Update test_libs/pyspec/eth2spec/utils/ssz/ssz_impl.py

Co-Authored-By: vbuterin <v@buterin.com>
This commit is contained in:
Diederik Loerakker 2019-06-15 20:57:22 +02:00 committed by protolambda
parent cd5f59eb74
commit 54a1fa9abe
1 changed files with 7 additions and 1 deletions

View File

@ -153,7 +153,13 @@ def item_length(typ):
return typ.byte_len
else:
return 32
def chunk_count(typ):
if is_basic_type(typ):
return 1
elif is_list_kind(typ) or is_vector_kind(typ):
return (typ.length * item_length(typ.elem_type) + 31) // 32
else:
return len(typ.get_fields())
def hash_tree_root(obj, typ):
if is_bottom_layer_kind(typ):