How irreducibleoss/binius works
Main components
• Cryptographic Protocol Core: Represented by the “crates/core” directory, which contains the implementations of various protocols (sumcheck, fri, gkr_exp, gkr_gpa, oracle, transcript, etc.). This is the “brain” of the system that runs the cryptographic arguments.
• Circuit Building: The “crates/circuits” module encapsulates circuits logic for arithmetic, bitwise operations, lookup tables, and witness handling. It acts as the interface for building circuits that can later be proven.
• Field Arithmetic: The “crates/field” contains the logic for binary fields and various optimizations, including platform-specific implementations (e.g., GFNI support and assembly optimizations for different architectures).
• Hardware Abstraction and Optimization: The “crates/hal” (hardware abstraction layer) handles backend-specific optimizations and differences (like CPU-specific instructions and sumcheck evaluators).
• Cryptographic Hash Functions: The “crates/hash” directory provides implementations of hash algorithms (groestl, sha2, keccak, vision, etc.) that are key to commitment schemes and Fiat-Shamir transforms.
• Mathematical Utilities: “crates/math” along with “crates/m3” and “crates/macros” offer support for arithmetic expressions, composition polynomials, tensor algebra, and other gadgets used within the proofs.
• Support Utilities: Supporting libraries like “crates/utils” and “crates/maybe_rayon” offer helper functions, error handling, parallel iteration, and general purpose operations.
• Other Specialized Components: Crates like “crates/ntt” implement fast number-theoretic transforms, which are foundational for some aspects of polynomial arithmetic used in the protocols.
Relationships and Data Flow
• The Field module underpins almost all computations—every protocol and circuit will depend on the optimized arithmetic and field operations.
• The Core protocols (in “crates/core”) build on the functionalities provided by Field and use Hash and Fiat-Shamir (part of “core” itself) to transform and verify proofs.
• Circuit building (in “crates/circuits”) uses the Core components to define constraints and then passes witness data to the proving and verifying procedures.
• The Hardware Abstraction Layer (HAL) modulates the low-level performance optimizations and ensures that core computations take advantage of CPU features.
• Libraries like Math, M3, and Macros provide higher-level abstractions that help in expressing complex arithmetic or proof systems while “glueing” together the low-level primitives.
• Utility crates (Utils, Maybe Rayon) support parallelization and common operations which are a cross-cutting concern.
Architectural Patterns and Design Principles
• Layered Architecture: At the bottom, the Field and Hash libraries provide basic arithmetic and cryptographic primitives. In the middle, the Core protocols merge these primitives into complex SNARK protocols. On top, the Circuits crate and the examples provide a higher-level interface to build and execute proofs.
• Modular/Crate-Based Design: Each “crate” is a separate library with its own concern, promoting loose coupling and making it easier to test or replace components.
• Portability and Optimization: Notice that multiple architectures and parallelization techniques are considered (via “maybe_rayon”, various “arch” directories, and HAL optimizations).
Relevant Technologies or Frameworks
• Rust’s Cargo package management system is used extensively (each directory with a Cargo.toml is a vital component).
• Criterion is used for benchmarking.
• GitHub Actions (in .github/workflows) for CI and nightly benchmarks.
• The code also integrates with architecture-specific instruction sets like GFNI.
Final Advice
• Be detailed in mapping out the layered dependencies and clearly note which components depend on which others.