Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
ae51d8c
Implement Hachi PCS protocol with required primitives (#1)
omibo Feb 28, 2026
4980e1a
Implement Batched Sumcheck and Gruen EQ (#2)
omibo Feb 28, 2026
10e53dd
Add rayon parallelism behind `parallel` feature flag (enabled by defa…
quangvdao Feb 28, 2026
0ed2736
Add e2e benchmark and make HachiCommitmentScheme generic over config
quangvdao Feb 28, 2026
96a9ccd
Refactor CRT-NTT backend: generalize over PrimeWidth, add Q128 support
quangvdao Feb 28, 2026
e4f9836
Add extension field arithmetic and refactor sumcheck trait bounds
quangvdao Feb 28, 2026
21b6f59
Fix CRT+NTT correctness and optimize negacyclic NTT pipeline
quangvdao Feb 28, 2026
01b65d0
Cache CRT+NTT matrix representations in setup to avoid repeated conve…
quangvdao Feb 28, 2026
89716fc
Remove dead code (HachiRoutines, domains/, redundant trait methods) a…
quangvdao Feb 28, 2026
3b5603d
Unify Blake2b and Keccak transcript backends into generic HashTranscript
quangvdao Feb 28, 2026
f74f2ed
Fix sumcheck degree bug, split types, in-place fold, CommitWitness, r…
quangvdao Feb 28, 2026
9cd06cf
fix(test): resolve clippy needless_range_loop in algebra tests
quangvdao Feb 28, 2026
dba56b2
Refactor commitment setup to runtime layout and staged artifacts.
quangvdao Feb 28, 2026
43d8ef2
Soundness hardening: panic-free verifier, Fiat-Shamir binding, NTT ov…
quangvdao Mar 1, 2026
1e24653
Hoist fully qualified paths to use statements in touched files
quangvdao Mar 1, 2026
2d35bdb
Dispatch norm sumcheck kernels by range size.
quangvdao Mar 1, 2026
7278414
Format commitment-related files for readability.
quangvdao Mar 1, 2026
1a2b846
Format: cargo fmt pass on commitment-related files
quangvdao Mar 1, 2026
c8565bb
feat: sequential coefficient ordering + streaming commitment
quangvdao Mar 1, 2026
a7bdea9
refactor: decompose verify_batched_sumcheck into composable steps
quangvdao Mar 2, 2026
6705efe
feat: accept Option<usize> in commit_onehot for sparse one-hot support
quangvdao Mar 2, 2026
1fdf18e
feat: submatrix commit for polynomials smaller than setup max
quangvdao Mar 2, 2026
ce8eca8
feat: add HachiSerialize impls for proof types
quangvdao Mar 2, 2026
c997b60
fix: relax balanced_decompose_pow2 assertion for 128-bit fields
quangvdao Mar 2, 2026
c6a6a4e
feat: add DynamicSmallTestCommitmentConfig
quangvdao Mar 2, 2026
5bf8762
perf: true submatrix in commit_coeffs — skip zero blocks
quangvdao Mar 2, 2026
2b03961
fix: use inner_width for zero_s in commit_coeffs/commit_onehot
quangvdao Mar 2, 2026
06d7095
fix: configure rayon with 64MB stack for D>=512 ring elements
quangvdao Mar 2, 2026
8962dcf
feat: add commit_mixed for mega-polynomial commitment
quangvdao Mar 2, 2026
5dad74f
perf: drop s vectors from CommitWitness and HachiCommitmentHint
quangvdao Mar 2, 2026
ce940d0
chore: untrack docs/ and paper/ from version control
quangvdao Mar 2, 2026
fa070fe
perf: fused sumcheck, split-eq streaming, compact w_evals — 8x memory…
quangvdao Mar 2, 2026
6d3dd14
revert: remove ensure_large_thread_stack rayon config
quangvdao Mar 2, 2026
a4af82a
perf: parallelize commit phase and reduce allocations
quangvdao Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Check formatting
Expand All @@ -31,20 +31,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy
- name: Clippy (all features)
run: cargo clippy -q --message-format=short --all-features --all-targets -- -D warnings
run: cargo clippy --all --all-targets --all-features -- -D warnings
- name: Clippy (no default features)
run: cargo clippy -q --message-format=short --no-default-features --lib -- -D warnings
run: cargo clippy --all --all-targets --no-default-features -- -D warnings

doc:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build documentation
run: cargo doc -q --no-deps --all-features
env:
Expand All @@ -55,8 +55,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Install cargo-nextest
uses: taiki-e/install-action@nextest
- name: Run tests
run: cargo nextest run -q --all-features
run: cargo nextest run --all-features
35 changes: 35 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AGENTS.md

**Compatibility notice (explicit): This repo makes NO backward-compatibility guarantees. Breaking changes are allowed and expected.**

## Project Overview

Hachi is a lattice-based polynomial commitment scheme (PCS) with transparent setup and post-quantum security. Built in Rust. Intended to replace Dory in Jolt.

## Essential Commands

```bash
cargo clippy --all --message-format=short -q -- -D warnings
cargo fmt -q
cargo test # no nextest yet
```

## Crate Structure

Two workspace members: `hachi-pcs` (root) and `derive` (proc macros).

- `src/primitives/` — Core traits: `FieldCore`, `Module`, `MultilinearLagrange`, `Transcript`, serialization
- `src/algebra/` — Concrete backends: prime fields, extension fields, cyclotomic rings, NTT, domains
- `src/protocol/` — Protocol layer: commitment, prover, verifier, opening (ring-switch), challenges, transcript
- `src/error.rs` — Error types

## Key Abstractions

- `CommitmentScheme` / `StreamingCommitmentScheme` — top-level PCS traits
- `FieldCore` + `PseudoMersenneField` + `Module` — arithmetic over lattice-friendly fields and rings
- `MultilinearLagrange` — multilinear polynomial in Lagrange basis
- `Transcript` — Fiat-Shamir

## Feature Flags

- `parallel` — Rayon parallelization
1 change: 1 addition & 0 deletions CLAUDE.md
42 changes: 42 additions & 0 deletions CONSTANT_TIME_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Constant-Time Review Notes (Phase 0/1 Algebra)

This note tracks timing-sensitive implementation decisions for the current
algebra and ring stack.

## Reviewed Components

- `src/algebra/fields/fp32.rs`
- `src/algebra/fields/fp64.rs`
- `src/algebra/fields/fp128.rs`
- `src/algebra/ntt/prime.rs`
- `src/algebra/ntt/butterfly.rs`
- `src/algebra/ring/cyclotomic.rs`
- `src/algebra/ring/crt_ntt_repr.rs`

## Current State

- Branchless primitives are in place for:
- `Fp32/Fp64/Fp128` add/sub/neg raw helpers.
- `Fp128` multiplication reduction (`reduce_u256`) with branchless conditional subtract.
- `Fp32/Fp64` multiplication reduction (division-free fixed-iteration paths).
- NTT helper operations `csubp`, `caddp`, and `center`.
- NTT butterfly arithmetic runs in fixed loop structure independent of data.
- Ring multiplication (`CyclotomicRing`) is fixed-structure schoolbook over `D`.
- CRT reconstruction inner accumulation now uses fixed-trip, branchless
modular add/mul-by-small-factor helpers.
- Prime fields now expose `Invertible::inv_or_zero()` for secret-bearing
inversion use-cases without input-dependent branching on zero.
- CRT reconstruction final projection now uses a division-free fixed-iteration
reducer (`reduce_u128_divfree`) instead of `% q`.

## Known Timing Risks / Follow-ups

- `FieldCore::inv()` still returns `Option` and therefore branches on zero;
treat that API as public-value oriented. Use `Invertible::inv_or_zero()`
in secret-dependent paths.

## Action Items Before Production-Critical Use

1. Wire secret-bearing call sites to `Invertible::inv_or_zero()` as
protocol code matures.
2. Add dedicated CT review tests/checklists for any arithmetic subsystem changes.
Loading