In serialisation we do not distinguish between unknown CustomConst
serialised value invalid but known CustomConst
serialised values
#1225
Labels
bug
Something isn't working
We use the
typetag
crate to manage serialisation and deserialisation ofdyn CustomConst
values. When deserialisation of adyn CustomConst
fails, we are not able to distinguish between:impl CustomConst
is not linked into the current program, so the typetag handler for that type is not presentimpl CustomConst
was invalid. (e.g. see Invalid constants can pass validation #1091)Currently we do not fail to deserialise, and store a
CustomSerialized
in the Hugr.We should fail to deserialise in the 2) case, and continue to succeed with a
CustomSerialized
in the 1) case.typetag
does not offer any facility to distinguish these cases. I see three options:typetag
. It's unclear whether it would be accepted.typetag::serde
(e.g.hugr::custom_const::serde
) that add this feature. This could be done by registering aninventory
of type names (as typetag does) in parallel, and and inspecting this during serialisation, and failing in a detectable way if deserialisation of the content failed when the tag is present in our inventory.Serialize + for<'a> Deserialize<'a>
to super traits ofCustomConst
. Thread&ExtensionRegistry
through where it is needed. remove#[cfg(not(miri))]
on tests that typetag breaks.The text was updated successfully, but these errors were encountered: