Skip to content

Commit

Permalink
Merge pull request #44 from dusk-network/fix_pi_constraint
Browse files Browse the repository at this point in the history
Fix pi constraints & update lib docs
  • Loading branch information
CPerezz authored Aug 3, 2020
2 parents 930baef + 0f53d97 commit 1552e58
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ edition = "2018"
kelvin = "0.18"
nstack = "0.4"
lazy_static = "1.3.0"
hades252 = { git = "https://github.com/dusk-network/hades252", version = "0.6.0" }
dusk-plonk = {version = "0.2.0", features = ["trace-print"]}
hades252 = { git = "https://github.com/dusk-network/hades252", version = "0.6.1" }
dusk-plonk = "0.2.6"

[dev-dependencies]
rand = "0.7"
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,9 @@
//! let mut verifier = Verifier::new(b"merkle_opening_tester");
//! gadget_tester(verifier.mut_cs());
//! verifier.preprocess(&ck).expect("Error on preprocessing");
//! let pi = verifier.mut_cs().public_inputs.clone();
//! assert!(verifier
//! .verify(&proof, &vk, &vec![BlsScalar::zero()])
//! .verify(&proof, &vk, &pi)
//! .is_ok());
//! }
//! ```
Expand Down
11 changes: 3 additions & 8 deletions src/merkle_proof/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,7 @@ pub fn merkle_opening_gadget(
// Add the last check regarding the last lvl-hash agains the tree root
// which will be a Public Input. On this case, it is not possible to make any kind
// of cheating on the Prover side by modifying the underlying `PoseidonBranch` data.
let root_var_announced = composer.add_input(proven_root);
composer.constrain_to_constant(
root_var_announced,
proven_root,
BlsScalar::zero(),
);
composer.assert_equal(root_var_announced, prev_lvl_hash);
composer.constrain_to_constant(prev_lvl_hash, BlsScalar::zero(), -proven_root);

assert_eq!(branch.root, proven_root);
}
Expand Down Expand Up @@ -244,8 +238,9 @@ mod tests {
let mut verifier = Verifier::new(b"merkle_opening_tester");
gadget_tester(verifier.mut_cs());
verifier.preprocess(&ck).expect("Error on preprocessing");
let pi = verifier.mut_cs().public_inputs.clone();
assert!(verifier
.verify(&proof, &vk, &vec![BlsScalar::zero()])
.verify(&proof, &vk, &pi)
.is_ok());
}

Expand Down
3 changes: 0 additions & 3 deletions src/sponge/sponge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,6 @@ mod tests {
BlsScalar::zero(),
BlsScalar::zero(),
);

composer.add_dummy_constraints();
composer.check_circuit_satisfied();
}

#[test]
Expand Down

0 comments on commit 1552e58

Please sign in to comment.