@@ -24,7 +24,6 @@ use tips_core::{
2424use tokio:: sync:: { broadcast, mpsc} ;
2525use tokio:: time:: { Duration , Instant , timeout} ;
2626use tracing:: { debug, info, warn} ;
27- use uuid:: Uuid ;
2827
2928use crate :: metrics:: { Metrics , record_histogram} ;
3029use crate :: queue:: { BundleQueuePublisher , MessageQueue , UserOpQueuePublisher } ;
@@ -86,7 +85,7 @@ pub struct IngressService<Q: MessageQueue, M: Mempool> {
8685 builder_backrun_tx : broadcast:: Sender < AcceptedBundle > ,
8786 max_backrun_txs : usize ,
8887 max_backrun_gas_limit : u64 ,
89- bundle_cache : Cache < Uuid , ( ) > ,
88+ bundle_cache : Cache < B256 , ( ) > ,
9089}
9190
9291impl < Q : MessageQueue , M : Mempool > IngressService < Q , M > {
@@ -308,43 +307,40 @@ impl<Q: MessageQueue + 'static, M: Mempool + 'static> IngressApiServer for Ingre
308307
309308 let bundle_hash = & parsed_bundle. bundle_hash ( ) ;
310309
311- self . metrics . bundles_parsed . increment ( 1 ) ;
312-
313- let meter_bundle_response = match self . meter_bundle ( & bundle, bundle_hash) . await {
314- Ok ( response) => {
315- info ! ( message = "Metering succeeded for raw transaction" , bundle_hash = %bundle_hash, response = ?response) ;
316- Some ( response)
317- }
318- Err ( e) => {
319- warn ! (
320- bundle_hash = %bundle_hash,
321- error = %e,
322- "Metering failed for raw transaction"
323- ) ;
324- None
325- }
326- } ;
327-
328- if let Some ( meter_info) = meter_bundle_response. as_ref ( ) {
329- self . metrics . successful_simulations . increment ( 1 ) ;
330- _ = self . builder_tx . send ( meter_info. clone ( ) ) ;
331- } else {
332- self . metrics . failed_simulations . increment ( 1 ) ;
333- }
334-
335- let accepted_bundle =
336- AcceptedBundle :: new ( parsed_bundle, meter_bundle_response. unwrap_or_default ( ) ) ;
337-
338- let bundle_id = * accepted_bundle. uuid ( ) ;
339- if self . bundle_cache . get ( & bundle_id) . await . is_some ( ) {
310+ if self . bundle_cache . get ( bundle_hash) . await . is_some ( ) {
340311 debug ! (
341312 message = "Duplicate bundle detected, skipping Kafka publish" ,
342- bundle_id = %bundle_id,
343313 bundle_hash = %bundle_hash,
344314 transaction_hash = %transaction. tx_hash( ) ,
345315 ) ;
346316 } else {
347- self . bundle_cache . insert ( bundle_id, ( ) ) . await ;
317+ self . bundle_cache . insert ( * bundle_hash, ( ) ) . await ;
318+ self . metrics . bundles_parsed . increment ( 1 ) ;
319+
320+ let meter_bundle_response = match self . meter_bundle ( & bundle, bundle_hash) . await {
321+ Ok ( response) => {
322+ info ! ( message = "Metering succeeded for raw transaction" , bundle_hash = %bundle_hash, response = ?response) ;
323+ Some ( response)
324+ }
325+ Err ( e) => {
326+ warn ! (
327+ bundle_hash = %bundle_hash,
328+ error = %e,
329+ "Metering failed for raw transaction"
330+ ) ;
331+ None
332+ }
333+ } ;
334+
335+ if let Some ( meter_info) = meter_bundle_response. as_ref ( ) {
336+ self . metrics . successful_simulations . increment ( 1 ) ;
337+ _ = self . builder_tx . send ( meter_info. clone ( ) ) ;
338+ } else {
339+ self . metrics . failed_simulations . increment ( 1 ) ;
340+ }
341+
342+ let accepted_bundle =
343+ AcceptedBundle :: new ( parsed_bundle, meter_bundle_response. unwrap_or_default ( ) ) ;
348344
349345 if send_to_kafka {
350346 if let Err ( e) = self
0 commit comments