Ian Goldberg 5 месяцев назад
Родитель
Сommit
75bec27889
1 измененных файлов с 24 добавлено и 0 удалено
  1. 24 0
      sigma-compiler-core/src/rangeproof.rs

+ 24 - 0
sigma-compiler-core/src/rangeproof.rs

@@ -186,6 +186,27 @@ fn parse(vars: &TaggedVarDict, vardict: &VarDict, expr: &Expr) -> Option<RangeSt
     None
 }
 
+/// Produce a [`String`] representation of a [`TaggedVarDict`]
+fn taggedvardict_to_string(vd: &TaggedVarDict) -> String {
+    let scalars_str = vd
+        .values()
+        .filter_map(|v| match v {
+            super::TaggedIdent::Scalar(ts) => Some(ts.to_string()),
+            _ => None,
+        })
+        .collect::<Vec<String>>()
+        .join(", ");
+    let points_str = vd
+        .values()
+        .filter_map(|v| match v {
+            super::TaggedIdent::Point(tp) => Some(tp.to_string()),
+            _ => None,
+        })
+        .collect::<Vec<String>>()
+        .join(", ");
+    format!("({scalars_str}),\n({points_str}),\n")
+}
+
 /// Look for, and transform, range statements specified in the
 /// [`StatementTree`] into basic statements about linear combinations of
 /// `Point`s.
@@ -204,6 +225,8 @@ pub fn transform(
     // Gather mutable references to all of the leaves of the
     // StatementTree.  Note that this ignores the combiner structure in
     // the StatementTree, but that's fine.
+    print!("{}", taggedvardict_to_string(&vars));
+    st.dump();
     let mut leaves = st.leaves_st_mut();
 
     // A list of the computationally independent (non-vector) Points in
@@ -230,6 +253,7 @@ pub fn transform(
             }
         })
         .collect();
+    println!("Recognized Pedersens: {pedersens:?}");
 
     // Count how many range statements we've seen
     let mut range_stmt_index = 0usize;