5

I am running anchor build and faced into an issue mentioned on Anchor discord.enter image description here

After fixing this issue by adding to dependencies, now I am facing this error even if I do not use spl-token-2022. Here is the Cargo.toml file.

[dependencies]
solana-program = "1.14.16"
anchor-spl = "0.27.0"
num-derive = "0.3.3"
num-traits = "0.2.15"
nom = "7"
spl-token = "3.5.0"
spl-associated-token-account = {version = "1.0.3", features = ["no-entrypoint"]}
switchboard-v2 = "0.1.23"

anchor-lang = { version = "0.27.0", features = ["init-if-needed"] }
winnow = "=0.4.1"
toml_datetime = "=0.6.1"

Error msg (ignoring long top log). Not code from my program.

...
error[E0609]: no field `destination_ciphertext` on type `&solana_zk_token_sdk::instruction::WithdrawWithheldTokensData`
    --> src/extension/confidential_transfer/processor.rs:1143:21
     |
1143 |         &proof_data.destination_ciphertext,
     |                     ^^^^^^^^^^^^^^^^^^^^^^ unknown field
     |
     = note: available fields are: `context`, `proof`
help: one of the expressions' fields has a field of the same name
     |
1143 |         &proof_data.context.destination_ciphertext,
     |                     ++++++++

Some errors have detailed explanations: E0061, E0599, E0609.
For more information about an error, try `rustc --explain E0061`.
error: could not compile `spl-token-2022` due to 43 previous errors

In Cargo.lock, there are two spl-token-2022 package with version 0.5.0 and 0.6.1 each.

[[package]]
name = "anchor-spl"
version = "0.27.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75cc8066fbd45e0e03edf48342c79265aa34ca76cefeace48ef6c402b6946665"
dependencies = [
 "anchor-lang",
 "solana-program",
 "spl-associated-token-account",
 "spl-token",
 "spl-token-2022 0.5.0",
]

[[package]]
name = "spl-associated-token-account"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978dba3bcbe88d0c2c58366c254d9ea41c5f73357e72fc0bdee4d6b5fc99c8f4"
dependencies = [
 "assert_matches",
 "borsh",
 "num-derive",
 "num-traits",
 "solana-program",
 "spl-token",
 "spl-token-2022 0.6.1",
 "thiserror",
]
1
  • Have exactly the same May 24, 2023 at 14:25

1 Answer 1

5

This fixed it for me:

anchor-lang = { git = "https://github.com/coral-xyz/anchor.git", features = ["init-if-needed"]}
anchor-spl = { git = "https://github.com/coral-xyz/anchor.git"}

It seems the issue stems from a certain version of spl-token-2022 with a deprecated dependency. The newer one works for me so far.

1
  • 1
    How can i fix this with the new 0.28.0. If i point to git, it takes from 0.28.0 but i want to stay in 0.27.0 since my other deps would break. Jun 16, 2023 at 17:00

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.