Bug [rlwe]: `rlwe.Parameters.ReadFrom` fails (PR #456)
Closed this issue · 0 comments
Pro7ech commented
#456 added WriteTo
and ReadFrom
to the rlwe.Parameters
without adding associated tests and it actually fails when calling .ReadFrom
.
This can be easily reproduced by testing the serialization of rlwe.Parameters
with the method buffer.RequireSerializerCorrect
, which returns the error: unexpected end of JSON input
.
This happens because .BinarySize()
is called on empty parameters by ReadFrom
to get the number of bytes to read. But this returns the wrong size because the serialization size of rlwe.Parameters
is dependant on the content of the struct.
-> Do like other content-dependent structs (e.g. ring.Poly
): add a 4/8 bytes prefix with the number of bytes to read