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

Polycommitlog #364

Open
wants to merge 14 commits into
base: dev
Choose a base branch
from
3 changes: 3 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ max_line_length=89
exclude =
charm/,
.eggs/
per-file-ignores =
honeybadgermpc/poly_commit_log.py: N806, N803
honeybadgermpc/proofs.py: N806, N803
28 changes: 28 additions & 0 deletions benchmark/test_benchmark_poly_commit_const.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
from pytest import mark
from honeybadgermpc.betterpairing import G1, ZR
from honeybadgermpc.polynomial import polynomials_over
from honeybadgermpc.poly_commit_const import PolyCommitConst, gen_pc_const_crs


@mark.parametrize("t", [3, 10, 20, 33])
def test_benchmark_commit(benchmark, t):
alpha = ZR.random()
g = G1.rand()
h = G1.rand()
crs = gen_pc_const_crs(t, alpha=alpha, g=g, h=h)
pc = PolyCommitConst(crs)
phi = polynomials_over(ZR).random(t)
benchmark(pc.commit, phi)


@mark.parametrize("t", [3, 10, 20, 33])
def test_benchmark_create_witness(benchmark, t):
alpha = ZR.random()
g = G1.rand()
h = G1.rand()
crs = gen_pc_const_crs(t, alpha=alpha, g=g, h=h)
pc = PolyCommitConst(crs)
phi = polynomials_over(ZR).random(t)
c, phi_hat = pc.commit(phi)
pc.preprocess_prover(10)
benchmark(pc.create_witness, phi, phi_hat, 3)
29 changes: 29 additions & 0 deletions benchmark/test_benchmark_poly_commit_log.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from pytest import mark
from honeybadgermpc.betterpairing import ZR
from honeybadgermpc.polynomial import polynomials_over
from honeybadgermpc.poly_commit_log import PolyCommitLog


@mark.parametrize("t", [3, 10, 20, 33])
def test_benchmark_commit(benchmark, t):
pc = PolyCommitLog(degree_max=t)
r = ZR.random()
phi = polynomials_over(ZR).random(t)
benchmark(pc.commit, phi, r)


@mark.parametrize("t", [3, 10, 20, 33])
def test_benchmark_create_witness(benchmark, t):
pc = PolyCommitLog(degree_max=t)
r = ZR.random()
phi = polynomials_over(ZR).random(t)
benchmark(pc.create_witness, phi, r, 3)


@mark.parametrize("t", [3, 10, 20, 33])
def test_benchmark_create_batch_witness(benchmark, t):
pc = PolyCommitLog(degree_max=t)
r = ZR.random()
phi = polynomials_over(ZR).random(t)
pc.preprocess_prover()
benchmark(pc.batch_create_witness, phi, r, n=3*t+1)
Loading