Skip to content

Fixes to native program example on CPI #392

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

4rjunc
Copy link

@4rjunc 4rjunc commented Jun 25, 2025

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.10 to 1.5.7 to fix build errors when running pnpm 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

@4rjunc 4rjunc changed the title Fixed the native Cross Program Invocation Fixes to Native Program on Cross Program Invocation Jun 25, 2025
@4rjunc 4rjunc changed the title Fixes to Native Program on Cross Program Invocation Fixes to Native program example on Cross Program Invocation Jun 25, 2025
@4rjunc 4rjunc changed the title Fixes to Native program example on Cross Program Invocation Fixes to Native program example on CPI Jun 25, 2025
@4rjunc 4rjunc changed the title Fixes to Native program example on CPI Fixes to native program example on CPI Jun 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant