Skip to content

Commit

Permalink
Feat/proving cycles (#42)
Browse files Browse the repository at this point in the history
* Add total_steps

* Update install_mips_rust_tool

* Update revme dependencies

* Update README for install toolchain

* Update version
  • Loading branch information
xander42280 authored Dec 20, 2024
1 parent 58e6aa3 commit ebd1755
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 70 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ There are two ways to prove the guest program:

![image](assets/temp-run-diagram.png)

## Getting Started

First to install zkm toolchain run the following command and follow the instructions:
```sh
curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/zkMIPS/toolchain/refs/heads/main/setup.sh | sh
source ~/.zkm-toolchain/env
```

## Template code structure

> [!NOTE]
Expand Down
3 changes: 0 additions & 3 deletions guest-program/revme/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ serde = { version = "1.0", default-features = false, features = ["alloc", "deriv
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
k256 = { version = "0.13.3", features = ["ecdsa"], default-features = false }

# TODO can be removed once the powdr RISCV nightly is updated
ahash = { version = "=0.8.6", default-features = false }

libc = { version = "0.2" , features = ["extra_traits"] }

[profile.dev]
Expand Down
2 changes: 1 addition & 1 deletion host-program/mem-alloc-vec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mem-alloc-vec"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion host-program/revme/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "revme"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion host-program/sha2-go/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sha2-go"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
2 changes: 1 addition & 1 deletion host-program/sha2-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sha2-rust"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
61 changes: 0 additions & 61 deletions install_mips_rust_tool

This file was deleted.

2 changes: 1 addition & 1 deletion sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "zkm-sdk"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand Down
3 changes: 2 additions & 1 deletion sdk/src/local/stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ pub fn prove_stark(
state.input_stream.push(input.public_inputstream.clone());
state.input_stream.push(input.private_inputstream.clone());

let (_total_steps, seg_num, state) = split_prog_into_segs(state, &seg_path, "", seg_size);
let (total_steps, seg_num, state) = split_prog_into_segs(state, &seg_path, "", seg_size);
result.output_stream = state.public_values_stream.clone();
result.total_steps = total_steps as u64;
if input.execute_only {
return Ok(false);
}
Expand Down
1 change: 1 addition & 0 deletions sdk/src/network/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ impl Prover for NetworkProver {
stark_proof: vec![],
solidity_verifier: vec![],
public_values: vec![],
total_steps: get_status_response.total_steps,
};
if !get_status_response.stark_proof_url.is_empty() {
proof_result.stark_proof =
Expand Down
1 change: 1 addition & 0 deletions sdk/src/proto/stage.proto
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ message GetStatusResponse {
bytes output_stream = 7;
int32 step = 8; // Step
string public_values_url = 9;
uint64 total_steps = 10;
}
1 change: 1 addition & 0 deletions sdk/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub struct ProverInput {

#[derive(Debug, Default, Deserialize, Serialize, Clone)]
pub struct ProverResult {
pub total_steps: u64,
pub output_stream: Vec<u8>,
pub proof_with_public_inputs: Vec<u8>,
pub stark_proof: Vec<u8>,
Expand Down

0 comments on commit ebd1755

Please sign in to comment.