-
Notifications
You must be signed in to change notification settings - Fork 39
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
base: main
Are you sure you want to change the base?
Add cost model #14
Conversation
15acf40
to
4b88b76
Compare
halo2_proofs/src/dev/cost_model.rs
Outdated
let params: Params<E::G1Affine> = Params::<E::G1Affine>::unsafe_setup::<E>(15_u32); | ||
let vk = keygen_vk(¶ms, &circuit).expect("keygen_vk should not fail"); | ||
let pk = keygen_pk(¶ms, vk, &circuit).expect("keygen_pk should not fail"); | ||
|
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
halo2_proofs/src/dev/cost_model.rs
Outdated
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); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
No description provided.