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 cost model #14

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open

Add cost model #14

wants to merge 15 commits into from

Conversation

spherel
Copy link
Member

@spherel spherel commented Aug 9, 2022

No description provided.

@spherel spherel force-pushed the add-cost-model branch 2 times, most recently from 15acf40 to 4b88b76 Compare August 9, 2022 02:20
halo2_proofs/src/poly/domain.rs Outdated Show resolved Hide resolved
halo2_proofs/src/dev/cost_model.rs Outdated Show resolved Hide resolved
halo2_proofs/src/dev/cost_model.rs Outdated Show resolved Hide resolved
Comment on lines 170 to 173
let params: Params<E::G1Affine> = Params::<E::G1Affine>::unsafe_setup::<E>(15_u32);
let vk = keygen_vk(&params, &circuit).expect("keygen_vk should not fail");
let pk = keygen_pk(&params, vk, &circuit).expect("keygen_pk should not fail");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems that we only need the ConstraintSystem object which can be generated by calling create_domain.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vk needs to be generated because the circuit needs to be synthesized here to convert simple selectors to fixed columns.

Comment on lines 179 to 194
let generate_fake_params = |k| {
let s = E::Scalar::random(OsRng);
let rand_c1 = <E::G1Affine as PrimeCurveAffine>::generator() * s;
let rand_c2 = <E::G2Affine as PrimeCurveAffine>::generator() * s;
let rand_c1: E::G1Affine = rand_c1.into();
let n = 1 << k;
Params {
k: k as u32,
n: n as u64,
g: (0..n).map(|_| rand_c1).collect(),
g_lagrange: (0..n).map(|_| rand_c1).collect(),
additional_data: Vec::from(rand_c2.to_bytes().as_ref()),
}
};

let params = generate_fake_params(k);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By applying the above comment, this fake_params is not needed anymore.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous params is the one with fixed smaller k, while fake_params is to generate one with larger k.

halo2_proofs/src/dev/cost_model.rs Outdated Show resolved Hide resolved
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 this pull request may close these issues.

2 participants