diff --git a/crates/starknet_http_server/src/http_server.rs b/crates/starknet_http_server/src/http_server.rs index 4711c07d7ee..b3ad67e5d5a 100644 --- a/crates/starknet_http_server/src/http_server.rs +++ b/crates/starknet_http_server/src/http_server.rs @@ -69,11 +69,17 @@ async fn add_tx( record_added_transaction(); let gateway_input: GatewayInput = GatewayInput { rpc_tx: tx, message_metadata: None }; + info!("Received tx: {:?}", gateway_input); + let add_tx_result = app_state.gateway_client.add_tx(gateway_input).await.map_err(|join_err| { error!("Failed to process tx: {}", join_err); GatewaySpecError::UnexpectedError { data: "Internal server error".to_owned() } }); + + info!("Add tx result: {:?}", add_tx_result); + record_added_transaction_status(add_tx_result.is_ok()); + info!("Updated the metrics"); add_tx_result_as_json(add_tx_result) } @@ -81,7 +87,11 @@ async fn add_tx( pub(crate) fn add_tx_result_as_json( result: Result, ) -> HttpServerResult> { + info!("add_tx_result_as_json"); + let tx_hash = result?; + info!("tx_hash: {:?}", tx_hash); + Ok(Json(tx_hash)) } diff --git a/crates/starknet_http_server/src/http_server_test.rs b/crates/starknet_http_server/src/http_server_test.rs index 733d626ca3d..28bd3f586cd 100644 --- a/crates/starknet_http_server/src/http_server_test.rs +++ b/crates/starknet_http_server/src/http_server_test.rs @@ -11,6 +11,7 @@ use metrics_exporter_prometheus::PrometheusBuilder; use starknet_api::transaction::TransactionHash; use starknet_gateway_types::communication::{GatewayClientError, MockGatewayClient}; use starknet_sequencer_infra::component_client::ClientError; +use starknet_sequencer_infra::trace_util::configure_tracing; use tokio::task; use crate::config::HttpServerConfig; @@ -40,6 +41,8 @@ async fn to_bytes(res: Response) -> Bytes { #[tokio::test] async fn get_metrics_test() { + configure_tracing().await; + let prometheus_handle = PrometheusBuilder::new() .install_recorder() .expect("should be able to build the recorder and install it globally"); @@ -61,7 +64,9 @@ async fn get_metrics_test() { "mock response".to_string(), ))), 1 => Ok(TransactionHash::default()), - _ => Ok(TransactionHash::default()), + _ => Err(GatewayClientError::ClientError(ClientError::UnexpectedResponse( + "mock response".to_string(), + ))), } });