refactor: split stage provers, deduplicate helpers, extract witness types#73
Merged
Merged
Conversation
…d modules Split three oversized files into smaller, focused modules for navigability: - stage3_prover.zig (3,133 → 1,248 LOC): Extract ShiftPrefixSuffixProver and RegistersPrefixSuffixProver into stage3_instances.zig, and InstructionInputProver into stage3_instruction_input.zig. - preprocessing.zig (2,250 → 205 LOC): Extract JoltInstruction to jolt_instruction.zig and BytecodePreprocessing to bytecode_preprocessing.zig. Breaks the preprocessing ↔ instruction_decoder import cycle. - mod.zig (1,800 → 397 LOC): Extract JoltProver wrapper, proveJoltCompatibleWithDoryAndSrsAtAddress, serialization, and helper functions into proving_pipeline.zig. All external import sites work through re-exports — no API changes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… witness types - Remove ~230 lines of dead pairing code (millerLoop, PairingInput, multiPairing, pairingCheck, and supporting private functions/tests) - Add deriveBatchingCoeffs comptime helper to sumcheck_helpers.zig, adopt in stage2/stage3/stage6 provers (replaces manual loops) - Add extrapolateLinearTo2 helper with test - Adopt parallelReduceOptional/parallelForOptional at 8 call sites in ram/ modules (read_write_checking, raf_checking, output_check, val_evaluation) - Extract R1CS witness types (R1CSInputIndex, Term, LinearCombination, LC, UniformConstraint) into witness_types.zig; constraints.zig re-exports for backward compatibility Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…t stage6 bytecode_raf - Adopt pool_helpers.parallel*Optional across 53 call sites (75% of null-check patterns) - Add parallelReduceForceOptional to zolt-pool helpers - Extract finishSumcheckRound, addInactiveToMonomial, deriveBatchingCoeffs, deriveGammaPowers into sumcheck_helpers.zig and adopt across stage3/5/6 - Extract bytecode Val poly computation from stage6_prover into stage6_bytecode_raf.zig (-900 LOC from stage6_prover) - Gate bench_timing behind comptime debug flag - Add dbgFieldLE/dbgFieldLE8 debug helpers - Extract stage6_debug.zig for diagnostic output - Update refactoring plan with revised estimates and status Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Split oversized files into focused modules and deduplicate shared patterns across the codebase.
File splits
Deduplication
deriveBatchingCoeffscomptime helper to sumcheck_helpers.zig, adopt in stage2/stage3/stage6 proversextrapolateLinearTo2helper with testparallelReduceOptional/parallelForOptionalat 8 call sites in ram/ modulesAll external import sites work through re-exports — no API changes.
Test plan
zig build test— all tests passzig build— clean in Debug and ReleaseFast🤖 Generated with Claude Code