program-examples
program-examples copied to clipboard
Fixes to native program example on CPI
Build and Test Fixes
The program was not building and test cases were failing. I made several changes to fix these issues:
Changes Made
1. Updated Borsh Dependency
- Changed borsh version from
0.10to1.5.7to fix build errors when runningpnpm run build-and-test
Error Fixed:
error[E0277]: the trait bound `SetPowerStatus: borsh::ser::BorshSerialize` is not satisfied
--> programs/hand/src/lib.rs:27:9
|
25 | let ix = Instruction::new_with_borsh(
| --------------------------- required by a bound introduced by this call
26 | *lever_program.key, // Our lever program's ID
27 | &set_power_status_instruction, // Passing instructions through
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `borsh::ser::BorshSerialize` is not implemented for `SetPowerStatus`
|
2. Updated Borsh API Call
- Changed
.try_to_vec()to.to_vec()to match the latest version of borsh
3. Updated Test Architecture
- Changed the test architecture to use bankrun