solana: Compilation error on solana_program vote state
Problem
The dependencies of the program I’m building right now got updated today automatically during compilation, and I’m now getting the following error. Note: I’m not deserializing a VoteState in my program.
$ cargo build-sbf && solana program deploy target/deploy/onocoy_common.so
Compiling proc-macro2 v1.0.51
Compiling unicode-ident v1.0.6
Compiling quote v1.0.23
Compiling syn v1.0.107
Compiling version_check v0.9.4
Compiling autocfg v1.1.0
Compiling semver v1.0.16
Compiling typenum v1.16.0
Compiling libc v0.2.139
Compiling serde_derive v1.0.152
Compiling serde v1.0.152
Compiling subtle v2.4.1
Compiling feature-probe v0.1.1
Compiling cfg-if v1.0.0
Compiling once_cell v1.17.0
Compiling memchr v2.5.0
Compiling rustversion v1.0.11
Compiling log v0.4.17
Compiling serde_json v1.0.92
Compiling thiserror v1.0.38
Compiling ryu v1.0.12
Compiling itoa v1.0.5
Compiling hashbrown v0.12.3
Compiling bs58 v0.4.0
Compiling constant_time_eq v0.2.4
Compiling keccak v0.1.3
Compiling lazy_static v1.4.0
Compiling toml_datetime v0.5.1
Compiling arrayref v0.3.6
Compiling arrayvec v0.7.2
Compiling either v1.8.1
Compiling base64 v0.13.1
Compiling assert_matches v1.5.0
Compiling generic-array v0.14.6
Compiling ahash v0.7.6
Compiling indexmap v1.9.2
Compiling num-traits v0.2.15
Compiling memoffset v0.8.0
Compiling bv v0.11.1
Compiling itertools v0.10.5
Compiling rustc_version v0.4.0
Compiling jobserver v0.1.25
Compiling nom8 v0.2.0
Compiling cc v1.0.79
Compiling solana-frozen-abi-macro v1.15.0
Compiling solana-frozen-abi v1.15.0
Compiling hashbrown v0.11.2
Compiling crypto-common v0.1.6
Compiling block-buffer v0.10.3
Compiling digest v0.10.6
Compiling sha2 v0.10.6
Compiling sha3 v0.10.6
Compiling blake3 v1.3.3
Compiling solana-program v1.15.0
Compiling toml_edit v0.18.1
Compiling toml v0.5.11
Compiling proc-macro-crate v1.3.0
Compiling proc-macro-crate v0.1.5
Compiling borsh-schema-derive-internal v0.9.3
Compiling borsh-derive-internal v0.9.3
Compiling thiserror-impl v1.0.38
Compiling borsh-derive v0.9.3
Compiling bytemuck_derive v1.4.0
Compiling num-derive v0.3.3
Compiling solana-sdk-macro v1.15.0
Compiling num_enum_derive v0.5.9
Compiling borsh v0.9.3
Compiling bytemuck v1.13.0
Compiling num_enum v0.5.9
Compiling serde_bytes v0.11.9
Compiling bincode v1.3.3
Error: Function _ZN14solana_program4vote5state9VoteState11deserialize17h65a0b753d702898aE Stack offset of 6344 exceeded max offset of 4096 by 2248 bytes, please minimize large stack variables
Error: Function _ZN229_$LT$solana_program..vote..state..vote_state_0_23_5.._..$LT$impl$u20$serde..de..Deserialize$u20$for$u20$solana_program..vote..state..vote_state_0_23_5..VoteState0_23_5$GT$..deserialize..__Visitor$u20$as$u20$serde..de..Visitor$GT$9visit_seq17hddbace8385e2b5daE Stack offset of 5752 exceeded max offset of 4096 by 1656 bytes, please minimize large stack variables
Compiling solana-zk-token-sdk v1.15.0
Compiling spl-memo v3.0.1
Compiling spl-token v3.5.0
Compiling spl-token-2022 v0.5.0
Compiling spl-associated-token-account v1.1.2
Compiling onocoy-common v0.1.0 (/Users/nathandm/dev/onocoy/protocol/programs/common)
Finished release [optimized] target(s) in 46.80s
Program Id: BRUWBDfztfuRHPCVAYgF2mma91PwZLtayCiQoqs69UTb
Here are my dependencies:
[dependencies]
borsh = "0.9.3"
solana-program = "1.14.12"
spl-token = { version="~3.5.0", features = [ "no-entrypoint" ] }
spl-associated-token-account = { version="~1.1.2", features = [ "no-entrypoint" ] }
thiserror = "~1.0.38"
I first suspected the new version of solana-zk-token-sdk (1.15.0) to be the cause of the error. But I pinned the former version (1.14.12) and still got the error, this time popping just before Compiling spl-token v3.5.0.
Given that both programs haven’t been updated for some time, while solana-program has been recently, I’m sharing this error here as it’s the source repo of solana-program.
Also, in Cargo.lock, I notice that solana-program has been moved to 1.15.0 (despite being pinned to 1.14.12). I don’t get why (but it might be me misunderstanding something about cargo dependency mgt).
Most importantly though, the program is still working fine.
Any thoughts?
Note: someone shared the same error recently on Solana Stackexchange: https://solana.stackexchange.com/questions/5651/stack-offset-error-for-anchor-build
Proposed Solution
Fix this error.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 2
- Comments: 17 (5 by maintainers)
Commits related to this issue
- remove VoteState::deserialize() from sbf builds the existing deserialize implementation overruns the stack and is unusable this silences a warning to that effect which all solana_program importers re... — committed to 2501babe/solana by 2501babe a year ago
- remove VoteState::deserialize() from sbf builds the existing deserialize implementation overruns the sbf stack and is unusable in a program context this silences a warning to that effect which all so... — committed to 2501babe/solana by 2501babe a year ago
- remove VoteState::deserialize() from sbf builds the existing deserialize implementation overruns the sbf stack and is unusable in a program context this silences a warning to that effect which all so... — committed to 2501babe/solana by 2501babe a year ago
- remove VoteState::deserialize() from sbf builds (#30515) the existing deserialize implementation overruns the sbf stack and is unusable in a program context this silences a warning to that effect wh... — committed to solana-labs/solana by 2501babe a year ago
- remove VoteState::deserialize() from sbf builds (#30515) the existing deserialize implementation overruns the sbf stack and is unusable in a program context this silences a warning to that effect whi... — committed to solana-labs/solana by 2501babe a year ago
- v1.15: remove VoteState::deserialize() from sbf builds (backport of #30515) (#30532) remove VoteState::deserialize() from sbf builds (#30515) the existing deserialize implementation overruns the s... — committed to solana-labs/solana by mergify[bot] a year ago
- remove VoteState::deserialize() from sbf builds (#30515) the existing deserialize implementation overruns the sbf stack and is unusable in a program context this silences a warning to that effect wh... — committed to nickfrosty/solana by 2501babe a year ago
anchor 0.27 depends on
solana-program = "1.14.16"so it should be sufficient, and not break anything, to putsolana-program = "~1.14.16"in your ownCargo.tomlto enforce that it not pull in 1.15. the release version situation is weird right now as we try to get mainnet onto 1.14, so it is unlikely a new 1.15 or 1.16 will come before thenUpgrading to Anchor 0.27.0 now introduces this compilation error into any project using Anchor.
If you delete the checksum line it will recalculate properly