Referencing #117, it's possible for canoto.Unmarshal() to fail even if canoto.Marshal() works. An example is as follows:
type Foo struct {
Bar []byte `canoto:"bytes,1"`
canotoData canotoData_Foo
}
anyField := canoto.AnyField{
Name: "Bar",
Bar: []byte{},
}
a := canoto.Any{
Fields: []canoto.AnyField{anyField},
}
f := &Foo{}
spec := f.CanotoSpec()
b, err := canoto.Marshal(spec, a) // err == nil
bytes, err := canoto.Unmarshal(spec, b) // err != nil
Ideally, we should have that:
canoto.Unmarshal(spec, canoto.Marshal(spec, a)) // ignoring errs
Adding a verification step to canoto.Marshal() would allow for the above to be possible.
Referencing #117, it's possible for
canoto.Unmarshal()to fail even ifcanoto.Marshal()works. An example is as follows:Ideally, we should have that:
Adding a verification step to
canoto.Marshal()would allow for the above to be possible.