chore: change rust kzg nif to direct elixir bindings#1484
Open
BlazeWasHere wants to merge 3 commits intolambdaclass:mainfrom
Open
chore: change rust kzg nif to direct elixir bindings#1484BlazeWasHere wants to merge 3 commits intolambdaclass:mainfrom
BlazeWasHere wants to merge 3 commits intolambdaclass:mainfrom
Conversation
BlazeWasHere
commented
Dec 10, 2025
| # 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 |
Author
There was a problem hiding this comment.
not sure if there should be another flag to skip compiling the nif?
BlazeWasHere
commented
Dec 10, 2025
|
|
||
| @type commitment :: <<_::384>> | ||
| @type proof :: <<_::768>> | ||
| @type proof :: <<_::384>> |
Author
There was a problem hiding this comment.
I am pretty sure proof size is 384 and not 768, but feel free to revert
BlazeWasHere
commented
Dec 10, 2025
| # 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 |
Author
There was a problem hiding this comment.
not sure i should add precompiling the nif here instead?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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