Skip to content

Commit d06b526

Browse files
author
Rafał Chabowski
committed
Cleanup
1 parent 8ef9a35 commit d06b526

File tree

3 files changed

+10
-49
lines changed

3 files changed

+10
-49
lines changed

crates/services/tx_status_manager/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
33
#![deny(clippy::arithmetic_side_effects)]
44
#![deny(clippy::cast_possible_truncation)]
5-
//#![deny(unused_crate_dependencies)]
6-
//#![deny(warnings)]
5+
#![deny(unused_crate_dependencies)]
6+
#![deny(warnings)]
77

88
pub mod config;
99
mod error;

crates/services/tx_status_manager/src/manager.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -208,38 +208,13 @@ impl TxStatusManager {
208208
}
209209

210210
#[cfg(test)]
211-
#[allow(non_snake_case)]
212211
mod tests {
213-
use std::{
214-
collections::HashSet,
215-
time::Duration,
216-
};
217-
218-
use futures::StreamExt;
219212
use test_case::test_case;
220213

221214
use fuel_core_types::{
222-
fuel_crypto::rand::{
223-
rngs::StdRng,
224-
seq::SliceRandom,
225-
SeedableRng,
226-
},
227-
fuel_tx::Bytes32,
228215
services::txpool::TransactionStatus,
229216
tai64::Tai64,
230217
};
231-
use tokio::sync::mpsc;
232-
use tokio_stream::wrappers::ReceiverStream;
233-
234-
use crate::{
235-
update_sender::{
236-
CreateChannel,
237-
Tx,
238-
TxStatusChange,
239-
},
240-
TxStatusMessage,
241-
TxStatusStream,
242-
};
243218

244219
use super::TxStatusManager;
245220

crates/services/tx_status_manager/src/service.rs

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ mod tests {
272272
},
273273
preconfirmation::{
274274
Preconfirmation,
275-
PreconfirmationStatus,
276275
Preconfirmations,
277276
},
278277
txpool::TransactionStatus,
@@ -545,14 +544,13 @@ mod tests {
545544
let (sender, receiver) = oneshot::channel();
546545
status_read
547546
.send(ReadRequest::GetStatus {
548-
tx_id: (*id).into(),
547+
tx_id: (*id),
549548
sender,
550549
})
551550
.await
552551
.unwrap();
553552

554-
let response = receiver.await.unwrap();
555-
response
553+
receiver.await.unwrap()
556554
}
557555

558556
async fn assert_status<F>(
@@ -566,7 +564,7 @@ mod tests {
566564
let (sender, receiver) = oneshot::channel();
567565
status_read
568566
.send(ReadRequest::GetStatus {
569-
tx_id: (*id).into(),
567+
tx_id: (*id),
570568
sender,
571569
})
572570
.await
@@ -586,8 +584,6 @@ mod tests {
586584
}
587585

588586
async fn assert_status_change_notifications(
589-
tx_id: Bytes32,
590-
tx_status_change: &TxStatusChange,
591587
validators: &[for<'a> fn(&'a TransactionStatus) -> bool],
592588
mut stream: BoxStream<'_, TxStatusMessage>,
593589
) {
@@ -605,9 +601,7 @@ mod tests {
605601
}
606602

607603
assert_eq!(received_statuses.len(), validators.len(), "Length mismatch");
608-
for (i, (item, &validator)) in
609-
received_statuses.iter().zip(validators.iter()).enumerate()
610-
{
604+
for (item, &validator) in received_statuses.iter().zip(validators.iter()) {
611605
assert!(validator(item));
612606
}
613607
}
@@ -679,22 +673,16 @@ mod tests {
679673
.await;
680674

681675
assert_status_change_notifications(
682-
tx1_id,
683-
&handles.tx_status_change,
684676
&[|s| matches!(s, &TransactionStatus::PreConfirmationSuccess(_))],
685677
stream_tx1,
686678
)
687679
.await;
688680
assert_status_change_notifications(
689-
tx2_id,
690-
&handles.tx_status_change,
691681
&[|s| matches!(s, &TransactionStatus::PreConfirmationSqueezedOut(_))],
692682
stream_tx2,
693683
)
694684
.await;
695685
assert_status_change_notifications(
696-
tx3_id,
697-
&handles.tx_status_change,
698686
&[|s| matches!(s, &TransactionStatus::PreConfirmationFailure(_))],
699687
stream_tx3,
700688
)
@@ -901,7 +889,7 @@ mod tests {
901889

902890
// Given
903891
let tx1_id = [1u8; 32].into();
904-
let status_updates = vec![
892+
let status_updates = [
905893
(tx1_id, status::transaction::submitted()),
906894
(tx1_id, status::transaction::success()),
907895
];
@@ -924,8 +912,6 @@ mod tests {
924912

925913
// Then
926914
assert_status_change_notifications(
927-
tx1_id,
928-
&handles.tx_status_change,
929915
&[
930916
|s| matches!(s, &TransactionStatus::Submitted(_)),
931917
|s| matches!(s, &TransactionStatus::Success(_)),
@@ -992,7 +978,7 @@ mod tests {
992978

993979
#[tokio::main(start_paused = true, flavor = "current_thread")]
994980
#[allow(clippy::arithmetic_side_effects)]
995-
async fn _pruning__correctly_prunes_old_statuses(
981+
async fn _run__correctly_prunes_old_statuses(
996982
ttl: Duration,
997983
actions: Vec<Action>,
998984
) {
@@ -1077,11 +1063,11 @@ mod tests {
10771063

10781064
#[test]
10791065
#[allow(clippy::arithmetic_side_effects)]
1080-
fn pruning__correctly_prunes_old_statuses(
1066+
fn run__correctly_prunes_old_statuses(
10811067
ttl in ttl_strategy(MIN_TTL, MAX_TTL),
10821068
actions in actions_strategy(MIN_ACTIONS, MAX_ACTIONS)
10831069
) {
1084-
_pruning__correctly_prunes_old_statuses(ttl, actions);
1070+
_run__correctly_prunes_old_statuses(ttl, actions);
10851071
}
10861072
}
10871073
}

0 commit comments

Comments
 (0)