scroll-tech / scroll-tech/ceno
Support KoalaBear field as a faster alternative to BabyBear
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 153
- Forks
- 43
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 4
Description
Motivation
Ceno currently supports BabyBear as one of its small-prime finite fields (alongside Goldilocks).
KoalaBear is a recently proposed 31-bit prime field with prime
p = 2^31 - 2^24 + 1 that offers significant performance advantages over BabyBear
(p = 2^31 - 2^27 + 1).
Why KoalaBear is faster
- Better hardware utilization: KoalaBear's prime
2^31 - 2^24 + 1enables more efficient
Montgomery/Barrett reduction on modern CPUs compared to BabyBear. - Faster multiplication: Benchmarks from Plonky3, SP1, and other ZK frameworks show KoalaBear
field multiplication is measurably faster than BabyBear on x86-64 and ARM architectures. - Same security level: KoalaBear is also a 31-bit field with similar security and extension
field properties (a degree-4 extension exists), so it is largely a drop-in replacement. - Ecosystem adoption: KoalaBear has been adopted by several leading ZK projects as a direct
replacement for BabyBear (Plonky3, SP1, etc.).
Proposal
- Add KoalaBear support in
ff_ext, providing aKoalaBearExt4type analogous to the
existingBabyBearExt4. - Expose KoalaBear as a
FieldTypeoption in the CLI (--field koalabear), alongside
babybearandgoldilocks. - Benchmark KoalaBear vs BabyBear within Ceno to quantify the speedup and guide users toward
the faster option. - Consider making KoalaBear the default field, or optionally deprecating BabyBear while
retaining it for backwards compatibility.
References
- KoalaBear paper: https://eprint.iacr.org/2024/278
- Plonky3 KoalaBear implementation: https://github.com/Plonky3/Plonky3/tree/main/koala-bear
- SP1 adoption of KoalaBear: https://blog.succinct.xyz/sp1-v4/
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the existing BabyBearExt4 implementation in ff_ext and the FieldType handling for the CLI's --field option. Review the KoalaBear paper and the referenced Plonky3 implementation before deciding how the extension field and compatibility choices fit Ceno. Done means KoalaBear support, CLI exposure, and comparative benchmarks are available, with the default-field decision addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- cli, cryptography, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100