Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault-magnet committed May 1, 2024
1 parent 5dbb64c commit 036a885
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 29 deletions.
1 change: 0 additions & 1 deletion compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ services:

block_committer:
container_name: block-committer
restart: unless-stopped
depends_on:
fuel_node:
condition: service_healthy
Expand Down
2 changes: 1 addition & 1 deletion src/adapters/storage/postgresql/test_instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ impl PostgresProcess {
let query = format!("CREATE DATABASE {db_name}");
db.execute(&query).await?;

config.database = db_name.clone();
config.database = db_name;

let db = Postgres::connect(&config).await?;

Expand Down
11 changes: 2 additions & 9 deletions src/config.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
use std::path::PathBuf;
use std::{net::Ipv4Addr, num::NonZeroU32, path::PathBuf, str::FromStr, time::Duration};

use clap::{command, Parser};

use std::{net::Ipv4Addr, num::NonZeroU32, str::FromStr, time::Duration};

use ethers::types::{Address, Chain};
use serde::Deserialize;
use url::Url;
Expand Down Expand Up @@ -113,9 +110,5 @@ pub fn parse() -> crate::errors::Result<Config> {
.add_source(config::Environment::with_prefix("COMMITTER").separator("__"))
.build()?;

tracing::info!("Config: {:?}", config);

let config = config.try_deserialize()?;

Ok(config)
Ok(config.try_deserialize()?)
}
30 changes: 15 additions & 15 deletions src/services/block_watcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ mod tests {
let latest_block = given_a_block(5);
let fuel_adapter = given_fetcher(vec![latest_block, missed_block]);

let db = PostgresProcess::shared().await.unwrap();
let db_tx = db_with_submissions(&db, vec![0, 2]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db_tx);
let process = PostgresProcess::shared().await.unwrap();
let db = db_with_submissions(&process, vec![0, 2]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db);

// when
block_watcher.run().await.unwrap();
Expand All @@ -183,9 +183,9 @@ mod tests {
let latest_block = given_a_block(5);
let fuel_adapter = given_fetcher(vec![latest_block, missed_block]);

let db = PostgresProcess::shared().await.unwrap();
let db_tx = db_with_submissions(&db, vec![0, 2, 4]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db_tx);
let process = PostgresProcess::shared().await.unwrap();
let db = db_with_submissions(&process, vec![0, 2, 4]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db);

// when
block_watcher.run().await.unwrap();
Expand All @@ -204,9 +204,9 @@ mod tests {
let latest_block = given_a_block(6);
let fuel_adapter = given_fetcher(vec![latest_block]);

let db = PostgresProcess::shared().await.unwrap();
let db_tx = db_with_submissions(&db, vec![0, 2, 4, 6]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db_tx);
let process = PostgresProcess::shared().await.unwrap();
let db = db_with_submissions(&process, vec![0, 2, 4, 6]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db);

// when
block_watcher.run().await.unwrap();
Expand All @@ -225,9 +225,9 @@ mod tests {
let block = given_a_block(4);
let fuel_adapter = given_fetcher(vec![block]);

let db = PostgresProcess::shared().await.unwrap();
let db_tx = db_with_submissions(&db, vec![0, 2]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db_tx);
let process = PostgresProcess::shared().await.unwrap();
let db = db_with_submissions(&process, vec![0, 2]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db);

// when
block_watcher.run().await.unwrap();
Expand All @@ -247,9 +247,9 @@ mod tests {

let fuel_adapter = given_fetcher(vec![given_a_block(5)]);

let db = PostgresProcess::shared().await.unwrap();
let db_tx = db_with_submissions(&db, vec![0, 2, 4]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db_tx);
let process = PostgresProcess::shared().await.unwrap();
let db = db_with_submissions(&process, vec![0, 2, 4]).await;
let mut block_watcher = BlockWatcher::new(2.try_into().unwrap(), tx, fuel_adapter, db);

let registry = Registry::default();
block_watcher.register_metrics(&registry);
Expand Down
6 changes: 3 additions & 3 deletions src/services/commit_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,11 @@ mod tests {
let eth_rpc_mock =
given_eth_rpc_that_will_stream(vec![Ok(block_hash)], submission.submittal_height);

let db = PostgresProcess::shared().await.unwrap();
let db_tx = db_with_submission(&db, submission).await;
let process = PostgresProcess::shared().await.unwrap();
let db = db_with_submission(&process, submission).await;

let mut commit_listener =
CommitListener::new(eth_rpc_mock, db_tx, CancellationToken::default());
CommitListener::new(eth_rpc_mock, db, CancellationToken::default());

let registry = Registry::new();
commit_listener.register_metrics(&registry);
Expand Down

0 comments on commit 036a885

Please sign in to comment.