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

Import bindings to a Rust library providing BLS12-381 #13

Closed
amiller opened this issue Aug 23, 2018 · 4 comments
Closed

Import bindings to a Rust library providing BLS12-381 #13

amiller opened this issue Aug 23, 2018 · 4 comments
Labels
compute optimization batch optimizations, accelerating things using rust bindings, exploiting parallelism, etc.

Comments

@amiller
Copy link
Contributor

amiller commented Aug 23, 2018

We're planning on using BLS12-381 for our cryptography and JubJub for elliptic curve cryptography applications within the MPC. The PBC library we're already using does not support BLS12-381, and we don't know of any efficient python libraries. Relic supports it but has bad bindings. We will prefer to use rust for modules, so we're going to try port all of the rust libraries, but just build our own rust module that uses it.

@amiller amiller added this to the Offline Phase milestone Aug 23, 2018
@amiller amiller added the compute optimization batch optimizations, accelerating things using rust bindings, exploiting parallelism, etc. label Aug 24, 2018
@amiller amiller mentioned this issue Aug 25, 2018
4 tasks
@amiller amiller removed this from the Offline Phase milestone Sep 6, 2018
@amiller
Copy link
Contributor Author

amiller commented Sep 17, 2018

Rahul made an initial version of this here, https://github.com/hybridNeo/pairing as a fork of pairing. This is cool, making a python wrapper could be something that the pairing merges upstream.

@amiller
Copy link
Contributor Author

amiller commented Oct 3, 2018

  • convert to python3
  • install this as a dependency in the hbmpc docker environment

@sbellem
Copy link
Collaborator

sbellem commented Oct 4, 2018

install this as a dependency in the hbmpc docker environment

If we keep the Alpine linux image this is non-trivial. See a possible approach at https://github.com/sbellem/pairing/blob/docker-build/wheel.Dockerfile (instructions are at https://github.com/sbellem/pairing/blob/docker-build/RustBindings.md#python-wheel).

The simplest and easiest approach for now will probably be to switch to a glibc friendly image such as ubuntu, as opposed to a musl lib one like Alpine.

Notes

  1. PyO3 minimum required rust version is 1.30.0-nightly 2018-08-18
  2. it is not possible to install the nightly build on Alpine linux which is what we use for the HBMPC Dockerfile
  3. workaround 1: we could change the HBMPC docker image from Alpine (musl) to Ubuntu (glibc)
  4. workaround 2: we could build binaries (python wheel) but installing a wheel on Alpine linux requires a workaround as well (ref: Install manylinux wheel although it's not officially supported by the host pypa/pip#3969 (comment))

The workaround in point 4 was chosen for now (see https://github.com/sbellem/HoneyBadgerMPC/blob/rust-zkcrypto-pairing/Dockerfile) in order to avoid changing the base image of HBMPC. Running the example @hybridNeo gave works. If we encounter weird problem we can always try the other workaround which involves changing HBMPC's base image to a glibc friendly linux distro such as Ubuntu or CentOS.

Relevant links

@amiller
Copy link
Contributor Author

amiller commented Apr 19, 2019

This is completed by @tyurek with #201 #196 #238 etc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compute optimization batch optimizations, accelerating things using rust bindings, exploiting parallelism, etc.
Projects
None yet
Development

No branches or pull requests

3 participants