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

[solana-client] [2.0.1] - Multiple build errors #1860

Closed
Jamesmallon1 opened this issue Jun 25, 2024 · 1 comment
Closed

[solana-client] [2.0.1] - Multiple build errors #1860

Jamesmallon1 opened this issue Jun 25, 2024 · 1 comment

Comments

@Jamesmallon1
Copy link

Jamesmallon1 commented Jun 25, 2024

Problem

Rust Version: 1.79.0
IDE: Rust Rover
Affected Crate: solana-client
Affected Crate Version: 2.0.1

Solana Client fails to build due to a dependency issue with spl-token-2022 v3.0.2.
It appears that this dependency has been left behind and is currently breaking the application.

Reproducible Cargo File:

[package]
name = "networking"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
tokio = { version = "1.37.0", features = ["full"] }
tokio-tungstenite = { version = "0.21.0", features = ["native-tls"] }
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"
futures-util = { version = "0.3.30" }
solana-client = "2.0.1"
async-trait = "0.1.80"
log = "0.4.21"
reqwest = { version = "0.12.4", features = ['json'] }
serde_urlencoded = "0.7.1"
rust_decimal = "1.35.0"

Error examples:

error[E0308]: mismatched types
    --> /Users/jamesmallon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-token-2022-3.0.2/src/extension/confidential_transfer/instruction.rs:784:27
     |
784  |         instructions.push(verify_pubkey_validity(None, proof_data));
     |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found a different `Instruction`
     |                      |
     |                      arguments to this method are incorrect
     |
     = note: `Instruction` and `Instruction` have similar names, but are actually distinct types
note: `Instruction` is defined in crate `solana_program`
    --> /Users/jamesmallon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.17/src/instruction.rs:329:1
     |
329  | pub struct Instruction {
     | ^^^^^^^^^^^^^^^^^^^^^^
note: `Instruction` is defined in crate `solana_program`
    --> /Users/jamesmallon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-2.0.1/src/instruction.rs:332:1
     |
332  | pub struct Instruction {
     | ^^^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
    --> /Users/jamesmallon/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:1993:12
     |
1993 |     pub fn push(&mut self, value: T) {
     |            ^^^^

error[E0308]: mismatched types
    --> /Users/jamesmallon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/spl-token-2022-3.0.2/src/extension/confidential_transfer/instruction.rs:1204:27
     |
1204 |         instructions.push(verify_transfer_with_fee(None, proof_data));
     |                      ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `Instruction`, found a different `Instruction`
     |                      |
     |                      arguments to this method are incorrect
     |
     = note: `Instruction` and `Instruction` have similar names, but are actually distinct types
note: `Instruction` is defined in crate `solana_program`
    --> /Users/jamesmallon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.17/src/instruction.rs:329:1
     |
329  | pub struct Instruction {
     | ^^^^^^^^^^^^^^^^^^^^^^
note: `Instruction` is defined in crate `solana_program`
    --> /Users/jamesmallon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-2.0.1/src/instruction.rs:332:1
     |
332  | pub struct Instruction {
     | ^^^^^^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
    --> /Users/jamesmallon/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/alloc/src/vec/mod.rs:1993:12
     |
1993 |     pub fn push(&mut self, value: T) {
     |            ^^^^


Proposed Solution

Bring solana-client up to speed with the rest of the upgraded crates.

@joncinque
Copy link

The crates are all up to speed, but most likely your Cargo.lock is using two different versions of solana-program. You can either edit the lockfile by hand to remove entries of solana-program 1.18.X, or clear your lockfile and regenerate it with updated dependencies.

If you create a new project with the Cargo.toml you've provided, the build will actually succeed!

@joncinque joncinque closed this as not planned Won't fix, can't repro, duplicate, stale Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants