mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-09 04:39:24 +00:00
Remove Monero as a dependency
Introduces missing CLSAG checks. The only difference now should be the additional rejection of torsioned points, which is relevant to https://github.com/serai-dex/serai/issues/25. Considering this is only currently used for FROST verification, this should be fine. Closes https://github.com/serai-dex/serai/issues/19 by making it irrelevant. Increases priority of https://github.com/serai-dex/serai/issues/68, as now it's used for the BP generators which are done at first-proof. Also merges BP's stricter hash_to_point with the library's, since CLSAG has the same bound.
This commit is contained in:
@@ -1,21 +0,0 @@
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
use crate::{Commitment, random_scalar, ringct::bulletproofs::Bulletproofs};
|
||||
|
||||
#[test]
|
||||
fn bulletproofs() {
|
||||
// Create Bulletproofs for all possible output quantities
|
||||
for i in 1 .. 17 {
|
||||
let commitments =
|
||||
(1 ..= i).map(|i| Commitment::new(random_scalar(&mut OsRng), i)).collect::<Vec<_>>();
|
||||
|
||||
assert!(Bulletproofs::new(&mut OsRng, &commitments)
|
||||
.unwrap()
|
||||
.verify(&mut OsRng, &commitments.iter().map(Commitment::calculate).collect::<Vec<_>>()));
|
||||
}
|
||||
|
||||
// Check it errors if we try to create too many
|
||||
assert!(
|
||||
Bulletproofs::new(&mut OsRng, &[Commitment::new(random_scalar(&mut OsRng), 1); 17]).is_err()
|
||||
);
|
||||
}
|
||||
@@ -74,8 +74,6 @@ fn clsag() {
|
||||
)
|
||||
.swap_remove(0);
|
||||
clsag.verify(&ring, &image, &pseudo_out, &msg).unwrap();
|
||||
#[cfg(feature = "experimental")]
|
||||
clsag.rust_verify(&ring, &image, &pseudo_out, &msg).unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
use rand::rngs::OsRng;
|
||||
|
||||
use curve25519_dalek::constants::ED25519_BASEPOINT_TABLE;
|
||||
|
||||
use crate::{
|
||||
random_scalar,
|
||||
ringct::hash_to_point::{hash_to_point as c_hash_to_point, rust_hash_to_point},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn hash_to_point() {
|
||||
for _ in 0 .. 50 {
|
||||
let point = &random_scalar(&mut OsRng) * &ED25519_BASEPOINT_TABLE;
|
||||
assert_eq!(rust_hash_to_point(point.compress().to_bytes()), c_hash_to_point(point));
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,2 @@
|
||||
mod hash_to_point;
|
||||
mod clsag;
|
||||
mod bulletproofs;
|
||||
mod address;
|
||||
|
||||
Reference in New Issue
Block a user