Skip to content

feat: cargo CLI update target directory #1662

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
May 20, 2025

Conversation

stephenh-axiom-xyz
Copy link
Contributor

@stephenh-axiom-xyz stephenh-axiom-xyz commented May 16, 2025

Resolves INT-3882, and records changes in the book as per INT-4038. Most importantly, reworks command outputs to primarily use the target/ directory that Cargo uses and assumes full control over.

  • User can specify target_dir; if unspecified, cargo openvm will use the Cargo default
  • Keys are stored in ${target_dir}/openvm/, while all other artifacts are stored in ${target_dir}/openvm/${profile}
  • User can copy outputs to ${output_dir}
  • NOTE - generated proofs are stored at ., as this file should generally be the final output

Other changes include:

  • build no longer generates app commits
  • run will call build before attempting to execute
  • prove will call build before attempting to generate a proof
  • Replaced all references to evm-proving-setup with references to setup
  • openvm.toml's default location is in the working directory instead of .

The basic workflow should now be cargo openvm prove ... into cargo openvm verify ....

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

@luffykai luffykai left a comment

Choose a reason for hiding this comment

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

I think the major comment is we should discuss and finalize the behavior first (or if we've done this before, we should document somewhere). e.g. do we always do keygen in prove/run even though key is already there?

Also the functions in global.rs should have clear docs, as their names don't match what they do. (implicit build/keygen happens in get_xx function

This comment has been minimized.

This comment has been minimized.


**Usage Example**: To build the guest binary in the `my_target` directory:
**Description**: Name of the generated initialization file, which will be written into the manifest directory.
Copy link
Contributor

Choose a reason for hiding this comment

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

what's init file?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it's a .rs file that contains setup macros (ex. moduli_init, sw_init, etc.) for a guest program? The idea being that given your config openvm.toml, it will auto-generate those macros so the user doesn't need to worry about them.


**Description**: Restricts the build to the example target with the given name, similar to `cargo build --example <NAME>`. Projects often include code samples or demos under the examples directory, and this flag focuses on compiling a specific example.
By default all package libraries and binaries will be built. To build samples or demos under the `examples` directory, use either the `--example` or `--examples` option.
Copy link
Contributor

Choose a reason for hiding this comment

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

how do we decide which one to transpile

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All targets that are built are transpiled

This comment has been minimized.

This comment has been minimized.


- `--manifest-dir <MANIFEST_DIR>`
Generally, outputs will always be built to the **target directory**, which will either be determined by the manifest path or explicitly set using the `--target-dir` option. OpenVM-specific artifacts will be placed in `${target_dir}/openvm/`, but if `--output-dir` is specified they will be copied to `${output-dir}/` as well.
Copy link
Contributor

Choose a reason for hiding this comment

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

might be worth to mention the default target directory when not explicitly set

```bash
cargo openvm build --example my_example
```
**Description**: Builds the package's library.
Copy link
Contributor

Choose a reason for hiding this comment

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

when is this useful? i thought the use case always involves some kind of executable?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doesn't really do anything special, mainly here for alignment with cargo build. I guess it will build the library to the risc0 target?

Copy link

group app.proof_time_ms app.cycles app.cells_used leaf.proof_time_ms leaf.cycles leaf.cells_used
verify_fibair (-45 [-3.7%]) 1,161 334,142 17,677,298 - - -
fibonacci (+17 [+0.7%]) 2,486 1,500,277 50,589,503 - - -
regex (-39 [-0.5%]) 7,441 4,165,226 166,511,152 - - -
ecrecover 1,386 (+20412 [+7.1%]) 309,859 (+672913 [+4.7%]) 15,143,099 - - -
pairing (+41 [+0.9%]) 4,613 (+36796 [+2.0%]) 1,857,232 (+1223114 [+1.3%]) 97,055,521 - - -

Commit: e69505c

Benchmark Workflow

@stephenh-axiom-xyz stephenh-axiom-xyz merged commit 1ec4308 into release-v1.2.1-rc.0 May 20, 2025
13 checks passed
@stephenh-axiom-xyz stephenh-axiom-xyz deleted the feat/cargo-cli-target branch May 20, 2025 19:27
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.

2 participants