Skip to content

Commit

Permalink
feat: fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
sebasti810 committed Jul 16, 2024
1 parent c054143 commit a594299
Showing 1 changed file with 4 additions and 29 deletions.
33 changes: 4 additions & 29 deletions src/zk_snark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,6 @@ pub fn hex_to_scalar(hex_string: &str) -> Result<Scalar, GeneralError> {
let mut wide = [0u8; 64];
wide[..32].copy_from_slice(&bytes);
let scalar = Scalar::from_bytes_wide(&wide);

println!(
"Hex: {}, Wide: {:?}, Scalar: {:?}",
hex_string, wide, scalar
);

Ok(scalar)
}

Expand Down Expand Up @@ -444,34 +438,21 @@ fn proof_of_non_membership<CS: ConstraintSystem<Scalar>>(
cs: &mut CS,
non_membership_root: Scalar,
non_membership_path: &[Node],
missing_node: LeafNode,
) -> Result<(), SynthesisError> {
// first we need to make sure, that the label of the missing node lies between the first element of the path
/* leave it out for now, find solution for annyoing modulus
let current_label = hex_to_scalar(&non_membership_path[0].get_label()).unwrap();
let missing_label = hex_to_scalar(&missing_node.label).unwrap();
let curret_next = hex_to_scalar(&non_membership_path[0].get_next()).unwrap();
println!(
"hex: {}, scalar: {}",
&non_membership_path[0].get_label(),
&current_label
);
println!("hex: {}, scalar: {}", &missing_node.label, &missing_label);
println!(
"hex: {}, scalar: {}",
&non_membership_path[0].get_next(),
&curret_next
);
println!();
println!();

// circuit check
LessThanCircuit::new(current_label, missing_label)
.synthesize(cs)
.expect("Failed to synthesize");
LessThanCircuit::new(missing_label, curret_next)
.synthesize(cs)
.expect("Failed to synthesize");
.expect("Failed to synthesize"); */

let allocated_root = cs.alloc(|| "non_membership_root", || Ok(non_membership_root))?;
let recalculated_root = recalculate_hash_as_scalar(non_membership_path);
Expand Down Expand Up @@ -553,12 +534,7 @@ impl Circuit<Scalar> for ProofVariantCircuit {
impl Circuit<Scalar> for InsertMerkleProofCircuit {
fn synthesize<CS: ConstraintSystem<Scalar>>(self, cs: &mut CS) -> Result<(), SynthesisError> {
// Proof of Non-Membership
match proof_of_non_membership(
cs,
self.non_membership_root,
&self.non_membership_path,
self.missing_node,
) {
match proof_of_non_membership(cs, self.non_membership_root, &self.non_membership_path) {
Ok(_) => (),
Err(_) => return Err(SynthesisError::AssignmentMissing),
}
Expand Down Expand Up @@ -658,7 +634,6 @@ impl Circuit<Scalar> for BatchMerkleProofCircuit {
cs,
insert_proof_circuit.non_membership_root,
&insert_proof_circuit.non_membership_path,
insert_proof_circuit.missing_node,
) {
Ok(_) => (),
Err(_) => return Err(SynthesisError::AssignmentMissing),
Expand Down

0 comments on commit a594299

Please sign in to comment.