tools: modernize shank example from Solita to Codama; re-enable in CI#61
Merged
Conversation
Solita is unmaintained and does not work on the current toolchain, so this example is reworked around Codama and modernised end to end. - Rename tools/shank-and-solita -> tools/shank-and-codama (Solita is gone). - Program: bump to borsh 1.x, shank 0.4.8, solana-program 4.0. Replace the removed solana_program::system_instruction with solana-system-interface and borsh try_to_vec with borsh::to_vec. Shank 0.4's #[seeds(...)] PDA codegen is broken (emits unparsable tokens) and is not emitted to the IDL, so seeds are dropped and PDAs derived explicitly via Car::find_pda / RentalOrder::find_pda. Make the crate standalone (empty [workspace]) so it pins its own deps/lock. - Regenerate the Shank IDL (origin "shank", u8 discriminants) and generate a @solana/kit TypeScript client with Codama via codama.ts. Remove .solitarc.js, .crates/, and the old Solita output. - Replace the devnet test with an in-process LiteSVM (npm) test that loads the built .so and exercises add_car/book_rental/pick_up_car through the generated client, asserting account state. Runs in CI with no network. - package.json scripts (build, generate-client, build-and-test) wired for native.yml; commit a fresh frozen pnpm-lock.yaml. Drop the stale .ghaignore entry; track the standalone program Cargo.lock via .gitignore exception. https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
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.
Summary
Modernizes the native "car rental service" example from the dead Solita client generator to Codama, and brings it onto the current toolchain so it runs in CI. Solita's last release was Nov 2023 (superseded by Kinobi → Codama); Shank is still actively maintained (0.4.8, Feb 2026) and remains the standard way to give a native (non-Anchor) program an IDL — so the Shank lesson is kept, only the client generator and the ancient deps are replaced.
Renames
tools/shank-and-solita→tools/shank-and-codama(the example is named after its tooling).Changes
Program (
program/) — now builds withcargo build-sbf:borsh/borsh-derive0.9 → 1.5.7,shank0.0.12 → 0.4.8,solana-program1.14 → 4.0.solana_program::system_instruction(removed in 4.0) →solana-system-interface;borsh::try_to_vec→borsh::to_vec.Cargo.lock.#[seeds(...)]PDA codegen emits unparsable tokens and doesn't write seeds to the IDL, so PDAs are derived explicitly viaCar::find_pda/RentalOrder::find_pda(same seed bytes).ShankAccount/ShankInstructionare still used for IDL extraction — the lesson is intact.IDL → client (Shank → Codama):
shank-cli0.4.8 (origin: "shank").codama.tsgenerator:rootNodeFromAnchor(idl)(origin shank) →createFromRoot→@codama/renderers-jsintotests/generated/. Removed.solitarc.js,.crates/, and the old Solita output.Test (TS +
litesvmnpm, in-process — no devnet/bankrun):tests/test.tsloads the built.sointolitesvm(kit-based, so it interops with the Codama JS client) and runsadd_car → book_rental → pick_up_car, asserting on-chain account state. Run via Node's built-in test runner (node --import tsx --test), so failures actually propagate.CI:
package.jsonscripts (build,generate-client,build-and-test), fresh frozenpnpm-lock.yaml, and removed the staletools/shank-and-solita/nativeentry from.github/.ghaignore.Verification (CI toolchain, Solana 3.1.x)
cargo build-sbf✓ ·pnpm install --frozen-lockfile && pnpm build && pnpm build-and-test→ test passes (1/0) ✓ ·cargo test✓ ·cargo fmt --checkclean ·cargo clippy --tests -D warningsclean. Notarget/,.so, ornode_modulescommitted.https://claude.ai/code/session_013dpnF6uSGWXjkJJZseqzcP
Generated by Claude Code