Solana SDK compatibility Issue

Hi, somewhat of a noob but having a hell of a time getting a working oracle setup.

I keep getting anchor dependency mismatches using Anchor 0.30.1 even though the docs say 0.30.1 is recommended.

I can’t find much online. Tried pinning version, but no dice. Can someone post me versions/dependency setup that’s working for you?

Hey!

First of all, I recommend that you look at this repo anchor-pyth/programs/anchor-pyth at main · guibescos/anchor-pyth · GitHub , whose branches have an anchor setup for v0.28.0, v0.29.0 and v0.30.1.

This link teaches you how to adjust the versions of the packages in your anchor workspace.

After this, you should be able to compile the program using cargo-build-sbf.

You might get more errors from IDL generation when running anchor build, this is because IDL generation uses the most recent nightly version of rust in your machine, and the current versions are not compatible with anchor v0.30.1.

You can override the nightly version used for IDL generation with the env variable RUSTUP_TOOLCHAIN. Try:

RUSTUP_TOOLCHAIN=“nightly-2024-06-20-aarch64-apple-darwin” anchor build

Let us know if you encounter more errors.

ahh dude thanks for that pivotal piece. Granted i’m a novice, but the pyth integration was not a smooth journey for me! Will post here in case others find it helpful, but it’s a bit of a dependency jigsaw puzzle.

My Cargo.toml ended up as:

[workspace]
members = [“programs/*”]
resolver = “2”

[workspace.dependencies]
anchor-lang = “=0.30.1”
anchor-spl = “=0.30.1”
pyth-solana-receiver-sdk = “=0.3.2”
solana-program = “=1.18.17”

[profile.release]
overflow-checks = true

Note I also had to downgrade to proc-macro2 1.0.94.

RUSTUP_TOOLCHAIN=“nightly-2024-06-20-aarch64-apple-darwin” anchor build

^^^ this was also a must.

Thanks again @guibescos

Hi guys apologise for the wait. Our devs just created this

crates.io: Rust Package Registry v1.0.0.

This updated version of the Pyth Core Solana sdk is compatible with solana v2.x.x and anchor v0.31.1 (the most recent versions of anchor and solana).

Here’s an example anchor workspace that uses it:

Hope this can help, let us know

1 Like