Skip to content

Commit

Permalink
ZKVM-484: revamp rzup cli (risc0#1961)
Browse files Browse the repository at this point in the history
This PR is a Rust revamp of the original `rzup` bash scripts. The goal
of this revamp is to have `rzup` act similarly to `rusutp` for toolchain
management, and to eventually supersede `cargo risczero install` and
`cargo risczero build-toolchain`.

The features and necessary requirements are likely to change with
suggestions and updates. Below is running list the progress.

To try it out: `cargo run --bin rzup` shows the info previewed below. 

To install the sane defaults (rust, cpp, cargo-risczero): `rzup install`

To install specifics: 
- cargo-risczero: `rzup extension install cargo-risczero` or `rzup
install cargo-risczero`
- rust: `rzup toolchain install rust` or `rzup install rust`
- cpp: `rzup toolchain install cpp` or `rzup install cpp`

To check for updates of cargo-risczero and the active toolchains: `rzup
check`

To show all installed things and meta: `rzup show`

To set new defaults (i.e. active) toolchains: `rzup default rust
<TOOLCHAIN_NAME>`, `rzup default cpp <TOOLCHAIN_NAME>`

To use different cargo-risczero versions (and zkVM): `rzup extension use
cargo-risczero <VERSION>`

Each of these have more subcommands that you can see with `--help`.

Todo: 
- [x] quick start install `rzup install` (latest rust toolchain, cpp, &
cargo risczero)
  - [x] cargo-risczero: extension installation / checking / updating
  - [x] List installed toolchains
  - [x] Install specific toolchains (cpp/rust)
  - [x] Build rust toolchain 
  - [x] Show toolchain / extension / rzup info*
  - [x] rust toolchain update checks 
  - [x] cargo risczero update check
  - [x] pretty print 
  - [x] c++ toolchain update check 
  - [x] Self (rzup) ~~check~~, update, etc 
  - [x] Set default toolchain + `settings.toml` persistence (?)
- [x] `rzup-init.sh` script for detecting the target and downloading
correct `rzup`
  - [x] Github token support to avoid throttling
  - [x] true verbosity 
  - [x] help/discussion coverage 
  - [x] Improve error handling

Preview: 
```
rzup 0.2.1

    ██████  █▀▀▀██
    ██████  █ ▄▀ █        Prove anything.
    ██████  ██▄▄▄█       Verify everywhere.
    ██████
    ██████   RISC
    ██████   ZERO

Contribute      : https://github.com/risc0/
Documentation   : https://dev.risczero.com/
Chat & Support  : https://discord.com/invite/risczero/


Usage: rzup [OPTIONS] [COMMAND]

Commands:
  show       Show the active and installed toolchains and extensions
  install    Install toolchains or extensions
  update     Update toolchains or extensions
  check      Check for updates to toolchains and extensions
  default    Set the default toolchains
  toolchain  Modify or query the installed toolchains
  extension  Modify or query the installed extensions
  help       Print this message or the help of the given subcommand(s)

Options:
  -v, --verbose
          Enable verbose output

  -h, --help
          Print help

  -V, --version
          Print version

Discussion:
    rzup installs RISC Zero toolchains and extensions from the official
    release channels, enabling you to easily switch between different
    versions and keep them updated.

    If you are new to RISC Zero, consider visitng our documentation
    to learn more.
```

---------

Co-authored-by: Erik Kaneda <[email protected]>
  • Loading branch information
hmrtn and SchmErik authored Jul 17, 2024
1 parent 2be1e86 commit 5241191
Show file tree
Hide file tree
Showing 25 changed files with 3,065 additions and 4 deletions.
207 changes: 203 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ members = [
"risc0/zkvm/methods",
"risc0/zkvm/platform",
"risc0/zkvm/receipts",
"rzup",
"tools/hotbench",
"website/doc-test/main",
"xtask",
Expand Down
28 changes: 28 additions & 0 deletions rzup/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[package]
name = "rzup"
version = "0.2.1"
edition = { workspace = true }
license = { workspace = true }
homepage = { workspace = true }
repository = { workspace = true }

[dependencies]
anyhow = "1.0.86"
cfg-if = "1.0.0"
clap = { version = "4.5.7", features = ["derive"] }
dirs = "5.0.1"
flate2 = "1.0.30"
fs2 = "0.4.3"
fs_extra = "1.3.0"
lazy_static = "1.5.0"
regex = "1.10.5"
reqwest = { version = "0.12.5", features = ["json", "rustls-tls"] }
serde = { version = "1.0.203", features = ["derive"] }
serde_json = "1.0.117"
tar = "0.4.41"
tempfile = "3.10.1"
termcolor = "1.4.1"
thiserror = "1.0.61"
tokio = { version = "1.38.0", features = ["rt-multi-thread", "macros"] }
xz = "0.1.0"

Loading

0 comments on commit 5241191

Please sign in to comment.