- To build the library, run
make
or runcargo build
- To build the documentation (with latex supported), run
make d
or runRUSTDOCFLAGS="--html-in-header katex-header.html" cargo doc --no-deps --open
- To run an example, first clone this repository and clone a testcq repository (in a same folder), then go to testcq directory and run
cargo run
git clone https://github.com/HuyHung0/cqplus.git
git clone https://github.com/HuyHung0/testcq.git
cd testcq
cargo run
We can put two repository in different place, but make sure to add the path of the library cqplus
in the Cargo.toml
file of testcq
- The notation of functions and variables in this project are based on the notation of the figure 1, page 19 of the paper in https://eprint.iacr.org/2023/1518.
- The formulas of each calculated polynomial are written in comments before the function
- Some functions was implemented in this repository https://github.com/geometryresearch/cq
- create srs (which is in
utils.rs
of thecq
repository) - create table (which is in
table.rs
of thecq
repository) - create commitments of polynomial (which is in
kzg.rs
of thecq
repository) - For the rest, I implemented from beginning
- create srs (which is in
- The structures of the codes as follows:
- First is
srs.rs
andtable.rs
to create Srs and table structure polynomials.rs
contains some basic polynomials for computation such as Lagrange basic, vanishing polynomial on a set,...kzg.rs
contains function to compute the commitment to a polynomial- After that
derive.rs
: implement thederive
functionprover.rs
: implement theprove
functionverifier.rs
: implement theverify
functiondata_structures.rs
contains the structures of the return of functionderive()
andprove()
- First is
- In
derive()
function,- there is a typo in the formula of
$T(X)$ . - when compute the commitment of
$\nu_K(s)U(s)$ in$G_2$ , we need a condition about the degree of this polynomial and the length of srs in$G_2$ . More specific, we need$(N-1)+(N_1-N+2) < N_2$ ,i.e., we need$N_1+2 \geq N_2$
- there is a typo in the formula of
- In
prove()
function,- Need to modify the input
- when compute
$[B(s)]_1$ , we need to evaluation$\rho_B(X)$ at$s$ . Hence, the secrets
should be in the input - the input notation
$e{N,n}$ should be the same as the output$e_{t,n}$ ofderive()
function
- when compute
- Need to modify the input
- In
verify()
function:- It written that computing
$[D(s)]_1$ , however, we don't know the components. I guess that this should be computed inprove()
function and the result should added to the return ofprove()
- We need
$[U(X)]_2$ . Hence, I guess that It should also include in the return ofderive()
. - The same for
$c_t$ . We need$[c_t]_2$ but inderive()
, we only have$[c_t]_1$ - The same for
$[B_\gamma]_1$ ,$[X-\gamma]_2$ - We also need some randoms value generated by
prove()
such as$\beta,\gamma,\eta$ . Hence, it should include in the return of theprove()
- In the end of condition i, it wrote
$[x]_2$ . I guess it should be$[1]_2$ .
- It written that computing
- Remove some debug commands in the library
- Update the crate version in
Cargo.toml
(in the new version, the some function names are changed, some functions are removed) - Implement the hash function which depends on all public inputs.
- If the project is corrected, public to crates.io