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

chore: update run local proving script #25

Merged
merged 3 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/verifier/snark_proof_with_public_inputs.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"Proof":{"Ar":{"X":"20986100223742189794428594083244953701408789026843989908435048719917632304610","Y":"13312112978838104297936765092731357265583798633367270419949950449739950262299"},"Krs":{"X":"21414385011717857401350318474624945713895831525422758574143367432063095862610","Y":"16423991045129868936811412810791234200886558293119184537442651275319977235533"},"Bs":{"X":{"A0":"11334377274679574919826609438981352168291239642667203135465250445892409261829","A1":"502135620489275023389952763328439911399553648581965110109386553942302300788"},"Y":{"A0":"17625733828018823879938709981005705770193800659886938923296199657306934864258","A1":"4260326572269494480125515901189030920228567526305403135494458666071296191877"}},"Commitments":[{"X":"17273959889587427045931700521956542100389478452246646316053540421122551664021","Y":"18318673986437913163676530971051070041062128124589353307942427661936033278456"}],"CommitmentPok":{"X":"5949616844048677802101960585122116163044527517837594064636603012726545439747","Y":"4465071354076921449919725370557406791935776422229056588281381686837540526870"}},"PublicWitness":["3","176","196","66","152","252","28","20","154","251","244","200","153","111","185","36","39","174","65","228","100","155","147","76","164","149","153","27","120","82","184","85","3","176","196","66","152","252","28","20","154","251","244","200","153","111","185","36","39","174","65","228","100","155","147","76","164","149","153","27","120","82","184","85","5009287862160307920686587520880862879519265129424853749905862185648451074148"]}
{"Proof":{"Ar":{"X":"20986100223742189794428594083244953701408789026843989908435048719917632304610","Y":"13312112978838104297936765092731357265583798633367270419949950449739950262299"},"Krs":{"X":"21414385011717857401350318474624945713895831525422758574143367432063095862610","Y":"16423991045129868936811412810791234200886558293119184537442651275319977235533"},"Bs":{"X":{"A0":"11334377274679574919826609438981352168291239642667203135465250445892409261829","A1":"502135620489275023389952763328439911399553648581965110109386553942302300788"},"Y":{"A0":"17625733828018823879938709981005705770193800659886938923296199657306934864258","A1":"4260326572269494480125515901189030920228567526305403135494458666071296191877"}},"Commitments":[{"X":"17273959889587427045931700521956542100389478452246646316053540421122551664021","Y":"18318673986437913163676530971051070041062128124589353307942427661936033278456"}],"CommitmentPok":{"X":"5949616844048677802101960585122116163044527517837594064636603012726545439747","Y":"4465071354076921449919725370557406791935776422229056588281381686837540526870"}},"PublicWitness":["3","176","196","66","152","252","28","20","154","251","244","200","153","111","185","36","39","174","65","228","100","155","147","76","164","149","153","27","120","82","184","85","3","176","196","66","152","252","28","20","154","251","244","200","153","111","185","36","39","174","65","228","100","155","147","76","164","149","153","27","120","82","184","85","5009287862160307920686587520880862879519265129424853749905862185648451074148"]}
2 changes: 1 addition & 1 deletion guest-program/mem-alloc-vec/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
[package]
name = "zkm-mips-elf-mem-alloc-vec"
name = "mem-alloc-vec"
version = "0.1.0"
edition = "2021"

Expand Down
2 changes: 1 addition & 1 deletion guest-program/sha2-rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
[package]
name = "zkm-mips-elf-sha2-rust"
name = "sha2-rust"
version = "0.1.0"
edition = "2021"

Expand Down
12 changes: 10 additions & 2 deletions host-program/run-local-proving.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
set -e
program=$1
BASEDIR=$(cd $(dirname $0); pwd)
export LD_LIBRARY_PATH=$BASEDIR/../sdk/src/local/libsnark:$LD_LIBRARY_PATH ##Modify it according your template
export ZKM_PROVER=local
export RUST_LOG=info
export SEG_SIZE=262144
export ARGS="711e9609339e92b03ddc0a211827dba421f38f9ed8b9d806e1ffdd8c15ffa03d world!"
#export ELF_PATH=${BASEDIR}/../guest-program/$program/target/mips-unknown-linux-musl/release/$program
export ELF_PATH=${BASEDIR}/../guest-program/$program/target/mips-unknown-linux-musl/release/$program

echo "Compile guest-program ${program}"
cd $BASEDIR/../guest-program/$program
cargo build -r --target=mips-unknown-linux-musl
cd -

echo "Setup input for guest-program ${program}"
#export PUBLIC_INPUT_PATH=host-program/test-vectors/244.json
#export OUTPUT_DIR=/tmp/$program
echo "BASEDIR:$BASEDIR"

nohup ../target/release/zkm-prove $program >./$program-local-proving.log 2>&1 &
echo 'check out the log by tail -f $program-local-proving.log'
echo 'Check out the log by tail -f $program-local-proving.log'
3 changes: 1 addition & 2 deletions host-program/src/bin/zkm-prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,7 @@ fn set_sha2_go_intput(seg_size_u: u32, execute_only_b: bool) -> anyhow::Result<P
}

fn set_mem_alloc_vec_intput(seg_size_u: u32, execute_only_b: bool) -> anyhow::Result<ProverInput> {
let elf_path =
env::var("ELF_PATH").unwrap_or("../guest-program/mem-alloc-vec/target/mips-unknown-linux-musl/release/zkm-mips-elf-mem-alloc-vec".to_string());
let elf_path = env::var("ELF_PATH").expect("ELF PATH is missed");
let input = ProverInput {
elf: read(elf_path).unwrap(),
public_inputstream: "".into(),
Expand Down
Loading