pyth-network / pyth-network/pyth-crosschain

pyth-solana-receiver-sdk 1.2.0 compiles natively against anchor-lang 0.32.1

Open
#3,756 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
247
Forks
348
Avg merge
2d 1h
Merged PRs (30d)
27

Description

The issue is a version conflict: pyth-solana-receiver-sdk 1.2.0 internally depends on anchor-lang 0.32.1, but the project uses anchor-lang 1.0.2

pyth-solana-receiver-sdk 1.2.0 → anchor-lang 0.32.1 → borsh 0.10.4
pythnet-sdk 2.3.1 → anchor-lang 1.0.2 → borsh 1.6.1

[dependencies]
anchor-lang = { version = "1.0.2", features = ["init-if-needed"] }
anchor-spl = "1.0.2"
pyth-solana-receiver-sdk = "1.2.0"
getrandom = { version = "0.2", features = ["custom"] }
Error Details

Compiling pyth-solana-receiver-sdk v1.2.0
error[E0277]: the trait bound pythnet_sdk::messages::PriceFeedMessage: BorshSerialize is not satisfied
--> src/price_update.rs:49:1
|
49 | #[account]
| ^^^^^^^^^^ the trait BorshSerialize is not implemented for pythnet_sdk::messages::PriceFeedMessage
|
note: there are multiple different versions of crate borsh in the dependency graph
--> src/ser/mod.rs:44:1
|
= note: this is the required trait
|
::: src/lib.rs:5:5
|
5 | anchor_lang::{declare_id, prelude::*},
| -----------
| |
| one version of crate borsh used here, as a dependency of crate solana_pubkey
| one version of crate borsh used here, as a dependency of crate solana_pubkey
--> src/messages.rs:93:1
|
= note: this type doesn't implement the required trait
--> src/de/mod.rs:36:1
|
= note: this is the found trait
= help: you can use cargo tree to explore your dependency tree
= help: see issue #48214
= note: this error originates in the derive macro AnchorSerialize (in Nightly builds, run with -Z macro-backtrace for more info)
help: add #![feature(trivial_bounds)] to the crate attributes to enable
--> src/lib.rs:4:1
|
4 + #![feature(trivial_bounds)]
|

error[E0277]: the trait bound pythnet_sdk::messages::PriceFeedMessage: BorshDeserialize is not satisfied
--> src/price_update.rs:49:1
|
49 | #[account]
| ^^^^^^^^^^ the trait BorshDeserialize is not implemented for pythnet_sdk::messages::PriceFeedMessage
|
note: there are multiple different versions of crate borsh in the dependency graph
--> src/de/mod.rs:35:1
|
= note: this is the required trait
::: src/de/mod.rs:36:1
|
= note: this is the found trait
|
::: src/lib.rs:5:5
|
5 | anchor_lang::{declare_id, prelude::*},
| -----------
| |
| one version of crate borsh used here, as a dependency of crate solana_pubkey
| one version of crate borsh used here, as a dependency of crate solana_pubkey
--> src/messages.rs:93:1
|
= note: this type doesn't implement the required trait
= help: you can use cargo tree to explore your dependency tree
= help: see issue #48214
= note: this error originates in the derive macro AnchorDeserialize (in Nightly builds, run with -Z macro-backtrace for more info)
help: add #![feature(trivial_bounds)] to the crate attributes to enable
--> src/lib.rs:4:1
|
4 + #![feature(trivial_bounds)]
|

error[E0277]: the trait bound pythnet_sdk::messages::PriceFeedMessage: BorshSerialize is not satisfied
--> src/price_update.rs:49:1
|
49 | #[account]
| ^^^^^^^^^^ the trait BorshSerialize is not implemented for pythnet_sdk::messages::PriceFeedMessage
|
note: there are multiple different versions of crate borsh in the dependency graph
--> src/ser/mod.rs:44:1
|
= note: this is the required trait
|
::: src/lib.rs:5:5
|
5 | anchor_lang::{declare_id, prelude::*},
| -----------
| |
| one version of crate borsh used here, as a dependency of crate solana_pubkey
| one version of crate borsh used here, as a dependency of crate solana_pubkey
--> src/messages.rs:93:1
|
= note: this type doesn't implement the required trait
--> src/de/mod.rs:36:1
|
= note: this is the found trait
= help: you can use cargo tree to explore your dependency tree
note: required for PriceUpdateV2 to implement BorshSerialize
--> src/price_update.rs:49:1
|
49 | #[account]
| ^^^^^^^^^^ unsatisfied trait bound introduced in this derive macro
50 | #[derive(BorshSchema)]
51 | pub struct PriceUpdateV2 {
| ^^^^^^^^^^^^^
= note: this error originates in the attribute macro account which comes from the expansion of the derive macro AnchorSerialize (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound pythnet_sdk::messages::PriceFeedMessage: BorshDeserialize is not satisfied
--> src/price_update.rs:49:1
|
49 | #[account]
| ^^^^^^^^^^ the trait BorshDeserialize is not implemented for pythnet_sdk::messages::PriceFeedMessage
|
note: there are multiple different versions of crate borsh in the dependency graph
--> src/de/mod.rs:35:1
|
= note: this is the required trait
::: src/de/mod.rs:36:1
|
= note: this is the found trait
|
::: src/lib.rs:5:5
|
5 | anchor_lang::{declare_id, prelude::*},
| -----------
| |
| one version of crate borsh used here, as a dependency of crate solana_pubkey
| one version of crate borsh used here, as a dependency of crate solana_pubkey
--> src/messages.rs:93:1
|
= note: this type doesn't implement the required trait
= help: you can use cargo tree to explore your dependency tree
note: required for PriceUpdateV2 to implement BorshDeserialize
--> src/price_update.rs:49:1
|
49 | #[account]
| ^^^^^^^^^^ unsatisfied trait bound introduced in this derive macro
50 | #[derive(BorshSchema)]
51 | pub struct PriceUpdateV2 {
| ^^^^^^^^^^^^^
= note: this error originates in the attribute macro account which comes from the expansion of the derive macro AnchorDeserialize (in Nightly builds, run with -Z macro-backtrace for more info)

For more information about this error, try rustc --explain E0277.
error: could not compile pyth-solana-receiver-sdk (lib) due to 4 previous errors

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dependency declarations and run cargo tree to confirm the conflicting anchor-lang and borsh versions. Inspect src/price_update.rs, especially the PriceUpdateV2 account derives, and src/lib.rs for the Anchor imports. Done means the SDK compiles with the stated dependency versions without the Borsh trait errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
blockchain
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.