1- use alloy_primitives:: Address ;
1+ use alloy_primitives:: B256 ;
22use alloy_rpc_types_mev:: EthSendBundle ;
33use anyhow:: { Error , Result } ;
44use async_trait:: async_trait;
@@ -10,7 +10,7 @@ use tracing::{error, info};
1010/// A queue to buffer transactions
1111#[ async_trait]
1212pub trait QueuePublisher : Send + Sync {
13- async fn publish ( & self , bundle : & EthSendBundle , sender : Address ) -> Result < ( ) > ;
13+ async fn publish ( & self , bundle : & EthSendBundle , bundle_hash : & B256 ) -> Result < ( ) > ;
1414}
1515
1616/// A queue to buffer transactions
@@ -27,9 +27,9 @@ impl KafkaQueuePublisher {
2727 pub async fn enqueue_bundle (
2828 & self ,
2929 bundle : & EthSendBundle ,
30- sender : Address ,
30+ bundle_hash : & B256 ,
3131 ) -> Result < ( ) , Error > {
32- let key = sender . to_string ( ) ;
32+ let key = bundle_hash . to_string ( ) ;
3333 let payload = serde_json:: to_vec ( bundle) ?;
3434
3535 let enqueue = || async {
@@ -38,7 +38,7 @@ impl KafkaQueuePublisher {
3838 match self . producer . send ( record, Duration :: from_secs ( 5 ) ) . await {
3939 Ok ( ( partition, offset) ) => {
4040 info ! (
41- sender = %sender ,
41+ bundle_hash = %bundle_hash ,
4242 partition = partition,
4343 offset = offset,
4444 topic = %self . topic,
@@ -48,7 +48,7 @@ impl KafkaQueuePublisher {
4848 }
4949 Err ( ( err, _) ) => {
5050 error ! (
51- sender = %sender ,
51+ bundle_hash = %bundle_hash ,
5252 error = %err,
5353 topic = %self . topic,
5454 "Failed to enqueue bundle"
@@ -74,8 +74,8 @@ impl KafkaQueuePublisher {
7474
7575#[ async_trait]
7676impl QueuePublisher for KafkaQueuePublisher {
77- async fn publish ( & self , bundle : & EthSendBundle , sender : Address ) -> Result < ( ) > {
78- self . enqueue_bundle ( bundle, sender ) . await
77+ async fn publish ( & self , bundle : & EthSendBundle , bundle_hash : & B256 ) -> Result < ( ) > {
78+ self . enqueue_bundle ( bundle, bundle_hash ) . await
7979 }
8080}
8181
@@ -100,10 +100,10 @@ mod tests {
100100
101101 let publisher = KafkaQueuePublisher :: new ( producer, "tips-ingress-rpc" . to_string ( ) ) ;
102102 let bundle = create_test_bundle ( ) ;
103- let sender = Address :: ZERO ;
103+ let bundle_hash = bundle . bundle_hash ( ) ;
104104
105105 let start = Instant :: now ( ) ;
106- let result = publisher. enqueue_bundle ( & bundle, sender ) . await ;
106+ let result = publisher. enqueue_bundle ( & bundle, & bundle_hash ) . await ;
107107 let elapsed = start. elapsed ( ) ;
108108
109109 // the backoff tries at minimum 100ms, so verify we tried at least once
0 commit comments