mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-07 16:23:12 +00:00
Merge pull request #548 from mir-protocol/remove_marking
Remove marking stuff
This commit is contained in:
commit
2831f8f28b
@ -40,7 +40,6 @@ use crate::plonk::permutation_argument::Forest;
|
|||||||
use crate::plonk::plonk_common::PlonkOracle;
|
use crate::plonk::plonk_common::PlonkOracle;
|
||||||
use crate::timed;
|
use crate::timed;
|
||||||
use crate::util::context_tree::ContextTree;
|
use crate::util::context_tree::ContextTree;
|
||||||
use crate::util::marking::{Markable, MarkedTargets};
|
|
||||||
use crate::util::partial_products::num_partial_products;
|
use crate::util::partial_products::num_partial_products;
|
||||||
use crate::util::timing::TimingTree;
|
use crate::util::timing::TimingTree;
|
||||||
use crate::util::{transpose, transpose_poly_values};
|
use crate::util::{transpose, transpose_poly_values};
|
||||||
@ -65,9 +64,6 @@ pub struct CircuitBuilder<F: RichField + Extendable<D>, const D: usize> {
|
|||||||
/// A tree of named scopes, used for debugging.
|
/// A tree of named scopes, used for debugging.
|
||||||
context_log: ContextTree,
|
context_log: ContextTree,
|
||||||
|
|
||||||
/// 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 used to generate the witness.
|
||||||
generators: Vec<Box<dyn WitnessGenerator<F>>>,
|
generators: Vec<Box<dyn WitnessGenerator<F>>>,
|
||||||
|
|
||||||
@ -97,7 +93,6 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
virtual_target_index: 0,
|
virtual_target_index: 0,
|
||||||
copy_constraints: Vec::new(),
|
copy_constraints: Vec::new(),
|
||||||
context_log: ContextTree::new(),
|
context_log: ContextTree::new(),
|
||||||
marked_targets: Vec::new(),
|
|
||||||
generators: Vec::new(),
|
generators: Vec::new(),
|
||||||
constants_to_targets: HashMap::new(),
|
constants_to_targets: HashMap::new(),
|
||||||
base_arithmetic_results: HashMap::new(),
|
base_arithmetic_results: HashMap::new(),
|
||||||
@ -393,13 +388,6 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
self.context_log.pop(self.num_gates());
|
self.context_log.pop(self.num_gates());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn add_marked(&mut self, targets: Markable<D>, 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`
|
/// 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
|
/// and constants `constants`. Parameters are any data used to differentiate which gate should be
|
||||||
/// used for the given operation.
|
/// used for the given operation.
|
||||||
@ -786,7 +774,6 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
|||||||
sigmas: transpose_poly_values(sigma_vecs),
|
sigmas: transpose_poly_values(sigma_vecs),
|
||||||
subgroup,
|
subgroup,
|
||||||
public_inputs: self.public_inputs,
|
public_inputs: self.public_inputs,
|
||||||
marked_targets: self.marked_targets,
|
|
||||||
representative_map: forest.parents,
|
representative_map: forest.parents,
|
||||||
fft_root_table: Some(fft_root_table),
|
fft_root_table: Some(fft_root_table),
|
||||||
};
|
};
|
||||||
|
|||||||
@ -26,7 +26,6 @@ use crate::plonk::plonk_common::{PlonkOracle, FRI_ORACLES};
|
|||||||
use crate::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs};
|
use crate::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInputs};
|
||||||
use crate::plonk::prover::prove;
|
use crate::plonk::prover::prove;
|
||||||
use crate::plonk::verifier::verify;
|
use crate::plonk::verifier::verify;
|
||||||
use crate::util::marking::MarkedTargets;
|
|
||||||
use crate::util::timing::TimingTree;
|
use crate::util::timing::TimingTree;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
@ -224,8 +223,6 @@ pub struct ProverOnlyCircuitData<
|
|||||||
pub subgroup: Vec<F>,
|
pub subgroup: Vec<F>,
|
||||||
/// Targets to be made public.
|
/// Targets to be made public.
|
||||||
pub public_inputs: Vec<Target>,
|
pub public_inputs: Vec<Target>,
|
||||||
/// A vector of marked targets. The values assigned to these targets will be displayed by the prover.
|
|
||||||
pub marked_targets: Vec<MarkedTargets<D>>,
|
|
||||||
/// A map from each `Target`'s index to the index of its representative in the disjoint-set
|
/// A map from each `Target`'s index to the index of its representative in the disjoint-set
|
||||||
/// forest.
|
/// forest.
|
||||||
pub representative_map: Vec<usize>,
|
pub representative_map: Vec<usize>,
|
||||||
|
|||||||
@ -49,13 +49,6 @@ where
|
|||||||
let public_inputs = partition_witness.get_targets(&prover_data.public_inputs);
|
let public_inputs = partition_witness.get_targets(&prover_data.public_inputs);
|
||||||
let public_inputs_hash = C::InnerHasher::hash_no_pad(&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!(
|
let witness = timed!(
|
||||||
timing,
|
timing,
|
||||||
"compute full witness",
|
"compute full witness",
|
||||||
|
|||||||
@ -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<const D: usize> {
|
|
||||||
Target(Target),
|
|
||||||
ExtensionTarget(ExtensionTarget<D>),
|
|
||||||
HashTarget(HashOutTarget),
|
|
||||||
Vec(Vec<Markable<D>>),
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<const D: usize> From<Target> for Markable<D> {
|
|
||||||
fn from(t: Target) -> Self {
|
|
||||||
Self::Target(t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<const D: usize> From<ExtensionTarget<D>> for Markable<D> {
|
|
||||||
fn from(et: ExtensionTarget<D>) -> Self {
|
|
||||||
Self::ExtensionTarget(et)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<const D: usize> From<HashOutTarget> for Markable<D> {
|
|
||||||
fn from(ht: HashOutTarget) -> Self {
|
|
||||||
Self::HashTarget(ht)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
impl<M: Into<Markable<D>>, const D: usize> From<Vec<M>> for Markable<D> {
|
|
||||||
fn from(v: Vec<M>) -> Self {
|
|
||||||
Self::Vec(v.into_iter().map(|m| m.into()).collect())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<const D: usize> Markable<D> {
|
|
||||||
/// Display a `Markable` by querying a partial witness.
|
|
||||||
fn print_markable<F: RichField + Extendable<D>>(&self, pw: &PartitionWitness<F>) {
|
|
||||||
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<const D: usize> {
|
|
||||||
pub targets: Markable<D>,
|
|
||||||
pub name: String,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<const D: usize> MarkedTargets<D> {
|
|
||||||
/// Display the collection of targets along with its name by querying a partial witness.
|
|
||||||
pub fn display<F: RichField + Extendable<D>>(&self, pw: &PartitionWitness<F>) {
|
|
||||||
println!("Values for {}:", self.name);
|
|
||||||
self.targets.print_markable(pw);
|
|
||||||
println!("End of values for {}", self.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -2,7 +2,6 @@ use plonky2_field::field_types::Field;
|
|||||||
use plonky2_field::polynomial::PolynomialValues;
|
use plonky2_field::polynomial::PolynomialValues;
|
||||||
|
|
||||||
pub(crate) mod context_tree;
|
pub(crate) mod context_tree;
|
||||||
pub(crate) mod marking;
|
|
||||||
pub(crate) mod partial_products;
|
pub(crate) mod partial_products;
|
||||||
pub mod reducing;
|
pub mod reducing;
|
||||||
pub mod serialization;
|
pub mod serialization;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user