readme and cfg files added

This commit is contained in:
Manish Kumar 2024-08-29 17:35:37 +05:30
parent 5927557f08
commit 4335f28dc7
5 changed files with 35 additions and 2 deletions

12
hash/jolt/bench/README.md Normal file
View File

@ -0,0 +1,12 @@
Benchmarking different hashes inside Jolt zkvm
-----------------------------------------------
The benchmark is defined by the following shell scripts:
- `build.sh` - build the code.
- `run.sh` and `run_tree.sh` - run the benchmark itself (`run.sh` for sha256, keccak, blake2b, blake3 and `run2.sh` for poseidon2 over bn254 and babybear)
Benchmarks can be parameterized using environment variables. By convention, we start the names of these environment variables with the `ZKBENCH_` prefix(See `run.sh` and `run_tree.sh` files).
Additional files `bench.cfg` and `bench_tree.cfg` specifies the configurations and parameters.

11
hash/jolt/bench/bench.cfg Normal file
View File

@ -0,0 +1,11 @@
name: "Hashes benchmarking using jolt zkvm prover"
author:
timeout: 200
params:
[ HASH_TYPE: [ "sha256", "keccak", "blake2b", "blake3"]
, INPUT_SIZE_BYTES: [ 256, 512, 1024, 2048 ]
]
tags: jolt, $HASH_TYPE
comments:
The benchmarks includes for sha256, keccak, blake2b, blake3.
the hashing is done inside the guest.

View File

@ -0,0 +1,10 @@
name: "Hashes benchmarking using jolt zkvm prover"
author:
timeout: 1000
params:
[ HASH_TYPE_TREE: [ "poseidon2_babybear", "poseidon2_bn256"]
, TREE_DEPTH: [ 2, 4, 8 ]
]
tags: jolt, $HASH_TYPE_TREE
comments:
The benchmarks includes for poseidon2(merkle hashing) over bn254 and babybear.

View File

@ -68,7 +68,6 @@ fn poseidon2_babybear(input: Vec<u32>) -> Vec<u32> {
}
//TODO: too slow!! need to do some optimizations
// poseidon2 over BN256
#[jolt::provable(stack_size = 1000000, memory_size = 10000000)]
pub fn poseidon2_bn256(input: Vec<Vec<u8>>) -> Vec<u8> {

View File

@ -9,7 +9,7 @@ use alloc::vec::Vec;
extern crate core;
use core::marker::PhantomData;
pub type Scalar = ark_bn254::fr::Fr;
pub type Scalar = ark_bn254::Fr;
#[derive(Clone, Debug)]
pub struct Poseidon2Params<F: PrimeField> {
@ -633,5 +633,6 @@ impl<F: PrimeField> MerkleTreeHash<F> for Poseidon2<F> {
pub fn from_hex<F: PrimeField>(s: &str) -> F {
let a = Vec::from_hex(&s[2..]).expect("Invalid Hex String");
F::from_be_bytes_mod_order(&a as &[u8])
}