Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
segfault-magnet committed May 6, 2024
1 parent ee05706 commit 65dc49c
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 10 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @digorithm @hal3e @MujkicA @segfault-magnet @Salka1988 @Br1ght0ne
4 changes: 2 additions & 2 deletions committer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ use actix_web::{
};
use ports::storage::Storage;
use services::{HealthReporter, StatusReporter};
use storage::Postgres;

use crate::{
config::Config,
errors::{Error, Result},
Database,
};

pub async fn launch_api_server(
Expand Down Expand Up @@ -56,7 +56,7 @@ async fn health(data: web::Data<Arc<HealthReporter>>) -> impl Responder {
}

#[get("/status")]
async fn status(data: web::Data<Arc<StatusReporter<Postgres>>>) -> impl Responder {
async fn status(data: web::Data<Arc<StatusReporter<Database>>>) -> impl Responder {
let report = data.current_status().await?;

Result::Ok(web::Json(report))
Expand Down
8 changes: 4 additions & 4 deletions committer/src/setup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ pub async fn create_l1_adapter(
internal_config: &InternalConfig,
registry: &Registry,
) -> Result<(L1, HealthChecker)> {
let ws_adapter = L1::connect(
let l1 = L1::connect(
&config.eth.rpc,
config.eth.chain_id,
config.eth.state_contract_address,
Expand All @@ -109,11 +109,11 @@ pub async fn create_l1_adapter(
)
.await?;

ws_adapter.register_metrics(registry);
l1.register_metrics(registry);

let health_check = ws_adapter.connection_health_checker();
let health_check = l1.connection_health_checker();

Ok((ws_adapter, health_check))
Ok((l1, health_check))
}

fn schedule_polling(
Expand Down
4 changes: 3 additions & 1 deletion packages/eth/src/websocket/connection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abigen!(
#[derive(Clone)]
pub struct WsConnection {
provider: Provider<Ws>,
pub(crate) contract: FUEL_STATE_CONTRACT<SignerMiddleware<Provider<Ws>, LocalWallet>>,
contract: FUEL_STATE_CONTRACT<SignerMiddleware<Provider<Ws>, LocalWallet>>,
commit_interval: NonZeroU32,
address: H160,
}
Expand Down Expand Up @@ -69,6 +69,7 @@ impl EthApi for WsConnection {
EthEventStreamer::new(events)
}

#[cfg(feature = "test-helpers")]
async fn finalized(&self, block: FuelBlock) -> Result<bool> {
Ok(self
.contract
Expand All @@ -77,6 +78,7 @@ impl EthApi for WsConnection {
.await?)
}

#[cfg(feature = "test-helpers")]
async fn block_hash_at_commit_height(&self, commit_height: u32) -> Result<[u8; 32]> {
Ok(self
.contract
Expand Down
6 changes: 5 additions & 1 deletion packages/eth/src/websocket/health_tracking_middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,14 @@ use crate::{

#[cfg_attr(test, mockall::automock)]
#[async_trait::async_trait]
pub trait EthApi {
pub(crate) trait EthApi {
async fn submit(&self, block: FuelBlock) -> Result<()>;
async fn get_block_number(&self) -> Result<u64>;
async fn balance(&self) -> Result<U256>;
fn event_streamer(&self, eth_block_height: u64) -> EthEventStreamer;
#[cfg(feature = "test-helpers")]
async fn finalized(&self, block: FuelBlock) -> Result<bool>;
#[cfg(feature = "test-helpers")]
async fn block_hash_at_commit_height(&self, commit_height: u32) -> Result<[u8; 32]>;
}

Expand Down Expand Up @@ -88,10 +90,12 @@ where
response
}

#[cfg(feature = "test-helpers")]
async fn finalized(&self, block: FuelBlock) -> Result<bool> {
self.adapter.finalized(block).await
}

#[cfg(feature = "test-helpers")]
async fn block_hash_at_commit_height(&self, commit_height: u32) -> Result<[u8; 32]> {
self.adapter
.block_hash_at_commit_height(commit_height)
Expand Down
4 changes: 2 additions & 2 deletions packages/services/src/commit_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use tracing::{error, info};

use super::Runner;

pub struct CommitListener<E, Db> {
contract: E,
pub struct CommitListener<C, Db> {
contract: C,
storage: Db,
metrics: Metrics,
cancel_token: CancellationToken,
Expand Down

0 comments on commit 65dc49c

Please sign in to comment.