Skip to content

chore: fix deploy artifact path in example build scripts - #702

Open
MarkFeder wants to merge 1 commit into
solana-foundation:mainfrom
MarkFeder:chore-fix-pinocchio-native-deploy-paths
Open

chore: fix deploy artifact path in example build scripts#702
MarkFeder wants to merge 1 commit into
solana-foundation:mainfrom
MarkFeder:chore-fix-pinocchio-native-deploy-paths

Conversation

@MarkFeder

@MarkFeder MarkFeder commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

What

The build/deploy npm scripts and cicd.sh in the native and pinocchio examples deploy program.so:

solana program deploy ./program/target/so/program.so

But cargo build-sbf --sbf-out-dir=./program/target/so names the output artifact after the crate, not program — e.g. token_2022_transfer_fee_pinocchio_program.so, transfer_tokens_program.so. So the documented deploy step fails with "No such file" because program.so never exists there.

Fix

Use a *.so glob so the deploy step resolves the built artifact regardless of its crate-derived name:

solana program deploy ./program/target/so/*.so

Each single-program build directory contains exactly one .so, so the glob resolves unambiguously. Applied uniformly to both cicd.sh and the deploy npm script across the affected single-program native and pinocchio examples (75 files).

Notes

  • CI is unaffected. These are reference/manual deploy scripts; CI builds to ./tests/fixtures (via build-and-test) and never runs deploy. Verified locally that the build emits the crate-named .so and the glob resolves to it.

Excluded

  • The asm example (basics/transfer-sol/asm) uses the sbpf toolchain, which has a different output layout and artifact name (its test loads transfer-sol-cpi.so); it needs a separate fix.
  • Multi-program examples (basics/cross-program-invocation): the build emits more than one .so, so a single *.so glob would pass multiple paths to solana program deploy (which takes one). Left unchanged — its cicd.sh already deploys each program explicitly.

This originated from a review comment on #701, where the same template line was flagged — fixing it repo-wide rather than diverging a single example.

@MarkFeder
MarkFeder requested a review from dev-jodee as a code owner August 26, 2026 21:01
@greptile-apps

greptile-apps Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR updates manual deployment commands in native and Pinocchio single-program examples to select the crate-named shared object rather than the nonexistent program.so.

  • Replaces explicit ./program/target/so/program.so paths with ./program/target/so/*.so.
  • Applies the change consistently across npm deploy scripts and shell build/deploy scripts.
  • Leaves the multi-program cross-program-invocation example unchanged because its build produces multiple artifacts.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
basics/account-data/native/cicd.sh The deployment command now resolves the single crate-derived artifact produced by the immediately preceding build.
basics/account-data/native/package.json The manual npm deploy script now selects the example's crate-named shared object.
basics/create-account/pinocchio/cicd.sh The deploy path was updated consistently while preserving the existing build invocation.
tokens/token-2022/transfer-fee/pinocchio/package.json The deploy script now matches the sole Token-2022 example artifact in its output directory.
tokens/transfer-tokens/pinocchio/cicd.sh The shell deployment step now resolves the single generated shared object instead of assuming the name program.so.

Reviews (2): Last reviewed commit: "chore: fix deploy artifact path in examp..." | Re-trigger Greptile

Comment thread basics/cross-program-invocation/native/package.json Outdated
The `build`/`deploy` npm scripts and cicd.sh deploy `program.so`, but
`cargo build-sbf --sbf-out-dir=./program/target/so` emits an artifact named
after the crate (e.g. `token_2022_transfer_fee_pinocchio_program.so`), so the
documented `solana program deploy` step fails to find the file.

Use a `*.so` glob so the deploy step resolves the built artifact regardless of
its crate-derived name, across the single-program native and pinocchio
examples. CI is unaffected (it builds to ./tests/fixtures and never runs
deploy).

Excluded:
- The asm example (basics/transfer-sol/asm): it uses the sbpf toolchain with a
  different output layout and artifact name; it needs a separate fix.
- Multi-program examples (basics/cross-program-invocation): their build emits
  more than one .so, so a single glob would pass multiple paths to
  `solana program deploy`, which takes one. Left unchanged.
@MarkFeder

Copy link
Copy Markdown
Contributor Author

@amilz could you take a look at this one when you get a chance?

No open review threads left on it, so it is ready for maintainer review. It is one of 23 open Pinocchio ports I have up — they are independent and self-contained, so they can be reviewed and merged in any order: https://github.com/solana-developers/program-examples/pulls/MarkFeder

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