diff --git a/README.md b/README.md index 220368f..c3263e5 100644 --- a/README.md +++ b/README.md @@ -4,24 +4,25 @@ An endpoint for `verify_kzg_proof` in [c-kzg-4844](https://github.com/ethereum/c ## Cycle Counts in SP1 -| Operation | Cycle Count | -| -------------------- | ----------- | -| `verify_kzg_proof` | | -| `load_trusted_setup` | 391 | +| Operation | Cycle Count | +| ----------------------------- | ----------------- | +| `verify_blob_kzg_proof` | 27,166,240 cycles | +| `verify_blob_kzg_proof_batch` | 27,363,307 cycles | +| `verify_kzg_proof` | 9,390,640 cycles | -Checkout the SP1 profile at [0xWOLAND/sp1-revm-kzg-profile](https://github.com/0xWOLAND/sp1-revm-kzg-profile). This crate has been used in a [fork of SP1's patch of `revm`](https://github.com/0xWOLAND/revm/tree/patch-v5.0.0), which passes all tests. Additionally, `kzg-rs` is based on [this](https://github.com/0xWOLAND/bls12_381) slightly modified fork of `bls12_381`. This crate works in `[no_std]` mode. +This crate has been used in a [fork of SP1's patch of `revm`](https://github.com/0xWOLAND/revm/tree/patch-v5.0.0), which passes all tests. `kzg-rs` is based on [this](https://github.com/0xWOLAND/bls12_381) slightly modified fork of `bls12_381`. This crate works in `[no_std]` mode. ## Usage -``` +```sh cargo add kzg-rs ``` -And add +Or add ```toml -kzg-rs = { version = "0.1", default-features = false, features=['cache'] optional = true } +kzg-rs = { version = "0.1" } ``` -You can rebuild `g1.bin` and `g2.bin` by running +You can rebuild `roots_of_unity.bin`, `g1.bin`, and `g2.bin` by running ```sh -cargo run --bin build_binaries +cargo build ``` diff --git a/src/g1.bin b/src/g1.bin index 012e861..006b78c 100644 Binary files a/src/g1.bin and b/src/g1.bin differ diff --git a/src/g2.bin b/src/g2.bin index fa83e08..acd642d 100644 Binary files a/src/g2.bin and b/src/g2.bin differ diff --git a/src/kzg_proof.rs b/src/kzg_proof.rs index 2494bb2..001ff18 100644 --- a/src/kzg_proof.rs +++ b/src/kzg_proof.rs @@ -388,9 +388,7 @@ impl KzgProof { let evaluation_challenge = compute_challenge(&blob, &commitment)?; let y = evaluate_polynomial_in_evaluation_form(polynomial, evaluation_challenge, kzg_settings)?; - let out = verify_kzg_proof_impl(commitment, evaluation_challenge, y, proof, kzg_settings); - - out + verify_kzg_proof_impl(commitment, evaluation_challenge, y, proof, kzg_settings) } pub fn verify_blob_kzg_proof_batch( @@ -512,9 +510,7 @@ pub mod tests { continue; }; - println!("cycle-tracker-start: test_verify_kzg_proof"); let result = KzgProof::verify_kzg_proof(&commitment, &z, &y, &proof, &kzg_settings); - println!("cycle-tracker-end: test_verify_kzg_proof"); match result { Ok(result) => { assert_eq!(result, test.get_output().unwrap_or(false)); @@ -615,14 +611,12 @@ pub mod tests { continue; }; - println!("cycle-tracker-start: test_verify_blob_kzg_proof_batch"); let result = KzgProof::verify_blob_kzg_proof_batch( vec![blobs], vec![commitments], vec![proofs], &kzg_settings, ); - println!("cycle-tracker-end: test_verify_blob_kzg_proof_batch"); match result { Ok(result) => { assert_eq!(result, test.get_output().unwrap_or(false));