-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add Tests for Segment Proving Without Keccak Tables #648
Changes from 12 commits
662c8db
d82b1a8
4498870
b14417f
eabcf5e
2ad3857
2b2e737
f63363b
cc9d41b
fe88819
7ff2fb1
8c940b0
3800986
91dbeaa
bb79080
ed9637d
fd55d1a
4de4c64
e34c59a
7d72eb9
ac41fa4
c822a70
447cfb9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2944,3 +2944,101 @@ where | |
circuit.verifier_only.circuit_digest.elements.len() | ||
+ (1 << circuit.common.config.fri_config.cap_height) * NUM_HASH_OUT_ELTS | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use plonky2::field::goldilocks_field::GoldilocksField; | ||
use plonky2::plonk::config::PoseidonGoldilocksConfig; | ||
use plonky2::timed; | ||
|
||
use super::*; | ||
use crate::testing_utils::{dummy_payload, init_logger}; | ||
|
||
type F = GoldilocksField; | ||
const D: usize = 2; | ||
type C = PoseidonGoldilocksConfig; | ||
|
||
#[test] | ||
#[ignore] | ||
fn test_segment_proof_generation_without_keccak() -> anyhow::Result<()> { | ||
let timing = &mut TimingTree::new("Segment Proof Generation", log::Level::Info); | ||
init_logger(); | ||
|
||
let all_stark = AllStark::<F, D>::default(); | ||
let config = StarkConfig::standard_fast_config(); | ||
|
||
let all_circuits = timed!( | ||
timing, | ||
log::Level::Info, | ||
"Create all recursive circuits", | ||
AllRecursiveCircuits::<F, C, D>::new( | ||
&all_stark, | ||
&[ | ||
16..17, | ||
8..9, | ||
9..10, | ||
4..5, | ||
8..9, | ||
4..5, | ||
17..18, | ||
17..18, | ||
17..18 | ||
], | ||
&config, | ||
) | ||
); | ||
|
||
// Generate a dummy payload for testing | ||
let dummy_payload = timed!( | ||
timing, | ||
log::Level::Info, | ||
"Generate dummy payload", | ||
dummy_payload(100, true)? | ||
); | ||
|
||
let max_cpu_len_log = 9; | ||
let segment_iterator = SegmentDataIterator::<F>::new(&dummy_payload, Some(max_cpu_len_log)); | ||
|
||
let mut proofs_without_keccak = vec![]; | ||
|
||
let skip_proofs_before_index = 3; | ||
for (i, segment_run) in segment_iterator.enumerate() { | ||
if i < skip_proofs_before_index { | ||
continue; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems highly specific, as any modification in the KERNEL ASM may break your assumption that the 3rd segment has no keccak operation. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree. Do you have any suggestions on how to craft a payload that generates segments without Keccak? Regarding cdk_erigon, I can add a feature flag to disable it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I think we'd need some around segment generation. Basically we'd want to do the same as in |
||
|
||
// Process and prove segment | ||
let (_, mut segment_data) = | ||
segment_run.map_err(|e: SegmentError| anyhow::format_err!(e))?; | ||
let segment_proof = timed!( | ||
timing, | ||
log::Level::Info, | ||
"Prove segment", | ||
all_circuits.prove_segment( | ||
&all_stark, | ||
&config, | ||
dummy_payload.trim(), | ||
&mut segment_data, | ||
timing, | ||
None, | ||
)? | ||
); | ||
|
||
proofs_without_keccak.push(segment_proof); | ||
break; // Process only one proof | ||
} | ||
|
||
// Verify the generated segment proof | ||
timed!( | ||
timing, | ||
log::Level::Info, | ||
"Verify segment proof", | ||
all_circuits.verify_root(proofs_without_keccak[0].proof_with_pis.clone())? | ||
); | ||
|
||
// Print timing details | ||
timing.print(); | ||
|
||
Ok(()) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will capture everything, I'd assume you want to initialize it right before proving?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it is what I intend to do. I also want to know recursive circuits generation time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, the timing tree name is slightly misleading then but not really blocking,