Skip to content

Commit

Permalink
update SHA_ID and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
weilzkm committed Nov 26, 2024
1 parent f70970c commit 1b24de8
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion prover/examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ RUST_LOG=info ELF_PATH=examples/revme/target/mips-unknown-linux-musl/release/evm
```

## Prove precompile code
* Build the sha2-rust
```
cd prover/examples/sha2-rust
cargo build -r --target=mips-unknown-linux-musl
```

* Build the sha2-precompile
```
cd prover/examples/sha2-precompile
Expand All @@ -100,5 +106,5 @@ cargo build -r --target=mips-unknown-linux-musl
```
cd ../..
RUST_LOG=info PRECOMPILE_PATH=examples/test-elf/fibonacci ELF_PATH=examples/sha2-precompile/target/mips-unknown-linux-musl/release/sha2-precompile HOST_PROGRAM=sha2_precompile SEG_OUTPUT=/tmp/output cargo run --release --example zkmips prove_host_program
RUST_LOG=info PRECOMPILE_PATH=examples/sha2-rust/target/mips-unknown-linux-musl/release/sha2-rust ELF_PATH=examples/sha2-precompile/target/mips-unknown-linux-musl/release/sha2-precompile HOST_PROGRAM=sha2_precompile SEG_OUTPUT=/tmp/output cargo run --release --example zkmips prove_host_program
```
2 changes: 1 addition & 1 deletion prover/examples/sha2-precompile/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate alloc;
use alloc::vec::Vec;

zkm_runtime::entrypoint!(main);
const SHA_ELF:[u8; 32] = [0u8;32]; //TOFIX
const SHA_ELF:[u8; 32] = [129, 12, 162, 243, 13, 71, 77, 130, 253, 215, 203, 135, 109, 246, 146, 134, 227, 92, 220, 161, 120, 228, 132, 97, 48, 91, 180, 2, 192, 82, 162, 109];

pub fn main() {
let public_input: Vec<u8> = zkm_runtime::io::read();
Expand Down
4 changes: 2 additions & 2 deletions prover/examples/zkmips.rs
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,8 @@ fn prove_sha_5_precompile(

let (_total_steps, seg_num, mut state) = split_prog_into_segs(state, seg_path, "", 0);

let value = state.read_public_values::<u32>();
log::info!("public value: {:X?}", value);
let value = state.read_public_values::<[u8; 32]>();
log::info!("public value: {:?}", value);

assert!(seg_num == 1);

Expand Down

0 comments on commit 1b24de8

Please sign in to comment.