Compare commits

...

2 Commits

Author SHA1 Message Date
Bogdan-Ștefan Neacșu 3a0fbb4b77 Validator used logs 2022-11-14 14:14:06 +02:00
Bogdan-Ștefan Neacșu 0c67e6cca9 Some logging on cred verification 2022-11-14 13:42:52 +02:00
3 changed files with 14 additions and 3 deletions
+2
View File
@@ -43,6 +43,7 @@ use crate::error::Error;
pub async fn obtain_aggregate_verification_key(
validators: &[Url],
) -> Result<VerificationKey, Error> {
println!("Aggregating from {:?}", validators);
if validators.is_empty() {
return Err(Error::NoValidatorsAvailable);
}
@@ -54,6 +55,7 @@ pub async fn obtain_aggregate_verification_key(
for (id, validator_url) in validators.iter().enumerate() {
client.change_validator_api(validator_url.clone());
let response = client.get_coconut_verification_key().await?;
println!("Validator {} with id {}", validator_url, id + 1);
indices.push((id + 1) as u64);
shares.push(response.key);
}
+10 -2
View File
@@ -221,10 +221,12 @@ pub fn verify_credential(
if public_attributes.len() + theta.pi_v.private_attributes_len()
> verification_key.beta_g2.len()
{
println!("Length check");
return false;
}
if !theta.verify_proof(params, verification_key) {
println!("Proof check");
return false;
}
@@ -245,12 +247,18 @@ pub fn verify_credential(
theta.blinded_message + signed_public_attributes
};
check_bilinear_pairing(
let ret = check_bilinear_pairing(
&theta.credential.0.to_affine(),
&G2Prepared::from(kappa.to_affine()),
&(theta.credential.1).to_affine(),
params.prepared_miller_g2(),
) && !bool::from(theta.credential.0.is_identity())
);
if !ret {
println!("Bilinear check");
} else {
println!("Identity check");
}
ret && !bool::from(theta.credential.0.is_identity())
}
// Used in tests only
@@ -5,7 +5,7 @@ use std::time::{Duration, SystemTime};
use log::*;
use coconut_interface::{Credential, VerificationKey};
use coconut_interface::{Base58, Credential, VerificationKey};
use validator_client::{
nymd::{
cosmwasm_client::logs::find_attribute,
@@ -40,6 +40,7 @@ impl CoconutVerifier {
needed: 1,
});
}
println!("Using VK {}", aggregated_verification_key.to_bs58());
Ok(CoconutVerifier {
api_clients,
nymd_client,