Skip to content
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

[End-user workaround] Constantine-rust: public fields and Default fields #331

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mratsim
Copy link
Owner

@mratsim mratsim commented Jan 3, 2024

Requested by https://github.com/sifraitech/rust-kzg

Due to the orphan rule preventing building traits on top of external libraries, the Sifraitech team needs the fields to be public.

Unfortunately this conflicts with security best practices and isolation concerns, especially given that Constantine may handle sensitive secrets that must be protected in a best effort manner. Keeping fields private is a good way to avoid accidentally spilling data in a debug log for example.

This exposes the fields in a branch while keeping the library pristine.

This also adds a Default trait implementation for convenience. For elliptic curves using it as-is MAY result in undefined behavior for Jacobian or Projective points, as setInf is the proper initialization.
This commit Ensure the projective point at infinity is not all zeros, but (0, 1, 0) fixed an issue with all zero initialization.
Though I'm not sure how to automate it with bindgen.

cc @Armantidas @sauliusgrigaitis

@mratsim
Copy link
Owner Author

mratsim commented Jun 13, 2024

If you use the KZG parallel implementation of Constantine, I have changed the API in #394.

The threadpool is now directly stored in the KZG context.

See https://github.com/mratsim/constantine/pull/394/files#diff-2c8630f256e9d494d19bbb20fae5cd7a6ced97a9800d5a192c1979bde72e5494R487

I can update the branch whenever.

No impact on the serial KZG.

@sauliusgrigaitis
Copy link

Thanks, if you want to work on rust-kzg update then check https://github.com/ArtiomTr/rust-kzg/tree/Integrate_sppark_msm . This is going to be merged soon. It also contains the updated performance graphs. Seems constantine peformance penalty is gone!

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.

2 participants