Skip to content

Commit

Permalink
v0.2.1 with SDK Guest Runtime Fix (nexus-xyz#259)
Browse files Browse the repository at this point in the history
* Fix SDK installation of guest runtime for 0.2.1 patch release.

* Updated test script.

* Tag the SDK as well.

* Use explicit tag.

* Format.

* Have GH CI use commit being tested.

* Enable configuring version.

* Format

* Clippy

* Minor.

* Format

* clippy

* Clippy again

* Format

* Fixes

* Fixes

* more fixes
  • Loading branch information
sjudson authored Aug 2, 2024
1 parent b77a934 commit 424473c
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exclude = ["nova-benches"]

[workspace.package]
edition = "2021"
version = "0.2.0"
version = "0.2.1"
authors = ["The Nexus Team <[email protected]>"]
homepage = "https://nexus.xyz/"
repository = "https://github.com/nexus-xyz/nexus-zkvm/"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ rustup target add riscv32i-unknown-none-elf
Then, install the Nexus zkVM:

```shell
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.0'
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.1'
```

Verify the installation:
Expand Down
16 changes: 5 additions & 11 deletions assets/scripts/test_sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,17 @@ cargo build --release --package cargo-nexus --bin cargo-nexus
}

function create_nexus_project() {
./target/release/cargo-nexus nexus host "$PROJECT_NAME"
if [[ -z "${GITHUB_SHA}" ]]; then
./target/release/cargo-nexus nexus host "$PROJECT_NAME"
else
./target/release/cargo-nexus nexus host "$PROJECT_NAME" --rev "${GITHUB_SHA}"
fi
}

function copy_test_file() {
cp "$1" "$PROJECT_NAME/src/guest/src/main.rs"
}

function update_dependencies() {
# Link host SDK in Cargo.toml to the current SDK commit
sed -i.bak "s#nexus-sdk = { git = \"https://github.com/nexus-xyz/nexus-zkvm.git\", version = \"0.2.0\" }#nexus-sdk = { path = \"$ORIGINAL_DIR/sdk\"}#" Cargo.toml
cd src/guest
# Link guest runtime in Cargo.toml to the current commit runtime
sed -i.bak "s#nexus-rt = { git = \"https://github.com/nexus-xyz/nexus-zkvm.git\", version = \"0.2.0\" }#nexus-rt = { path = \"$ORIGINAL_DIR/runtime\" }#" Cargo.toml
cd ../../
}

function run_project() {
cargo update
cargo run --release
Expand All @@ -72,7 +67,6 @@ build_cargo_nexus
create_nexus_project
copy_test_file "$1"
cd "$PROJECT_NAME"
update_dependencies
run_project

cleanup
24 changes: 22 additions & 2 deletions cli/src/command/host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,38 @@ use crate::utils::cargo;
pub struct HostArgs {
#[arg(name = "path")]
pub path: PathBuf,
#[arg(long, name = "rev", conflicts_with = "tag")]
pub rev: Option<String>,
#[arg(long, name = "tag", conflicts_with = "rev")]
pub tag: Option<String>,
}

pub fn handle_command(args: HostArgs) -> anyhow::Result<()> {
let path = args.path;
let rev = args.rev;
let mut tag = args.tag;

setup_crate(path)
if rev.is_none() && tag.is_none() {
// default to current release
tag = Some(String::from("0.2.1"));
}

setup_crate(path, rev, tag)
}

fn setup_crate(host_path: PathBuf) -> anyhow::Result<()> {
fn setup_crate(host_path: PathBuf, rev: Option<String>, tag: Option<String>) -> anyhow::Result<()> {
assert!(rev.is_some() || tag.is_some());

let host_str = host_path
.to_str()
.context("path is not a valid UTF-8 string")?;

let guest_path = host_path.join("src").join("guest");
let guest_str = guest_path.to_str().unwrap();

let arg = if rev.is_some() { "--rev" } else { "--tag" };
let ver = if let Some(v) = rev { v } else { tag.unwrap() };

// run cargo to setup project
cargo(None, ["new", host_str])?;
cargo(
Expand All @@ -33,6 +49,8 @@ fn setup_crate(host_path: PathBuf) -> anyhow::Result<()> {
"add",
"--git",
"https://github.com/nexus-xyz/nexus-zkvm.git",
arg,
&ver,
"nexus-sdk",
],
)?;
Expand Down Expand Up @@ -92,6 +110,8 @@ fn setup_crate(host_path: PathBuf) -> anyhow::Result<()> {
"add",
"--git",
"https://github.com/nexus-xyz/nexus-zkvm.git",
arg,
&ver,
"nexus-rt",
],
)?;
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import { Callout } from 'nextra/components'

The Nexus zkVM (zero-knowledge virtual machine) is a modular, extensible, open-source, highly-parallelized, prover-optimized, contributor-friendly, [zkVM](specs/zkvm-overview.mdx) written in Rust, focused on performance and security.

[Nexus zkVM v0.2.0](https://github.com/nexus-xyz/nexus-zkvm/releases/tag/v0.2.0) is the current stable release, implementing the zkVM component of the Nexus 2.0 system.
[Nexus zkVM v0.2.1](https://github.com/nexus-xyz/nexus-zkvm/releases/tag/v0.2.1) is the current stable release, implementing the zkVM component of the Nexus 2.0 system.

## Proving Computation

Expand Down
2 changes: 1 addition & 1 deletion docs/pages/network.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { Callout } from 'nextra/components'

The Nexus Network is a massively-parallelized proof network for executing and proving the Nexus zkVM.

[Nexus Network v0.2.0](https://github.com/nexus-xyz/nexus-zkvm/releases/tag/v0.2.0) is the current stable release, implementing the network component of the Nexus 2.0 system.
[Nexus Network v0.2.1](https://github.com/nexus-xyz/nexus-zkvm/releases/tag/v0.2.1) is the current stable release, implementing the network component of the Nexus 2.0 system.

<Callout type="info" emoji="ℹ️">
The Nexus Network is currently in a prototype stage.
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/zkvm/cli-quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustup target add riscv32i-unknown-none-elf
Then, install the Nexus zkVM:

```shell
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.0'
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.1'
```

Verify the installation:
Expand Down
2 changes: 1 addition & 1 deletion docs/pages/zkvm/sdk-quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ rustup target add riscv32i-unknown-none-elf
Then, install the Nexus zkVM:

```shell
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.0'
cargo install --git https://github.com/nexus-xyz/nexus-zkvm cargo-nexus --tag 'v0.2.1'
```

Verify the installation:
Expand Down

0 comments on commit 424473c

Please sign in to comment.