Skip to content

PriceUpdateV2 LEN #1871

@adrena-orex

Description

@adrena-orex

Issue

Deserializing an PriceUpdateV2 account info using AnchorDeserialize::try_from_slice(data) fails.

Note: Using PriceUpdateV2::try_deserialize(&mut data) works.

Cause

The PriceUpdateV2 structure have a size of 136 bytes, while LEN is 134 and onchain accounts are 134 bytes.

Onchain Account Example

Screenshot 2024-09-04 at 17 05 43

https://explorer.solana.com/address/7UVimffxr9ow1uXYxsr4LHAcV58mLzhmwaeKvJ1pjLiE?cluster=devnet

PriceUpdateV2 struct in the code

#[account]
#[derive(BorshSchema)]
pub struct PriceUpdateV2 {
    pub write_authority:    Pubkey,
    pub verification_level: VerificationLevel,
    pub price_message:      PriceFeedMessage,
    pub posted_slot:        u64,
}

impl PriceUpdateV2 {
    pub const LEN: usize = 8 + 32 + 2 + 32 + 8 + 8 + 4 + 8 + 8 + 8 + 8 + 8;
}

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