Open yanliu38 opened 1 month ago
Seems to be related: https://github.com/near/borsh-rs/issues/114
Borsh does not include the schema inside the serialized data, so you should plan your upgradability accordingly. If you start from scratch, you have two paths:
enum MyStruct { V1(MyStructV1) }
), which will add a one byte tag as part of the borsh serialization for enums, here is an exampleIf you already have the data serialized with the old MyStruct
, you can follow (2) and consider to implement (1) for seamless operation going forward.
Would you like to contribute a README/docs for this topic? I would be happy to review a PR
Hi there,
We have some existing serialized data of something like
We would now like to add a new field to the existing struct to have something like:
However, when deserializing existing data with the new
MyStruct
, the following error is returned:What is the recommended way to add fields to an existing struct, that already has serialized data?