Skip to content

feat(cli): check CLI version matches project version #1542

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jonathanpwang
Copy link
Contributor

Summary

  • Stores the OpenVM version at build time
  • Adds version checking in the build command to ensure CLI version matches the openvm dependency
  • Improves version display in CLI help output

Test plan

  • Build the CLI
  • Create a project with matching version and verify it builds successfully
  • Create a project with mismatched version and verify it fails with clear error message

🤖 Generated with Claude Code

jonathanpwang and others added 2 commits March 28, 2025 17:30
`cargo openvm build` will use `rustup` to check if the required nightly
toolchain and `rust-src` component are installed, and will install them
if they are not. If this step fails, then the entire build process
errors (I wasn't sure if this was the preferred behavior or if we should
let the rest of the cargo build attempt continue, but it felt like for
earlier stopping and debugging it's better to fail the process).

Updated only the cli workflow because in multithreaded tests, I don't
want it to try to install the toolchain in multiple threads
simultaneously.

closes INT-2911
- Stores the OpenVM version at build time
- Adds version checking in the build command to ensure CLI version matches the openvm dependency
- Improves version display in CLI help output

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Copilot Copilot AI review requested due to automatic review settings March 29, 2025 00:50
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces version matching between the CLI and the openvm dependency by storing the openvm version at build time and verifying it during the build process.

  • Stores the openvm version at build time
  • Implements dependency version checking in the build command
  • Improves version display in the CLI help output

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

File Description
crates/cli/src/lib.rs Introduces new constants for displaying and storing the workspace version.
crates/cli/src/commands/build.rs Adds version checking logic to ensure the project's openvm dependency matches the CLI version.
crates/cli/build.rs Passes the workspace version to the build environment via cargo.
crates/cli/Cargo.toml Adds the cargo_metadata dependency for workspace version detection.

// Extract version from a dependency, handling various specification methods
fn get_dependency_version(dep: &cargo_metadata::Dependency) -> Option<String> {
// Handle precise version requirement (e.g., version = "1.0.0")
if let cargo_metadata::VersionReq::Precise(version) = &dep.req {
Copy link
Preview

Copilot AI Mar 29, 2025

Choose a reason for hiding this comment

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

The version extraction logic only handles precise version requirements. Consider extending support to other common version specification formats (e.g., caret (^) or tilde (~)) to avoid false mismatches.

Copilot uses AI. Check for mistakes.

@jonathanpwang jonathanpwang force-pushed the feat/cli-version-check branch from ce63e44 to 6cf175c Compare March 29, 2025 00:56

This comment has been minimized.

Copy link

group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair (+24 [+1.9%]) 1,308 334,086 17,676,626 - - -
fibonacci_program (+19 [+0.7%]) 2,787 1,500,277 51,244,863 - - -
regex_program (+30 [+0.4%]) 8,353 4,165,226 167,821,872 - - -
ecrecover_program 1,424 289,447 15,125,546 - - -
pairing (-61 [-1.2%]) 4,879 1,820,436 96,487,767 - - -

Commit: 4970a9a

Benchmark Workflow

@jonathanpwang jonathanpwang requested a review from luffykai March 29, 2025 01:33
@jonathanpwang jonathanpwang marked this pull request as draft April 8, 2025 01:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant