-
Notifications
You must be signed in to change notification settings - Fork 42
chore: change rust kzg nif to direct elixir bindings #1484
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
| # Avoid compiling Rustler NIFs when `RUSTLER_SKIP_COMPILE` is set | ||
| if System.get_env("RUSTLER_SKIP_COMPILE") do | ||
| config :lambda_ethereum_consensus, Bls, skip_compilation?: true | ||
| config :lambda_ethereum_consensus, Kzg, skip_compilation?: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure if there should be another flag to skip compiling the nif?
|
|
||
| @type commitment :: <<_::384>> | ||
| @type proof :: <<_::768>> | ||
| @type proof :: <<_::384>> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am pretty sure proof size is 384 and not 768, but feel free to revert
| # TODO: only copy artifacts | ||
| # Copy precompiled rust crates. Rustler stores targets under _build | ||
| COPY --from=bls_nif_builder /bls_nif/libbls_nif.so /consensus/priv/native/libbls_nif.so | ||
| COPY --from=kzg_nif_builder /kzg_nif/libkzg_nif.so /consensus/priv/native/libkzg_nif.so |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i should add precompiling the nif here instead?
Motivation
Removes the overhead from elixir -> rust (via rustler) -> c and now does elixir -> c via these elixir bindings.
Description
Removes usage of the c-kzg Rustler NIF and replaces it with direct c-kzg bindings instead.
Getting speedups of ~40x with
verify_blob_kzg_proofwith this changeNote: This NIF loads the trusted setup (settings) once, so essentially closes #848