-
Notifications
You must be signed in to change notification settings - Fork 513
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
Define a stable serialization format for VerifyingKey
#449
Comments
a bit more of the context:
|
ViewingKey
serialization is not round-trip compatibleVerificationKey
serialization is not round-trip compatible
VerificationKey
serialization is not round-trip compatibleVerifyingKey
serialization is not round-trip compatible
the following code can be added to the end of the use halo2_proofs::{
plonk::{create_proof, keygen_pk, keygen_vk, VerifyingKey},
poly::commitment::Params,
transcript::Blake2bWrite,
};
use pasta_curves::{vesta, EqAffine};
use rand_core::OsRng;
let params: Params<EqAffine> = halo2_proofs::poly::commitment::Params::new(k);
let vk = keygen_vk(¶ms, &circuit).unwrap();
let mut vk_buffer = vec![];
vk.write(&mut vk_buffer).unwrap();
let vk =
VerifyingKey::<EqAffine>::read::<_, MyCircuit<Fp>>(&mut &vk_buffer[..], ¶ms).unwrap();
let pk = keygen_pk(¶ms, vk, &circuit).unwrap();
let mut transcript = Blake2bWrite::<_, vesta::Affine, _>::init(vec![]);
create_proof(
¶ms,
&pk,
&[circuit],
&[&[&[c]]],
&mut OsRng,
&mut transcript,
); |
Possible helpful info: |
The code that is supposed to test this is used on a circuit that has no selectors |
I've figured out the problem.
halo2/halo2_proofs/src/plonk.rs Lines 64 to 70 in 9617336
During keygen, we generate both the fixed column commitments and the permutation verifying key. However, we also mutate the halo2/halo2_proofs/src/plonk/keygen.rs Lines 207 to 221 in 9617336
The problem is that the effect of
We don't want to re-synthesize the circuit in
I suspect it will be easier to serialize the inputs. |
I would prefer that we not rerun selector compression, just for simplicity of analysis. Selector compression is supposed to be expressible as an optimization that transforms PLONKish circuits to PLONKish circuits. That is, it should be possible to serialize the transformed gates. |
Note that changing the serialization of the verification key to resolve this issue will be incompatible with older proofs, because the verification key is serialized in order to initialize the common inputs for Fiat-Shamir. |
VerifyingKey
serialization is not round-trip compatibleVerifyingKey
In a pairing, @ebfull and I decided that for |
Related: Currently you need the circuit to read the VerifyingKey, which seems counterintuitive to me. Is there any chance this limitation could be lifted, such that you don't need the code for creating the circuit to verify a proof?
|
@L-as You do need the |
…s in vk bytes" (#18) This reverts commit df0f7bc. We need selectors to correctly verify the proofs. See zcash/halo2#449 (comment) .
The verification key serialization should include the number of public input elements. |
in https://github.com/appliedzkp/zkevm-circuits/blob/main/circuit-benchmarks/src/evm_circuit.rs#L84 using the vk in memory works fine, but saving&reloading the VK (not PK mentioned in this issue) doesn't work. (and https://github.com/zcash/halo2/blob/main/examples/sha256/benches.rs works good)
Would you happen to have a chance to know any clue?
Originally posted by @HAOYUatHZ in #443 (comment)
The text was updated successfully, but these errors were encountered: