4

Related to the Borsh serialize error the changes suggested by @acheron only work for running the program, but doesn't work or are ignored when publishing the crate to crates.io.

For instance when running cargo publish on a program with the following dependencies:

[dependencies]
anchor-lang = { version = "0.28.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.28.0", features = ["metadata"] }
solana-program = "=1.14.21"

throws many errors like this:

   --> src/system_program.rs:374:10
    |
374 | #[derive(Accounts)]
    |          ^^^^^^^^ the trait `BorshSerialize` is not implemented for `Pubkey`
    |
    = help: the following other types implement trait `BorshSerialize`:
              &T
              ()
              (T0, T1)
              (T0, T1, T2)
              (T0, T1, T2, T3)
              (T0, T1, T2, T3, T4)
              (T0, T1, T2, T3, T4, T5)
              (T0, T1, T2, T3, T4, T5, T6)
            and 81 others

Is there any way to have that cargo update -p [email protected] --precise 0.9.3 applied to cargo publish?

1 Answer 1

2

Try these constraints

anchor-lang = { version = "0.28.0", features = ["init-if-needed"] }
anchor-spl = { version = "0.28.0", features = ["metadata"] }
solana-program = "=1.14.17"

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.