Compare commits

...

7 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
Jon Häggblad d79c25861b Merge pull request #1740 from nymtech/develop-with-release-1.1.0-merged-in
Merge release/v1.1.0 into develop
2022-11-09 11:02:12 +01:00
Jon Häggblad b89ec2e0be clippy 2022-11-09 10:43:53 +01:00
Jon Häggblad 269f50bdd4 rustfmt 2022-11-09 10:25:39 +01:00
durch e3c02dc80a Actually save updated pledge cap 2022-11-09 10:22:14 +01:00
Drazen Urch 65a9320d35 Set default pledge cap to 10% (#1739)
* Set default pledge cap to 10%

* fix clippy beta lints
2022-11-09 10:22:08 +01:00
5 changed files with 19 additions and 7 deletions
@@ -85,7 +85,8 @@ impl FromStr for PledgeCap {
impl Default for PledgeCap {
fn default() -> Self {
PledgeCap::Absolute(Uint128::from(100_000_000_000u128))
#[allow(clippy::expect_used)]
PledgeCap::Percent(Percent::from_percentage_value(10).expect("This can never fail!"))
}
}
+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
+3 -3
View File
@@ -1,8 +1,8 @@
use crate::errors::ContractError;
use crate::queued_migrations::migrate_to_v2_mixnet_contract;
use crate::storage::{
account_from_address, BlockTimestampSecs, ADMIN, DELEGATIONS, MIXNET_CONTRACT_ADDRESS,
MIX_DENOM,
account_from_address, save_account, BlockTimestampSecs, ADMIN, DELEGATIONS,
MIXNET_CONTRACT_ADDRESS, MIX_DENOM,
};
use crate::traits::{
DelegatingAccount, GatewayBondingAccount, MixnodeBondingAccount, VestingAccount,
@@ -158,7 +158,7 @@ pub fn try_update_locked_pledge_cap(
let mut account = account_from_address(&address, deps.storage, deps.api)?;
account.pledge_cap = Some(cap);
// update_locked_pledge_cap(amount, deps.storage)?;
save_account(&account, deps.storage)?;
Ok(Response::default())
}
@@ -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,