-
Notifications
You must be signed in to change notification settings - Fork 39
keccakf precompile + GKR-IOP integration
#893
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
Merged
spherel
merged 18 commits into
scroll-tech:tianyi/refactor-prover
from
Inversed-Tech:mihai/keccakf_integration
May 2, 2025
Merged
Changes from 2 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
5e18d9a
add keccak_f precompiles & utilities
mcalancea 7611e70
add gkr_iop state to ConstraintSystem/ZKVMWitness (wip, Apr 2)
mcalancea 1cedbc8
add gkr_iop state to ConstraintSystem/ZKVMWitness (wip, Apr 3)
mcalancea dd5ade7
add lookups to DummyEcall (wip, Apr 9)
mcalancea ee54156
add lookups to DummyEcall (wip, Apr 10)
mcalancea dcf7c62
debug
mcalancea db68cfd
correct phase1_witness and commit
mcalancea dd57222
add aux wits to PCS
mcalancea 039465b
debug evals out of bounds
mcalancea 08b3f5d
weird verify behavior for wrong evals
mcalancea 4cb0d95
fix expr_names bug in verifier
mcalancea b398a14
debugging verifier
mcalancea 34956c9
debug verifier
mcalancea 8fcd809
refactor & clean-up
mcalancea 29e38a4
back to the verifier
mcalancea 639ee44
improve unit tests
mcalancea 6b9015d
refactor & polish
mcalancea a589775
Merge branch 'tianyi/refactor-prover' into mihai/keccakf_integration
mcalancea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| use std::time::Duration; | ||
|
|
||
| use criterion::*; | ||
| use gkr_iop::precompiles::run_faster_keccakf; | ||
|
|
||
| use rand::{Rng, SeedableRng}; | ||
| criterion_group!(benches, keccak_f_fn); | ||
| criterion_main!(benches); | ||
|
|
||
| const NUM_SAMPLES: usize = 10; | ||
|
|
||
| fn keccak_f_fn(c: &mut Criterion) { | ||
| // expand more input size once runtime is acceptable | ||
| let mut group = c.benchmark_group(format!("keccak_f")); | ||
| group.sample_size(NUM_SAMPLES); | ||
|
|
||
| // Benchmark the proving time | ||
| group.bench_function(BenchmarkId::new("keccak_f", format!("keccak_f")), |b| { | ||
| b.iter_custom(|iters| { | ||
| let mut time = Duration::new(0, 0); | ||
| for _ in 0..iters { | ||
| // Use seeded rng for debugging convenience | ||
| let mut rng = rand::rngs::StdRng::seed_from_u64(42); | ||
| let state1: [u64; 25] = std::array::from_fn(|_| rng.gen()); | ||
| let state2: [u64; 25] = std::array::from_fn(|_| rng.gen()); | ||
|
|
||
| let instant = std::time::Instant::now(); | ||
| let _ = black_box(run_faster_keccakf(vec![state1, state2], false, false)); | ||
| let elapsed = instant.elapsed(); | ||
| time += elapsed; | ||
| } | ||
|
|
||
| time | ||
| }); | ||
| }); | ||
|
|
||
| group.finish(); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| use std::time::Duration; | ||
|
|
||
| use criterion::*; | ||
| use gkr_iop::precompiles::{run_faster_keccakf, run_keccakf}; | ||
| use p3_field::extension::BinomialExtensionField; | ||
| use p3_goldilocks::Goldilocks; | ||
| use rand::{Rng, SeedableRng}; | ||
| criterion_group!(benches, keccak_f_fn); | ||
| criterion_main!(benches); | ||
|
|
||
| const NUM_SAMPLES: usize = 10; | ||
|
|
||
| fn keccak_f_fn(c: &mut Criterion) { | ||
| // expand more input size once runtime is acceptable | ||
| let mut group = c.benchmark_group(format!("keccak_f")); | ||
| group.sample_size(NUM_SAMPLES); | ||
|
|
||
| // Benchmark the proving time | ||
| group.bench_function(BenchmarkId::new("keccak_f", format!("keccak_f")), |b| { | ||
| b.iter_custom(|iters| { | ||
| let mut time = Duration::new(0, 0); | ||
| for _ in 0..iters { | ||
| // Use seeded rng for debugging convenience | ||
| let mut rng = rand::rngs::StdRng::seed_from_u64(42); | ||
| let state: [u64; 25] = std::array::from_fn(|_| rng.gen()); | ||
|
|
||
| let instant = std::time::Instant::now(); | ||
| let _ = black_box(run_keccakf(state, false, false)); | ||
| let elapsed = instant.elapsed(); | ||
| time += elapsed; | ||
| } | ||
|
|
||
| time | ||
| }); | ||
| }); | ||
|
|
||
| group.finish(); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.