Work-around a scary issue affecting the SSZ serialization

This commit is contained in:
Zahary Karadjov 2020-05-19 13:42:56 +03:00
parent 7ff764ca1f
commit b61fcb51ad
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
1 changed files with 6 additions and 1 deletions

View File

@ -185,7 +185,12 @@ proc makeFieldReadersTable(RecordType, Reader: distinct type):
when RecordType is tuple:
obj[i] = readFieldIMPL(F, reader)
else:
field(obj, fieldName) = readFieldIMPL(F, reader)
# TODO: The `FieldType` coercion below is required to deal
# with a nim bug caused by the distinct `ssz.List` type.
# It seems to break the generics cache mechanism, which
# leads to an incorrect return type being reported from
# the `readFieldIMPL` function.
field(obj, fieldName) = FieldType readFieldIMPL(F, reader)
except SerializationError:
raise
except CatchableError as err: