diff --git a/TODO.md b/TODO.md index 7b0476ad..c4382839 100644 --- a/TODO.md +++ b/TODO.md @@ -241,6 +241,8 @@ These are roughly in order of completition - [x] web3_proxy_cli command should read database settings from config - [-] add configurable size limits to all the Caches - instead of configuring each cache with MB sizes, have one value for total memory footprint and then percentages for each cache +- [-] more trace logging +- [ ] add more to web3_proxy_cli - [ ] add block timestamp to the /status page - [ ] cache the status page for a second - [ ] probably need to turn more sentry log integrations (like anyhow) on! diff --git a/web3_proxy/src/app.rs b/web3_proxy/src/app.rs index c92fda8e..3c2c08ee 100644 --- a/web3_proxy/src/app.rs +++ b/web3_proxy/src/app.rs @@ -25,7 +25,7 @@ use futures::stream::FuturesUnordered; use futures::stream::StreamExt; use hashbrown::HashMap; use ipnet::IpNet; -use log::{debug, error, info, warn}; +use log::{debug, error, info, trace, warn}; use metered::{metered, ErrorCount, HitCount, ResponseTime, Throughput}; use migration::sea_orm::{self, ConnectionTrait, Database, DatabaseConnection}; use migration::sea_query::table::ColumnDef; @@ -640,7 +640,12 @@ impl Web3ProxyApp { subscription_registration, ); - // // trace!(?subscription_id, "pending transactions subscription"); + trace!( + "pending transactions subscription id: {:?}", + subscription_id + ); + + // TODO: do something with this handle? tokio::spawn(async move { while let Some(Ok(new_tx_state)) = pending_tx_receiver.next().await { let new_tx = match new_tx_state { @@ -668,7 +673,7 @@ impl Web3ProxyApp { }; } - // // trace!(?subscription_id, "closed new heads subscription"); + // trace!(?subscription_id, "closed new heads subscription"); }); } Some(x) if x == json!(["newPendingFullTransactions"]) => { @@ -712,7 +717,7 @@ impl Web3ProxyApp { }; } - // // trace!(?subscription_id, "closed new heads subscription"); + // trace!(?subscription_id, "closed new heads subscription"); }); } Some(x) if x == json!(["newPendingRawTransactions"]) => { @@ -724,7 +729,10 @@ impl Web3ProxyApp { subscription_registration, ); - // // trace!(?subscription_id, "pending transactions subscription"); + trace!( + "pending transactions subscription id: {:?}", + subscription_id + ); // TODO: do something with this handle? tokio::spawn(async move { @@ -756,7 +764,7 @@ impl Web3ProxyApp { }; } - // // trace!(?subscription_id, "closed new heads subscription"); + trace!("closed new heads subscription: {:?}", subscription_id); }); } _ => return Err(anyhow::anyhow!("unimplemented")), diff --git a/web3_proxy/src/frontend/rpc_proxy_ws.rs b/web3_proxy/src/frontend/rpc_proxy_ws.rs index e98877b0..0f9ef556 100644 --- a/web3_proxy/src/frontend/rpc_proxy_ws.rs +++ b/web3_proxy/src/frontend/rpc_proxy_ws.rs @@ -263,6 +263,7 @@ async fn read_web3_socket( let subscription_count = AtomicUsize::new(1); while let Some(Ok(msg)) = ws_rx.next().await { + // TODO: spawn this? // new message from our client. forward to a backend and then send it through response_tx let response_msg = match msg { Message::Text(payload) => { @@ -320,6 +321,7 @@ async fn write_web3_socket( ) { // TODO: increment counter for open websockets + // TODO: is there any way to make this stream receive. while let Ok(msg) = response_rx.recv_async().await { // a response is ready diff --git a/web3_proxy/src/rpcs/blockchain.rs b/web3_proxy/src/rpcs/blockchain.rs index 06533123..3f0ce72e 100644 --- a/web3_proxy/src/rpcs/blockchain.rs +++ b/web3_proxy/src/rpcs/blockchain.rs @@ -62,11 +62,11 @@ impl Web3Connections { } if blockchain.contains_node(*block_hash) { - // // trace!(%block_hash, %block_num, "block already saved"); + // trace!(%block_hash, %block_num, "block already saved"); return Ok(()); } - // // trace!(%block_hash, %block_num, "saving new block"); + // trace!(%block_hash, %block_num, "saving new block"); // TODO: this block is very likely already in block_hashes self.block_hashes