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

chore(pyth-solana-receiver-sdk): enable solana-program >= 2 (and thus anchor-lang 0.31.0) #2504

Merged
merged 1 commit into from
Mar 20, 2025

Conversation

tejasbadadare
Copy link
Contributor

Summary

Remove the solana-program<2 bound in our pyth-solana-receiver-sdk dependencies to enable using the SDK with anchor 0.31.0.

Rationale

  • anchor-lang v0.31.0 requires solana-program=^2. Thus, this change enables using anchor 0.31.0 with our SDK. This change has been requested by a few consumers.
  • bytemuck_derive has been restricted to <=1.8.1 since after this version, minimum rust version 1.84 is required, which breaks compatibility with the other packages in the workspace.
  • We did not bump the minimum anchor version to 0.31.0 since solana-program ^2 requires a higher rust version, which would also break compatibility with other packages in the workspace.
  • Once this lands, I'll publish this repo to our GH org which shows a example of using the SDK with anchor 0.31.0 (and other versions).

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Sorry, something went wrong.

Copy link

vercel bot commented Mar 19, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Mar 19, 2025 9:48pm
component-library ⬜️ Ignored (Inspect) Mar 19, 2025 9:48pm
entropy-debugger ⬜️ Ignored (Inspect) Mar 19, 2025 9:48pm
insights ⬜️ Ignored (Inspect) Mar 19, 2025 9:48pm
proposals ⬜️ Ignored (Inspect) Mar 19, 2025 9:48pm
staking ⬜️ Ignored (Inspect) Mar 19, 2025 9:48pm

pythnet-sdk = { path = "../../../pythnet/pythnet_sdk", version = "2.1.0", features = [
"solana-program",
] }
solana-program = ">=1.16.0, <2.0.0"
solana-program = ">=1.16.0"
Copy link
Contributor

Choose a reason for hiding this comment

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

actually anchor people recommend against having solana-program here and encourage using the reexport in anchor_lang::solana_program , can you try that for the sdk

Copy link
Contributor Author

@tejasbadadare tejasbadadare Mar 19, 2025

Choose a reason for hiding this comment

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

Yeah I saw that in the migration notes, (and its in my cursed WIP PR).

This is tricky because we use the pubkey! macro in lib.rs, but this comes from the solana-program crate, not the reexport. See here: coral-xyz/anchor#3021
Their conclusion was just to have consumers specify a solana-program in their Cargo.toml and rely on dependency resolution to figure it out.

Later on they added the macro to the anchor prelude, but this isn't available in 0.28.0, which we need to support due to the other packages in the workspace that need 0.28.0 and have a path dependency on the SDK.

We could publish v0.6.0 of the SDK which enforces anchor-lang>=0.31 and uses the reexport, and then have the workspace programs depend on 0.5.0 of the SDK rather than the path dependency. But of course this removes some of the utility of having the workspace. I think its okay in this case to explicitly depend on solana-program>=1.16.0, especially since we don't use anything that broke in v2.

@tejasbadadare tejasbadadare merged commit 30efb0d into main Mar 20, 2025
8 checks passed
@tejasbadadare tejasbadadare deleted the tb/pyth-solana-receiver-sdk/enable-solana-v2 branch March 20, 2025 22:38
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.

None yet

3 participants