Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion clients/native/src/websocket/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ impl Handler {

async fn handle_text_message(&mut self, msg: String) -> Option<WsMessage> {
debug!("Handling text message request");
trace!("Content: {:?}", msg);
trace!("Content: {msg:?}");

self.received_response_type = ReceivedResponseType::Text;
let client_request = ClientRequest::try_from_text(msg);
Expand Down
4 changes: 2 additions & 2 deletions clients/native/src/websocket/listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ impl Listener {
new_conn = tcp_listener.accept() => {
match new_conn {
Ok((mut socket, remote_addr)) => {
debug!("Received connection from {:?}", remote_addr);
debug!("Received connection from {remote_addr:?}");
if self.state.is_connected() {
warn!("Tried to open a duplicate websocket connection. The request came from {}", remote_addr);
warn!("Tried to open a duplicate websocket connection. The request came from {remote_addr}");
// if we've already got a connection, don't allow another one
// while we only ever want to accept a single connection, we don't want
// to leave clients hanging (and also allow for reconnection if it somehow
Expand Down
2 changes: 1 addition & 1 deletion common/async-file-watcher/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ impl AsyncFileWatcher {
log::error!("the file watcher receiver has been dropped!");
}
} else {
log::debug!("will not propagate information about {:?}", event);
log::debug!("will not propagate information about {event:?}");
}
}
Err(err) => {
Expand Down
2 changes: 1 addition & 1 deletion common/bandwidth-controller/src/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ impl std::fmt::Display for BandwidthStatusMessage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
BandwidthStatusMessage::RemainingBandwidth(b) => {
write!(f, "remaining bandwidth: {}", b)
write!(f, "remaining bandwidth: {b}")
}
BandwidthStatusMessage::NoBandwidth => write!(f, "no bandwidth left"),
}
Expand Down
2 changes: 1 addition & 1 deletion common/client-core/src/client/mix_traffic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl MixTrafficController {
Some(client_request) => {
match self.gateway_transceiver.send_client_request(client_request).await {
Ok(_) => (),
Err(e) => error!("Failed to send client request: {}", e),
Err(e) => error!("Failed to send client request: {e}"),
};
},
None => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl AcknowledgementListener {
return;
}

trace!("Received {} from the mix network", frag_id);
trace!("Received {frag_id} from the mix network");
self.stats_tx
.report(PacketStatisticsEvent::RealAckReceived(ack_content.len()).into());
if let Err(err) = self
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ impl ActionController {
fn handle_insert(&mut self, pending_acks: Vec<PendingAcknowledgement>) {
for pending_ack in pending_acks {
let frag_id = pending_ack.message_chunk.fragment_identifier();
trace!("{} is inserted", frag_id);
trace!("{frag_id} is inserted");

if self
.pending_acks_data
Expand Down Expand Up @@ -161,22 +161,16 @@ impl ActionController {
let new_queue_key = self.pending_acks_timers.insert(frag_id, timeout);
*queue_key = Some(new_queue_key)
} else {
debug!(
"Tried to START TIMER on pending ack that is already gone! - {}",
frag_id
);
debug!("Tried to START TIMER on pending ack that is already gone! - {frag_id}");
}
}

fn handle_remove(&mut self, frag_id: FragmentIdentifier) {
trace!("{} is getting removed", frag_id);
trace!("{frag_id} is getting removed");

match self.pending_acks_data.remove(&frag_id) {
None => {
debug!(
"Tried to REMOVE pending ack that is already gone! - {}",
frag_id
);
debug!("Tried to REMOVE pending ack that is already gone! - {frag_id}");
}
Some((_, queue_key)) => {
if let Some(queue_key) = queue_key {
Expand All @@ -188,10 +182,7 @@ impl ActionController {
} else {
// I'm not 100% sure if having a `None` key is even possible here
// (REMOVE would have to be called before START TIMER),
debug!(
"Tried to REMOVE pending ack without TIMER active - {}",
frag_id
);
debug!("Tried to REMOVE pending ack without TIMER active - {frag_id}");
}
}
}
Expand All @@ -200,7 +191,7 @@ impl ActionController {
// initiated basically as a first step of retransmission. At first data has its delay updated
// (as new sphinx packet was created with new expected delivery time)
fn handle_update_pending_ack(&mut self, frag_id: FragmentIdentifier, delay: SphinxDelay) {
trace!("{} is updating its delay", frag_id);
trace!("{frag_id} is updating its delay");
// TODO: is it possible to solve this without either locking or temporarily removing the value?
if let Some((pending_ack_data, queue_key)) = self.pending_acks_data.remove(&frag_id) {
// this Action is triggered by `RetransmissionRequestListener` (for 'normal' packets)
Expand All @@ -213,10 +204,7 @@ impl ActionController {
self.pending_acks_data
.insert(frag_id, (Arc::new(inner_data), queue_key));
} else {
debug!(
"Tried to UPDATE TIMER on pending ack that is already gone! - {}",
frag_id
);
debug!("Tried to UPDATE TIMER on pending ack that is already gone! - {frag_id}");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ where
// well technically the message was not sent just yet, but now it's up to internal
// queues and client load rather than the required delay. So realistically we can treat
// whatever is about to happen as negligible additional delay.
trace!("{} is about to get sent to the mixnet", frag_id);
trace!("{frag_id} is about to get sent to the mixnet");
if let Err(err) = self.sent_notifier.unbounded_send(frag_id) {
error!("Failed to notify about sent message: {err}");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,11 +164,11 @@ impl SendingDelayController {
self.current_multiplier()
);
if self.current_multiplier() > 0 {
log::debug!("{}", status_str);
log::debug!("{status_str}");
} else if self.current_multiplier() > 1 {
log::info!("{}", status_str);
log::info!("{status_str}");
} else if self.current_multiplier() > 2 {
log::warn!("{}", status_str);
log::warn!("{status_str}");
}
self.time_when_logged_about_elevated_multiplier = now;
}
Expand Down
5 changes: 1 addition & 4 deletions common/client-core/src/client/received_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,7 @@ impl<R: MessageReceiver> ReceivedMessagesBuffer<R> {
let stored_messages = std::mem::take(&mut guard.messages);
if !stored_messages.is_empty() {
if let Err(err) = sender.unbounded_send(stored_messages) {
error!(
"The sender channel we just received is already invalidated - {:?}",
err
);
error!("The sender channel we just received is already invalidated - {err:?}");
// put the values back to the buffer
// the returned error has two fields: err: SendError and val: T,
// where val is the value that was failed to get sent;
Expand Down
20 changes: 7 additions & 13 deletions common/client-core/src/client/replies/reply_controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,14 @@ where
.surbs_storage_ref()
.contains_surbs_for(&recipient_tag)
{
warn!("received reply request for {:?} but we don't have any surbs stored for that recipient!", recipient_tag);
warn!("received reply request for {recipient_tag:?} but we don't have any surbs stored for that recipient!");
return;
}

trace!("handling reply to {:?}", recipient_tag);
trace!("handling reply to {recipient_tag:?}");
let mut fragments = self.message_handler.split_reply_message(data);
let total_size = fragments.len();
trace!("This reply requires {:?} SURBs", total_size);
trace!("This reply requires {total_size:?} SURBs");

let available_surbs = self
.full_reply_storage
Expand Down Expand Up @@ -327,10 +327,7 @@ where
.await
{
let err = err.return_unused_surbs(self.full_reply_storage.surbs_storage_ref(), &target);
warn!(
"failed to request additional surbs from {:?} - {err}",
target
);
warn!("failed to request additional surbs from {target:?} - {err}");
return Err(err);
} else {
self.full_reply_storage
Expand Down Expand Up @@ -409,10 +406,7 @@ where
err.return_unused_surbs(self.full_reply_storage.surbs_storage_ref(), &target);
self.re_insert_pending_retransmission(&target, to_take);

warn!(
"failed to clear pending retransmission queue for {:?} - {err}",
target
);
warn!("failed to clear pending retransmission queue for {target:?} - {err}");
return;
}
};
Expand Down Expand Up @@ -489,7 +483,7 @@ where
let err =
err.return_unused_surbs(self.full_reply_storage.surbs_storage_ref(), &target);
self.re_insert_pending_replies(&target, to_send);
warn!("failed to clear pending queue for {:?} - {err}", target);
warn!("failed to clear pending queue for {target:?} - {err}");
}
} else {
trace!("the pending queue is empty");
Expand Down Expand Up @@ -816,7 +810,7 @@ where
if diff > max_drop_wait {
to_remove.push(*pending_reply_target)
} else {
debug!("We haven't received any surbs in {:?} from {pending_reply_target}. Going to explicitly ask for more", diff);
debug!("We haven't received any surbs in {diff:?} from {pending_reply_target}. Going to explicitly ask for more");
to_request.push(*pending_reply_target);
}
}
Expand Down
2 changes: 1 addition & 1 deletion common/client-core/src/client/statistics_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl StatisticsControl {
None,
);
if let Err(err) = self.report_tx.send(report_message).await {
log::error!("Failed to report client stats: {:?}", err);
log::error!("Failed to report client stats: {err:?}");
} else {
self.stats.reset();
}
Expand Down
2 changes: 1 addition & 1 deletion common/client-core/src/client/transmission_buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ impl<T> TransmissionBuffer<T> {
};

let msg = self.pop_front_from_lane(&lane)?;
log::trace!("picking to send from lane: {:?}", lane);
log::trace!("picking to send from lane: {lane:?}");
Some((lane, msg))
}

Expand Down
6 changes: 3 additions & 3 deletions common/client-core/src/init/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub async fn gateways_for_init<R: Rng>(
let gateways = client.get_all_basic_entry_assigned_nodes_v2().await?.nodes;
info!("nym api reports {} gateways", gateways.len());

log::trace!("Gateways: {:#?}", gateways);
log::trace!("Gateways: {gateways:#?}");

// filter out gateways below minimum performance and ones that could operate as a mixnode
// (we don't want instability)
Expand All @@ -121,7 +121,7 @@ pub async fn gateways_for_init<R: Rng>(
.filter_map(|gateway| gateway.try_into().ok())
.collect::<Vec<_>>();
log::debug!("After checking validity: {}", valid_gateways.len());
log::trace!("Valid gateways: {:#?}", valid_gateways);
log::trace!("Valid gateways: {valid_gateways:#?}");

log::info!(
"and {} after validity and performance filtering",
Expand Down Expand Up @@ -286,7 +286,7 @@ pub(super) fn get_specified_gateway(
gateways: &[RoutingNode],
must_use_tls: bool,
) -> Result<RoutingNode, ClientCoreError> {
log::debug!("Requesting specified gateway: {}", gateway_identity);
log::debug!("Requesting specified gateway: {gateway_identity}");
let user_gateway = ed25519::PublicKey::from_base58_string(gateway_identity)
.map_err(ClientCoreError::UnableToCreatePublicKeyFromGatewayId)?;

Expand Down
4 changes: 2 additions & 2 deletions common/commands/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@ pub fn show_error<E>(e: E)
where
E: Display,
{
error!("{}", e);
error!("{e}");
}

pub fn show_error_passthrough<E>(e: E) -> E
where
E: Error + Display,
{
error!("{}", e);
error!("{e}");
e
}

Expand Down
2 changes: 1 addition & 1 deletion common/commands/src/validator/account/balance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub async fn query_balance(
.address
.unwrap_or_else(|| address_from_mnemonic.expect("please provide a mnemonic"));

info!("Getting balance for {}...", address);
info!("Getting balance for {address}...");

match client.get_all_balances(&address).await {
Ok(coins) => {
Expand Down
6 changes: 3 additions & 3 deletions common/commands/src/validator/account/pubkey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ pub fn get_pubkey_from_mnemonic(address: AccountId, prefix: &str, mnemonic: bip3
println!("{}", account.public_key().to_string());
}
None => {
error!("Could not derive key that matches {}", address)
error!("Could not derive key that matches {address}")
}
},
Err(e) => {
error!("Failed to derive accounts. {}", e);
error!("Failed to derive accounts. {e}");
}
}
}

pub async fn get_pubkey_from_chain(address: AccountId, client: &QueryClient) {
info!("Getting public key for address {} from chain...", address);
info!("Getting public key for address {address} from chain...");
match client.get_account(&address).await {
Ok(Some(account)) => {
if let Ok(base_account) = account.try_get_base_account() {
Expand Down
15 changes: 6 additions & 9 deletions common/commands/src/validator/account/send_multiple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub async fn send_multiple(args: Args, client: &SigningClient) {

let rows = InputFileReader::new(&args.input);
if let Err(e) = rows {
error!("Failed to read input file: {}", e);
error!("Failed to read input file: {e}");
return;
}
let rows = rows.unwrap();
Expand Down Expand Up @@ -67,7 +67,7 @@ pub async fn send_multiple(args: Args, client: &SigningClient) {
.prompt();

if let Err(e) = ans {
info!("Aborting, {}...", e);
info!("Aborting, {e}...");
return;
}
if let Ok(false) = ans {
Expand Down Expand Up @@ -100,13 +100,10 @@ pub async fn send_multiple(args: Args, client: &SigningClient) {
println!("Transaction hash: {}", &res.hash);

if let Some(output_filename) = args.output {
println!("\nWriting output log to {}", output_filename);
println!("\nWriting output log to {output_filename}");

if let Err(e) = write_output_file(rows, res, &output_filename) {
error!(
"Failed to write output file {} with error {}",
output_filename, e
);
error!("Failed to write output file {output_filename} with error {e}");
}
}
}
Expand Down Expand Up @@ -136,7 +133,7 @@ fn write_output_file(
.collect::<Vec<String>>()
.join("\n");

Ok(file.write_all(format!("{}\n", data).as_bytes())?)
Ok(file.write_all(format!("{data}\n").as_bytes())?)
}

#[derive(Debug)]
Expand Down Expand Up @@ -171,7 +168,7 @@ impl InputFileReader {

// multiply when a whole token amount, e.g. 50nym (50.123456nym is not allowed, that must be input as 50123456unym)
let (amount, denom) = if !denom.starts_with('u') {
(amount * 1_000_000u128, format!("u{}", denom))
(amount * 1_000_000u128, format!("u{denom}"))
} else {
(amount, denom)
};
Expand Down
2 changes: 1 addition & 1 deletion common/commands/src/validator/cosmwasm/execute_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@ pub async fn execute(args: Args, client: SigningClient) {
.await
{
Ok(res) => info!("SUCCESS ✅\n{}", json!(res)),
Err(e) => error!("FAILURE ❌\n{}", e),
Err(e) => error!("FAILURE ❌\n{e}"),
}
}
Loading
Loading