mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 00:33:06 +00:00
PR feedback
This commit is contained in:
parent
ce0a4f4480
commit
2bb63a6f11
@ -32,41 +32,39 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
let ProofWithPublicInputsTarget {
|
let ProofWithPublicInputsTarget {
|
||||||
proof:
|
proof:
|
||||||
ProofTarget {
|
ProofTarget {
|
||||||
wires_cap,
|
wires_cap: wires_cap0,
|
||||||
plonk_zs_partial_products_cap,
|
plonk_zs_partial_products_cap: plonk_zs_partial_products_cap0,
|
||||||
quotient_polys_cap,
|
quotient_polys_cap: quotient_polys_cap0,
|
||||||
openings,
|
openings: openings0,
|
||||||
opening_proof,
|
opening_proof: opening_proof0,
|
||||||
},
|
},
|
||||||
public_inputs,
|
public_inputs: public_inputs0,
|
||||||
} = proof_with_pis0;
|
} = proof_with_pis0;
|
||||||
let ProofWithPublicInputsTarget {
|
let ProofWithPublicInputsTarget {
|
||||||
proof:
|
proof:
|
||||||
ProofTarget {
|
ProofTarget {
|
||||||
wires_cap: dummy_wires_cap,
|
wires_cap: wires_cap1,
|
||||||
plonk_zs_partial_products_cap: dummy_plonk_zs_partial_products_cap,
|
plonk_zs_partial_products_cap: plonk_zs_partial_products_cap1,
|
||||||
quotient_polys_cap: dummy_quotient_polys_cap,
|
quotient_polys_cap: quotient_polys_cap1,
|
||||||
openings: dummy_openings,
|
openings: openings1,
|
||||||
|
opening_proof: opening_proof1,
|
||||||
opening_proof: dummy_opening_proof,
|
|
||||||
},
|
},
|
||||||
public_inputs: dummy_public_inputs,
|
public_inputs: public_inputs1,
|
||||||
} = proof_with_pis1;
|
} = proof_with_pis1;
|
||||||
|
|
||||||
let selected_proof = with_context!(self, "select proof", {
|
let selected_proof = with_context!(self, "select proof", {
|
||||||
let selected_wires_cap = self.select_cap(condition, wires_cap, dummy_wires_cap);
|
let selected_wires_cap = self.select_cap(condition, wires_cap0, wires_cap1);
|
||||||
let selected_plonk_zs_partial_products_cap = self.select_cap(
|
let selected_plonk_zs_partial_products_cap = self.select_cap(
|
||||||
condition,
|
condition,
|
||||||
plonk_zs_partial_products_cap,
|
plonk_zs_partial_products_cap0,
|
||||||
dummy_plonk_zs_partial_products_cap,
|
plonk_zs_partial_products_cap1,
|
||||||
);
|
);
|
||||||
let selected_quotient_polys_cap =
|
let selected_quotient_polys_cap =
|
||||||
self.select_cap(condition, quotient_polys_cap, dummy_quotient_polys_cap);
|
self.select_cap(condition, quotient_polys_cap0, quotient_polys_cap1);
|
||||||
let selected_openings = self.select_opening_set(condition, openings, dummy_openings);
|
let selected_openings = self.select_opening_set(condition, openings0, openings1);
|
||||||
let selected_opening_proof =
|
let selected_opening_proof =
|
||||||
self.select_opening_proof(condition, opening_proof, dummy_opening_proof);
|
self.select_opening_proof(condition, opening_proof0, opening_proof1);
|
||||||
let selected_public_inputs =
|
let selected_public_inputs = self.select_vec(condition, public_inputs0, public_inputs1);
|
||||||
self.select_vec(condition, public_inputs, dummy_public_inputs);
|
|
||||||
ProofWithPublicInputsTarget {
|
ProofWithPublicInputsTarget {
|
||||||
proof: ProofTarget {
|
proof: ProofTarget {
|
||||||
wires_cap: selected_wires_cap,
|
wires_cap: selected_wires_cap,
|
||||||
@ -96,6 +94,17 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn select_hash(
|
||||||
|
&mut self,
|
||||||
|
b: BoolTarget,
|
||||||
|
h0: HashOutTarget,
|
||||||
|
h1: HashOutTarget,
|
||||||
|
) -> HashOutTarget {
|
||||||
|
HashOutTarget {
|
||||||
|
elements: std::array::from_fn(|i| self.select(b, h0.elements[i], h1.elements[i])),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn select_cap(
|
fn select_cap(
|
||||||
&mut self,
|
&mut self,
|
||||||
b: BoolTarget,
|
b: BoolTarget,
|
||||||
@ -107,11 +116,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
cap0.0
|
cap0.0
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip_eq(cap1.0)
|
.zip_eq(cap1.0)
|
||||||
.map(|(h0, h1)| HashOutTarget {
|
.map(|(h0, h1)| self.select_hash(b, h0, h1))
|
||||||
elements: std::array::from_fn(|i| {
|
|
||||||
self.select(b, h0.elements[i], h1.elements[i])
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
.collect(),
|
.collect(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -243,11 +248,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
.siblings
|
.siblings
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip_eq(proof1.siblings)
|
.zip_eq(proof1.siblings)
|
||||||
.map(|(h0, h1)| HashOutTarget {
|
.map(|(h0, h1)| self.select_hash(b, h0, h1))
|
||||||
elements: std::array::from_fn(|i| {
|
|
||||||
self.select(b, h0.elements[i], h1.elements[i])
|
|
||||||
}),
|
|
||||||
})
|
|
||||||
.collect(),
|
.collect(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user