Skip to content

Fixes to native program example on CPI#392

Closed
aarjn wants to merge 3 commits into
solana-developers:mainfrom
aarjn:main
Closed

Fixes to native program example on CPI#392
aarjn wants to merge 3 commits into
solana-developers:mainfrom
aarjn:main

Conversation

@aarjn
Copy link
Copy Markdown

@aarjn aarjn 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

@aarjn aarjn changed the title Fixed the native Cross Program Invocation Fixes to Native Program on Cross Program Invocation Jun 25, 2025
@aarjn aarjn changed the title Fixes to Native Program on Cross Program Invocation Fixes to Native program example on Cross Program Invocation Jun 25, 2025
@aarjn aarjn changed the title Fixes to Native program example on Cross Program Invocation Fixes to Native program example on CPI Jun 25, 2025
@aarjn aarjn changed the title Fixes to Native program example on CPI Fixes to native program example on CPI Jun 25, 2025
@aarjn
Copy link
Copy Markdown
Author

aarjn commented May 30, 2026

Hi @Perelyn-sama can't we merge this ? ik it's been a while and I didn't get any review on this

@Perelyn-sama
Copy link
Copy Markdown
Collaborator

hey @aarjn I'd be happy to review an updated PR

@aarjn
Copy link
Copy Markdown
Author

aarjn commented May 31, 2026

okay, should I push it with using bankrun in testcases or liteSVM ? CONTRIBUTE.md says to use bankrun but it is deprecated

@Perelyn-sama
Copy link
Copy Markdown
Collaborator

Use litesvm, thanks for pointing that out I'll update the readme

@aarjn
Copy link
Copy Markdown
Author

aarjn commented Jun 1, 2026

Hy @Perelyn-sama, Raised a PR #585 since this is closed

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.

2 participants