Skip to content

Conversation

@b-wagn
Copy link
Collaborator

@b-wagn b-wagn commented Nov 20, 2025

This PR does a major refactoring of the codebase with the aim to allow integrating zkVMs that are based on WHIR.

Related to #19

Status

  • Make name, soundness, proof size, parameters functions of the zkVM
  • Split zkVM into subclasses (FRI-based, WHIR-based, or even more later)
  • Re-integrate best attack
  • Re-integrate printing of parameters
  • Define WHIR parameters
  • Create a dummy WHIR VM to test things
  • Add computation of WHIR proof sizes
  • Add computation of WHIR security levels
  • Add a proximity gaps regime class
  • Add a UDR regime
  • Add a Johnson bound regime
  • Add batching for WHIR
  • Add grinding for WHIR
  • Re-integrate md report

@asn-d6
Copy link
Collaborator

asn-d6 commented Nov 21, 2025

Thanks for all the work! Fixed a bug, and revived the markdown.

Some thoughts on the refactoring:

  • regimes/fri_regime.py seems a bit weird, as FRI is definitely not a regime. What's the plan? How much of regimes/ do we think will also be useful for WHIR?

  • A side-effect now is that there is a bunch of FRI stuff scattered across the modules. An alternative structure (not sure if it's better) would be to make a soundcalc/FRI/ directory and put there all the FRI stuff there, including zkvms/fri_based_vm.py and common/fri.py. Then introduce a soundcalc/WHIR/ directory. What is not clear to me right now is how much code will be shared between the FRI and the WHIR module (probably some of the proximity gaps stuff).

@b-wagn
Copy link
Collaborator Author

b-wagn commented Nov 21, 2025

Thanks for the review and the progress :)
About your questions:

FRI-Regimes: I agree that it is a bit weird. In the long term, I think we should have proximity gaps / CA regimes and both WHIR and FRI VMs should call them to get their soundness errors. Right now, the reason why it is still called FRI-regime is that the functions that it provides are still FRI-specific, e.g., the name get_commit_phase_error does not make a lot of sense for WHIR. My strategy would be to keep the regimes FRI-specific for now, then integrate WHIR, and then see how much code is shared and move it into a separate proximity gaps module.

Structure: I think what you propose here makes sense to me. Btw, it was a bit tricky to avoid circular dependency between modules here, which is why the class FRIParameters was introduced.

@b-wagn b-wagn marked this pull request as ready for review November 26, 2025 08:42
@asn-d6 asn-d6 force-pushed the refactor-prepare-whir branch 2 times, most recently from a428e00 to ef05fa4 Compare November 26, 2025 10:28
@b-wagn b-wagn changed the title Refactor to prepare for WHIR Integration Refactor and WHIR Integration Nov 26, 2025
Copy link
Collaborator

@asn-d6 asn-d6 left a comment

Choose a reason for hiding this comment

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

Did an initial review

@@ -0,0 +1,3 @@

Copy link
Collaborator

@asn-d6 asn-d6 Nov 26, 2025

Choose a reason for hiding this comment

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

As discussed, it would be good if we could unify soundcalc/proxgaps/ and soundcalc/regimes/, as they essentially do things related to proximity gaps.

import math

@dataclass(frozen=True)
class WHIRBasedVMConfig:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there an equivalent of trace_length for WHIR VMs?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure tbh

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe 2 ** log_degree?

@asn-d6 asn-d6 merged commit 8a69473 into main Nov 26, 2025
1 check passed
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.

3 participants