You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
transaction_metadatum =
{ * transaction_metadatum => transaction_metadatum } ; @name map
/ [ * transaction_metadatum ] ; @name list
/ int
/ bytes .size (0..64)
/ text .size (0..64)
For type choice we just start trying variants and backtrack if we encounter an error. This allows us to simply support all type choices with one codegen method, but has several downsides when the type choice consists of completely different types like the above. One downside is we waste time trying the other variants, but more critically is that errors are essentially eaten completely making debugging more of a pain. Instead of getting specific errors telling us exactly what went wrong and where, it will be eaten up by the topmost type/group choice as simply "No variant matched".
This would complicate codegen slightly but I think it's worth it just for the better errors. I just wasted some time debugging CML block parsing that would have been made immediately obvious if we did this instead. The faster deserialization time for choices would be an added bonus.
It can be solved by matching on raw.cbor_type() and having branches for each covered type in the choice. If the user isn't using extern types we have the ability to check all possible cbor starting tags for types, although the support isn't 100% for structs (or at least plain group ones?) it is better than nothing and would still help us for most cardano CDDL specs.
The text was updated successfully, but these errors were encountered:
Another option could be to just give DeserializeFailure::NoVariantMatched a Vec<DeserializeError> value which would require less changes. Or we could do the above match for when they're disjoint, and the old approach with the vec of errs when they're not.
Addresses #194
This helps avoid any type/group choice from eating any errors on
variants as instead of receiving a NoVariantMatched you will receive one
with errors as to why each variant failed.
This drastically helps debugging and also works for nested choices as
well.
Together these fix#194 and #145
* NoVariantMatchedWithCauses deser error variant
Addresses #194
This helps avoid any type/group choice from eating any errors on
variants as instead of receiving a NoVariantMatched you will receive one
with errors as to why each variant failed.
This drastically helps debugging and also works for nested choices as
well.
* Avoid try-all on enums with non-overlapping CBOR
Fixes#145
When all variants have non-overlapping first CBOR type we can avoid
brute-force trying all possible variants for type/group choices and
instead branch on raw.cbor_type() to only try the variant that makes
sense.
e.g.
For type choice we just start trying variants and backtrack if we encounter an error. This allows us to simply support all type choices with one codegen method, but has several downsides when the type choice consists of completely different types like the above. One downside is we waste time trying the other variants, but more critically is that errors are essentially eaten completely making debugging more of a pain. Instead of getting specific errors telling us exactly what went wrong and where, it will be eaten up by the topmost type/group choice as simply "No variant matched".
This would complicate codegen slightly but I think it's worth it just for the better errors. I just wasted some time debugging CML block parsing that would have been made immediately obvious if we did this instead. The faster deserialization time for choices would be an added bonus.
It can be solved by matching on raw.cbor_type() and having branches for each covered type in the choice. If the user isn't using extern types we have the ability to check all possible cbor starting tags for types, although the support isn't 100% for structs (or at least plain group ones?) it is better than nothing and would still help us for most cardano CDDL specs.
The text was updated successfully, but these errors were encountered: