@@ -274,6 +274,19 @@ impl EoaExecutorStoreKeys {
274274 None => format ! ( "eoa_executor:health:{}:{}" , self . chain_id, self . eoa) ,
275275 }
276276 }
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+ }
277290}
278291
279292impl EoaExecutorStore {
@@ -341,6 +354,7 @@ impl From<BorrowedTransactionData> for SubmittedTransactionDehydrated {
341354 transaction_hash : data. signed_transaction . hash ( ) . to_string ( ) ,
342355 transaction_id : data. transaction_id . clone ( ) ,
343356 queued_at : data. queued_at ,
357+ submitted_at : EoaExecutorStore :: now ( ) ,
344358 }
345359 }
346360}
@@ -721,6 +735,15 @@ impl EoaExecutorStore {
721735 Ok ( ( ) )
722736 }
723737
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+
724747 /// Get count of submitted transactions awaiting confirmation
725748 pub async fn get_submitted_transactions_count ( & self ) -> Result < u64 , TransactionStoreError > {
726749 let submitted_key = self . submitted_transactions_zset_name ( ) ;
@@ -752,7 +775,7 @@ impl EoaExecutorStore {
752775 }
753776
754777 /// Get the current time in milliseconds
755- ///
778+ ///
756779 /// Used as the canonical time representation for this store
757780 pub fn now ( ) -> u64 {
758781 chrono:: Utc :: now ( ) . timestamp_millis ( ) . max ( 0 ) as u64
@@ -795,11 +818,13 @@ impl EoaExecutorStore {
795818 }
796819
797820 /// 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 > {
799824 let submitted_key = self . submitted_transactions_zset_name ( ) ;
800825 let mut conn = self . redis . clone ( ) ;
801826
802- let submitted_data: Vec < SubmittedTransactionStringWithNonce > =
827+ let submitted_data: Vec < SubmittedTransactionStringWithNonce > =
803828 conn. zrange_withscores ( & submitted_key, 0 , -1 ) . await ?;
804829
805830 let submitted_txs: Vec < SubmittedTransactionDehydrated > =
@@ -809,7 +834,10 @@ impl EoaExecutorStore {
809834 }
810835
811836 /// 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 > {
813841 let attempts_key = self . transaction_attempts_list_name ( transaction_id) ;
814842 let mut conn = self . redis . clone ( ) ;
815843
@@ -818,12 +846,15 @@ impl EoaExecutorStore {
818846 }
819847
820848 /// 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 > {
822853 let attempts_key = self . transaction_attempts_list_name ( transaction_id) ;
823854 let mut conn = self . redis . clone ( ) ;
824855
825856 let attempts_data: Vec < String > = conn. lrange ( & attempts_key, 0 , -1 ) . await ?;
826-
857+
827858 let mut attempts = Vec :: new ( ) ;
828859 for attempt_json in attempts_data {
829860 let attempt: TransactionAttempt = serde_json:: from_str ( & attempt_json) ?;
@@ -832,6 +863,14 @@ impl EoaExecutorStore {
832863
833864 Ok ( attempts)
834865 }
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+ }
835874}
836875
837876// Additional error types
0 commit comments