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
what does field STATE_WIDTH and CAN_ACCESS_NEXT_TRACE_STEP mean of PlonkConstraintSystemParams? #43
Comments
I should answer you tomorrow when back to the laptop with a normal keyboard :) |
Ok, so:
|
originally I understand witness as (A,B,C,D) columns values, STATE_WIDTH is equal to number of such columns, but in your comment, the "witness" meaning transformed, which is dedicated using for custom gate. the new STATE_WIDTH represents my old understanding witness. Correct me if wrong ! Thanks for discussion! |
Your understanding of witness is correct, it's just that I've used another naming. "Witness" in my terms is not used anywhere yet, but it can be used e.g. to make custom affine transform + non-linearity gate for Poseidon hash like the following: A + B + C = W_0; W_0 ^4 = W_1; W_0 * W_1 = D. Effectively we get that D = (A + B + C)^5 and it's what we want, but used extra witness/advice columns (that are effectively discarded) for some extra bookkeeping and to have a degree of the constraints low (this example is quite artificial, but should give you a hint). Halo2 uses other types of gates that allow one to access values in the previous and next rows as far as I remember, but with Plonk you can design many relationships using both relative or absolute row addressing. Regarding D_on_next_row: you can do like this a1 + b1 + c1 + d1 + const - d2 = 0, -a2 + b2 + c2 + d2 = 0, effectively making a long linear combination into a2 (I've zeroed a coefficient for D_next in the row number 2) |
more clear to your designing motivation, as D_next imported requires a new polynomial over D_next vectors in prove & verify procedure I think, D_next also reduce number of gates for the same arithmetic computation as well . also, about HAS_CUSTOM_GATES flag, how to determine if there is an actual custom gate or how to make a custom gate underling in other words ? |
Yes, such gate requires an extra polynomial in setup (coefficients in front of D_next), but this is also not too large price because it's amortized by linearization |
yeah, is there any custom gate example helping understanding "HAS_CUSTOM_GATES" flag, Thanks ! |
Here is an example how to define a custom gate that does 5th degree non-linearity https://github.com/matter-labs/franklin-crypto/blob/770156e665d2d866f080e241876b358136ccc9f1/src/plonk/circuit/custom_rescue_gate.rs#L31 |
Got , will take a look! |
in latest better_better_cs module, PlonkConstraintSystemParams as follow:
pub trait PlonkConstraintSystemParams<E: Engine>: Sized + Copy + Clone + Send + Sync {
const STATE_WIDTH: usize;
const WITNESS_WIDTH: usize;
const HAS_WITNESS_POLYNOMIALS: bool;
const HAS_CUSTOM_GATES: bool;
const CAN_ACCESS_NEXT_TRACE_STEP: bool;
}
here what does field STATE_WIDTH and CAN_ACCESS_NEXT_TRACE_STEP mean?
and what is difference between STATE_WIDTH and WITNESS_WIDTH? looks confusing .
Can anybody explain ?
Thanks in advance !
The text was updated successfully, but these errors were encountered: