arkworks 0.6.0
Small primes, native arithmetic.
All primes up to 64 bits in length are now backed by primitive-tuned backends in Arkworks. The arithmetic behind modern proving systems is first-class.
Public domain via Wikimedia Commons.
The shape of proving has changed.
Over the last decade, proving systems have shrunk their arithmetic. Each generation has found a way to make the same soundness argument over a smaller field, from well over 200 bits to fields that fit inside a single 64 bit register.
That matters because hardware matters.
A wider field becomes a loop. A register sized field becomes native. Its arithmetic compiles into the instructions a modern CPU was built to execute. The math may not care. The machine does.
The primes that have surfaced in this movement, Mersenne31, BabyBear, KoalaBear, and Goldilocks, share a simple property. The machine likes them.
Arkworks 0.6.0 makes them central to the system. It accepts these fields, and it accepts whatever comes next.
Optimizations
The headline isn't four primes. The headline is that ark-ff now contains a procedural macro,
SmallFp, which takes any prime up to 64 bits and emits a field type whose memory representation
is decided at compile time from the modulus. A 31-bit prime lives in a u32. A 64-bit
Goldilocks element lives in a u64. Nothing in the hot path pays for a limb loop, because the
limb loop has been compiled away.
Where the prime has a recognizable shape — Mersenne form, for instance — the macro emits a reduction path tuned for that shape. Where it doesn't, the fallback is a clean native-integer reduction.
Non-Breaking
SmallFp is a drop in replacement. No breaking changes. Migration is one line.
Higher-level protocols see up to a 30% speedup.
The migration replaces a config struct and a type alias with a single call:
define_field!(
name = Goldilocks,
modulus = "18446744069414584321",
generator = "7",
);
Everything generic over Field — sumcheck, FFTs, MSMs, your constraint system — keeps
compiling. The pairing-friendly curves and their 254-bit arithmetic continue along the path they were always on,
untouched.
See wall-clock benchmarks for Rust libraries at andrewzitek.xyz/smallfp-site.
See the source at github.com/arkworks-rs/algebra.