Open haroldcarr opened 1 year ago
Thank you for the response. I can't try the AsEnum/Struct thing at the moment, but I will sometime and report back.
Question: in your purgatory article you only use via As*
in ONE place : via AsStruct Color
The rest just do deriving newtype (BorshSize, ToBorsh, FromBorsh)
--- so that is what I have done everwhere.
Is there a reason you only explicitly leave via As*
out in other places?
The blog post refers to an earlier version of the library, where the default was AsEnum
and you could use AsStruct
if you really wanted to skip the tag for the constructor. However, that was error prone, and was leading to precisely the kinds of decoding errors that you are seeing, so we changed the library to force people to make an explicit choice between enums and structs.
Got it. I will try being explicit and report back. Thank you.
Do you have any ideas off-the-top-of-your-head.
I know from looking around that the "real" error is coming from
Codec.Borsch.Decoding
decodeEnum
Also, note the size - it is BIG.
For serialization in Rust, I use this macro:
I have used that macro for other types with with smaller instances successfully.