Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'new_from_bytes' function and update dependencies #75

Merged
merged 9 commits into from
Dec 1, 2022

Conversation

0xripleys
Copy link
Contributor

@0xripleys 0xripleys commented Nov 30, 2022

  1. In our program, once we bump the solana version >= 1.10, there are some rust lifetime issues with using AggregatorAccountData::new(account_info) that currently seem unfixable. I can get you an error snippet if you need one. The easy solution is to make a similar function that takes in a slice of bytes (instead of an account info), which avoids the lifetime stuff entirely.
  2. anchor 0.25.0 uses solana 1.10 which currently seems broken due to Building for BPF fails using the latest mainnet release solana-labs/solana#28711 . Talked to anchor devs and they're gonna release 0.26 in a couple weeks, which should hopefully resolve the problem. In the meantime i use the master branch

(1) should probably be merged, (2) probably not

fn discriminator() -> [u8; 8] {
[50, 35, 51, 115, 169, 219, 158, 52]
}
const DISCRIMINATOR: [u8; 8] = [50, 35, 51, 115, 169, 219, 158, 52];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anchor made a breaking change here.

solana-program = "~1.10.29"
anchor-lang = { git = "https://github.com/coral-xyz/anchor.git" }
anchor-spl = { git = "https://github.com/coral-xyz/anchor.git" }
rust_decimal = "1.26.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this rust decimal change isn't necessary

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

rust/switchboard-v2/Cargo.toml Show resolved Hide resolved
solana-program = "~1.10.29"
anchor-lang = { git = "https://github.com/coral-xyz/anchor.git" }
anchor-spl = { git = "https://github.com/coral-xyz/anchor.git" }
rust_decimal = "1.26.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

///
/// let data_feed = AggregatorAccountData::new(feed_account_info.try_borrow_data()?)?;
/// ```
pub fn new_from_bytes(data: &[u8]) -> anchor_lang::Result<&AggregatorAccountData> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

rust/switchboard-v2/Cargo.toml Show resolved Hide resolved
@mgild mgild merged commit c8d04b0 into switchboard-xyz:main Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants