Skip to content

Commit d98856f

Browse files
Fix cross-program-invocation: remove lever crate dep that conflicts with declare_program!
The lever dev-dependency creates a name collision with the declare_program!(lever) macro-generated module. Since Anchor 1.0's declare_program! provides all needed CPI types from the IDL, the crate dependency isn't needed for the program build. The test uses hand::lever::ID (from the declare_program! generated module) instead of lever::id() (from the crate). This was previously correct in 3ee5f60 but was accidentally reverted in 5b929bc.
1 parent 3b7bda9 commit d98856f

2 files changed

Lines changed: 2 additions & 5 deletions

File tree

basics/cross-program-invocation/anchor/programs/hand/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ litesvm = "0.11.0"
2727
solana-signer = "3.0.0"
2828
solana-keypair = "3.0.1"
2929
solana-kite = "0.3.0"
30-
lever = { path = "../lever", features = ["no-entrypoint"] }
3130

3231
[lints.rust]
3332
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(target_os, values("solana"))'] }

basics/cross-program-invocation/anchor/programs/hand/tests/test_hand.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use {
66
},
77
InstructionData, ToAccountMetas,
88
},
9-
lever,
109
litesvm::LiteSVM,
1110
solana_keypair::Keypair,
1211
solana_kite::{create_wallet, send_transaction_from_instructions},
@@ -44,9 +43,8 @@ fn build_lever_initialize_ix(
4443
#[test]
4544
fn test_pull_lever_cpi() {
4645
let hand_program_id = hand::id();
47-
// Use lever::id() (not hand::lever::ID) so the ID stays in sync with the compiled lever.so
48-
// after anchor keys sync changes the program ID on fresh CI runs.
49-
let lever_program_id = lever::id();
46+
// The lever program ID from declare_program!(lever) inside hand crate
47+
let lever_program_id = hand::lever::ID;
5048

5149
let mut svm = LiteSVM::new();
5250

0 commit comments

Comments
 (0)