@@ -274,6 +274,19 @@ impl EoaExecutorStoreKeys {
274
274
None => format ! ( "eoa_executor:health:{}:{}" , self . chain_id, self . eoa) ,
275
275
}
276
276
}
277
+
278
+ /// Manual reset key name.
279
+ ///
280
+ /// This holds a timestamp if a manual reset is scheduled.
281
+ pub fn manual_reset_key_name ( & self ) -> String {
282
+ match & self . namespace {
283
+ Some ( ns) => format ! (
284
+ "{ns}:eoa_executor:pending_manual_reset:{}:{}" ,
285
+ self . chain_id, self . eoa
286
+ ) ,
287
+ None => format ! ( "eoa_executor:pending_manual_reset:{}:{}" , self . chain_id, self . eoa) ,
288
+ }
289
+ }
277
290
}
278
291
279
292
impl EoaExecutorStore {
@@ -341,6 +354,7 @@ impl From<BorrowedTransactionData> for SubmittedTransactionDehydrated {
341
354
transaction_hash : data. signed_transaction . hash ( ) . to_string ( ) ,
342
355
transaction_id : data. transaction_id . clone ( ) ,
343
356
queued_at : data. queued_at ,
357
+ submitted_at : EoaExecutorStore :: now ( ) ,
344
358
}
345
359
}
346
360
}
@@ -721,6 +735,15 @@ impl EoaExecutorStore {
721
735
Ok ( ( ) )
722
736
}
723
737
738
+ /// Schedule a manual reset for the EOA
739
+ pub async fn schedule_manual_reset ( & self ) -> Result < ( ) , TransactionStoreError > {
740
+ let manual_reset_key = self . manual_reset_key_name ( ) ;
741
+ let mut conn = self . redis . clone ( ) ;
742
+ conn. set :: < _ , _ , ( ) > ( & manual_reset_key, EoaExecutorStore :: now ( ) )
743
+ . await ?;
744
+ Ok ( ( ) )
745
+ }
746
+
724
747
/// Get count of submitted transactions awaiting confirmation
725
748
pub async fn get_submitted_transactions_count ( & self ) -> Result < u64 , TransactionStoreError > {
726
749
let submitted_key = self . submitted_transactions_zset_name ( ) ;
@@ -752,7 +775,7 @@ impl EoaExecutorStore {
752
775
}
753
776
754
777
/// Get the current time in milliseconds
755
- ///
778
+ ///
756
779
/// Used as the canonical time representation for this store
757
780
pub fn now ( ) -> u64 {
758
781
chrono:: Utc :: now ( ) . timestamp_millis ( ) . max ( 0 ) as u64
@@ -795,11 +818,13 @@ impl EoaExecutorStore {
795
818
}
796
819
797
820
/// Get all submitted transactions (raw data)
798
- pub async fn get_all_submitted_transactions ( & self ) -> Result < Vec < SubmittedTransactionDehydrated > , TransactionStoreError > {
821
+ pub async fn get_all_submitted_transactions (
822
+ & self ,
823
+ ) -> Result < Vec < SubmittedTransactionDehydrated > , TransactionStoreError > {
799
824
let submitted_key = self . submitted_transactions_zset_name ( ) ;
800
825
let mut conn = self . redis . clone ( ) ;
801
826
802
- let submitted_data: Vec < SubmittedTransactionStringWithNonce > =
827
+ let submitted_data: Vec < SubmittedTransactionStringWithNonce > =
803
828
conn. zrange_withscores ( & submitted_key, 0 , -1 ) . await ?;
804
829
805
830
let submitted_txs: Vec < SubmittedTransactionDehydrated > =
@@ -809,7 +834,10 @@ impl EoaExecutorStore {
809
834
}
810
835
811
836
/// Get attempts count for a specific transaction
812
- pub async fn get_transaction_attempts_count ( & self , transaction_id : & str ) -> Result < u64 , TransactionStoreError > {
837
+ pub async fn get_transaction_attempts_count (
838
+ & self ,
839
+ transaction_id : & str ,
840
+ ) -> Result < u64 , TransactionStoreError > {
813
841
let attempts_key = self . transaction_attempts_list_name ( transaction_id) ;
814
842
let mut conn = self . redis . clone ( ) ;
815
843
@@ -818,12 +846,15 @@ impl EoaExecutorStore {
818
846
}
819
847
820
848
/// Get all transaction attempts for a specific transaction
821
- pub async fn get_transaction_attempts ( & self , transaction_id : & str ) -> Result < Vec < TransactionAttempt > , TransactionStoreError > {
849
+ pub async fn get_transaction_attempts (
850
+ & self ,
851
+ transaction_id : & str ,
852
+ ) -> Result < Vec < TransactionAttempt > , TransactionStoreError > {
822
853
let attempts_key = self . transaction_attempts_list_name ( transaction_id) ;
823
854
let mut conn = self . redis . clone ( ) ;
824
855
825
856
let attempts_data: Vec < String > = conn. lrange ( & attempts_key, 0 , -1 ) . await ?;
826
-
857
+
827
858
let mut attempts = Vec :: new ( ) ;
828
859
for attempt_json in attempts_data {
829
860
let attempt: TransactionAttempt = serde_json:: from_str ( & attempt_json) ?;
@@ -832,6 +863,14 @@ impl EoaExecutorStore {
832
863
833
864
Ok ( attempts)
834
865
}
866
+
867
+ pub async fn is_manual_reset_scheduled ( & self ) -> Result < bool , TransactionStoreError > {
868
+ let manual_reset_key = self . manual_reset_key_name ( ) ;
869
+ let mut conn = self . redis . clone ( ) ;
870
+
871
+ let manual_reset: Option < u64 > = conn. get ( & manual_reset_key) . await ?;
872
+ Ok ( manual_reset. is_some ( ) )
873
+ }
835
874
}
836
875
837
876
// Additional error types
0 commit comments