diff --git a/hash/sp1/bench/README.md b/hash/sp1/bench/README.md new file mode 100644 index 0000000..55f09f8 --- /dev/null +++ b/hash/sp1/bench/README.md @@ -0,0 +1,10 @@ +Benchmarking inside sp1 ZKVM +-------------------------------- + +- The `sp1/benches` contains the following hash `program`(the source code that will be proven inside the zkVM): sha256, keccak, blake2, blake3, and poseidon2 ober BN256. +- `script` folder contains the benchmarking code that contains proof generation and verification code for each hash program. +- The `build.sh` script builds the whole code. +- `run.sh` and `run_tree.sh` runs the benchmark. (`run.sh` for sha256, keccak, blake2, blake3 and `run_tree.sh` for poseidon2 over BN256) +- Benchmarks can be parameterized using environment variables. By convention, we start the names of these environment variables with the `ZKBENCH_` prefix. +- By default the `run.sh` will run the sha256 benchmark over 1KB of data. other hashes can be run by settig the environment variables accordingly. +- Additional files `bench.cfg` and `bench_tree.cfg` specifies the configurations and parameters. diff --git a/hash/sp1/bench/bench.cfg b/hash/sp1/bench/bench.cfg new file mode 100644 index 0000000..0aa0b9d --- /dev/null +++ b/hash/sp1/bench/bench.cfg @@ -0,0 +1,11 @@ +name: "Hashes benchmarking using sp1 prover" +author: +timeout: 200 +params: + [ HASH_TYPE: [ "sha256", "keccak", "blake2", "blake3"] + , INPUT_SIZE_BYTES: [ 256, 512, 1024, 2048 ] + ] +tags: sp1, $HASH_TYPE + +comments: + The benchmarks includes for sha256, keccak, blake2, blake3 using sp1. diff --git a/hash/sp1/bench/bench_tree.cfg b/hash/sp1/bench/bench_tree.cfg new file mode 100644 index 0000000..c09e4bc --- /dev/null +++ b/hash/sp1/bench/bench_tree.cfg @@ -0,0 +1,10 @@ +name: "Hashes benchmarking using sp1 prover" +author: +timeout: 500 +params: + [ HASH_TYPE_TREE: [ "poseidon2"] + , TREE_DEPTH: [ 2, 4, 8, 16 ] + ] +tags: sp1, $HASH_TYPE_TREE +comments: + The benchmarks includes for poseidon2(merkle hashing) over BN256. \ No newline at end of file diff --git a/hash/sp1/bench/run_tree.sh b/hash/sp1/bench/run_tree.sh index 094983c..c8db6c6 100755 --- a/hash/sp1/bench/run_tree.sh +++ b/hash/sp1/bench/run_tree.sh @@ -13,4 +13,4 @@ echo "HASH = $ZKBENCH_HASH_TYPE_TREE" echo "Tree Depth = $ZKBENCH_TREE_DEPTH" # Run the benchmarks -./target/release/bench-script $ZKBENCH_HASH_TYPE_TREE $ZKBENCH_TREE_DEPTH \ No newline at end of file +RUST_LOG=info ./target/release/bench-script $ZKBENCH_HASH_TYPE_TREE $ZKBENCH_TREE_DEPTH \ No newline at end of file diff --git a/hash/sp1/bench/sha256/elf/riscv32im-succinct-zkvm-elf b/hash/sp1/bench/sha256/elf/riscv32im-succinct-zkvm-elf index 3e19cb1..5c22e41 100755 Binary files a/hash/sp1/bench/sha256/elf/riscv32im-succinct-zkvm-elf and b/hash/sp1/bench/sha256/elf/riscv32im-succinct-zkvm-elf differ