Skip to content

Commit

Permalink
group imports
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault-magnet committed Jan 10, 2025
1 parent 242a73d commit 7e6e035
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 26 deletions.
25 changes: 14 additions & 11 deletions packages/adapters/storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Check warning on line 205 in packages/adapters/storage/src/lib.rs

View workflow job for this annotation

GitHub Actions / cargo-verifications

"Commiter" should be "Committer".
state_listener::port::Storage as ListenerStorage,
types::{nonempty, CollectNonEmpty, L1Tx, TransactionCostUpdate, TransactionState},
};

use super::*;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
21 changes: 11 additions & 10 deletions packages/adapters/storage/src/postgres.rs
Original file line number Diff line number Diff line change
@@ -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::{
Expand All @@ -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 {
Expand Down Expand Up @@ -1188,15 +1190,13 @@ fn create_ranges(heights: Vec<u32>) -> Vec<RangeInclusive<u32>> {
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() {
Expand Down Expand Up @@ -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();

Expand Down
11 changes: 6 additions & 5 deletions packages/adapters/storage/src/test_instance.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
use std::{
borrow::Cow,
ops::RangeInclusive,
sync::{Arc, Weak},
};

use delegate::delegate;
use services::{
block_bundler, block_committer, block_importer,
Expand All @@ -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,
Expand Down

0 comments on commit 7e6e035

Please sign in to comment.