mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 00:33:06 +00:00
Comments
This commit is contained in:
parent
2e12ee8e82
commit
7d41785ac6
@ -46,9 +46,11 @@ pub struct CircuitBuilder<F: Extendable<D>, const D: usize> {
|
||||
|
||||
copy_constraints: Vec<CopyConstraint>,
|
||||
|
||||
/// A context string used to give context to copy constraints.
|
||||
context: String,
|
||||
|
||||
pub marked_targets: Vec<MarkedTargets<D>>,
|
||||
/// A vector of marked targets. The values assigned to these targets will be displayed by the prover.
|
||||
marked_targets: Vec<MarkedTargets<D>>,
|
||||
|
||||
/// Generators used to generate the witness.
|
||||
generators: Vec<Box<dyn WitnessGenerator<F>>>,
|
||||
|
||||
@ -130,6 +130,7 @@ pub(crate) struct ProverOnlyCircuitData<F: Extendable<D>, const D: usize> {
|
||||
pub copy_constraints: Vec<CopyConstraint>,
|
||||
/// The concrete placement of each gate in the circuit.
|
||||
pub gate_instances: Vec<GateInstance<F, D>>,
|
||||
/// A vector of marked targets. The values assigned to these targets will be displayed by the prover.
|
||||
pub marked_targets: Vec<MarkedTargets<D>>,
|
||||
}
|
||||
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
use crate::target::Target;
|
||||
|
||||
/// A named copy constraint.
|
||||
pub struct CopyConstraint {
|
||||
pub pair: (Target, Target),
|
||||
pub name: String,
|
||||
|
||||
@ -41,6 +41,7 @@ pub(crate) fn prove<F: Extendable<D>, const D: usize>(
|
||||
"to generate witness"
|
||||
);
|
||||
|
||||
// Display the marked targets for debugging purposes.
|
||||
for m in &prover_data.marked_targets {
|
||||
m.display(&partial_witness);
|
||||
}
|
||||
|
||||
@ -7,6 +7,7 @@ use crate::proof::HashTarget;
|
||||
use crate::target::Target;
|
||||
use crate::witness::{PartialWitness, Witness};
|
||||
|
||||
/// Enum representing all types of targets, so that they can be marked.
|
||||
#[derive(Clone)]
|
||||
pub enum Markable<const D: usize> {
|
||||
Target(Target),
|
||||
@ -37,6 +38,7 @@ impl<M: Into<Markable<D>>, const D: usize> From<Vec<M>> for Markable<D> {
|
||||
}
|
||||
|
||||
impl<const D: usize> Markable<D> {
|
||||
/// Display a `Markable` by querying a partial witness.
|
||||
fn print_markable<F: Extendable<D>>(&self, pw: &PartialWitness<F>) {
|
||||
match self {
|
||||
Markable::Target(t) => println!("{}", pw.get_target(*t)),
|
||||
@ -47,6 +49,7 @@ impl<const D: usize> Markable<D> {
|
||||
}
|
||||
}
|
||||
|
||||
/// A named collection of targets.
|
||||
#[derive(Clone)]
|
||||
pub struct MarkedTargets<const D: usize> {
|
||||
pub targets: Markable<D>,
|
||||
@ -54,6 +57,7 @@ pub struct MarkedTargets<const D: usize> {
|
||||
}
|
||||
|
||||
impl<const D: usize> MarkedTargets<D> {
|
||||
/// Display the collection of targets along with its name by querying a partial witness.
|
||||
pub fn display<F: Extendable<D>>(&self, pw: &PartialWitness<F>) {
|
||||
println!("Values for {}:", self.name);
|
||||
self.targets.print_markable(pw);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user