Skip to content

Getting Invalid Account Size for pyth_sdk_solana::state::SolanaPriceAccount, which differs from pyth_solana_receiver_sdk::price_update::PriceUpdateV2 #132

Open
@DJPoland

Description

@DJPoland

I have the following Rust code:

let sol_usd_price_feed = Pubkey::from_str("H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG")?;
let account = rpc_client.get_account(&sol_usd_price_feed)?;
let price_account: &pyth_sdk_solana::state::SolanaPriceAccount = load_price_account(&account.data)?;

println!("{:?}", price_account);

Yet the data I am getting is possibly stale? Payload is the following:

GenericPriceAccount { magic: 2712847316, ver: 2, atype: 3, size: 3312, ptype: Price, expo: -8, num: 0, num_qt: 1, last_slot: 281687928, valid_slot: 299058481, ema_price: Rational { val: 12068220500, numer: 888720031, denom: 7364134588 }, ema_conf: Rational { val: 13079402, numer: 963184796, denom: 7364134588 }, timestamp: 1730534
860, min_pub: 255, drv2: 0, drv3: 50, drv4: 0, prod: ALP8SdU9oARYVLgLR7LrqMNCYBnhtnQz1cj6bwgwQmgj, next: 11111111111111111111111111111111, prev_slot: 281687928, prev_price: 11923378000, prev_conf: 16676631, prev_timestamp: 1722852532, agg: PriceInfo { price: 11923378000, conf: 16676631, status: Unknown, corp_act: NoCorpAct, pub_s
lot: 299058484 }, comp: [PriceComp { publisher: 11111111111111111111111111111111, agg: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 }, latest: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 } }, PriceComp { publisher: 11111111111111111111111111111111, agg: Pric
eInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 }, latest: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 } }, PriceComp { publisher: 11111111111111111111111111111111, agg: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 }, latest: Pri
ceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 } }, PriceComp { publisher: 11111111111111111111111111111111, agg: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 }, latest: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 } }, PriceCom
p { publisher: 11111111111111111111111111111111, agg: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 }, latest: PriceInfo { price: 0, conf: 0, status: Unknown, corp_act: NoCorpAct, pub_slot: 0 } }, PriceComp { publisher: 11111111111111111111111111111111, agg: PriceInfo { price: 0, conf: 0, status

I am referencing the sol/usd price feed from https://www.pyth.network/price-feeds/crypto-sol-usd, yet for some reason the data that is being fetched from H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG pubkey has a price of 12068220500 which I would assume would be something like 15910708767 as price today is ~$159. My guess is that pubkey is incorrect, or load_price_account is doing something wrong with solana accounts of that sort.

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