Rust fmt and clippy
This commit is contained in:
parent
25216705b3
commit
a5d1efc207
|
@ -123,7 +123,7 @@ impl CloseAccountProof {
|
||||||
// Edge case #2: if D is zeroed, but C is not, then this is an invalid ciphertext
|
// Edge case #2: if D is zeroed, but C is not, then this is an invalid ciphertext
|
||||||
if D.is_identity() {
|
if D.is_identity() {
|
||||||
transcript.append_point(b"R", &R);
|
transcript.append_point(b"R", &R);
|
||||||
return Err(ProofError::VerificationError)
|
return Err(ProofError::VerificationError);
|
||||||
}
|
}
|
||||||
|
|
||||||
// generate a challenge scalar
|
// generate a challenge scalar
|
||||||
|
@ -148,7 +148,7 @@ impl CloseAccountProof {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::encryption::elgamal::ElGamal;
|
use crate::encryption::elgamal::ElGamal;
|
||||||
use crate::encryption::pedersen::{Pedersen, PedersenOpening, PedersenDecryptHandle};
|
use crate::encryption::pedersen::{Pedersen, PedersenDecryptHandle, PedersenOpening};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_close_account_correctness() {
|
fn test_close_account_correctness() {
|
||||||
|
|
|
@ -215,7 +215,7 @@ impl UpdateAccountPkProof {
|
||||||
mod test {
|
mod test {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::encryption::elgamal::ElGamal;
|
use crate::encryption::elgamal::ElGamal;
|
||||||
use crate::encryption::pedersen::{Pedersen, PedersenOpening, PedersenDecryptHandle};
|
use crate::encryption::pedersen::{Pedersen, PedersenDecryptHandle, PedersenOpening};
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_update_account_public_key_general_cases() {
|
fn test_update_account_public_key_general_cases() {
|
||||||
|
@ -284,6 +284,7 @@ mod test {
|
||||||
.is_ok());
|
.is_ok());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
fn test_update_account_public_key_partially_zeroed_ciphertexts() {
|
fn test_update_account_public_key_partially_zeroed_ciphertexts() {
|
||||||
let (current_pk, current_sk) = ElGamal::new();
|
let (current_pk, current_sk) = ElGamal::new();
|
||||||
let (new_pk, new_sk) = ElGamal::new();
|
let (new_pk, new_sk) = ElGamal::new();
|
||||||
|
@ -308,9 +309,7 @@ mod test {
|
||||||
&zeroed_comm_ciphertext,
|
&zeroed_comm_ciphertext,
|
||||||
&new_ct,
|
&new_ct,
|
||||||
);
|
);
|
||||||
assert!(proof
|
assert!(proof.verify(&zeroed_comm_ciphertext, &new_ct).is_err());
|
||||||
.verify(&zeroed_comm_ciphertext, &new_ct)
|
|
||||||
.is_err());
|
|
||||||
|
|
||||||
let zeroed_handle_ciphertext = ElGamalCiphertext {
|
let zeroed_handle_ciphertext = ElGamalCiphertext {
|
||||||
message_comm: balance_ciphertext.message_comm,
|
message_comm: balance_ciphertext.message_comm,
|
||||||
|
@ -324,9 +323,7 @@ mod test {
|
||||||
&zeroed_handle_ciphertext,
|
&zeroed_handle_ciphertext,
|
||||||
&new_ct,
|
&new_ct,
|
||||||
);
|
);
|
||||||
assert!(proof
|
assert!(proof.verify(&zeroed_handle_ciphertext, &new_ct).is_err());
|
||||||
.verify(&zeroed_handle_ciphertext, &new_ct)
|
|
||||||
.is_err());
|
|
||||||
|
|
||||||
// Partially zeroed cipehrtext as new ciphertext
|
// Partially zeroed cipehrtext as new ciphertext
|
||||||
let zeroed_comm_ciphertext = ElGamalCiphertext {
|
let zeroed_comm_ciphertext = ElGamalCiphertext {
|
||||||
|
@ -342,9 +339,7 @@ mod test {
|
||||||
¤t_ct,
|
¤t_ct,
|
||||||
&zeroed_comm_ciphertext,
|
&zeroed_comm_ciphertext,
|
||||||
);
|
);
|
||||||
assert!(proof
|
assert!(proof.verify(¤t_ct, &zeroed_comm_ciphertext).is_err());
|
||||||
.verify(¤t_ct, &zeroed_comm_ciphertext)
|
|
||||||
.is_err());
|
|
||||||
|
|
||||||
let zeroed_handle_ciphertext = ElGamalCiphertext {
|
let zeroed_handle_ciphertext = ElGamalCiphertext {
|
||||||
message_comm: balance_ciphertext.message_comm,
|
message_comm: balance_ciphertext.message_comm,
|
||||||
|
@ -361,6 +356,5 @@ mod test {
|
||||||
assert!(proof
|
assert!(proof
|
||||||
.verify(¤t_ct, &zeroed_handle_ciphertext)
|
.verify(¤t_ct, &zeroed_handle_ciphertext)
|
||||||
.is_err());
|
.is_err());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue