Skip to content

Commit 5f79fc4

Browse files
authored
Major rewrite (#99)
* canonical rewrite: SumcheckProver trait, generic field, SIMD, streaming * fmt * fix ci * readme * no std, readme + docs * fmt * readme * force oracle check * revert oracle check thing * eq evals opts * changelog * p3 compatibility example
1 parent cc0821c commit 5f79fc4

148 files changed

Lines changed: 12784 additions & 6226 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/bench.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Benchmarks
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
permissions:
10+
contents: write
11+
deployments: write
12+
13+
jobs:
14+
benchmark:
15+
name: Criterion benchmarks
16+
# Use self-hosted for stable hardware (no noisy-neighbor variance).
17+
# To use self-hosted: change to ["self-hosted", "linux", "x64"].
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- name: Install Rust toolchain
23+
uses: dtolnay/rust-toolchain@stable
24+
25+
- name: Cache cargo registry + build
26+
uses: actions/cache@v4
27+
with:
28+
path: |
29+
~/.cargo/registry
30+
~/.cargo/git
31+
target
32+
key: bench-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
33+
34+
- name: Detect CPU features
35+
id: cpu
36+
run: |
37+
if grep -q avx512ifma /proc/cpuinfo 2>/dev/null; then
38+
echo "rustflags=-C target-feature=+avx512ifma" >> "$GITHUB_OUTPUT"
39+
echo "label=avx512" >> "$GITHUB_OUTPUT"
40+
echo "::notice::AVX-512 IFMA detected — SIMD benchmarks enabled"
41+
elif [ "$(uname -m)" = "aarch64" ]; then
42+
echo "rustflags=" >> "$GITHUB_OUTPUT"
43+
echo "label=neon" >> "$GITHUB_OUTPUT"
44+
echo "::notice::aarch64 detected — NEON benchmarks enabled"
45+
else
46+
echo "rustflags=" >> "$GITHUB_OUTPUT"
47+
echo "label=scalar" >> "$GITHUB_OUTPUT"
48+
echo "::notice::No SIMD target features detected — scalar benchmarks"
49+
fi
50+
51+
- name: Run benchmarks
52+
env:
53+
RUSTFLAGS: ${{ steps.cpu.outputs.rustflags }}
54+
run: cargo bench --bench sumcheck -- --output-format bencher | tee output.txt
55+
56+
- name: Store benchmark results
57+
uses: benchmark-action/github-action-benchmark@v1
58+
with:
59+
name: "Sumcheck Benchmarks (${{ steps.cpu.outputs.label }})"
60+
tool: cargo
61+
output-file-path: output.txt
62+
# On push to main: commit results to gh-pages for trendline tracking.
63+
# On PR: compare against main baseline and comment.
64+
auto-push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
65+
github-token: ${{ secrets.GITHUB_TOKEN }}
66+
# Alert thresholds.
67+
alert-threshold: "115%"
68+
comment-on-alert: true
69+
fail-on-alert: false
70+
benchmark-data-dir-path: "dev/bench-${{ steps.cpu.outputs.label }}"

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
check:
14+
name: Build + Test + Clippy
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Install Rust toolchain
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: clippy
23+
24+
- name: Cache cargo
25+
uses: actions/cache@v4
26+
with:
27+
path: |
28+
~/.cargo/registry
29+
~/.cargo/git
30+
target
31+
key: ci-${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
32+
33+
- name: Build
34+
run: cargo build --release
35+
36+
- name: Clippy
37+
run: cargo clippy --release -- -D warnings
38+
39+
- name: Tests
40+
run: cargo test --release

.github/workflows/rust.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@ jobs:
5050
- name: Run tests
5151
run: cargo test --verbose
5252

53-
test_with_no_default_features:
53+
build_with_no_default_features:
5454
runs-on: ubuntu-latest
5555
steps:
5656
- uses: actions/checkout@v3
5757

58-
- name: Run tests
59-
run: cargo test --verbose --no-default-features
58+
- name: Build without arkworks
59+
run: cargo build --verbose --no-default-features

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
**/lag-poly-benches/target/
77
.vscode
88
.DS_Store
9+
.claude/

CHANGELOG.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,38 @@
22

33
All notable changes to this project will be documented in this file.
44

5-
## [Unreleased]
5+
## [Unreleased] — Canonical Rewrite
6+
7+
Major revision: unified API, one verifier, one proof type, 7 provers, SIMD acceleration.
8+
9+
### Breaking
10+
11+
- **Package renamed** from `efficient-sumcheck` to `effsc`.
12+
- **Single verifier**`sumcheck_verify()` returns `SumcheckResult { challenges, final_claim }`. The oracle check is the caller's responsibility ([Thaler Remark 4.2](https://people.cs.georgetown.edu/jthaler/ProofsArgsAndZK.pdf)). Removed `inner_product_sumcheck_verify`, `multilinear_sumcheck_verify`, and `coefficient_sumcheck::sumcheck_verify`.
13+
- **Single proof type**`SumcheckProof<F>` replaces `Sumcheck<F>` and `ProductSumcheck<F>`.
14+
- **Transcript redesigned**`send()`/`receive()`/`challenge()` replace `read()`/`write()`.
15+
- **Legacy entry points demoted** — use `runner::sumcheck()` with a prover type.
616

717
### Added
8-
- **Base/Extension field support**: `multilinear_sumcheck` and `inner_product_sumcheck` now take two type parameters `<BF, EF>` — base field for evaluations, extension field for challenges. Set `EF = BF` when no extension is needed.
9-
- `pairwise::cross_field_reduce` — parallel helper for folding `BF` evaluations with an `EF` challenge.
18+
19+
- **`SumcheckProver<F>` trait** — single extension point for all polynomial shapes.
20+
- **7 concrete provers**`MultilinearProver`, `InnerProductProver`, `CoefficientProver` (each with MSB + LSB variants), `GkrProver`.
21+
- **`SumcheckField` trait** — generic field interface; blanket impl for `ark_ff::Field` behind `feature = "arkworks"`.
22+
- **`SimdRepr` trait** — safe SIMD opt-in with `zerocopy` layout verification.
23+
- **`runner::sumcheck()`** — single runner with partial execution and per-round hooks.
24+
- **Eq polynomial utilities**`eq_poly`, `eq_poly_non_binary`, O(2^v) incremental `compute_hypercube_eq_evals`.
25+
- **Adversarial verifier tests** — corrupted proofs, wrong sums, wrong final values across all prover types.
26+
- **`no_std` support** — core library works without `arkworks` feature.
27+
- **SIMD** — transparent 8-wide AVX-512 IFMA, 2-wide NEON acceleration.
28+
29+
### Integrations
30+
31+
- [WHIR](https://github.com/WizardOfMenlo/whir) ([PR #250](https://github.com/WizardOfMenlo/whir/pull/250))
32+
- [WARP](https://github.com/compsec-epfl/warp) ([PR #24](https://github.com/compsec-epfl/warp/pull/24))
33+
34+
### Removed
35+
36+
- **~4,500 lines of legacy code** — old `Prover` trait, `TimeProver`/`SpaceProver`/`BlendyProver`, `OrderStrategy`, `messages/`, `interpolation/`, `simd_ops`.
1037

1138
## [0.0.2] - 2026-02-11
1239

Cargo.toml

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,53 @@
11
[package]
2-
name = "efficient-sumcheck"
2+
name = "effsc"
33
version = "0.0.2"
44
authors = ["arkworks maintainers"]
55
description = "TODO"
66
repository = "https://github.com/compsec-epfl/space-efficient-sumcheck"
77
include = ["Cargo.toml", "src", "README.md", "LICENSE-APACHE", "LICENSE-MIT"]
88
edition = "2021"
9+
rust-version = "1.81"
910

1011
[dependencies]
11-
ark-ff = "0.5.0"
12-
ark-poly = "0.5.0"
13-
ark-serialize = "0.5.0"
14-
ark-std ="0.5.0"
12+
ark-ff = { version = "0.5.0", optional = true }
13+
ark-poly = { version = "0.5.0", optional = true }
14+
ark-serialize = { version = "0.5.0", optional = true }
15+
ark-std = { version = "0.5.0", optional = true }
1516
memmap2 = "0.9.5"
1617
nohash-hasher = "0.2.0"
1718
rayon = { version = "1.10", optional = true }
18-
spongefish = { git = "https://github.com/arkworks-rs/spongefish", branch = "main", features = ["ark-ff"] }
19+
spongefish = { git = "https://github.com/z-tech/spongefish.git", branch = "smallfp-support", features = ["ark-ff"], optional = true }
20+
zerocopy = { version = "0.8", features = ["derive"] }
1921

2022
[dev-dependencies]
2123
criterion = "0.8"
24+
p3-field = "0.5"
25+
p3-goldilocks = "0.5"
2226

2327
[features]
24-
default = ["parallel"]
28+
default = ["arkworks", "parallel", "simd"]
29+
arkworks = [
30+
"dep:ark-ff",
31+
"dep:ark-poly",
32+
"dep:ark-serialize",
33+
"dep:ark-std",
34+
"dep:spongefish",
35+
]
36+
simd = []
2537
parallel = [
2638
"dep:rayon",
27-
"ark-ff/parallel",
28-
"ark-poly/parallel",
29-
"ark-std/parallel",
39+
"ark-ff?/parallel",
40+
"ark-poly?/parallel",
41+
"ark-std?/parallel",
3042
]
3143

3244
[[bench]]
33-
name = "provers"
34-
path = "benches/provers.rs"
45+
name = "sumcheck"
46+
path = "benches/sumcheck.rs"
3547
harness = false
48+
49+
[patch.crates-io]
50+
ark-ff = { git = "https://github.com/arkworks-rs/algebra.git", branch = "master" }
51+
ark-poly = { git = "https://github.com/arkworks-rs/algebra.git", branch = "master" }
52+
ark-serialize = { git = "https://github.com/arkworks-rs/algebra.git", branch = "master" }
53+
spongefish = { git = "https://github.com/z-tech/spongefish.git", branch = "smallfp-support" }

0 commit comments

Comments
 (0)