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

adding comments for clarifying accum #313

Merged
merged 8 commits into from Jan 16, 2023
Merged

adding comments for clarifying accum #313

merged 8 commits into from Jan 16, 2023

Conversation

pdg744
Copy link
Contributor

@pdg744 pdg744 commented Dec 22, 2022

No description provided.

@flaub flaub requested review from flaub and shkoo December 22, 2022 22:13
Copy link
Member

@flaub flaub left a comment

Choose a reason for hiding this comment

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

Hopefully all TODOs can be resolved before landing, otherwise LGTM

risc0/zkp/src/prove/accum.rs Outdated Show resolved Hide resolved
risc0/zkp/src/prove/accum.rs Outdated Show resolved Hide resolved
risc0/zkp/src/prove/accum.rs Outdated Show resolved Hide resolved
@@ -21,23 +21,29 @@ use crate::{
field::{Elem, ExtElem, Field},
};

/// Tracks plonk accumulations for an execution.
/// Tracks grand product accumulations for PLOOKUP.
Copy link
Member

Choose a reason for hiding this comment

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

My understanding was that we are using the PLONK permutation argument to verify that memory is valid. In this section of the code, I'm not sure PLOOKUP applies. I think PLOOKUP is used in the circuit to avoid having to split every bit of a byte or word into an individual column.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure either -- @jbruestle can you clarify whether Accum is just used for the memory-based grand product accumulation or whether this struct is also involved in the bytes-based accumulation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The answer to the TODO about kinds will be clarifying on this front.

Copy link
Contributor

Choose a reason for hiding this comment

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

So both are permutation arguments, but and accum is used for both, PLOOKUP is too specific. Technically, since at least in our case PLOOKUP is a specialization of PLONK, I'd either call it PLONK, or just a permutation argument.

@@ -21,23 +21,29 @@ use crate::{
field::{Elem, ExtElem, Field},
};

/// Tracks plonk accumulations for an execution.
/// Tracks grand product accumulations for PLOOKUP.
Copy link
Contributor

Choose a reason for hiding this comment

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

So both are permutation arguments, but and accum is used for both, PLOOKUP is too specific. Technically, since at least in our case PLOOKUP is a specialization of PLONK, I'd either call it PLONK, or just a permutation argument.

risc0/zkp/src/prove/accum.rs Outdated Show resolved Hide resolved
risc0/zkp/src/prove/accum.rs Outdated Show resolved Hide resolved
@@ -57,6 +60,7 @@ impl<E: Elem> Accum<E> {
}

pub struct Handler<'a, F: Field> {
// TODO what is p?
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jbruestle one TODO remaining -- can you clarify the role of p in the Handler?

Copy link
Member

Choose a reason for hiding this comment

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

@shkoo Do you know what p refers to in this context?

Copy link
Contributor

Choose a reason for hiding this comment

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

p is a mutex lock (an implementation detail so it can be used in multiple threads and as a callback) containing a "Accum" structure, that's commented as "Tracks grand product accumulations for PLONK-style permutation arguments." on line 24

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for clarifying, @shkoo
I've edited the TODO to read, "p is a mutex lock that contains an Accum structure;" lmk if you'd revise that.

@pdg744 pdg744 marked this pull request as ready for review January 4, 2023 16:26
@pdg744
Copy link
Contributor Author

pdg744 commented Jan 9, 2023

All TODOs have been taken care of -- thanks for the help, everyone!

Will land soon (Tuesday AM?) unless anyone has any last edits to suggest.

@pdg744 pdg744 enabled auto-merge (squash) January 10, 2023 14:21
@pdg744 pdg744 merged commit 9c01b71 into main Jan 16, 2023
@pdg744 pdg744 deleted the paulg/clarifying-accum branch January 16, 2023 19:42
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.

None yet

4 participants