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

Improve the design of circuit, config, and instances for CycleFold #158

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

winderica
Copy link
Collaborator

@winderica winderica commented Sep 11, 2024

This PR aims to refactor the existing code related to CycleFold and improve the design. Specifically:

  • Add support for multiple random values when accumulating points in CF circuit, while maintaining the efficiency of current implementation for multiple points. (See the comments in Protogalaxy based IVC #123 (comment))
    This is achieved by modifying the CycleFold circuit to iteratively compute $P = (P + p_i) \cdot r_i$, so the final folded $P$ becomes $P = (((((p_{n - 1} \cdot r_{n - 1}) + p_{n - 2}) \cdot r_{n - 2} + p_{n - 3}) \cdot r_{n - 3} + ...) \cdot r_1 + p_0) \cdot r_0$, which is expanded to $$P = r_0 p_0 + r_0 r_1 p_1 + r_0 r_1 r_2 p_2 + ...$$.
    Thus, for HyperNova we simply need to specify $r_0 = 1, r_1 = r_2 = ... = R$, where $R$ is the actual randomness ($\rho$ in HyperNova).
    Also, for ProtoGalaxy we have $r_0 = R_0, r_1 = R_1 / R_0, r_2 = R_2 / R_1, ...$ (or more generally, $r_i = R_i / R_{i - 1}$), where $R_i$ is the actual $i$-th randomness.
    (Note that I failed to run the full test i.e. without the light-test flag for ProtoGalaxy's decider on my machine with 64GB of RAM because the CycleFold circuit now does more computation and has more constraints, thus blowing up the size of decider circuit. Hopefully this could be resolved by addressing Support Pedersen commitment in decider #171)
  • Extract the construction of cf_u.x into a separate function. Before this PR, cf_u.x is manually constructed by concatenating randomness and points in all augmented circuits of Nova, HyperNova, and ProtoGalaxy, as observed in Protogalaxy based IVC #123 (comment).
  • Implement CycleFoldAugmentationGadget which simplifies both the native and the in-circuit folding of CycleFold instances.
  • Absorb pp_hash when initializing the transcript / sponge, so that we no longer need to absorb it in subsequent operations.

@winderica winderica marked this pull request as ready for review January 16, 2025 14:52
@winderica
Copy link
Collaborator Author

After pondering for a long time on the best approach to a CycleFold circuit that can handle both HyperNova and ProtoGalaxy without loosing efficiency, I came up with the current solution. Now this PR should be ready for review, and any feedback would be appreciated!

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