Skip to content

Commit

Permalink
Exit logs cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jkilpatr committed Nov 23, 2023
1 parent 6be1877 commit 2b89d43
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 20 deletions.
2 changes: 1 addition & 1 deletion integration_tests/src/contract_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub async fn validate_contract_user_functionality(db_addr: Address) {
// Try requests when there are no users present
let res = get_all_regsitered_clients(&contact, miner_pub_key, db_addr).await;

assert!(res.is_err());
assert_eq!(res.unwrap(), vec![]);

let res =
get_registered_client_using_wgkey(user_1.wg_public_key, miner_pub_key, db_addr, &contact)
Expand Down
5 changes: 5 additions & 0 deletions rita_client_registration/src/client_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,11 @@ pub fn parse_identity_array_abi(bytes: Vec<u8>) -> Result<Vec<Identity>, Web3Err
let mut ret = vec![];
let byte_chunks: Vec<&[u8]> = bytes.chunks(WORD_SIZE).collect();

// An empty list, the first word has a type identifier, the second is empty
if byte_chunks.len() == 2 {
return Ok(vec![])
}

// A valid array with 1 entry has 5 lines. An empty list has 2 lines
if byte_chunks.len() < 5 {
return Err(Web3Error::BadInput(format!(
Expand Down
2 changes: 1 addition & 1 deletion rita_exit/src/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ pub async fn client_status(
})
}
Err(e) => {
error!("Failed to retrieve a client: {}", e);
trace!("Failed to retrieve a client: {}", e);
Err(Box::new(RitaExitError::NoClientError))
}
}
Expand Down
18 changes: 2 additions & 16 deletions rita_exit/src/network_endpoints/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,7 @@ pub async fn secure_setup_request(
let exit_settings = get_rita_exit();

let our_old_secretkey: WgKey = exit_settings.exit_network.wg_private_key;
let our_new_secretkey = exit_settings
.network
.wg_private_key
.unwrap_or(our_old_secretkey);

if our_old_secretkey == our_new_secretkey {
error!("Two Distinct wg key are not setup on this exit, please setup!!");
}
let our_new_secretkey = exit_settings.network.wg_private_key.unwrap();

let our_old_secretkey: SecretKey = our_old_secretkey.into();
let our_new_secretkey = our_new_secretkey.into();
Expand Down Expand Up @@ -224,14 +217,7 @@ pub async fn secure_setup_request(
pub async fn secure_status_request(request: Json<EncryptedExitClientIdentity>) -> HttpResponse {
let exit_settings = get_rita_exit();
let our_old_secretkey: WgKey = exit_settings.exit_network.wg_private_key;
let our_new_secretkey = exit_settings
.network
.wg_private_key
.unwrap_or(our_old_secretkey);

if our_old_secretkey == our_new_secretkey {
error!("Two Distinct wg key are not setup on this exit, please setup!!");
}
let our_new_secretkey = exit_settings.network.wg_private_key.unwrap();

let our_old_secretkey = our_old_secretkey.into();
let our_new_secretkey = our_new_secretkey.into();
Expand Down
7 changes: 5 additions & 2 deletions rita_exit/src/operator_update/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub const OPERATOR_UPDATE_TIMEOUT: Duration = Duration::from_secs(4);
pub async fn operator_update(rita_started: Instant) {
let url: &str;
if cfg!(feature = "dev_env") {
url = "http://7.7.7.7:8080/exitcheckin";
url = "http://7.7.7.1:8080/exitcheckin";
} else if cfg!(feature = "operator_debug") {
url = "http://192.168.10.2:8080/exitcheckin";
} else {
Expand All @@ -53,7 +53,10 @@ pub async fn operator_update(rita_started: Instant) {
})
.await;
match response {
Ok(v) => info!("Exit operator update succeeded with {:?}", v),
Ok(v) => match v.status().is_success() {
true => info!("Exit operator update succeeded"),
false => error!("Exit operator update failed with {:?}", v),
},
Err(e) => error!("Exit operator update failed with {:?}", e),
}
}
Expand Down

0 comments on commit 2b89d43

Please sign in to comment.