@@ -9,8 +9,7 @@ use engine_core::transaction::TransactionTypeData;
99use serde:: { Deserialize , Serialize } ;
1010use std:: collections:: HashMap ;
1111use std:: ops:: Deref ;
12- use twmq:: redis:: AsyncCommands ;
13- use twmq:: redis:: cluster_async:: ClusterConnection ;
12+ use twmq:: redis:: { AsyncCommands , aio:: ConnectionManager } ;
1413
1514mod atomic;
1615mod borrowed;
@@ -99,7 +98,7 @@ pub struct TransactionData {
9998
10099/// Transaction store focused on transaction_id operations and nonce indexing
101100pub struct EoaExecutorStore {
102- pub redis : ClusterConnection ,
101+ pub redis : ConnectionManager ,
103102 pub keys : EoaExecutorStoreKeys ,
104103 pub completed_transaction_ttl_seconds : u64 ,
105104}
@@ -122,14 +121,8 @@ impl EoaExecutorStoreKeys {
122121 /// Lock key name for EOA processing
123122 pub fn eoa_lock_key_name ( & self ) -> String {
124123 match & self . namespace {
125- Some ( ns) => format ! (
126- "{ns}:{}:eoa_executor:lock:{}:{}" ,
127- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
128- ) ,
129- None => format ! (
130- "{}:eoa_executor:lock:{}:{}" ,
131- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
132- ) ,
124+ Some ( ns) => format ! ( "{ns}:eoa_executor:lock:{}:{}" , self . chain_id, self . eoa) ,
125+ None => format ! ( "eoa_executor:lock:{}:{}" , self . chain_id, self . eoa) ,
133126 }
134127 }
135128
@@ -144,14 +137,8 @@ impl EoaExecutorStoreKeys {
144137 /// - "failure_reason": String failure reason (optional)
145138 pub fn transaction_data_key_name ( & self , transaction_id : & str ) -> String {
146139 match & self . namespace {
147- Some ( ns) => format ! (
148- "{ns}:{}:eoa_executor:tx_data:{transaction_id}" ,
149- twmq:: ENGINE_HASH_TAG
150- ) ,
151- None => format ! (
152- "{}:eoa_executor:tx_data:{transaction_id}" ,
153- twmq:: ENGINE_HASH_TAG
154- ) ,
140+ Some ( ns) => format ! ( "{ns}:eoa_executor:tx_data:{transaction_id}" ) ,
141+ None => format ! ( "eoa_executor:tx_data:{transaction_id}" ) ,
155142 }
156143 }
157144
@@ -161,14 +148,8 @@ impl EoaExecutorStoreKeys {
161148 /// of a TransactionAttempt. This allows efficient append operations.
162149 pub fn transaction_attempts_list_name ( & self , transaction_id : & str ) -> String {
163150 match & self . namespace {
164- Some ( ns) => format ! (
165- "{ns}:{}:eoa_executor:tx_attempts:{transaction_id}" ,
166- twmq:: ENGINE_HASH_TAG
167- ) ,
168- None => format ! (
169- "{}:eoa_executor:tx_attempts:{transaction_id}" ,
170- twmq:: ENGINE_HASH_TAG
171- ) ,
151+ Some ( ns) => format ! ( "{ns}:eoa_executor:tx_attempts:{transaction_id}" ) ,
152+ None => format ! ( "eoa_executor:tx_attempts:{transaction_id}" ) ,
172153 }
173154 }
174155
@@ -178,13 +159,10 @@ impl EoaExecutorStoreKeys {
178159 pub fn pending_transactions_zset_name ( & self ) -> String {
179160 match & self . namespace {
180161 Some ( ns) => format ! (
181- "{ns}:{}:eoa_executor:pending_txs:{}:{}" ,
182- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
183- ) ,
184- None => format ! (
185- "{}:eoa_executor:pending_txs:{}:{}" ,
186- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
162+ "{ns}:eoa_executor:pending_txs:{}:{}" ,
163+ self . chain_id, self . eoa
187164 ) ,
165+ None => format ! ( "eoa_executor:pending_txs:{}:{}" , self . chain_id, self . eoa) ,
188166 }
189167 }
190168
@@ -194,27 +172,18 @@ impl EoaExecutorStoreKeys {
194172 pub fn submitted_transactions_zset_name ( & self ) -> String {
195173 match & self . namespace {
196174 Some ( ns) => format ! (
197- "{ns}:{}:eoa_executor:submitted_txs:{}:{}" ,
198- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
199- ) ,
200- None => format ! (
201- "{}:eoa_executor:submitted_txs:{}:{}" ,
202- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
175+ "{ns}:eoa_executor:submitted_txs:{}:{}" ,
176+ self . chain_id, self . eoa
203177 ) ,
178+ None => format ! ( "eoa_executor:submitted_txs:{}:{}" , self . chain_id, self . eoa) ,
204179 }
205180 }
206181
207182 /// Name of the key that maps transaction hash to transaction id
208183 pub fn transaction_hash_to_id_key_name ( & self , hash : & str ) -> String {
209184 match & self . namespace {
210- Some ( ns) => format ! (
211- "{ns}:{}:eoa_executor:tx_hash_to_id:{hash}" ,
212- twmq:: ENGINE_HASH_TAG
213- ) ,
214- None => format ! (
215- "{}:eoa_executor:tx_hash_to_id:{hash}" ,
216- twmq:: ENGINE_HASH_TAG
217- ) ,
185+ Some ( ns) => format ! ( "{ns}:eoa_executor:tx_hash_to_id:{hash}" ) ,
186+ None => format ! ( "eoa_executor:tx_hash_to_id:{hash}" ) ,
218187 }
219188 }
220189
@@ -228,13 +197,10 @@ impl EoaExecutorStoreKeys {
228197 pub fn borrowed_transactions_hashmap_name ( & self ) -> String {
229198 match & self . namespace {
230199 Some ( ns) => format ! (
231- "{ns}:{}:eoa_executor:borrowed_txs:{}:{}" ,
232- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
233- ) ,
234- None => format ! (
235- "{}:eoa_executor:borrowed_txs:{}:{}" ,
236- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
200+ "{ns}:eoa_executor:borrowed_txs:{}:{}" ,
201+ self . chain_id, self . eoa
237202 ) ,
203+ None => format ! ( "eoa_executor:borrowed_txs:{}:{}" , self . chain_id, self . eoa) ,
238204 }
239205 }
240206
@@ -248,12 +214,12 @@ impl EoaExecutorStoreKeys {
248214 pub fn recycled_nonces_zset_name ( & self ) -> String {
249215 match & self . namespace {
250216 Some ( ns) => format ! (
251- "{ns}:{}: eoa_executor:recycled_nonces:{}:{}" ,
252- twmq :: ENGINE_HASH_TAG , self . chain_id, self . eoa
217+ "{ns}:eoa_executor:recycled_nonces:{}:{}" ,
218+ self . chain_id, self . eoa
253219 ) ,
254220 None => format ! (
255- "{}: eoa_executor:recycled_nonces:{}:{}" ,
256- twmq :: ENGINE_HASH_TAG , self . chain_id, self . eoa
221+ "eoa_executor:recycled_nonces:{}:{}" ,
222+ self . chain_id, self . eoa
257223 ) ,
258224 }
259225 }
@@ -270,12 +236,12 @@ impl EoaExecutorStoreKeys {
270236 pub fn optimistic_transaction_count_key_name ( & self ) -> String {
271237 match & self . namespace {
272238 Some ( ns) => format ! (
273- "{ns}:{}: eoa_executor:optimistic_nonce:{}:{}" ,
274- twmq :: ENGINE_HASH_TAG , self . chain_id, self . eoa
239+ "{ns}:eoa_executor:optimistic_nonce:{}:{}" ,
240+ self . chain_id, self . eoa
275241 ) ,
276242 None => format ! (
277- "{}: eoa_executor:optimistic_nonce:{}:{}" ,
278- twmq :: ENGINE_HASH_TAG , self . chain_id, self . eoa
243+ "eoa_executor:optimistic_nonce:{}:{}" ,
244+ self . chain_id, self . eoa
279245 ) ,
280246 }
281247 }
@@ -290,13 +256,10 @@ impl EoaExecutorStoreKeys {
290256 pub fn last_transaction_count_key_name ( & self ) -> String {
291257 match & self . namespace {
292258 Some ( ns) => format ! (
293- "{ns}:{}:eoa_executor:last_tx_nonce:{}:{}" ,
294- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
295- ) ,
296- None => format ! (
297- "{}:eoa_executor:last_tx_nonce:{}:{}" ,
298- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
259+ "{ns}:eoa_executor:last_tx_nonce:{}:{}" ,
260+ self . chain_id, self . eoa
299261 ) ,
262+ None => format ! ( "eoa_executor:last_tx_nonce:{}:{}" , self . chain_id, self . eoa) ,
300263 }
301264 }
302265
@@ -308,14 +271,8 @@ impl EoaExecutorStoreKeys {
308271 /// - timestamp of the last 5 nonce resets
309272 pub fn eoa_health_key_name ( & self ) -> String {
310273 match & self . namespace {
311- Some ( ns) => format ! (
312- "{ns}:{}:eoa_executor:health:{}:{}" ,
313- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
314- ) ,
315- None => format ! (
316- "{}:eoa_executor:health:{}:{}" ,
317- twmq:: ENGINE_HASH_TAG , self . chain_id, self . eoa
318- ) ,
274+ Some ( ns) => format ! ( "{ns}:eoa_executor:health:{}:{}" , self . chain_id, self . eoa) ,
275+ None => format ! ( "eoa_executor:health:{}:{}" , self . chain_id, self . eoa) ,
319276 }
320277 }
321278
@@ -325,20 +282,20 @@ impl EoaExecutorStoreKeys {
325282 pub fn manual_reset_key_name ( & self ) -> String {
326283 match & self . namespace {
327284 Some ( ns) => format ! (
328- "{ns}:{}: eoa_executor:pending_manual_reset:{}:{}" ,
329- twmq :: ENGINE_HASH_TAG , self . chain_id, self . eoa
285+ "{ns}:eoa_executor:pending_manual_reset:{}:{}" ,
286+ self . chain_id, self . eoa
330287 ) ,
331288 None => format ! (
332- "{}: eoa_executor:pending_manual_reset:{}:{}" ,
333- twmq :: ENGINE_HASH_TAG , self . chain_id, self . eoa
289+ "eoa_executor:pending_manual_reset:{}:{}" ,
290+ self . chain_id, self . eoa
334291 ) ,
335292 }
336293 }
337294}
338295
339296impl EoaExecutorStore {
340297 pub fn new (
341- redis : ClusterConnection ,
298+ redis : ConnectionManager ,
342299 namespace : Option < String > ,
343300 eoa : Address ,
344301 chain_id : u64 ,
0 commit comments