Skip to content

Precompiled contracts for EIP2357/BLS12 #42

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

Merged
merged 10 commits into from
May 7, 2025

Conversation

virgil-serbanuta
Copy link
Member

No description provided.

@virgil-serbanuta virgil-serbanuta force-pushed the virgil/eip2357-precompiled branch 3 times, most recently from ea99e16 to 87f6a7f Compare April 17, 2025 23:07
@virgil-serbanuta virgil-serbanuta force-pushed the virgil/eip2357-precompiled branch from 5676a69 to 706bd60 Compare April 30, 2025 11:56
@virgil-serbanuta virgil-serbanuta marked this pull request as ready for review April 30, 2025 11:57
Comment on lines 1270 to 1276
// TODO: implement `bls12G1Msm` as a hook, using Pippenger's algorithm (blst_p1s_mult_pippenger)
// However, note that the implementation of `g1_lincomb_fast` has the
// following comment:
//
// * @remark While this function is significantly faster than g1_lincomb_naive(), we refrain from
// * using it in security-critical places (like verification) because the blst Pippenger code has not
// * been audited. In those critical places, we prefer using g1_lincomb_naive() which is much simpler.
//
// https://github.com/ethereum/c-kzg-4844/blob/cc33b779cd3a227f51b35ce519a83cf91d81ccea/src/common/lincomb.c#L54-L56

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dwightguth, could you please take a look at this and advise?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the version preferred by the client is relatively straightforward, we should still implement this as a hook using established libraries. We do not want to be responsible for the maintenance burden of ensuring a cryptographic function is secure, which is a more onerous burden than simply ensuring functional correctness as seen here.

Copy link

@Robertorosmaninho Robertorosmaninho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some stylish comments, otherwise LGTM. Had you already had the chance to tests these modifications with the spec tests? If so, all the precompiled tests pass with them?

@virgil-serbanuta
Copy link
Member Author

Just some stylish comments, otherwise LGTM. Had you already had the chance to tests these modifications with the spec tests? If so, all the precompiled tests pass with them?

I tested them with the following filter and they passed:

	bt.runonly(".*eip2537.*")

@Robertorosmaninho
Copy link

Just some stylish comments, otherwise LGTM. Had you already had the chance to tests these modifications with the spec tests? If so, all the precompiled tests pass with them?

I tested them with the following filter and they passed:

	bt.runonly(".*eip2537.*")

Could you please execute the tests with your new modifications and open a PR on the op-geth directory updating your known-failures.txt files deleting the tests that now pass? If possible, also modify its name to blockchain-failing.llvm.

Comment on lines 1270 to 1276
// TODO: implement `bls12G1Msm` as a hook, using Pippenger's algorithm (blst_p1s_mult_pippenger)
// However, note that the implementation of `g1_lincomb_fast` has the
// following comment:
//
// * @remark While this function is significantly faster than g1_lincomb_naive(), we refrain from
// * using it in security-critical places (like verification) because the blst Pippenger code has not
// * been audited. In those critical places, we prefer using g1_lincomb_naive() which is much simpler.
//
// https://github.com/ethereum/c-kzg-4844/blob/cc33b779cd3a227f51b35ce519a83cf91d81ccea/src/common/lincomb.c#L54-L56

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if the version preferred by the client is relatively straightforward, we should still implement this as a hook using established libraries. We do not want to be responsible for the maintenance burden of ensuring a cryptographic function is secure, which is a more onerous burden than simply ensuring functional correctness as seen here.

@virgil-serbanuta virgil-serbanuta force-pushed the virgil/eip2357-precompiled branch from ece3d9e to 9186b88 Compare May 6, 2025 09:55
@virgil-serbanuta
Copy link
Member Author

@dwightguth I implemented multi-scalar-multiplication as a hook that just calls the BLST's implementation for Pippenger's algorithm. Does the PR look better now?

@Robertorosmaninho Robertorosmaninho dismissed dwightguth’s stale review May 7, 2025 14:52

Dismissing the review to unblock the PR from being merged, as the modification request was already done. @dwightguth, once you can, please give us your review, and if needed, Virgil will open a new PR to address it, ok?

@Robertorosmaninho Robertorosmaninho merged commit a78904e into ulm May 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants