Skip to content

Commit d147f9c

Browse files
committed
chore: fix clippy
1 parent 7b0e614 commit d147f9c

File tree

9 files changed

+85
-96
lines changed

9 files changed

+85
-96
lines changed

omni-relayer/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ async fn main() -> Result<()> {
180180
result = futures::future::select_all(handles) => {
181181
let (res, _, _) = result;
182182
if let Ok(Err(err)) = res {
183-
error!("A worker encountered an error: {:?}", err);
183+
error!("A worker encountered an error: {err:?}");
184184
}
185185
}
186186
}

omni-relayer/src/startup/bridge_indexer.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::{config, utils, workers};
1717

1818
const OMNI_EVENTS: &str = "omni_events";
1919

20-
fn get_expected_finalization_time(config: &config::Config, chain_kind: ChainKind) -> Result<i64> {
20+
fn get_expected_finalization_time(config: config::Config, chain_kind: ChainKind) -> Result<i64> {
2121
let Some(expected_finalization_time) = (match chain_kind {
2222
ChainKind::Eth => config.eth.map(|eth| eth.expected_finalization_time),
2323
ChainKind::Base => config.base.map(|base| base.expected_finalization_time),
@@ -134,7 +134,7 @@ async fn handle_transaction_event(
134134
};
135135

136136
let expected_finalization_time =
137-
get_expected_finalization_time(&config, chain_kind).unwrap();
137+
get_expected_finalization_time(config, chain_kind).unwrap();
138138

139139
utils::redis::add_event(
140140
&mut redis_connection,
@@ -180,7 +180,7 @@ async fn handle_transaction_event(
180180
};
181181

182182
let expected_finalization_time =
183-
get_expected_finalization_time(&config, chain_kind).unwrap();
183+
get_expected_finalization_time(config, chain_kind).unwrap();
184184

185185
utils::redis::add_event(
186186
&mut redis_connection,
@@ -276,7 +276,7 @@ async fn handle_meta_event(
276276
) -> Result<()> {
277277
match event.details {
278278
OmniMetaEventDetails::EVMDeployToken(deploy_token_event) => {
279-
info!("Received EVMDeployToken: {:?}", deploy_token_event);
279+
info!("Received EVMDeployToken: {deploy_token_event:?}");
280280

281281
let OmniTransactionOrigin::EVMLog {
282282
block_number,
@@ -306,7 +306,7 @@ async fn handle_meta_event(
306306
};
307307

308308
let expected_finalization_time =
309-
get_expected_finalization_time(&config, chain_kind).unwrap();
309+
get_expected_finalization_time(config, chain_kind).unwrap();
310310

311311
utils::redis::add_event(
312312
&mut redis_connection,
@@ -326,7 +326,7 @@ async fn handle_meta_event(
326326
OmniMetaEventDetails::SolanaDeployToken {
327327
emitter, sequence, ..
328328
} => {
329-
info!("Received EVMDeployToken: {}", sequence);
329+
info!("Received EVMDeployToken: {sequence}");
330330
utils::redis::add_event(
331331
&mut redis_connection,
332332
utils::redis::EVENTS,
@@ -380,7 +380,7 @@ async fn watch_omni_events_collection(
380380
)
381381
.await
382382
{
383-
warn!("Failed to handle transaction event: {}", err);
383+
warn!("Failed to handle transaction event: {err:?}");
384384
}
385385
}
386386
});
@@ -400,15 +400,15 @@ async fn watch_omni_events_collection(
400400
)
401401
.await
402402
{
403-
warn!("Failed to handle meta event: {}", err);
403+
warn!("Failed to handle meta event: {err:?}");
404404
}
405405
}
406406
});
407407
}
408408
}
409409
}
410410
}
411-
Err(e) => warn!("Error watching changes: {}", e),
411+
Err(err) => warn!("Error watching changes: {err:?}"),
412412
}
413413

414414
if let Some(ref resume_token) = stream
@@ -444,10 +444,7 @@ pub async fn start_indexer(config: config::Config, redis_client: redis::Client)
444444
let omni_events_collection = db.collection::<OmniEvent>(OMNI_EVENTS);
445445

446446
loop {
447-
info!(
448-
"Starting a mongodb stream that track changes in {}",
449-
OMNI_EVENTS
450-
);
447+
info!("Starting a mongodb stream that track changes in {OMNI_EVENTS}");
451448

452449
watch_omni_events_collection(&omni_events_collection, redis_connection.clone(), &config)
453450
.await;

omni-relayer/src/startup/evm.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,11 @@ pub async fn start_indexer(
9292
)
9393
.await
9494
.map_err(|err| hide_api_key(&err)),
95-
format!(
96-
"Failed to process recent blocks for {:?} indexer",
97-
chain_kind
98-
),
95+
format!("Failed to process recent blocks for {chain_kind:?} indexer"),
9996
5
10097
);
10198

102-
info!(
103-
"All historical logs processed, starting {:?} WS subscription",
104-
chain_kind
105-
);
99+
info!("All historical logs processed, starting {chain_kind:?} WS subscription");
106100

107101
let ws_provider = crate::skip_fail!(
108102
ProviderBuilder::new()
@@ -123,7 +117,7 @@ pub async fn start_indexer(
123117
)
124118
.into_stream();
125119

126-
info!("Subscribed to {:?} logs", chain_kind);
120+
info!("Subscribed to {chain_kind:?} logs");
127121

128122
while let Some(log) = stream.next().await {
129123
process_log(
@@ -213,14 +207,14 @@ async fn process_log(
213207
expected_finalization_time: i64,
214208
) {
215209
let Some(tx_hash) = log.transaction_hash else {
216-
warn!("No transaction hash in log: {:?}", log);
210+
warn!("No transaction hash in log: {log:?}");
217211
return;
218212
};
219213

220214
let tx_hash = H256::from_slice(tx_hash.as_slice());
221215

222216
let Some(block_number) = log.block_number else {
223-
warn!("No block number in log: {:?}", log);
217+
warn!("No block number in log: {log:?}");
224218
return;
225219
};
226220

@@ -237,7 +231,7 @@ async fn process_log(
237231
let topic = log.topic0();
238232

239233
if let Ok(init_log) = log.log_decode::<utils::evm::InitTransfer>() {
240-
info!("Received InitTransfer on {:?} ({:?})", chain_kind, tx_hash);
234+
info!("Received InitTransfer on {chain_kind:?} ({tx_hash:?})");
241235

242236
let log = utils::evm::InitTransfer {
243237
sender: init_log.inner.sender,
@@ -266,15 +260,15 @@ async fn process_log(
266260
)
267261
.await;
268262
} else if let Ok(fin_log) = log.log_decode::<utils::evm::FinTransfer>() {
269-
info!("Received FinTransfer on {:?} ({:?})", chain_kind, tx_hash);
263+
info!("Received FinTransfer on {chain_kind:?} ({tx_hash:?})");
270264

271265
let Some(&topic) = topic else {
272-
warn!("Topic is empty for log: {:?}", log);
266+
warn!("Topic is empty for log: {log:?}");
273267
return;
274268
};
275269

276270
let Ok(origin_chain) = ChainKind::try_from(fin_log.inner.originChain) else {
277-
warn!("Failed to parse origin chain from log: {:?}", log);
271+
warn!("Failed to parse origin chain from log: {log:?}");
278272
return;
279273
};
280274

@@ -295,10 +289,10 @@ async fn process_log(
295289
)
296290
.await;
297291
} else if log.log_decode::<utils::evm::DeployToken>().is_ok() {
298-
info!("Received DeployToken on {:?} ({:?})", chain_kind, tx_hash);
292+
info!("Received DeployToken on {chain_kind:?} ({tx_hash:?})");
299293

300294
let Some(&topic) = topic else {
301-
warn!("Topic is empty for log: {:?}", log);
295+
warn!("Topic is empty for log: {log:?}");
302296
return;
303297
};
304298

@@ -317,7 +311,7 @@ async fn process_log(
317311
)
318312
.await;
319313
} else {
320-
warn!("Received unknown log on {:?}: {:?}", chain_kind, log);
314+
warn!("Received unknown log on {chain_kind:?}: {log:?}");
321315
}
322316

323317
utils::redis::update_last_processed(

omni-relayer/src/startup/near.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ pub fn get_signer(file: Option<&String>) -> Result<InMemorySigner> {
1515
info!("Creating NEAR signer");
1616

1717
if let Some(file) = file {
18-
info!("Using NEAR credentials file: {}", file);
18+
info!("Using NEAR credentials file: {file}");
1919
if let Ok(Signer::InMemory(signer)) = InMemorySigner::from_file(Path::new(file)) {
2020
return Ok(signer);
2121
}
@@ -58,7 +58,7 @@ async fn create_lake_config(
5858
),
5959
};
6060

61-
info!("NEAR Lake will start from block: {}", start_block_height);
61+
info!("NEAR Lake will start from block: {start_block_height}");
6262

6363
let lake_config = LakeConfigBuilder::default().start_block_height(start_block_height);
6464

omni-relayer/src/startup/solana.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ pub async fn start_indexer(
8686

8787
while let Some(log) = log_stream.next().await {
8888
if let Ok(signature) = Signature::from_str(&log.value.signature) {
89-
info!("Found a signature on Solana: {:?}", signature);
89+
info!("Found a signature on Solana: {signature:?}");
9090
utils::redis::add_event(
9191
&mut redis_connection,
9292
utils::redis::SOLANA_EVENTS,
@@ -206,11 +206,11 @@ pub async fn process_signature(config: config::Config, redis_client: redis::Clie
206206

207207
async move {
208208
let Ok(signature) = Signature::from_str(&key) else {
209-
warn!("Failed to parse signature: {:?}", key);
209+
warn!("Failed to parse signature: {key:?}");
210210
return;
211211
};
212212

213-
info!("Trying to process signature: {:?}", signature);
213+
info!("Trying to process signature: {signature:?}");
214214

215215
match http_client
216216
.get_transaction_with_config(&signature, fetching_config)
@@ -248,7 +248,7 @@ pub async fn process_signature(config: config::Config, redis_client: redis::Clie
248248
.await;
249249
}
250250
Err(err) => {
251-
warn!("Failed to fetch transaction (probably signature wasn't finalized yet): {}", err);
251+
warn!("Failed to fetch transaction (probably signature wasn't finalized yet): {err:?}");
252252
}
253253
};
254254
}

omni-relayer/src/utils/evm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ pub async fn construct_prover_args(
8080
match eth_proof::get_proof_for_event(tx_hash, topic, &eth.rpc_http_url).await {
8181
Ok(proof) => proof,
8282
Err(err) => {
83-
warn!("Failed to get proof: {}", err);
83+
warn!("Failed to get proof: {err:?}");
8484
return None;
8585
}
8686
};

omni-relayer/src/utils/redis.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ pub async fn add_event<F, E>(
9898
E: serde::Serialize + std::fmt::Debug + Send,
9999
{
100100
let Ok(serialized_event) = serde_json::to_string(&event) else {
101-
warn!("Failed to serialize event: {:?}", event);
101+
warn!("Failed to serialize event: {event:?}");
102102
return;
103103
};
104104

omni-relayer/src/utils/solana.rs

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub async fn process_message(
4646
)
4747
.await
4848
{
49-
warn!("Failed to decode instruction: {}", err);
49+
warn!("Failed to decode instruction: {err:?}");
5050
}
5151
}
5252
}
@@ -77,7 +77,7 @@ async fn decode_instruction(
7777
.starts_with(discriminator)
7878
.then_some((discriminator, len))
7979
}) {
80-
info!("Received InitTransfer on Solana ({})", signature);
80+
info!("Received InitTransfer on Solana ({signature})");
8181

8282
let mut payload_data = decoded_data
8383
.get(offset..)
@@ -123,7 +123,7 @@ async fn decode_instruction(
123123
let Ok(Ok(sender)) = Pubkey::from_str(sender).map(|sender| {
124124
OmniAddress::new_from_slice(ChainKind::Sol, &sender.to_bytes())
125125
}) else {
126-
warn!("Failed to parse sender as a pubkey: {:?}", sender);
126+
warn!("Failed to parse sender as a pubkey: {sender:?}");
127127
continue;
128128
};
129129

@@ -132,26 +132,24 @@ async fn decode_instruction(
132132
OmniAddress::new_from_slice(ChainKind::Sol, &recipient.to_bytes())
133133
})
134134
else {
135-
warn!("Failed to parse recipient as a pubkey: {:?}", sender);
135+
warn!("Failed to parse recipient as a pubkey: {sender:?}");
136136
continue;
137137
};
138138

139139
let Ok(token) = Pubkey::from_str(token) else {
140-
warn!("Failed to parse token as a pubkey: {:?}", token);
140+
warn!("Failed to parse token as a pubkey: {token:?}");
141141
continue;
142142
};
143143

144-
let Some(Ok(sequence)) = log
145-
.split_ascii_whitespace()
146-
.last()
147-
.map(|sequence| sequence.parse())
144+
let Some(Ok(sequence)) =
145+
log.split_ascii_whitespace().last().map(str::parse)
148146
else {
149-
warn!("Failed to parse sequence number from log: {:?}", log);
147+
warn!("Failed to parse sequence number from log: {log:?}");
150148
continue;
151149
};
152150

153151
let Ok(emitter) = Pubkey::from_str(emitter) else {
154-
warn!("Failed to parse emitter as a pubkey: {:?}", emitter);
152+
warn!("Failed to parse emitter as a pubkey: {emitter:?}");
155153
continue;
156154
};
157155

@@ -185,7 +183,7 @@ async fn decode_instruction(
185183
.into_iter()
186184
.find(|discriminator| decoded_data.starts_with(discriminator))
187185
{
188-
info!("Received FinTransfer on Solana: {}", signature);
186+
info!("Received FinTransfer on Solana: {signature}");
189187

190188
let emitter = if discriminator == &solana.finalize_transfer_discriminator {
191189
account_keys
@@ -211,12 +209,12 @@ async fn decode_instruction(
211209
.last()
212210
.map(std::string::ToString::to_string)
213211
else {
214-
warn!("Failed to parse sequence number from log: {:?}", log);
212+
warn!("Failed to parse sequence number from log: {log:?}");
215213
continue;
216214
};
217215

218216
let Ok(sequence) = sequence.parse() else {
219-
warn!("Failed to parse sequence as a number: {:?}", sequence);
217+
warn!("Failed to parse sequence as a number: {sequence:?}");
220218
continue;
221219
};
222220

@@ -234,7 +232,7 @@ async fn decode_instruction(
234232
}
235233
}
236234
} else if decoded_data.starts_with(&solana.deploy_token_discriminator) {
237-
info!("Received DeployToken on Solana ({})", signature);
235+
info!("Received DeployToken on Solana ({signature})");
238236

239237
if let Some(OptionSerializer::Some(logs)) =
240238
transaction.clone().meta.map(|meta| meta.log_messages)
@@ -246,11 +244,11 @@ async fn decode_instruction(
246244
.last()
247245
.map(std::string::ToString::to_string)
248246
else {
249-
warn!("Failed to parse sequence number from log: {:?}", log);
247+
warn!("Failed to parse sequence number from log: {log:?}");
250248
continue;
251249
};
252250
let Ok(sequence) = sequence.parse() else {
253-
warn!("Failed to parse sequence as a number: {:?}", sequence);
251+
warn!("Failed to parse sequence as a number: {sequence:?}");
254252
continue;
255253
};
256254

0 commit comments

Comments
 (0)