@@ -36,12 +36,7 @@ pub struct TransactionMetadata {
3636#[ derive( Debug , Clone , Serialize , Deserialize ) ]
3737#[ serde( tag = "event" , content = "data" ) ]
3838pub enum BundleHistoryEvent {
39- Created {
40- key : String ,
41- timestamp : i64 ,
42- bundle : Bundle ,
43- } ,
44- Updated {
39+ Received {
4540 key : String ,
4641 timestamp : i64 ,
4742 bundle : Bundle ,
@@ -73,8 +68,7 @@ pub enum BundleHistoryEvent {
7368impl BundleHistoryEvent {
7469 pub fn key ( & self ) -> & str {
7570 match self {
76- BundleHistoryEvent :: Created { key, .. } => key,
77- BundleHistoryEvent :: Updated { key, .. } => key,
71+ BundleHistoryEvent :: Received { key, .. } => key,
7872 BundleHistoryEvent :: Cancelled { key, .. } => key,
7973 BundleHistoryEvent :: BuilderIncluded { key, .. } => key,
8074 BundleHistoryEvent :: BlockIncluded { key, .. } => key,
@@ -106,12 +100,7 @@ fn update_bundle_history_transform(
106100 }
107101
108102 let history_event = match & event. event {
109- BundleEvent :: Created { bundle, .. } => BundleHistoryEvent :: Created {
110- key : event. key . clone ( ) ,
111- timestamp : event. timestamp ,
112- bundle : bundle. clone ( ) ,
113- } ,
114- BundleEvent :: Updated { bundle, .. } => BundleHistoryEvent :: Updated {
103+ BundleEvent :: Received { bundle, .. } => BundleHistoryEvent :: Received {
115104 key : event. key . clone ( ) ,
116105 timestamp : event. timestamp ,
117106 bundle : bundle. clone ( ) ,
@@ -396,7 +385,7 @@ mod tests {
396385 let bundle_history = BundleHistory { history : vec ! [ ] } ;
397386 let bundle = create_test_bundle ( ) ;
398387 let bundle_id = Uuid :: new_v4 ( ) ;
399- let bundle_event = BundleEvent :: Created {
388+ let bundle_event = BundleEvent :: Received {
400389 bundle_id,
401390 bundle : bundle. clone ( ) ,
402391 } ;
@@ -409,7 +398,7 @@ mod tests {
409398 assert_eq ! ( bundle_history. history. len( ) , 1 ) ;
410399
411400 match & bundle_history. history [ 0 ] {
412- BundleHistoryEvent :: Created {
401+ BundleHistoryEvent :: Received {
413402 key,
414403 timestamp : ts,
415404 bundle : b,
@@ -424,7 +413,7 @@ mod tests {
424413
425414 #[ test]
426415 fn test_update_bundle_history_transform_skips_duplicate_key ( ) {
427- let existing_event = BundleHistoryEvent :: Created {
416+ let existing_event = BundleHistoryEvent :: Received {
428417 key : "duplicate-key" . to_string ( ) ,
429418 timestamp : 1111111111 ,
430419 bundle : create_test_bundle ( ) ,
@@ -435,7 +424,7 @@ mod tests {
435424
436425 let bundle = create_test_bundle ( ) ;
437426 let bundle_id = Uuid :: new_v4 ( ) ;
438- let bundle_event = BundleEvent :: Updated { bundle_id, bundle } ;
427+ let bundle_event = BundleEvent :: Received { bundle_id, bundle } ;
439428 let event = create_test_event ( "duplicate-key" , 1234567890 , bundle_event) ;
440429
441430 let result = update_bundle_history_transform ( bundle_history, & event) ;
@@ -449,24 +438,16 @@ mod tests {
449438 let bundle_id = Uuid :: new_v4 ( ) ;
450439
451440 let bundle = create_test_bundle ( ) ;
452- let bundle_event = BundleEvent :: Created {
441+ let bundle_event = BundleEvent :: Received {
453442 bundle_id,
454443 bundle : bundle. clone ( ) ,
455444 } ;
456445 let event = create_test_event ( "test-key" , 1234567890 , bundle_event) ;
457446 let result = update_bundle_history_transform ( bundle_history. clone ( ) , & event) ;
458447 assert ! ( result. is_some( ) ) ;
459448
460- let bundle_event = BundleEvent :: Updated {
461- bundle_id,
462- bundle : bundle. clone ( ) ,
463- } ;
464- let event = create_test_event ( "test-key-2" , 1234567890 , bundle_event) ;
465- let result = update_bundle_history_transform ( bundle_history. clone ( ) , & event) ;
466- assert ! ( result. is_some( ) ) ;
467-
468449 let bundle_event = BundleEvent :: Cancelled { bundle_id } ;
469- let event = create_test_event ( "test-key-3 " , 1234567890 , bundle_event) ;
450+ let event = create_test_event ( "test-key-2 " , 1234567890 , bundle_event) ;
470451 let result = update_bundle_history_transform ( bundle_history. clone ( ) , & event) ;
471452 assert ! ( result. is_some( ) ) ;
472453
@@ -476,7 +457,7 @@ mod tests {
476457 block_number : 12345 ,
477458 flashblock_index : 1 ,
478459 } ;
479- let event = create_test_event ( "test-key-4 " , 1234567890 , bundle_event) ;
460+ let event = create_test_event ( "test-key-3 " , 1234567890 , bundle_event) ;
480461 let result = update_bundle_history_transform ( bundle_history. clone ( ) , & event) ;
481462 assert ! ( result. is_some( ) ) ;
482463
@@ -485,15 +466,15 @@ mod tests {
485466 block_number : 12345 ,
486467 block_hash : TxHash :: from ( [ 1u8 ; 32 ] ) ,
487468 } ;
488- let event = create_test_event ( "test-key-5 " , 1234567890 , bundle_event) ;
469+ let event = create_test_event ( "test-key-4 " , 1234567890 , bundle_event) ;
489470 let result = update_bundle_history_transform ( bundle_history. clone ( ) , & event) ;
490471 assert ! ( result. is_some( ) ) ;
491472
492473 let bundle_event = BundleEvent :: Dropped {
493474 bundle_id,
494475 reason : DropReason :: TimedOut ,
495476 } ;
496- let event = create_test_event ( "test-key-6 " , 1234567890 , bundle_event) ;
477+ let event = create_test_event ( "test-key-5 " , 1234567890 , bundle_event) ;
497478 let result = update_bundle_history_transform ( bundle_history, & event) ;
498479 assert ! ( result. is_some( ) ) ;
499480 }
0 commit comments