Constantine v0.2.0 "Coat of Arms" #528
mratsim
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am very happy to present you the second version of Constantine.
I thank the Ethereum Foundation for their sponsorship on implementing Torus-based cryptography to make the performance of Secret Leader Election viable.
The highlight of this release, and the inspiration for its name is the introduction of specialized ARM64 assembly for most key field operations and SHA256. Thanks to it the latest M4 Max is within 5% of an overclocked AMD Ryzen 9950X on single-threaded performance (though multithreaded performance is lackluster due to Apple very aggressive powersaving). Currently this is only for MacOS but will be coming to Linux, Android and iOS.
The second highlight of this release is significant backend work for JIT compiling elliptic curves to Nvidia and AMD GPUs.
Backends for x86 and ARM have also been explored and could present an alternative to provide libconstantine as a fully optimized assembly file, at least at Ethereum and elliptic curves level. This would streamline build systems by removing the Nim compiler. and also make it easy to vectorize the library.
Constantine is currently being scoped for a security audit, after which a 1.0 version should follow.
You can review the scope here: #483, and I'm looking for sponsors.
An independent benchmark showed that Constantine is as of January 2025 the fastest backend for EIP-4844 / KZG polynomial commitments: https://github.com/grandinetech/rust-kzg.
The Nim minimum version has been updated to Nim v2.2.0. 99% of Constantine should still work with v1.6.16 and v2.0.8 except the Torus-basec cryptography part.
Now let's review the main changes per-category
Ethereum
The focus for this release has been Ethereum Execution layer with the introduction of:
Performance on x86 and ARM is detailed in: #520
The precompiles are exposed in C, Nim and Rust except ECRECOVER which is under review for corner cases that may not be covered by Ethereum tests and "low performance" (a 1.7x perf advantage at low-level turns to 1x no advantage at elliptic curve level - #446)
The inner product argument (IPA) multi-proof primitives for Ethereum Verkle Tries have been thoroughly reviewed and improved.
On the Consensus side, sponsored work has been done on accelerating multi-exponentiation in 𝔾ₜ pairing group via Torus-based cryptography for the purposes of secret leader election: https://ethresear.ch/t/the-return-of-torus-based-cryptography-whisk-and-curdleproof-in-the-target-group/16678/4
Proof-system
Multilinear extensions of polynomials have been added. This is a prerequisite for sumchecks, the current state-of-the-art proving technique in research.
A Groth16 prover has been submitted in a PR by @Vindaar and is under final review.
Backend
We added an ARM64 compile-time assembler and 90% of the main computing bottlenecks now have ARM64 acceleration.
Performance: #513
Exploration in LLVM JIT compilation for GPU has been progressing with:
The threadpool had a task garbage collection fix on ARM64 (and other weak memory models ISA)
Misc
Constantine can now generate benchmarks in https://zka.lc format with
In CI, the Nim installation script has been completely rewritten to install from either of:
and can handle versioning for all 3 as well as the new Linux and MacOS ARM64 builds, and testing on Linux in 32-bit mode.
Future work
Please refer to https://github.com/mratsim/constantine/blob/v0.2.0/PLANNING.md and the issue tracker https://github.com/mratsim/constantine/issues?q=is%3Aopen+is%3Aissue+label%3A%22enhancement+%3Ashipit%3A%22+
Here are some of the work stream I want to prioritize
i256
to<i256 x 4>
and reusing the exact same LLVM IR.-- Mamy
Detailed changes (auto-generated)
scalarMul_vartime
for tiny multiple 5 by @Vindaar in fixscalarMul_vartime
for tiny multiple 5 #426ccopy
,neg
,cneg
,nsqr
, ... for CUDA target by @Vindaar in Implement finite fieldccopy
,neg
,cneg
,nsqr
, ... for CUDA target #466ECRecover
EVM precompile by @Vindaar in AddECRecover
EVM precompile #504New Contributors
Full Changelog: v0.1.0...v0.2.0
This discussion was created from the release Constantine v0.2.0 "Coat of Arms".
Beta Was this translation helpful? Give feedback.
All reactions