Skip to content

Account::LEN incorrect for 8-byte alignment #2

@tomjohn1028

Description

@tomjohn1028

When using the @codama/renderers-vixen-parser package to generate account parsers, it generates a match with arms reliant on LEN of an account, where LEN is also generated by codama. In anchor account cases where data structures are not explicitly written proper 8-byte aligned values, the generated LEN is under that actual account length. This causes the try_unpack method to fail.

The std::mem::size_of::<MyAccount>() calculation on an account is correct. A potential solution could be to build those match arms with the std::mem::size_of::<MyAccount>(), but I have not thought through or tested implications of that change. I would like to see the use of discriminators in a flexible pattern, but I'll leave that for a separate issue.

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