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

Add support for bls12_381 and other crates in our bls crate #61

Open
sauliusgrigaitis opened this issue Dec 12, 2024 · 4 comments · May be fixed by #69
Open

Add support for bls12_381 and other crates in our bls crate #61

sauliusgrigaitis opened this issue Dec 12, 2024 · 4 comments · May be fixed by #69

Comments

@sauliusgrigaitis
Copy link
Member

Currently, we support only blst in our bls crate. For some use cases we would to have a pure Rust BLS implementation instead of a highly optimized (ASM) BLST. A particular use case is Risc0 and SP1 ZKVMs. SP1 already support BLS precompile via bls12_381 patched crate. Risc0 is planning to implement BLS precompile via the same bls12_381 patched crate. So my suggestion would be to start with bls12_381 support and then try to add the rest.

Our rust-kzg we already have multiple ECC backends support. Maybe it even makes sense to extend rust-kzg with BLS signatures functionality...

@shreyas-londhe
Copy link

Hi @sauliusgrigaitis ! I'm interested in working on this. I have worked with BLS signatures before and would love to give this a try. Can you please assign this to me and give me an idea on how I should get started?

@sauliusgrigaitis
Copy link
Member Author

@shreyas-londhe We usually do not assign issues to external contributors because external contributors rarely finish tasks. The best is to simply signal here that you are working on the issue by posting a link to your branch. Then it's unlikely that someone else will start working on it if you already have decent progress.

So the idea would be to do something like rust-kzg. rust-kzg supports multiple ECC backends for EIP-4844 functionality. However the problem with rust-kzg is that in order switch ECC backend you need to change the crate (for example change from rust-kzg-blst to rust-kzg-arkworks). We can maybe start with something like this for our bls crate. So we could have bls-blst, bls-zkcrypto etc. and just manually switch the dependency.

However, for the long-term solution, I would prefer that we have an option to switch at runtime (let's say with some command line flag) without a need to recompile the client. But if we will have to switch at the runtime - then I also would like to make optional backends via Rust features. This would allow to disable at compile time some of the ECC backends in tricky situations (for example if ECC backend doesn't support particular compilation target).

@shreyas-londhe
Copy link

Thanks for the detailed explanation @sauliusgrigaitis ! I'll get started on this and make a draft PR in a few days.

@sauliusgrigaitis
Copy link
Member Author

One thing I forgot to mention - we now are coupled with BLST types, it would be nice to be able to compile Grandine without BLST completely (when using a different ECC library). This would help with the exotic targets where BLST doesn't compile.

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 a pull request may close this issue.

2 participants