From 4602eaaec955ae4abc6fac593168313d9fd01bc5 Mon Sep 17 00:00:00 2001 From: ShuangWu121 Date: Mon, 30 Sep 2024 23:07:11 +0200 Subject: [PATCH] add params directory --- backend/src/stwo/circuit_builder.rs | 30 ++++++++++++++++++++++++++ backend/src/stwo/params/mersenne_31.rs | 0 backend/src/stwo/params/mod.rs | 1 + 3 files changed, 31 insertions(+) create mode 100644 backend/src/stwo/params/mersenne_31.rs create mode 100644 backend/src/stwo/params/mod.rs diff --git a/backend/src/stwo/circuit_builder.rs b/backend/src/stwo/circuit_builder.rs index 390a1a555e..cf41795ebd 100644 --- a/backend/src/stwo/circuit_builder.rs +++ b/backend/src/stwo/circuit_builder.rs @@ -95,6 +95,36 @@ impl<'a, T: FieldElement> PowdrCircuit<'a, T> { } } +impl<'a, T: FieldElement> FrameworkEval for PowdrCircuit<'a, T> { + fn log_size(&self) -> u32 { + // Assuming the log size is based on the analyzed data. + // Modify this logic as per the specific requirements. + self.analyzed.degree().ilog2() + } + + fn max_constraint_log_degree_bound(&self) -> u32 { + // Assuming the max constraint log degree is calculated based on the analyzed data. + // Modify this logic as per the specific requirements. + self.analyzed.degree().ilog2() + } + + fn evaluate(&self, mut eval: E) -> E { + // Assuming we are evaluating constraints based on the witness data. + // This is an example, modify according to the specific logic of the circuit. + if let Some(witness) = self.witness { + for (name, values) in witness.iter() { + for value in values { + let trace_mask = eval.next_trace_mask(); + eval.add_constraint(trace_mask - *value); + } + } + } + eval + } +} + + + pub fn generate_parallel_stwo_trace_by_witness_repitition(length: usize, witness: &[(String, Vec)], log_n_instances: u32 diff --git a/backend/src/stwo/params/mersenne_31.rs b/backend/src/stwo/params/mersenne_31.rs new file mode 100644 index 0000000000..e69de29bb2 diff --git a/backend/src/stwo/params/mod.rs b/backend/src/stwo/params/mod.rs new file mode 100644 index 0000000000..c019d06847 --- /dev/null +++ b/backend/src/stwo/params/mod.rs @@ -0,0 +1 @@ +pub mod mersenne_31; \ No newline at end of file