diff --git a/prover/examples/sha2-rust/Cargo.lock b/prover/examples/sha2-rust/Cargo.lock index 6f264411..5e1d7282 100644 --- a/prover/examples/sha2-rust/Cargo.lock +++ b/prover/examples/sha2-rust/Cargo.lock @@ -225,17 +225,16 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "zkm-precompiles" version = "0.1.0" -source = "git+https://github.com/zkMIPS/zkm#ab68657c118b076c430cef3a303a267a9ade88c7" dependencies = [ "bincode", "cfg-if", "serde", + "sha2", ] [[package]] name = "zkm-runtime" version = "0.1.0" -source = "git+https://github.com/zkMIPS/zkm#ab68657c118b076c430cef3a303a267a9ade88c7" dependencies = [ "bincode", "cfg-if", diff --git a/prover/examples/sha2-rust/Cargo.toml b/prover/examples/sha2-rust/Cargo.toml index b5485569..4727671b 100644 --- a/prover/examples/sha2-rust/Cargo.toml +++ b/prover/examples/sha2-rust/Cargo.toml @@ -5,5 +5,6 @@ name = "sha2-rust" edition = "2021" [dependencies] -zkm-runtime = { git = "https://github.com/zkMIPS/zkm", package = "zkm-runtime" } +#zkm-runtime = { git = "https://github.com/zkMIPS/zkm", package = "zkm-runtime" } +zkm-runtime = { path = "../../../runtime/entrypoint" } sha2 = { version = "0.10.8", default-features = false } diff --git a/prover/examples/zkmips.rs b/prover/examples/zkmips.rs index adab72db..b75ad7e8 100644 --- a/prover/examples/zkmips.rs +++ b/prover/examples/zkmips.rs @@ -62,14 +62,14 @@ fn split_segments() { let _ = split_prog_into_segs(state, &seg_path, &block_path, seg_size); } +const D: usize = 2; +type C = PoseidonGoldilocksConfig; +type F = >::F; + fn prove_single_seg_common(seg_file: &str, basedir: &str, block: &str, file: &str) { let seg_reader = BufReader::new(File::open(seg_file).unwrap()); let kernel = segment_kernel(basedir, block, file, seg_reader); - const D: usize = 2; - type C = PoseidonGoldilocksConfig; - type F = >::F; - let allstark: AllStark = AllStark::default(); let config = StarkConfig::standard_fast_config(); let mut timing = TimingTree::new("prove", log::Level::Info); @@ -98,10 +98,6 @@ fn prove_multi_seg_common( type InnerParameters = DefaultParameters; type OuterParameters = Groth16WrapperParameters; - type F = GoldilocksField; - const D: usize = 2; - type C = PoseidonGoldilocksConfig; - if seg_file_number < 2 { panic!("seg file number must >= 2\n"); } @@ -304,10 +300,7 @@ fn u32_array_to_u8_vec(u32_array: &[u32; 8]) -> Vec { fn prove_sha_5_precompile( elf_path: &str, seg_path: &str, -) -> Receipt<>::F, PoseidonGoldilocksConfig, 2> { - const D: usize = 2; - type C = PoseidonGoldilocksConfig; - type F = >::F; +) -> Receipt<>::F, C, D> { let mut state = load_elf_with_patch(elf_path, vec![]); let n: u32 = 5; @@ -352,10 +345,6 @@ fn prove_sha_5_precompile( fn prove_sha2_precompile() { // 1. split ELF into segs - const D: usize = 2; - type C = PoseidonGoldilocksConfig; - type F = >::F; - let elf_path = env::var("ELF_PATH").expect("ELF file is missing"); let precompile_path = env::var("PRECOMPILE_PATH").expect("PRECOMPILE ELF file is missing"); let seg_path = env::var("SEG_OUTPUT").expect("Segment output path is missing"); diff --git a/prover/src/generation/state.rs b/prover/src/generation/state.rs index cc290e09..2744774f 100644 --- a/prover/src/generation/state.rs +++ b/prover/src/generation/state.rs @@ -27,6 +27,7 @@ where { pub fn claim_digest(&self) -> [u8; 32] { let mut hasher = Sha256::new(); + hasher.update(self.root_before.clone()); hasher.update(self.userdata.clone()); let digest: [u8; 32] = hasher.finalize().into(); diff --git a/runtime/entrypoint/src/lib.rs b/runtime/entrypoint/src/lib.rs index 60e4660b..1c3915df 100644 --- a/runtime/entrypoint/src/lib.rs +++ b/runtime/entrypoint/src/lib.rs @@ -1,5 +1,5 @@ //! Ported from Entrypoint for SP1 zkVM. -#![feature(asm_experimental_arch)] +//#![feature(asm_experimental_arch)] pub mod heap; pub mod syscalls; pub mod io {