How sunblaze-ucb/libra works
Main Components
• Core Library Modules:
• VPD: Contains files in both “include/VPD” and “src/VPD”. This module likely handles verifiable computation or proofs related to polynomial delegation.
• Linear GKR: Located under “include/linear_gkr” and “src/linear_gkr”. Contains the implementations (including several “prover” and “verifier” variants) for interactive proofs using the linear approach.
• Traditional GKR: Found in “include/traditional_gkr” and “src/traditional_gkr”. This module provides an alternative (traditional) implementation approach for the GKR protocol.
• Binary Executables:
• The “bin” directory holds several compiled programs (e.g., main_zk, various “clogc” and “bclogc” versions) that serve as entry points to run experiments or demonstrations of these protocols.
• Testing Components:
• Tests for specific algorithms (SHA256, Lanczos, and Matmul) are organized under the “tests” directory with their own build scripts and Python runners.
• Auxiliary/Supporting Components:
• Build scripts (e.g., Makefile, setup.sh, and various Python “build.py” scripts in the tests) indicate integration/compilation procedures.
• Helper code in the “include/infrastructure” directory.
Relationships and Data Flow
• The binary executables in “bin” likely depend on the core library modules to perform the proof computations.
• The “src” code implements the actual logic of the protocols which get exposed via header files in “include”.
• The tests in “tests” call into the core modules (for instance, running SHA256 or Lanczos tests) by invoking the corresponding binaries or test runners.
• Build scripts and configuration files (like the Makefile and Python build scripts) orchestrate the building and testing processes.
Architectural Patterns and Design Principles
• Component Separation: The project is cleanly segmented into libraries (core protocols) and test suites—this indicates a layered architecture.
• Modular Design: VPD, linear GKR, and traditional GKR are isolated modules. This suggests modularity and possible reusability of the proof components.
• Clear Interfaces: The headers (in “include”) define a clear API for components, and the existence of different “prover” and “verifier” variants hints at an interface-based design.
• Test-Driven/Experiment-Driven: The presence of comprehensive test directories (with build and run scripts) means the design incorporates automated testing as an integral component.