Observe public inputs (#119)

* Observe public inputs

* Observe the hash instead
This commit is contained in:
Daniel Lubarov 2021-07-22 10:27:10 -07:00 committed by GitHub
parent 1d5cd4430e
commit 6bd197e9cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 4 deletions

View File

@ -78,9 +78,10 @@ pub(crate) fn prove<F: Extendable<D>, const D: usize>(
);
let mut challenger = Challenger::new();
// Observe the instance.
// TODO: Need to include public inputs as well.
challenger.observe_hash(&common_data.circuit_digest);
challenger.observe_hash(&public_inputs_hash);
challenger.observe_hash(&wires_commitment.merkle_tree.root);
let betas = challenger.get_n_challenges(num_challenges);

View File

@ -28,18 +28,20 @@ impl<F: Extendable<D>, const D: usize> CircuitBuilder<F, D> {
} = proof_with_pis;
let one = self.one_extension();
let public_inputs_hash = &self.hash_n_to_hash(public_inputs, true);
let num_challenges = inner_config.num_challenges;
let public_inputs_hash = &self.hash_n_to_hash(public_inputs, true);
let mut challenger = RecursiveChallenger::new(self);
let (betas, gammas, alphas, zeta) =
context!(self, "observe proof and generates challenges", {
// Observe the instance.
let digest = HashTarget::from_vec(
self.constants(&inner_common_data.circuit_digest.elements),
);
challenger.observe_hash(&digest);
challenger.observe_hash(&public_inputs_hash);
challenger.observe_hash(&proof.wires_root);
let betas = challenger.get_n_challenges(self, num_challenges);

View File

@ -25,9 +25,10 @@ pub(crate) fn verify<F: Extendable<D>, const D: usize>(
let public_inputs_hash = &hash_n_to_hash(public_inputs, true);
let mut challenger = Challenger::new();
// Observe the instance.
// TODO: Need to include public inputs as well.
challenger.observe_hash(&common_data.circuit_digest);
challenger.observe_hash(&public_inputs_hash);
challenger.observe_hash(&proof.wires_root);
let betas = challenger.get_n_challenges(num_challenges);