move decoder for fuzzing, minor fixes, update dependency to support SOS style offsets

This commit is contained in:
protolambda 2019-06-14 19:09:49 +02:00
parent e7bb9bf19b
commit 7b0ffc1ace
No known key found for this signature in database
GPG Key ID: EC89FDBB2B4C7623
5 changed files with 7 additions and 8 deletions

View File

@ -1,3 +0,0 @@
../../test_libs/pyspec
../../test_libs/config_helpers
ssz==0.1.0a8

View File

@ -10,7 +10,7 @@ def translate_typ(typ) -> ssz.BaseSedes:
""" """
if spec_ssz.is_container_type(typ): if spec_ssz.is_container_type(typ):
return ssz.Container( return ssz.Container(
[(field_name, translate_typ(field_typ)) for (field_name, field_typ) in typ.get_fields()]) [translate_typ(field_typ) for (field_name, field_typ) in typ.get_fields()])
elif spec_ssz.is_bytesn_type(typ): elif spec_ssz.is_bytesn_type(typ):
return ssz.ByteVector(typ.length) return ssz.ByteVector(typ.length)
elif spec_ssz.is_bytes_type(typ): elif spec_ssz.is_bytes_type(typ):
@ -38,7 +38,7 @@ def translate_typ(typ) -> ssz.BaseSedes:
else: else:
raise TypeError("invalid uint size") raise TypeError("invalid uint size")
else: else:
raise Exception("Type not supported: {}".format(typ)) raise TypeError("Type not supported: {}".format(typ))
def translate_value(value, typ): def translate_value(value, typ):
@ -79,6 +79,6 @@ def translate_value(value, typ):
return value return value
elif spec_ssz.is_container_type(typ): elif spec_ssz.is_container_type(typ):
return typ(**{f_name: translate_value(f_val, f_typ) for (f_name, f_val, f_typ) return typ(**{f_name: translate_value(f_val, f_typ) for (f_name, f_val, f_typ)
in zip(typ.get_field_names(), value.values(), typ.get_field_types())}) in zip(typ.get_field_names(), value, typ.get_field_types())})
else: else:
raise Exception("Type not supported: {}".format(typ)) raise TypeError("Type not supported: {}".format(typ))

View File

@ -3,3 +3,4 @@ eth-typing>=2.1.0,<3.0.0
pycryptodome==3.7.3 pycryptodome==3.7.3
py_ecc>=1.6.0 py_ecc>=1.6.0
typing_inspect==0.4.0 typing_inspect==0.4.0
ssz==0.1.0a9

View File

@ -9,6 +9,7 @@ setup(
"eth-typing>=2.1.0,<3.0.0", "eth-typing>=2.1.0,<3.0.0",
"pycryptodome==3.7.3", "pycryptodome==3.7.3",
"py_ecc>=1.6.0", "py_ecc>=1.6.0",
"typing_inspect==0.4.0" "typing_inspect==0.4.0",
"ssz==0.1.0a9"
] ]
) )