-
Notifications
You must be signed in to change notification settings - Fork 20
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
feat(ivc): impl cyclefold::sfc
#413
base: feat-protogalaxy-nifs
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
**Motivation** This PR combines all the changes for operability #373 **Overview** - Renamed `PairedPlonkInstance` and `PairedTrace` to `SupportPlonkInstance` and `SupportTrace` for better alignment with the functionality - Added alignment for W_commitments & challenes, since we don't know them at the "before zero step" stage, this takes 300 extra rows - Changed `Input` absorption order for consistency from nifs::{sangria,protogalaxy} (Some fields are now converted to bn, oncircuit only)
360ca6e
to
5bb8218
Compare
@@ -237,34 +340,79 @@ impl<F: PrimeField> PairedPlonkInstance<F> { | |||
}) | |||
.collect::<Result<Vec<_>, Halo2PlonkError>>()?; | |||
|
|||
iter::repeat((F::ZERO, F::ZERO)) | |||
.take(W_COMMITMENTS_MAX_LEN - W_commitments.len()) |
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.
the number of W_commitments is known during the circuit setup phase which depends on the user-defined circuit. It seems we don't need to pad.
region, | ||
|| "", | ||
iter::repeat(F::ZERO).take(W_CHALLENGES_MAX_LEN - challenges.len()), | ||
)?; |
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.
similar as padding of W_Commitments above
pub(crate) W_commitments: Vec<(F, F)>, | ||
pub(crate) instances: Vec<Vec<BigUint<F>>>, | ||
pub(crate) challenges: Vec<BigUint<F>>, | ||
// should be bn, but for absorb use original value and make bn oncircuit |
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.
I understand 'should be bn' part. don't get 'but for ... and make bn oncircuit' part
@@ -112,8 +111,13 @@ impl<F: PrimeField, RO: ROTrait<F>> AbsorbInRO<F, RO> for PairedPlonkInstance<F> | |||
} = self; | |||
|
|||
ro.absorb_field_iter(W_commitments.iter().flat_map(|(x, y)| [x, y]).copied()) | |||
.absorb_iter(instances.iter().flatten()) | |||
.absorb_iter(challenges.iter()); | |||
.absorb_field_iter( |
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.
will absorb_field_iter
absorb the field element as BigUInt to be consistency with on-circuit absorb"?
.absorb_field(*ex) | ||
.absorb_field(*ey) | ||
.absorb_field(*u); | ||
.absorb_field(F::ZERO); |
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.
why absorb zero here?
|
||
let mut self_ = self.input.clone(); | ||
|
||
self_.step += 1; |
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.
IIUC, instances is return the instance of current step.
can you remind me that before call fn instances
, what data the self hold/account for?
let expected_l0 = mg.conditional_select(region, &zero, &poly_L_values[0], &is_zero_term)?; | ||
let expected_l0 = bn_chip | ||
let expected_l0 = mg.conditional_select(region, &zero, &poly_L_values[0], &is_zero_step)?; | ||
let expected_l0_limbs = bn_chip |
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.
how is it handled at step=0? both l0 and l1 are zero?
self.self_trace.input_accumulator.ins.W_commitments.iter(), | ||
self.self_trace.incoming.W_commitments.iter(), | ||
self.paired_trace.incoming.iter(), | ||
self.support_trace.incoming.iter(), |
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.
IIRC, the new_acc.ins.W_commitments here are still old one and need to be updated here.
.from_assigned_value_to_limbs(region, &expected_l1) | ||
.map_err(|err| { | ||
error!("while make from L1 biguint form: {err:?}"); | ||
Halo2PlonkError::Synthesis | ||
})?; | ||
|
||
for (acc_W, incoming_W, trace, new_acc_W) in itertools::multizip(( | ||
for (acc_W, incoming_W, trace, new_acc_W, index) in itertools::multizip(( |
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.
It might be a good idea to add a comment of how many delegation of ecc multiplication have been used somewhere. maybe here or in function comment
Motivation
This PR combines all the changes for operability #373
Overview
PairedPlonkInstance
andPairedTrace
toSupportPlonkInstance
andSupportTrace
for better alignment with the functionalityInput
absorption order for consistency from nifs::{sangria,protogalaxy} (Some fields are now converted to bn, oncircuit only)