2

I am having trouble compiling my solana project..

I seem to have a clash of publicKey types which i presume are caused by the solana_program and solana_sdk pubkey.

here is the error

    error[E0308]: mismatched types
    --> /Users/harris/.cargo/git/checkouts/solana-58d818797bb1766e/be9f17f/account-decoder/src/parse_account_data.rs:38:18
     |
28   |         m.insert(
     |         - ... which causes `m` to have type `HashMap<solana_sdk::pubkey::Pubkey, ParsableAccount>`
29   |             *ADDRESS_LOOKUP_PROGRAM_ID,
     |             -------------------------- this argument has type `solana_sdk::pubkey::Pubkey`...
...
38   |         m.insert(spl_token::id(), ParsableAccount::SplToken);
     |           ------ ^^^^^^^^^^^^^^^ expected `solana_sdk::pubkey::Pubkey`, found `Pubkey`
     |           |
     |           arguments to this method are incorrect
     |
     = note: `Pubkey` and `solana_sdk::pubkey::Pubkey` have similar names, but are actually distinct types
note: `Pubkey` is defined in crate `solana_program`
    --> /Users/harris/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solana-program-1.18.1/src/pubkey.rs:88:1
     |
88   | pub struct Pubkey(pub(crate) [u8; 32]);
     | ^^^^^^^^^^^^^^^^^
note: `solana_sdk::pubkey::Pubkey` is defined in crate `solana_program`
    --> /Users/harris/.cargo/git/checkouts/solana-58d818797bb1766e/be9f17f/sdk/program/src/pubkey.rs:92:1
     |
92   | pub struct Pubkey(pub(crate) [u8; 32]);
     | ^^^^^^^^^^^^^^^^^
     = note: perhaps two different versions of crate `solana_program` are being used?
note: method defined here
    --> /Users/harris/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/std/src/collections/hash/map.rs:1104:12
     |
1104 |     pub fn insert(&mut self, k: K, v: V) -> Option<V> {
     |            ^^^^^^

I am new to rust so this might just be something basic but i really am stumped - i take that it is a dependancy issue with them clashing.

[dependencies]
raydium-contract-instructions = {git="https://github.com/raydium-io/raydium-contract-instructions.git", branch = "master"}
tungstenite = {version = "0.20.1", features = ["rustls-tls-native-roots"] }
url = "2.5.0"
serde_json = "1.0.111"
bs58 = "0.5.0"
solana-sdk = "1.18.1"
solana-client = "1.18.1"
solana-program = "1.18.1"
bytemuck = { version = "1.14.0", features = [] }
safe-transmute = "0.11.2"
serum_dex = "0.5.4"
anyhow = "1.0.66"
spl-associated-token-account = "2.3.0"
solana-quic-client = { git = "https://github.com/solana-labs/solana.git", branch="master" }

Any suggestions are welcome

1 Answer 1

1
solana-quic-client = { git = "https://github.com/solana-labs/solana.git", branch="master" }

Was causing the issue, was pulling a weird/old version i suppose. Changed to

solana-quic-client = "1.18.1"

inline with the other solana package versions.

2
  • 1
    When specifying the git repo like this, you pull in the newest unreleased changes, which has other other fresh dependencies that aren't compatible. Nice job finding the solution on your own!
    – Jon C
    Commented Feb 6 at 17:37
  • Thanks for that!
    – MHCH
    Commented Feb 6 at 20:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.