Skip to content
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

refactor: deprecate sp1-helper #1268

Merged
merged 7 commits into from
Aug 20, 2024
Merged

refactor: deprecate sp1-helper #1268

merged 7 commits into from
Aug 20, 2024

Conversation

ratankaliani
Copy link
Member

@ratankaliani ratankaliani commented Aug 6, 2024

Overview

  • Deprecate sp1-helper and consolidate logic in sp1-build.
  • Add a deprecation warning to sp1-helper with re-exports.
  • Refactor the sp1-build crate for usability.

Misc

Note: In several places, SP1's next version is assumed to be 1.2.0. Will need to change this if that's not the case.

since = "1.2.0",

## Build Script
If you want your program crate to be built automatically whenever you build/run your script crate, you can add a `build.rs` file inside of `script/` (at the same level as `Cargo.toml` of your script crate) that utilizes the `sp1-build` crate:
```rust,noplayground
{{#include ../../examples/fibonacci/script/build.rs}}
```
The path passed in to `build_program` should point to the directory containing the `Cargo.toml` file for your program. Make sure to also add `sp1-build` as a build dependency in `script/Cargo.toml`:
```toml
[build-dependencies]
sp1-build = "1.2.0"
```
You will see output like the following from the build script if the program has changed, indicating that the program was rebuilt:
````
[fibonacci-script 0.1.0] cargo:rerun-if-changed=../program/src
[fibonacci-script 0.1.0] cargo:rerun-if-changed=../program/Cargo.toml
[fibonacci-script 0.1.0] cargo:rerun-if-changed=../program/Cargo.lock
[fibonacci-script 0.1.0] cargo:warning=fibonacci-program built at 2024-03-02 22:01:26
[fibonacci-script 0.1.0] [sp1] Compiling fibonacci-program v0.1.0 (/Users/umaroy/Documents/fibonacci/program)
[fibonacci-script 0.1.0] [sp1] Finished release [optimized] target(s) in 0.15s
warning: [email protected]: fibonacci-program built at 2024-03-02 22:01:26
````
The above output was generated by running `RUST_LOG=info cargo run --release -vv` for the `script` folder of the Fibonacci example.
### Advanced build options
To configure the build process when using the `sp1-build` crate, you can pass a [`BuildArgs`](https://docs.rs/sp1-build/1.2.0/sp1_build/struct.BuildArgs.html) struct to to the [`build_program_with_args`](https://docs.rs/sp1-build/1.2.0/sp1_build/fn.build_program_with_args.html) function. The build arguments are the same as the ones available from the `cargo prove build` command.

@ratankaliani ratankaliani changed the base branch from main to dev August 6, 2024 19:27
@ratankaliani ratankaliani changed the title feat: deprecate sp1 helper feat: deprecate sp1-helper Aug 6, 2024
@ratankaliani ratankaliani changed the title feat: deprecate sp1-helper refactor: deprecate sp1-helper Aug 7, 2024
@jtguibas jtguibas force-pushed the ratan/deprecate-sp1-helper branch from 0718ac7 to 63fa8f7 Compare August 20, 2024 01:49
@jtguibas jtguibas merged commit 1f407df into dev Aug 20, 2024
6 checks passed
@jtguibas jtguibas deleted the ratan/deprecate-sp1-helper branch August 20, 2024 18:25
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