chore: fix deploy artifact path in example build scripts - #702
Conversation
Greptile SummaryThe PR updates manual deployment commands in native and Pinocchio single-program examples to select the crate-named shared object rather than the nonexistent
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
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" |
There was a problem hiding this comment.
There was a problem hiding this comment.
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.
480649d to
11ef181
Compare
What
The
build/deploynpm scripts andcicd.shin the native and pinocchio examples deployprogram.so:But
cargo build-sbf --sbf-out-dir=./program/target/sonames the output artifact after the crate, notprogram— e.g.token_2022_transfer_fee_pinocchio_program.so,transfer_tokens_program.so. So the documented deploy step fails with "No such file" becauseprogram.sonever exists there.Fix
Use a
*.soglob so the deploy step resolves the built artifact regardless of its crate-derived name:Each single-program build directory contains exactly one
.so, so the glob resolves unambiguously. Applied uniformly to bothcicd.shand thedeploynpm script across the affected single-program native and pinocchio examples (75 files).Notes
./tests/fixtures(viabuild-and-test) and never runsdeploy. Verified locally that the build emits the crate-named.soand the glob resolves to it.Excluded
basics/transfer-sol/asm) uses thesbpftoolchain, which has a different output layout and artifact name (its test loadstransfer-sol-cpi.so); it needs a separate fix.basics/cross-program-invocation): the build emits more than one.so, so a single*.soglob would pass multiple paths tosolana program deploy(which takes one). Left unchanged — itscicd.shalready 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.