How microsoft/nova works
Project Type and Purpose
• This is a Rust-based cryptographic library that implements Nova—a high-speed recursive SNARK proof system. Its primary role is to allow the creation of incrementally verifiable proofs (IVC) via recursive proofs and circuit folding.
• The project supports several curve cycles with various cryptographic schemes (e.g., HyperKZG, Pedersen commitments, Spartan SNARK for compression). It also supports multiple “front-ends” for creating circuits (e.g., bellman-style circuits and integrations with DSLs like Circom).
Analyzing the File Structure
• Top-Level Files: Files such as Cargo.toml, LICENSE, and README indicate that this is an open-source Rust library.
• Several directories (e.g., benches, examples) help users test and understand its functionalities.
• The src/ directory is where most of the implementation resides. Note the logical separation into submodules:
– src/frontend: Implements the constraint system and various cryptographic “gadgets” (e.g., for SHA256, Poseidon) that build circuits.
– src/gadgets: Contains lower-level implementations of cryptographic primitives and utility code.
– src/neutron: Contains components specifically for “neutron,” which is one of the core abstractions for representing or processing circuits (its “circuit” subdirectory, nifs.rs, relations, and univariate modules suggest that it may transform or serve as an intermediate representation for circuits).
– src/nova: Encapsulates the core logic for the Nova proof system, particularly the recursive SNARK aspects (e.g., its circuit submodules and nifs.rs).
– src/provider: Implements the underlying cryptographic providers and commitment schemes (e.g., for hyperkzg, pedersen, etc.) that support both the Nova and Neutron modules.
– Other modules (r1cs, spartan, traits): They support constraint system representations, snark compression (the Spartan SNARK), and shared abstractions.
Focusing on Neutron and Nova
• Neutron Component:
• Found under src/neutron, this module appears to handle circuit definitions and associated computations. Its contained files (e.g., circuit/mod.rs, circuit/nifs.rs, relation.rs) suggest that it is responsible for converting high-level circuit representations into formats amenable for proof composition.
• It likely interfaces with both the frontend (providing the circuit constraints and gadget integration) and the Nova module (for eventual recursive proof formation).
• Nova Component:
• Located in src/nova, Nova is at the heart of the recursive SNARK construction. It implements the recursive proof system and, through folding schemes and integration with Spartan SNARK components, compresses and verifies proofs.
• It depends on the cryptographic routines provided by the provider module and the circuit details supplied by Neutron (and perhaps, indirectly, the frontend and gadgets).