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: read public input from input stream instead #177

Merged
merged 6 commits into from
Oct 24, 2024

Conversation

weilzkm
Copy link
Contributor

@weilzkm weilzkm commented Oct 22, 2024

No description provided.

Copy link

@gavin-ygy gavin-ygy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fn prove_multi_seg_common(){
let wrapped_circuit = WrappedCircuit::<InnerParameters, OuterParameters, D>::build(
circuit,
Some((vec![], bit_size)),
);

//Gavin
let block_public_inputs = serde_json::json!({
            "public_inputs": block_proof.public_inputs,
                });
let path_buf = PathBuf::from(path.clone());
let block_public_inputs_file = File::create(path_buf.join("public_inputs.json"))?;
serde_json::to_writer(&block_public_inputs_file, &block_public_inputs)?;

//end
log::info!("build finish");

let wrapped_proof = wrapped_circuit.prove(&block_proof).unwrap();
wrapped_proof.save(path).unwrap();

total_timing.filter(Duration::from_millis(100)).print();
result

}
在这个函数的末尾,需加上 保存public_input 到文件 public_inputs.json 的动作

Copy link

@gavin-ygy gavin-ygy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

基于你的分支,编译后运行,报错:
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/zkm/prover$ ARGS="711e9609339e92b03ddc0a211827dba421f38f9ed8b9d806e1ffdd8c15ffa03d world!" RUST_LOG=info ELF_PATH=examples/sha2-rust/target/mips-unknown-linux-musl/release/sha2-rust HOST_PROGRAM=sha2_rust SEG_OUTPUT=/tmp/output SEG_SIZE=6553 cargo run --release --example zkmips prove_host_program
warning: /mnt/data/.cargo/config is deprecated in favor of config.toml
note: if you need to support cargo 1.38 or earlier, you can symlink config to config.toml
warning: /mnt/data/.cargo/config is deprecated in favor of config.toml
note: if you need to support cargo 1.38 or earlier, you can symlink config to config.toml
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package: /mnt/data/gavin/test/zkm/prover/Cargo.toml
workspace: /mnt/data/gavin/test/zkm/Cargo.toml
Compiling zkm-prover v0.1.0 (/mnt/data/gavin/test/zkm/prover)
Finished release profile [optimized] target(s) in 19.22s
Running /mnt/data/gavin/test/zkm/target/release/examples/zkmips prove_host_program
[2024-10-23T02:24:15Z INFO zkmips] expected public value in hex: "711e9609339e92b03ddc0a211827dba421f38f9ed8b9d806e1ffdd8c15ffa03d"
[2024-10-23T02:24:15Z INFO zkmips] expected public value: [71, 1E, 96, 9, 33, 9E, 92, B0, 3D, DC, A, 21, 18, 27, DB, A4, 21, F3, 8F, 9E, D8, B9, D8, 6, E1, FF, DD, 8C, 15, FF, A0, 3D]
[2024-10-23T02:24:15Z INFO zkmips] private input value: [77, 6F, 72, 6C, 64, 21]
[2024-10-23T02:24:15Z INFO zkm_emulator::utils] Split done 6913 : 31813
[2024-10-23T02:24:15Z INFO zkmips] public value: [71, 1E, 96, 9, 33, 9E, 92, B0, 3D, DC, A, 21, 18, 27, DB, A4, 21, F3, 8F, 9E, D8, B9, D8, 6, E1, FF, DD, 8C, 15, FF, A0, 3D]
[2024-10-23T02:24:15Z INFO zkmips] public value: 711e9609339e92b03ddc0a211827dba421f38f9ed8b9d806e1ffdd8c15ffa03d in hex
[2024-10-23T02:25:04Z INFO zkmips] Process segment /tmp/output/0
[2024-10-23T02:25:07Z INFO zkm_prover::cpu::bootstrap_kernel] Bootstrapping took 3099 cycles
[2024-10-23T02:25:07Z INFO zkm_prover::generation] CPU halted after 5779 cycles
[2024-10-23T02:25:07Z INFO zkm_prover::generation] CPU trace padded to 8192 cycles
[2024-10-23T02:25:07Z INFO zkm_prover::generation] Trace lengths (before padding): TraceCheckpoint { arithmetic_len: 957, cpu_len: 8192, poseidon_len: 3098, poseidon_sponge_len: 3098, logic_len: 139, memory_len: 135315 }
thread 'main' panicked at /mnt/data/gavin/test/zkm/prover/src/recursive_verifier.rs:631:13:
index out of bounds: the len is 32 but the index is 32
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
ubuntu@ip-172-31-0-75:/mnt/data/gavin/test/zkm/prover$

@weilzkm
Copy link
Contributor Author

weilzkm commented Oct 23, 2024

I tested it in new version. The error is fixed.

@eigmax eigmax merged commit 415b293 into zkMIPS:main Oct 24, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants