diff --git a/packages/adapters/storage/src/lib.rs b/packages/adapters/storage/src/lib.rs index dbbd0d09..1866e804 100644 --- a/packages/adapters/storage/src/lib.rs +++ b/packages/adapters/storage/src/lib.rs @@ -194,17 +194,18 @@ impl services::state_pruner::port::Storage for Postgres { #[cfg(test)] mod tests { - use services::block_bundler::port::Storage as BundlerStorage; - use services::cost_reporter::port::Storage as CostStorage; - use services::state_committer::port::Storage as CommiterStorage; - use services::state_listener::port::Storage as ListenerStorage; - use services::types::{L1Tx, TransactionCostUpdate, TransactionState}; use std::time::Duration; use clock::TestClock; use itertools::Itertools; use rand::{thread_rng, Rng}; - use services::types::{nonempty, CollectNonEmpty}; + use services::{ + block_bundler::port::Storage as BundlerStorage, + cost_reporter::port::Storage as CostStorage, + state_committer::port::Storage as CommiterStorage, + state_listener::port::Storage as ListenerStorage, + types::{nonempty, CollectNonEmpty, L1Tx, TransactionCostUpdate, TransactionState}, + }; use super::*; @@ -462,8 +463,9 @@ mod tests { #[tokio::test] async fn can_get_last_time_a_fragment_was_finalized() { - use services::state_committer::port::Storage; - use services::state_listener::port::Storage as ListenerStorage; + use services::{ + state_committer::port::Storage, state_listener::port::Storage as ListenerStorage, + }; // given let storage = start_db().await; @@ -926,9 +928,10 @@ mod tests { #[tokio::test] async fn can_update_costs() -> Result<()> { - use services::cost_reporter::port::Storage; - use services::state_committer::port::Storage as StateStorage; - use services::state_listener::port::Storage as ListenerStorage; + use services::{ + cost_reporter::port::Storage, state_committer::port::Storage as StateStorage, + state_listener::port::Storage as ListenerStorage, + }; // given let storage = start_db().await; diff --git a/packages/adapters/storage/src/postgres.rs b/packages/adapters/storage/src/postgres.rs index d29f2c65..014e599f 100644 --- a/packages/adapters/storage/src/postgres.rs +++ b/packages/adapters/storage/src/postgres.rs @@ -1,6 +1,5 @@ use std::{collections::HashMap, ops::RangeInclusive}; -use crate::postgres::tables::u128_to_bigdecimal; use itertools::Itertools; use metrics::{prometheus::IntGauge, RegistersMetrics}; use services::types::{ @@ -14,7 +13,10 @@ use sqlx::{ }; use super::error::{Error, Result}; -use crate::mappings::tables::{self, L1TxState}; +use crate::{ + mappings::tables::{self, L1TxState}, + postgres::tables::u128_to_bigdecimal, +}; #[derive(Debug, Clone)] struct Metrics { @@ -1188,15 +1190,13 @@ fn create_ranges(heights: Vec) -> Vec> { mod tests { use std::{env, fs, path::Path}; + use rand::Rng; + use services::types::{CollectNonEmpty, Fragment, L1Tx, TransactionState}; use sqlx::{Executor, PgPool, Row}; use tokio::time::Instant; - use crate::test_instance; - use super::*; - - use rand::Rng; - use services::types::{CollectNonEmpty, Fragment, L1Tx, TransactionState}; + use crate::test_instance; #[tokio::test] async fn test_second_migration_applies_successfully() { @@ -1459,9 +1459,10 @@ mod tests { #[tokio::test] async fn stress_test_update_costs() -> Result<()> { - use services::block_bundler::port::Storage; - use services::state_committer::port::Storage as CommitterStorage; - use services::state_listener::port::Storage as ListenerStorage; + use services::{ + block_bundler::port::Storage, state_committer::port::Storage as CommitterStorage, + state_listener::port::Storage as ListenerStorage, + }; let mut rng = rand::thread_rng(); diff --git a/packages/adapters/storage/src/test_instance.rs b/packages/adapters/storage/src/test_instance.rs index 4056593e..6d9d70d7 100644 --- a/packages/adapters/storage/src/test_instance.rs +++ b/packages/adapters/storage/src/test_instance.rs @@ -1,3 +1,9 @@ +use std::{ + borrow::Cow, + ops::RangeInclusive, + sync::{Arc, Weak}, +}; + use delegate::delegate; use services::{ block_bundler, block_committer, block_importer, @@ -8,11 +14,6 @@ use services::{ }, }; use sqlx::Executor; -use std::{ - borrow::Cow, - ops::RangeInclusive, - sync::{Arc, Weak}, -}; use testcontainers::{ core::{ContainerPort, WaitFor}, runners::AsyncRunner,