Skip to content
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

Merged
merged 11 commits into from
Dec 18, 2024

Conversation

matthiasgoergens
Copy link
Collaborator

@matthiasgoergens matthiasgoergens commented Dec 18, 2024

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.)

@@ -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
Copy link
Collaborator Author

@matthiasgoergens matthiasgoergens Dec 18, 2024

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.

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(),
Copy link
Collaborator Author

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.

@@ -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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rewording here is all in #770 and doesn't have much to do with your PR. (It'll go away in the diff, once we merge #770 into master.)

@@ -179,11 +179,9 @@ fn test_rw_lk_expression_combination() {
&verifier_challenges,
)
.expect("verifier failed");

drop(v_transcript);
Copy link
Collaborator Author

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.

@matthiasgoergens matthiasgoergens merged commit 0eef57a into feat/transcript_stat Dec 18, 2024
3 checks passed
@matthiasgoergens matthiasgoergens deleted the matthias/feat/transcript_stat branch December 18, 2024 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant