From 1ab8facabd15bf16a8b7283546356856fba42fe7 Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Wed, 8 Oct 2025 15:25:14 -0500 Subject: [PATCH 1/5] fix: connecting to rds pg cluster --- ui/src/db/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/src/db/index.ts b/ui/src/db/index.ts index 55c8a8fb..b0f88222 100644 --- a/ui/src/db/index.ts +++ b/ui/src/db/index.ts @@ -4,6 +4,9 @@ import * as schema from "./schema"; const pool = new Pool({ connectionString: process.env.TIPS_DATABASE_URL, + ssl: { + rejectUnauthorized: false, + }, }); export const db = drizzle(pool, { schema }); From 12c82a86d9bd430e6f407177246a54e245c4e4df Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Thu, 9 Oct 2025 10:30:18 -0500 Subject: [PATCH 2/5] add error logging --- crates/ingress-rpc/src/validation.rs | 32 +++++++++++++++++----------- ui/src/db/index.ts | 1 + 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/crates/ingress-rpc/src/validation.rs b/crates/ingress-rpc/src/validation.rs index 54d8a328..cacc66d8 100644 --- a/crates/ingress-rpc/src/validation.rs +++ b/crates/ingress-rpc/src/validation.rs @@ -1,3 +1,4 @@ +use alloy_consensus::private::alloy_eips::{BlockId, BlockNumberOrTag}; use alloy_consensus::{Transaction, Typed2718, constants::KECCAK_EMPTY, transaction::Recovered}; use alloy_primitives::{Address, B256, U256}; use alloy_provider::{Provider, RootProvider}; @@ -49,24 +50,29 @@ pub trait L1BlockInfoLookup: Send + Sync { #[async_trait] impl L1BlockInfoLookup for RootProvider { async fn fetch_l1_block_info(&self) -> RpcResult { - let block_number = self - .get_block_number() - .await - .map_err(|_| EthApiError::InternalEthError.into_rpc_err())?; let block = self - .get_block_by_number(block_number.into()) + .get_block(BlockId::Number(BlockNumberOrTag::Latest)) .full() .await - .map_err(|_| EthApiError::InternalEthError.into_rpc_err())? - .ok_or_else(|| EthApiError::HeaderNotFound(block_number.into()).into_rpc_err())?; + .map_err(|e| { + warn!(message = "failed to fetch latest block", err = %e); + EthApiError::InternalEthError.into_rpc_err() + })? + .ok_or_else(|| { + warn!(message = "empty latest block returned"); + EthApiError::InternalEthError.into_rpc_err() + })?; let txs = block.transactions.clone(); - let first_tx = txs - .first_transaction() - .ok_or_else(|| EthApiError::InternalEthError.into_rpc_err())?; - - Ok(extract_l1_info_from_tx(&first_tx.clone()) - .map_err(|_| EthApiError::InternalEthError.into_rpc_err())?) + let first_tx = txs.first_transaction().ok_or_else(|| { + warn!(message = "block contains no transactions"); + EthApiError::InternalEthError.into_rpc_err() + })?; + + Ok(extract_l1_info_from_tx(&first_tx.clone()).map_err(|e| { + warn!(message = "failed to extract l1_info from tx", err = %e); + EthApiError::InternalEthError.into_rpc_err() + })?) } } diff --git a/ui/src/db/index.ts b/ui/src/db/index.ts index b0f88222..284ca5a5 100644 --- a/ui/src/db/index.ts +++ b/ui/src/db/index.ts @@ -5,6 +5,7 @@ import * as schema from "./schema"; const pool = new Pool({ connectionString: process.env.TIPS_DATABASE_URL, ssl: { + requestCert: false, rejectUnauthorized: false, }, }); From 0b747440106bd725d3d51e343849a5d344561f83 Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Fri, 10 Oct 2025 16:20:50 -0500 Subject: [PATCH 3/5] add additional logging --- crates/maintenance/src/job.rs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/maintenance/src/job.rs b/crates/maintenance/src/job.rs index 835f1a7d..a3ac6e16 100644 --- a/crates/maintenance/src/job.rs +++ b/crates/maintenance/src/job.rs @@ -142,33 +142,36 @@ impl, K: BundleEventPublisher> Mainten loop { tokio::select! { _ = maintenance_interval.tick() => { + info!(message = "starting maintenance"); match self.periodic_maintenance().await { Ok(_) => { - info!("Periodic maintenance completed"); + info!(message = "Periodic maintenance completed"); }, Err(err) => { - error!("Error in periodic maintenance: {:?}", err); + error!(message = "Error in periodic maintenance", error = %err); } } } _ = execution_interval.tick() => { + info!(message = "starting execution run"); match self.execute().await { Ok(_) => { - info!("Successfully executed maintenance run"); + info!(message = "Successfully executed maintenance run"); } Err(e) => { - error!("Error executing maintenance run: {:?}", e); + error!(message = "Error executing maintenance run", error = %e); } } } Some(flashblock) = fb_rx.recv() => { + info!(message = "starting flashblock processing"); match self.process_flashblock(flashblock).await { Ok(_) => { - info!("Successfully processed flashblock"); + info!(message = "Successfully processed flashblock"); } Err(e) => { - error!("Error processing flashblock: {:?}", e); + error!(message = "Error processing flashblock", error = %e); } } } From 10e02d9bf7454966e2f5114b4d2d04f5186b562e Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Fri, 10 Oct 2025 18:06:48 -0500 Subject: [PATCH 4/5] add logging --- crates/maintenance/src/job.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/maintenance/src/job.rs b/crates/maintenance/src/job.rs index a3ac6e16..b34d6f43 100644 --- a/crates/maintenance/src/job.rs +++ b/crates/maintenance/src/job.rs @@ -54,6 +54,8 @@ impl, K: BundleEventPublisher> Mainten .await? .ok_or_else(|| anyhow::anyhow!("Failed to get latest block"))?; + info!(message = "Executing up to latest block", ?latest_block); + let block_info = self.store.get_current_block_info().await?; if let Some(current_block_info) = block_info { @@ -62,6 +64,8 @@ impl, K: BundleEventPublisher> Mainten for block_num in (current_block_info.latest_block_number + 1)..=latest_block.header.number { + info!(message = "Fetching block number", ?latest_block); + let block = self .node .get_block(BlockId::Number(alloy_rpc_types::BlockNumberOrTag::Number( From a8b999c9ded35639123424724e2d50e0fd9bc0b5 Mon Sep 17 00:00:00 2001 From: Danyal Prout Date: Fri, 10 Oct 2025 21:37:47 -0500 Subject: [PATCH 5/5] persist to db --- crates/maintenance/src/job.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/crates/maintenance/src/job.rs b/crates/maintenance/src/job.rs index b34d6f43..386bf3e4 100644 --- a/crates/maintenance/src/job.rs +++ b/crates/maintenance/src/job.rs @@ -16,9 +16,9 @@ use std::collections::HashSet; use std::time::Duration; use tips_audit::{BundleEvent, BundleEventPublisher, DropReason}; use tips_datastore::BundleDatastore; -use tips_datastore::postgres::{BundleFilter, BundleState, BundleWithMetadata}; +use tips_datastore::postgres::{BlockInfoUpdate, BundleFilter, BundleState, BundleWithMetadata}; use tokio::sync::mpsc; -use tracing::{error, info, warn}; +use tracing::{debug, error, info, warn}; use uuid::Uuid; pub struct MaintenanceJob, K: BundleEventPublisher> { @@ -54,7 +54,10 @@ impl, K: BundleEventPublisher> Mainten .await? .ok_or_else(|| anyhow::anyhow!("Failed to get latest block"))?; - info!(message = "Executing up to latest block", ?latest_block); + debug!( + message = "Executing up to latest block", + block_number = latest_block.number() + ); let block_info = self.store.get_current_block_info().await?; @@ -64,7 +67,7 @@ impl, K: BundleEventPublisher> Mainten for block_num in (current_block_info.latest_block_number + 1)..=latest_block.header.number { - info!(message = "Fetching block number", ?latest_block); + debug!(message = "Fetching block number", ?latest_block); let block = self .node @@ -75,12 +78,19 @@ impl, K: BundleEventPublisher> Mainten .await? .ok_or_else(|| anyhow::anyhow!("Failed to get block {}", block_num))?; + let hash = block.hash(); self.on_new_block(block).await?; + self.store + .commit_block_info(vec![BlockInfoUpdate { + block_number: block_num, + block_hash: hash, + }]) + .await?; } } } else { warn!("No block info found in database, initializing with latest block as finalized"); - let block_update = tips_datastore::postgres::BlockInfoUpdate { + let block_update = BlockInfoUpdate { block_number: latest_block.header.number, block_hash: latest_block.header.hash, };