Skip to content

fix: support Solana SDK v3.x projects missing solana-program in Cargo.lock#228

Open
MidTermDev wants to merge 1 commit intoEllipsis-Labs:masterfrom
MidTermDev:fix/sdk-v3-cargo-lock-compat
Open

fix: support Solana SDK v3.x projects missing solana-program in Cargo.lock#228
MidTermDev wants to merge 1 commit intoEllipsis-Labs:masterfrom
MidTermDev:fix/sdk-v3-cargo-lock-compat

Conversation

@MidTermDev
Copy link

Summary

  • Fixes solana-verify build failure for Solana SDK v3.x projects (e.g. pinocchio-based programs) where solana-program no longer exists as a standalone crate in Cargo.lock
  • When --base-image is provided, version parsing failure is now ignored instead of aborting
  • When no base image is provided, falls back to solana-program-error and solana-account-info crate names for automatic Docker image selection

Problem

In Solana SDK v3.x, the solana-program crate was split into subcrates (solana-program-error, solana-program-runtime, solana-account-info, etc.). Programs built with pinocchio or the new SDK don't have solana-program in their Cargo.lock, causing every build to fail with:

Error: Failed to parse solana-program version from Cargo.lock

This also affects the remote OtterSec verification service, making it impossible to verify any SDK v3.x program.

Fix

The version lookup in build() was unconditional (line 835) and ran before checking --base-image. This PR:

  1. Moves the version parsing inside the match base_image block
  2. When a custom --base-image is provided: gracefully defaults to (0, 0, 0) if solana-program isn't found
  3. When no base image is provided: tries solana-programsolana-program-errorsolana-account-info as fallback crate names to determine the Solana version

Test plan

  • Tested against solana-program/token pinocchio program (SDK v3.x, no solana-program in Cargo.lock)
  • solana-verify build --library-name pinocchio_token_program now auto-detects Solana 3.0.0 and selects the correct Docker image
  • solana-verify verify-from-repo full flow (clone → build → hash compare → PDA upload) works end-to-end
  • Build hash matches on-chain deployed program hash

🤖 Generated with Claude Code

….lock

In Solana SDK v3.x, the `solana-program` crate was split into subcrates
(e.g. `solana-program-error`, `solana-account-info`). Programs built with
pinocchio or the new SDK no longer have `solana-program` in their
Cargo.lock, causing `solana-verify build` to fail unconditionally with
"Failed to parse solana-program version from Cargo.lock".

This fixes two cases:

1. When `--base-image` is provided, the version parsing failure is now
   ignored since the Docker image is already explicitly specified.

2. When no base image is provided, the tool falls back to
   `solana-program-error` and `solana-account-info` crate names to
   determine the Solana version for automatic image selection.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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