Skip to content

Why borsh schema for Movie has different order of fields in serialize/deserialize #11

@SergeyDevyatkov

Description

@SergeyDevyatkov

Trying to understand, not explained anywhere, why the fields order is different in serialize and deserialize methods in movie model?

...
static borshSchema: borsh.Layout<Movie> = borsh.struct([
    borsh.u8("variant"),
    borsh.str("title"),
    borsh.u8("rating"),
    borsh.str("description"),
  ]);

  static borshAccountSchema: borsh.Layout<Movie> = borsh.struct([
    borsh.u8("initialized"),
    borsh.u8("rating"),
    borsh.str("title"),
    borsh.str("description"),
  ]);
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions