-
Notifications
You must be signed in to change notification settings - Fork 16
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
Suggestions for [Feat] Calculate proof size and number of hashes #771
Suggestions for [Feat] Calculate proof size and number of hashes #771
Conversation
Extracted from suggestions for #712
@@ -70,7 +70,7 @@ fn fibonacci_prove(c: &mut Criterion) { | |||
"max_steps = {}, proof size = {}, hashes count = {}", | |||
max_steps, | |||
serialize_size, | |||
stat_recorder.borrow().field_appended_num | |||
stat_recorder.into_inner().field_appended_num |
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 .into_inner()
enlists the borrow checker into making sure that no one else holds any access to our stat_recorder
refcell anymore. Specifically, this .into_inner()
only works when the borrowing in BasicTranscriptWitStat::new(&stat_recorder, b"riscv");
is done.
Because of this, we don't need the manual drop anymore.
mpcs/benches/basefold.rs
Outdated
let proof = Pcs::open(&pp, &poly, &comm, &point, &eval, &mut transcript).unwrap(); | ||
|
||
group.bench_function(BenchmarkId::new("open", format!("{}", num_vars)), |b| { | ||
b.iter_batched( | ||
|| transcript_for_bench.clone(), |
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.
We remove the need to clone here in #770
That PR is somewhat independent of yours, and we can merge it first, making the diff here smaller.
transcript/src/basic.rs
Outdated
@@ -32,15 +32,15 @@ impl<E: ExtensionField> Transcript<E> for BasicTranscript<E> { | |||
} | |||
|
|||
fn read_challenge(&mut self) -> Challenge<E> { | |||
// notice `from_bases` and `from_limbs` has the same behavior but |
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.
@@ -179,11 +179,9 @@ fn test_rw_lk_expression_combination() { | |||
&verifier_challenges, | |||
) | |||
.expect("verifier failed"); | |||
|
|||
drop(v_transcript); |
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.
.into_inner()
sort-of does the job that the manual drop used to do.
Here are some suggestions for #712
This builds on #770 and the diff will get smaller, once #770 is in master.
The main idea here is to remove the need to have a reference count and also simultaneously remove the need for a manual drop. We enlist the borrow checker's help to make sure that we only show the statistics, once everything has been added up. (No more
sync_stat
necessary, either.)