-
Notifications
You must be signed in to change notification settings - Fork 55
Open
Description
The last Anchor version that seems to be supported is 0.30.1
.
After having encountered the issue in a personal project, I've validated it against the Solana Starter Kit repo - and was able to consistently reproduce it.
Reproduction steps:
- Clone solana starter kit
- Run
anchor build
— observe that it succeeds - In
Cargo.toml
, update theanchor-lang
dependency to0.31.1
- Update the corresponding NPM package with
yarn upgrade @coral-xyz/[email protected]
- Run
anchor build
again - and not that it fails.
Expected behavior:
The project should build successfully with newer Anchor versions (>= 0.31.1).
Actual behavior:
Build fails after upgrading to Anchor 0.31.1.
The output of the failed `anchor build` run that I'm getting
Compiling proc-macro2 v1.0.86
Compiling unicode-ident v1.0.12
Compiling version_check v0.9.4
Compiling typenum v1.15.0
Compiling libc v0.2.155
Compiling syn v1.0.85
Compiling serde v1.0.204
Compiling unicode-xid v0.2.2
Compiling thiserror v1.0.63
Compiling serde_json v1.0.122
Compiling semver v1.0.4
Compiling anyhow v1.0.52
Compiling itoa v1.0.1
Compiling ryu v1.0.9
Compiling cfg-if v1.0.0
Compiling unicode-segmentation v1.8.0
Compiling bs58 v0.5.1
Compiling memchr v2.7.4
Compiling autocfg v1.0.1
Compiling heck v0.3.3
Compiling generic-array v0.14.7
Compiling proc-macro-error-attr v1.0.4
Compiling once_cell v1.19.0
Compiling proc-macro-error v1.0.4
Compiling equivalent v1.0.1
Compiling subtle v2.4.1
Compiling hashbrown v0.14.5
Compiling rustc_version v0.4.0
Compiling indexmap v2.3.0
Compiling ahash v0.8.11
Compiling toml_datetime v0.6.8
Compiling feature-probe v0.1.1
Compiling winnow v0.5.40
Compiling rustversion v1.0.17
Compiling bv v0.11.1
Compiling quote v1.0.36
Compiling syn v2.0.72
Compiling cpufeatures v0.2.1
Compiling jobserver v0.1.32
Compiling cfg_aliases v0.2.1
Compiling zerocopy v0.7.35
Compiling borsh v1.5.1
Compiling cc v1.1.7
Compiling memoffset v0.9.1
Compiling toml_edit v0.21.1
Compiling num-traits v0.2.19
Compiling ahash v0.7.8
Compiling block-buffer v0.10.4
Compiling crypto-common v0.1.6
Compiling digest v0.10.7
Compiling sha2 v0.10.8
Compiling hashbrown v0.13.2
Compiling proc-macro-crate v3.1.0
Compiling solana-frozen-abi-macro v1.18.20
Compiling log v0.4.22
Compiling constant_time_eq v0.3.0
Compiling arrayvec v0.7.4
Compiling arrayref v0.3.6
Compiling lazy_static v1.4.0
Compiling keccak v0.1.5
Compiling solana-frozen-abi v1.18.20
Compiling sha3 v0.10.8
Compiling getrandom v0.2.15
Compiling solana-program v2.0.25
Compiling borsh-derive-internal v0.10.3
Compiling borsh-schema-derive-internal v0.10.3
Compiling borsh-schema-derive-internal v0.9.3
Compiling borsh-derive-internal v0.9.3
Compiling hashbrown v0.11.2
Compiling bs58 v0.4.0
Compiling either v1.13.0
Compiling itertools v0.10.5
Compiling base64 v0.21.7
Compiling blake3 v1.5.1
Compiling solana-program v1.18.20
Compiling anchor-derive-space v0.31.1
Compiling serde_derive v1.0.204
Compiling thiserror-impl v1.0.63
Compiling syn_derive v0.1.8
Compiling bytemuck_derive v1.7.0
Compiling num-derive v0.4.2
Compiling solana-sdk-macro v2.0.25
Compiling solana-sdk-macro v1.18.20
Compiling borsh-derive v1.5.1
Compiling bytemuck v1.16.3
Compiling serde_bytes v0.11.15
Compiling bincode v1.3.3
Compiling toml v0.5.8
Compiling anchor-lang-idl-spec v0.1.0
Compiling anchor-syn v0.31.1
Compiling anchor-lang-idl v0.1.2
Compiling proc-macro-crate v0.1.5
Compiling borsh-derive v0.10.3
Compiling borsh-derive v0.9.3
Compiling borsh v0.9.3
Compiling borsh v0.10.3
Compiling anchor-derive-serde v0.31.1
Compiling anchor-attribute-access-control v0.31.1
Compiling anchor-derive-accounts v0.31.1
Compiling anchor-attribute-constant v0.31.1
Compiling anchor-attribute-event v0.31.1
Compiling anchor-attribute-error v0.31.1
Compiling anchor-attribute-account v0.31.1
Error: Function _ZN4core5slice4sort6stable14driftsort_main17hdf5f1fdd79b92c70E Stack offset of 4104 exceeded max offset of 4096 by 8 bytes, please minimize large stack variables. Estimated function frame size: 4160 bytes. Exceeding the maximum stack offset may cause undefined behavior during execution.
Error: Function _ZN4core5slice4sort6stable14driftsort_main17h746ad55ff80ce04cE Stack offset of 4104 exceeded max offset of 4096 by 8 bytes, please minimize large stack variables. Estimated function frame size: 4160 bytes. Exceeding the maximum stack offset may cause undefined behavior during execution.
Compiling chainlink_solana v1.0.0
Compiling anchor-attribute-program v0.31.1
Compiling anchor-lang v0.31.1
Compiling chainlink-solana-demo v0.1.0 (/Users/iaros/Desktop/Projects/solana-starter-kit/programs/chainlink_solana_demo)
warning: unexpected `cfg` condition value: `custom-heap`
--> programs/chainlink_solana_demo/src/lib.rs:7:1
|
7 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= help: consider adding `custom-heap` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default
= note: this warning originates in the macro `$crate::custom_heap_default` which comes from the expansion of the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `custom-panic`
--> programs/chainlink_solana_demo/src/lib.rs:7:1
|
7 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= help: consider adding `custom-panic` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the macro `$crate::custom_panic_default` which comes from the expansion of the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `anchor-debug`
--> programs/chainlink_solana_demo/src/lib.rs:7:1
|
7 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= help: consider adding `anchor-debug` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the attribute macro `program` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `anchor-debug`
--> programs/chainlink_solana_demo/src/lib.rs:7:1
|
7 | #[program]
| ^^^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= help: consider adding `anchor-debug` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unexpected `cfg` condition value: `anchor-debug`
--> programs/chainlink_solana_demo/src/lib.rs:40:10
|
40 | #[derive(Accounts)]
| ^^^^^^^^
|
= note: expected values for `feature` are: `cpi`, `default`, `idl-build`, `no-entrypoint`, `no-idl`, and `no-log-ix-name`
= help: consider adding `anchor-debug` as a feature in `Cargo.toml`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
= note: this warning originates in the derive macro `Accounts` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: arguments to this function are incorrect
--> programs/chainlink_solana_demo/src/lib.rs:16:28
|
16 | let round: Round = chainlink::latest_round_data(
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
17 | ctx.accounts.chainlink_program.to_account_info(),
| ------------------------------------------------ expected `AccountInfo<'_>`, found a different `AccountInfo<'_>`
18 | ctx.accounts.chainlink_feed.to_account_info(),
| --------------------------------------------- expected `AccountInfo<'_>`, found a different `AccountInfo<'_>`
|
= note: `AccountInfo<'_>` and `AccountInfo<'_>` have similar names, but are actually distinct types
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
= note: perhaps two different versions of crate `solana_program` are being used?
= note: `AccountInfo<'_>` and `AccountInfo<'_>` have similar names, but are actually distinct types
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
= note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
--> src/lib.rs:98:8
error[E0277]: `?` couldn't convert the error to `anchor_lang::error::Error`
--> programs/chainlink_solana_demo/src/lib.rs:19:10
|
15 | ) -> Result<()> {
| ---------- expected `anchor_lang::error::Error` because of this
16 | let round: Round = chainlink::latest_round_data(
| ____________________________-
17 | | ctx.accounts.chainlink_program.to_account_info(),
18 | | ctx.accounts.chainlink_feed.to_account_info(),
19 | | )?;
| | -^ the trait `From<solana_program::program_error::ProgramError>` is not implemented for `anchor_lang::error::Error`
| |_________|
| this can't be annotated with `?` because it has type `Result<_, solana_program::program_error::ProgramError>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`anchor_lang::error::Error` implements `From<ErrorCode>`
`anchor_lang::error::Error` implements `From<ProgramErrorWithOrigin>`
`anchor_lang::error::Error` implements `From<TryFromIntError>`
`anchor_lang::error::Error` implements `From<anchor_lang::error::AnchorError>`
`anchor_lang::error::Error` implements `From<anchor_lang::prelude::ProgramError>`
`anchor_lang::error::Error` implements `From<std::io::Error>`
= note: required for `std::result::Result<(), anchor_lang::error::Error>` to implement `FromResidual<std::result::Result<Infallible, solana_program::program_error::ProgramError>>`
error[E0308]: arguments to this function are incorrect
--> programs/chainlink_solana_demo/src/lib.rs:21:35
|
21 | let description: String = chainlink::description(
| ^^^^^^^^^^^^^^^^^^^^^^
22 | ctx.accounts.chainlink_program.to_account_info(),
| ------------------------------------------------ expected `AccountInfo<'_>`, found a different `AccountInfo<'_>`
23 | ctx.accounts.chainlink_feed.to_account_info(),
| --------------------------------------------- expected `AccountInfo<'_>`, found a different `AccountInfo<'_>`
|
= note: `AccountInfo<'_>` and `AccountInfo<'_>` have similar names, but are actually distinct types
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
= note: perhaps two different versions of crate `solana_program` are being used?
= note: `AccountInfo<'_>` and `AccountInfo<'_>` have similar names, but are actually distinct types
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
= note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
--> src/lib.rs:90:8
error[E0277]: `?` couldn't convert the error to `anchor_lang::error::Error`
--> programs/chainlink_solana_demo/src/lib.rs:24:10
|
15 | ) -> Result<()> {
| ---------- expected `anchor_lang::error::Error` because of this
...
21 | let description: String = chainlink::description(
| ___________________________________-
22 | | ctx.accounts.chainlink_program.to_account_info(),
23 | | ctx.accounts.chainlink_feed.to_account_info(),
24 | | )?;
| | -^ the trait `From<solana_program::program_error::ProgramError>` is not implemented for `anchor_lang::error::Error`
| |_________|
| this can't be annotated with `?` because it has type `Result<_, solana_program::program_error::ProgramError>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`anchor_lang::error::Error` implements `From<ErrorCode>`
`anchor_lang::error::Error` implements `From<ProgramErrorWithOrigin>`
`anchor_lang::error::Error` implements `From<TryFromIntError>`
`anchor_lang::error::Error` implements `From<anchor_lang::error::AnchorError>`
`anchor_lang::error::Error` implements `From<anchor_lang::prelude::ProgramError>`
`anchor_lang::error::Error` implements `From<std::io::Error>`
= note: required for `std::result::Result<(), anchor_lang::error::Error>` to implement `FromResidual<std::result::Result<Infallible, solana_program::program_error::ProgramError>>`
error[E0308]: arguments to this function are incorrect
--> programs/chainlink_solana_demo/src/lib.rs:26:28
|
26 | let decimals: u8 = chainlink::decimals(
| ^^^^^^^^^^^^^^^^^^^
27 | ctx.accounts.chainlink_program.to_account_info(),
| ------------------------------------------------ expected `AccountInfo<'_>`, found a different `AccountInfo<'_>`
28 | ctx.accounts.chainlink_feed.to_account_info())?;
| --------------------------------------------- expected `AccountInfo<'_>`, found a different `AccountInfo<'_>`
|
= note: `AccountInfo<'_>` and `AccountInfo<'_>` have similar names, but are actually distinct types
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
= note: perhaps two different versions of crate `solana_program` are being used?
= note: `AccountInfo<'_>` and `AccountInfo<'_>` have similar names, but are actually distinct types
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
note: `AccountInfo<'_>` is defined in crate `solana_program`
--> src/account_info.rs:19:1
= note: perhaps two different versions of crate `solana_program` are being used?
note: function defined here
--> src/lib.rs:82:8
error[E0277]: `?` couldn't convert the error to `anchor_lang::error::Error`
--> programs/chainlink_solana_demo/src/lib.rs:28:59
|
15 | ) -> Result<()> {
| ---------- expected `anchor_lang::error::Error` because of this
...
26 | let decimals: u8 = chainlink::decimals(
| ____________________________-
27 | | ctx.accounts.chainlink_program.to_account_info(),
28 | | ctx.accounts.chainlink_feed.to_account_info())?;
| | -^ the trait `From<solana_program::program_error::ProgramError>` is not implemented for `anchor_lang::error::Error`
| |__________________________________________________________|
| this can't be annotated with `?` because it has type `Result<_, solana_program::program_error::ProgramError>`
|
= note: the question mark operation (`?`) implicitly performs a conversion on the error value using the `From` trait
= help: the following other types implement trait `From<T>`:
`anchor_lang::error::Error` implements `From<ErrorCode>`
`anchor_lang::error::Error` implements `From<ProgramErrorWithOrigin>`
`anchor_lang::error::Error` implements `From<TryFromIntError>`
`anchor_lang::error::Error` implements `From<anchor_lang::error::AnchorError>`
`anchor_lang::error::Error` implements `From<anchor_lang::prelude::ProgramError>`
`anchor_lang::error::Error` implements `From<std::io::Error>`
= note: required for `std::result::Result<(), anchor_lang::error::Error>` to implement `FromResidual<std::result::Result<Infallible, solana_program::program_error::ProgramError>>`
Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
warning: `chainlink-solana-demo` (lib) generated 10 warnings (5 duplicates)
error: could not compile `chainlink-solana-demo` (lib) due to 6 previous errors; 10 warnings emitted
PaulRBerg
Metadata
Metadata
Assignees
Labels
No labels