From 781d1edb8e7fbb9057dd2cd19c25ed495efa24c8 Mon Sep 17 00:00:00 2001 From: wborgeaud Date: Wed, 18 May 2022 19:37:05 +0200 Subject: [PATCH] Remove marking --- plonky2/src/plonk/circuit_builder.rs | 13 ------ plonky2/src/plonk/circuit_data.rs | 3 -- plonky2/src/plonk/prover.rs | 7 --- plonky2/src/util/marking.rs | 64 ---------------------------- plonky2/src/util/mod.rs | 1 - 5 files changed, 88 deletions(-) delete mode 100644 plonky2/src/util/marking.rs diff --git a/plonky2/src/plonk/circuit_builder.rs b/plonky2/src/plonk/circuit_builder.rs index 4bda9618..b01a8fbb 100644 --- a/plonky2/src/plonk/circuit_builder.rs +++ b/plonky2/src/plonk/circuit_builder.rs @@ -40,7 +40,6 @@ use crate::plonk::permutation_argument::Forest; use crate::plonk::plonk_common::PlonkOracle; use crate::timed; use crate::util::context_tree::ContextTree; -use crate::util::marking::{Markable, MarkedTargets}; use crate::util::partial_products::num_partial_products; use crate::util::timing::TimingTree; use crate::util::{transpose, transpose_poly_values}; @@ -65,9 +64,6 @@ pub struct CircuitBuilder, const D: usize> { /// A tree of named scopes, used for debugging. context_log: ContextTree, - /// A vector of marked targets. The values assigned to these targets will be displayed by the prover. - marked_targets: Vec>, - /// Generators used to generate the witness. generators: Vec>>, @@ -97,7 +93,6 @@ impl, const D: usize> CircuitBuilder { virtual_target_index: 0, copy_constraints: Vec::new(), context_log: ContextTree::new(), - marked_targets: Vec::new(), generators: Vec::new(), constants_to_targets: HashMap::new(), base_arithmetic_results: HashMap::new(), @@ -393,13 +388,6 @@ impl, const D: usize> CircuitBuilder { self.context_log.pop(self.num_gates()); } - pub fn add_marked(&mut self, targets: Markable, name: &str) { - self.marked_targets.push(MarkedTargets { - targets, - name: name.to_string(), - }) - } - /// Find an available slot, of the form `(row, op)` for gate `G` using parameters `params` /// and constants `constants`. Parameters are any data used to differentiate which gate should be /// used for the given operation. @@ -786,7 +774,6 @@ impl, const D: usize> CircuitBuilder { sigmas: transpose_poly_values(sigma_vecs), subgroup, public_inputs: self.public_inputs, - marked_targets: self.marked_targets, representative_map: forest.parents, fft_root_table: Some(fft_root_table), }; diff --git a/plonky2/src/plonk/circuit_data.rs b/plonky2/src/plonk/circuit_data.rs index 75246c20..e6aa7638 100644 --- a/plonky2/src/plonk/circuit_data.rs +++ b/plonky2/src/plonk/circuit_data.rs @@ -26,7 +26,6 @@ use crate::plonk::plonk_common::{PlonkOracle, FRI_ORACLES}; use crate::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs}; use crate::plonk::prover::prove; use crate::plonk::verifier::verify; -use crate::util::marking::MarkedTargets; use crate::util::timing::TimingTree; #[derive(Clone, Debug)] @@ -224,8 +223,6 @@ pub struct ProverOnlyCircuitData< pub subgroup: Vec, /// Targets to be made public. pub public_inputs: Vec, - /// A vector of marked targets. The values assigned to these targets will be displayed by the prover. - pub marked_targets: Vec>, /// A map from each `Target`'s index to the index of its representative in the disjoint-set /// forest. pub representative_map: Vec, diff --git a/plonky2/src/plonk/prover.rs b/plonky2/src/plonk/prover.rs index f3d43f6f..3c235a0a 100644 --- a/plonky2/src/plonk/prover.rs +++ b/plonky2/src/plonk/prover.rs @@ -49,13 +49,6 @@ where let public_inputs = partition_witness.get_targets(&prover_data.public_inputs); let public_inputs_hash = C::InnerHasher::hash_no_pad(&public_inputs); - if cfg!(debug_assertions) { - // Display the marked targets for debugging purposes. - for m in &prover_data.marked_targets { - m.display(&partition_witness); - } - } - let witness = timed!( timing, "compute full witness", diff --git a/plonky2/src/util/marking.rs b/plonky2/src/util/marking.rs deleted file mode 100644 index 67ef89f4..00000000 --- a/plonky2/src/util/marking.rs +++ /dev/null @@ -1,64 +0,0 @@ -use plonky2_field::extension_field::Extendable; - -use crate::hash::hash_types::{HashOutTarget, RichField}; -use crate::iop::ext_target::ExtensionTarget; -use crate::iop::target::Target; -use crate::iop::witness::{PartitionWitness, Witness}; - -/// Enum representing all types of targets, so that they can be marked. -#[derive(Clone)] -pub enum Markable { - Target(Target), - ExtensionTarget(ExtensionTarget), - HashTarget(HashOutTarget), - Vec(Vec>), -} - -impl From for Markable { - fn from(t: Target) -> Self { - Self::Target(t) - } -} -impl From> for Markable { - fn from(et: ExtensionTarget) -> Self { - Self::ExtensionTarget(et) - } -} -impl From for Markable { - fn from(ht: HashOutTarget) -> Self { - Self::HashTarget(ht) - } -} -impl>, const D: usize> From> for Markable { - fn from(v: Vec) -> Self { - Self::Vec(v.into_iter().map(|m| m.into()).collect()) - } -} - -impl Markable { - /// Display a `Markable` by querying a partial witness. - fn print_markable>(&self, pw: &PartitionWitness) { - match self { - Markable::Target(t) => println!("{}", pw.get_target(*t)), - Markable::ExtensionTarget(et) => println!("{}", pw.get_extension_target(*et)), - Markable::HashTarget(ht) => println!("{:?}", pw.get_hash_target(*ht)), - Markable::Vec(v) => v.iter().for_each(|m| m.print_markable(pw)), - } - } -} - -/// A named collection of targets. -#[derive(Clone)] -pub struct MarkedTargets { - pub targets: Markable, - pub name: String, -} - -impl MarkedTargets { - /// Display the collection of targets along with its name by querying a partial witness. - pub fn display>(&self, pw: &PartitionWitness) { - println!("Values for {}:", self.name); - self.targets.print_markable(pw); - println!("End of values for {}", self.name); - } -} diff --git a/plonky2/src/util/mod.rs b/plonky2/src/util/mod.rs index 9342a75e..329b2143 100644 --- a/plonky2/src/util/mod.rs +++ b/plonky2/src/util/mod.rs @@ -2,7 +2,6 @@ use plonky2_field::field_types::Field; use plonky2_field::polynomial::PolynomialValues; pub(crate) mod context_tree; -pub(crate) mod marking; pub(crate) mod partial_products; pub mod reducing; pub mod serialization;