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

feat(ivc): impl cyclefold zero step #404

Open
wants to merge 1 commit into
base: 369-feat-support-circuit-p-out
Choose a base branch
from

Conversation

cyphersnake
Copy link
Collaborator

Motivation
Part of #373 and testing of #369

Overview
The first part of the implementation of the zero step cyclefold. Split because of size of changes

Temporarily commented out part of cyclefold step folding circuit concerning pairing check

@cyphersnake cyphersnake requested a review from chaosma December 16, 2024 15:05
@cyphersnake cyphersnake self-assigned this Dec 16, 2024
**Motivation**
Part of #373 and testing of #369

**Overview**
The first part of the implementation of the zero step cyclefold

__Temporarily commented out part of cyclefold step folding circuit concerning pairing check__
@cyphersnake
Copy link
Collaborator Author

A lot of staff will changed in future PR, not spent a lot of time with IVC::new

initial_secondary_trace: FoldablePlonkTrace<C2>,
pub support_ck: CommitmentKey<CSup>,
pub support_S: PlonkStructure<CSup::ScalarExt>,
pub support_initial_trace: FoldablePlonkTrace<CSup>,
Copy link
Collaborator

Choose a reason for hiding this comment

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

what are difference between FoldablePlonkTrace and PlonkTrace? Can we just use one type of trace?

Copy link
Collaborator Author

@cyphersnake cyphersnake Jan 27, 2025

Choose a reason for hiding this comment

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

This is a NewType pattern for checking conditions

Using NonZero as an example: using this type implies that it is not zero and you don't need to use a check everywhere.

Specifically here it saved me hours of debugging or hundreds of lines like assert!(trace.instances.len() == MARKERS_LEN).

Well and this has been in the code base for a some time

@@ -20,11 +20,11 @@ pub const RATE: usize = T - 1;
pub const R_F: usize = 10;
pub const R_P: usize = 10;

/// Safety: because 32 != 0
pub const DEFAULT_LIMB_WIDTH: NonZeroUsize = unsafe { NonZeroUsize::new_unchecked(32) };
/// Safety: because 64 != 0
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is the reason to increase both LIMB_WIDTH and COUNT_LIMIT here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This simply reduced the number of rows, the search for optimal values is left to the benchmark stage

@@ -430,12 +449,55 @@ impl<F: PrimeField> SangriaAccumulatorInstance<F> {

pub type SangriaCrossTermCommits<F> = Vec<(AssignedValue<F>, AssignedValue<F>)>;

pub struct PairedIncoming<F: PrimeField> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

NBD: add a short comment to describe what is it, e.g. something like
// instance from support circuit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, will add at the end of PR-train ✍️

@@ -408,7 +576,121 @@ impl<const ARITY: usize, F: PrimeField, RO: ROTrait<F>> AbsorbInRO<F, RO> for In

impl<const ARITY: usize, F: PrimeField> Input<ARITY, F> {
pub(super) fn get_without_witness(&self) -> Self {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just to double confirm, this is used for initial input at step zero?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, in pp.new

@cyphersnake cyphersnake requested a review from chaosma January 27, 2025 15:00
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.

2 participants