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

"build-and-test": "cargo build-sbf --sbf-out-dir=./tests/fixtures --manifest-path=programs/lever/Cargo.toml && cargo build-sbf --sbf-out-dir=./tests/fixtures --manifest-path=programs/hand/Cargo.toml && pnpm test",
"build": "cargo build-sbf --sbf-out-dir=./program/target/so",
"deploy": "solana program deploy ./program/target/so/program.so"
"deploy": "solana program deploy ./program/target/so/*.so"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Wildcard passes two programs

When pnpm build runs in this two-crate workspace, it emits both the hand and lever program artifacts. The changed wildcard passes both paths to a solana program deploy invocation that accepts one program filepath, causing the manual deployment to fail.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed. This example is a two-crate workspace (hand + lever), so its build emits both artifacts and a single *.so glob would pass two paths to solana program deploy. I've reverted this example's package.json (its cicd.sh already deploys hand.so and lever.so explicitly) and excluded multi-program examples from the change; the glob now applies only to single-program examples where it resolves unambiguously.

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
MarkFeder force-pushed the chore-fix-pinocchio-native-deploy-paths branch from 480649d to 11ef181 Compare August 26, 2026 21:13
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