Add Pinocchio cross-program-invocation and repository-layout examples#70
Merged
Conversation
…ayout examples Port the two newest Pinocchio basics examples contributed to solana-developers/program-examples (upstream #582 and #584) into the Quicknode example set, which already carries Pinocchio variants for every other basics example. - cross-program-invocation/pinocchio: hand + lever two-program CPI demo - repository-layout/pinocchio: recommended multi-file program layout Both register in the workspace and follow the repo's pnpm build/build-and-test convention. Tests are written in Rust against LiteSVM (no JavaScript tests): repository-layout in program/tests/test.rs, cross-program-invocation in programs/lever/tests/test.rs. Original Pinocchio examples authored by @MarkFeder. Co-authored-by: Marco A. <MarkFeder@users.noreply.github.com>
8e34292 to
a6628c4
Compare
added 2 commits
June 12, 2026 19:31
…vention Merge in main's Rust-only Pinocchio test convention (PR #69) and adopt it for the two new examples: - Drop package.json / pnpm-lock.yaml (no JS); examples build with `cargo build-sbf` and test with `cargo test`. - include_bytes! the program .so from the workspace target/deploy instead of tests/fixtures, matching the CI that builds with `cargo build-sbf --manifest-path=<manifest>` (no --sbf-out-dir). - Update READMEs to the cargo build-sbf / cargo test workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Ports the two newest Pinocchio
basicsexamples contributed to solana-developers/program-examples into this repo:basics/cross-program-invocation/pinocchio— a two-program CPI demo (handinvokeslever'sswitch_powervia CPI). Upstream #584.basics/repository-layout/pinocchio— the recommended multi-file program layout (lib/processor/instructions//state/). Upstream #582.Credit
Both original Pinocchio examples were authored by @MarkFeder in solana-developers/program-examples (PRs #582 and #584). The credit is recorded in each example's
README.mdand as aCo-authored-bytrailer on the commit. 🙏Why
These are the only two
basicsexamples that were missing a Pinocchio variant in this repo — every other basics example already ships one. The docs at solana.com/docs/programs/examples point developers to this example set, so filling these two gaps keeps the Pinocchio coverage complete.Tests: Rust + LiteSVM only (no JavaScript)
Per review feedback, these examples have no JS/bankrun tests. Each program is tested on-chain with LiteSVM from Rust:
basics/repository-layout/pinocchio/program/tests/test.rs— exercises the ride/game/food instructions plus invalid-attraction rejection.basics/cross-program-invocation/pinocchio/programs/lever/tests/test.rs— exercises the fullinitialize → pull → pull-againCPI flow plus an invalid-discriminator rejection.The
package.jsonfiles keep only the build/deploy scripts needed by CI (no JS deps);pnpm build/build-and-testcompile the.sointotests/fixturesso the LiteSVM tests can load it, and the Rust tests run viacargo test.How it was adapted to this repo's conventions
Cargo.toml;Cargo.lockupdated additively (no version bumps).pnpm-lock.yamlwith the repo's pinned pnpm (10.33.0); both passpnpm install --frozen-lockfile.cicd.shfiles to match the existing Pinocchio examples.README.mdfor each example.Verification
cargo checkpasses for all three program crates on the host toolchain.cargo test --no-runcompiles both LiteSVM test crates (test code + deps resolve and type-check).cargo fmt --checkandbiome checkare clean on the new files.cargo build-sbfis not available in this environment, so the on-chain.sobuild + LiteSVM test run is left to CI (the program sources are unchanged from upstream and use the same pinnedpinocchio0.10.2 API as the existing examples).