diff --git a/src/simulation/state.rs b/src/simulation/state.rs index e05f88e..ad6aefa 100644 --- a/src/simulation/state.rs +++ b/src/simulation/state.rs @@ -1,4 +1,4 @@ -use lox_cli::{networking::*, *}; +use lox_cli::networking::*; use lox_library::IssuerPubKey; use std::collections::HashMap; use x25519_dalek::PublicKey; diff --git a/src/simulation/user.rs b/src/simulation/user.rs index 92c8574..1447205 100644 --- a/src/simulation/user.rs +++ b/src/simulation/user.rs @@ -6,10 +6,7 @@ use crate::{ }; use lox_cli::{networking::*, *}; use lox_library::{ - bridge_table::{BridgeLine, MAX_BRIDGES_PER_BUCKET}, - cred::{Invitation, Lox}, - proto::check_blockage::MIN_TRUST_LEVEL, - scalar_u32, IssuerPubKey, + bridge_table::BridgeLine, cred::Lox, proto::check_blockage::MIN_TRUST_LEVEL, scalar_u32, }; use rand::Rng; @@ -32,12 +29,13 @@ pub struct User { impl User { pub async fn new(state: &State) -> Self { - let (cred, bl) = get_lox_credential( + let cred = get_lox_credential( &state.net, &get_open_invitation(&state.net).await, get_lox_pub(&state.la_pubkeys), ) - .await; + .await + .0; // Probabilistically decide whether this user cooperates with a censor let mut rng = rand::thread_rng(); @@ -53,7 +51,7 @@ impl User { let cc = { let mut cc = String::default(); for (country, prob) in &state.probs_user_in_country { - let mut prob = *prob; + let prob = *prob; if prob < num { cc = country.to_string(); break; @@ -86,13 +84,14 @@ impl User { ) .await; self.primary_cred = new_cred; - let (friend_cred, bucket) = redeem_invite( + let friend_cred = redeem_invite( &state.net, &invite, get_lox_pub(&state.la_pubkeys), get_invitation_pub(&state.la_pubkeys), ) - .await; + .await + .0; // Probabilistically decide whether this user cooperates with a censor // We do not influence this by the inviting friend's status. Anyone @@ -205,12 +204,13 @@ impl User { std::mem::replace(&mut self.secondary_cred, None) } else { // Get new credential - let (cred, bl) = get_lox_credential( + let cred = get_lox_credential( &state.net, &get_open_invitation(&state.net).await, get_lox_pub(&state.la_pubkeys), ) - .await; + .await + .0; Some(cred) } } else { @@ -320,7 +320,7 @@ impl User { // Invite friends if applicable let invitations = scalar_u32(&self.primary_cred.invites_remaining).unwrap(); let mut new_friends = Vec::::new(); - for i in 0..invitations { + for _i in 0..invitations { let mut rng = rand::thread_rng(); let num: f64 = rng.gen_range(0.0..1.0); if num < state.prob_user_invites_friend {