kimchi_stubs/arkworks/
mod.rs

1//! This module contains wrapper types to Arkworks types.
2//! To use Arkwork types in OCaml, you have to convert to these types,
3//! and convert back from them to use them in Rust.
4//!
5//! For example:
6//!
7//! ```
8//! use ark_ff::BigInteger256;
9//! use core::ops::Add;
10//! use kimchi_stubs::arkworks::CamlBigInteger256;
11//! use num_bigint::BigUint;
12//!
13//! #[ocaml::func]
14//! pub fn caml_add(x: CamlBigInteger256, y: CamlBigInteger256) -> CamlBigInteger256 {
15//!    let x: BigUint = x.into();
16//!    let y: BigUint = y.into();
17//!    let z: BigInteger256 = (x + y).try_into().expect("Something happened while adding");
18//!    z.into()
19//! }
20//! ```
21//!
22
23pub mod bigint_256;
24pub mod group_affine;
25pub mod group_projective;
26pub mod pasta_fp;
27pub mod pasta_fq;
28
29// re-export what's important
30
31pub use bigint_256::CamlBigInteger256;
32pub use group_affine::{CamlGPallas, CamlGVesta, CamlGroupAffine};
33pub use group_projective::{CamlGroupProjectivePallas, CamlGroupProjectiveVesta};
34pub use pasta_fp::CamlFp;
35pub use pasta_fq::CamlFq;