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

feat: Add initial support for rust runtime #140

Merged
merged 13 commits into from
Jul 5, 2024
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ edition = "2021"
#plonky2_util = { path = "../plonky2/util" }
#plonky2_maybe_rayon = { path = "../plonky2/maybe_rayon" }

bincode = "1.3.3"

plonky2 = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" }
#starky = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" }
plonky2_util = { git = "https://github.com/zkMIPS/plonky2.git", branch = "zkm_dev" }
Expand Down
32 changes: 32 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,36 @@ BASEDIR=test-vectors RUST_LOG=info BLOCK_NO=13284491 SEG_FILE_DIR="/tmp/output"
cargo run --release --example zkmips aggregate_proof_all
```

- run bench

- download/install toolchain for mips

```
wget http://musl.cc/mips-linux-muslsf-cross.tgz
tar -zxvf mips-linux-muslsf-cross.tgz
```

- modify ~/.cargo/config:

```
[target.mips-unknown-linux-musl]
linker = <path-to>/mips-linux-muslsf-gcc"
rustflags = ["--cfg", 'target_os="zkvm"',"-C", "target-feature=+crt-static", "-C", "link-arg=-g"]
```

- build sha2

```
cd examples/sha2
cargo build --target=mips-unknown-linux-musl
cd ../../
```

- run bench

```
RUST_LOG=info ELF_PATH=examples/sha2/target/mips-unknown-linux-musl/debug/sha2-bench SEG_OUTPUT=/tmp/output cargo run --release --example zkmips bench
```

Basically, you can run the example on a 32G RAM machine, if you get OOM error, please read https://github.com/zkMIPS/zkm/issues/97.

350 changes: 350 additions & 0 deletions examples/sha2/Cargo.lock

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

Loading
Loading