Skip to content

Commit e27651f

Browse files
committed
Revert "valkey integration (#97)"
This reverts commit 6bf1f2f.
1 parent 590e57a commit e27651f

27 files changed

Lines changed: 259 additions & 407 deletions

Cargo.toml

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,17 +98,7 @@ config = "0.15.11"
9898
aws-arn = "0.3.1"
9999

100100
# Redis
101-
redis = { version = "0.31.0", features = ["tokio-comp", "connection-manager", "cluster", "cluster-async", "tls-rustls", "tokio-rustls-comp"] }
101+
redis = { version = "0.31.0", features = ["tokio-comp", "connection-manager"] }
102102

103103
# Dev dependencies
104-
criterion = { version = "0.6", features = ["html_reports", "async_tokio"] }
105-
106-
# Rustls
107-
#
108-
# NOTE: rustls 0.23 requires selecting exactly one process-wide crypto provider
109-
# (features: `ring` or `aws_lc_rs` / `aws-lc-rs`). Some dependency graphs (e.g. via
110-
# redis-rs' rustls integration) can end up with *no* provider enabled, which causes a
111-
# runtime panic when building TLS client/server configs.
112-
#
113-
# We explicitly enable the `ring` provider here to make TLS work reliably.
114-
rustls = { version = "0.23.32", default-features = false, features = ["std", "ring"] }
104+
criterion = { version = "0.6", features = ["html_reports", "async_tokio"] }

executors/src/eoa/store/atomic.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use alloy::{
44
consensus::{Signed, TypedTransaction},
55
primitives::Address,
66
};
7-
use twmq::redis::{AsyncCommands, Pipeline};
8-
use twmq::redis::cluster_async::ClusterConnection;
7+
use twmq::redis::{AsyncCommands, Pipeline, aio::ConnectionManager};
98

109
use crate::{
1110
eoa::{
@@ -44,7 +43,7 @@ pub trait SafeRedisTransaction: Send + Sync {
4443
) -> Self::OperationResult;
4544
fn validation(
4645
&self,
47-
conn: &mut ClusterConnection,
46+
conn: &mut ConnectionManager,
4847
store: &EoaExecutorStore,
4948
) -> impl Future<Output = Result<Self::ValidationData, TransactionStoreError>> + Send;
5049
fn watch_keys(&self) -> Vec<String>;
@@ -816,7 +815,7 @@ impl SafeRedisTransaction for ResetNoncesTransaction<'_> {
816815

817816
async fn validation(
818817
&self,
819-
_conn: &mut ClusterConnection,
818+
_conn: &mut ConnectionManager,
820819
store: &EoaExecutorStore,
821820
) -> Result<Self::ValidationData, TransactionStoreError> {
822821
let now = chrono::Utc::now().timestamp_millis().max(0) as u64;

executors/src/eoa/store/borrowed.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::sync::Arc;
22

33
use twmq::Queue;
4-
use twmq::redis::{AsyncCommands, Pipeline};
5-
use twmq::redis::cluster_async::ClusterConnection;
4+
use twmq::redis::{AsyncCommands, Pipeline, aio::ConnectionManager};
65

76
use crate::eoa::EoaExecutorStore;
87
use crate::eoa::{
@@ -72,7 +71,7 @@ impl SafeRedisTransaction for ProcessBorrowedTransactions<'_> {
7271

7372
async fn validation(
7473
&self,
75-
conn: &mut ClusterConnection,
74+
conn: &mut ConnectionManager,
7675
_store: &EoaExecutorStore,
7776
) -> Result<Self::ValidationData, TransactionStoreError> {
7877
// Get all borrowed transaction IDs

executors/src/eoa/store/mod.rs

Lines changed: 37 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@ use engine_core::transaction::TransactionTypeData;
99
use serde::{Deserialize, Serialize};
1010
use std::collections::HashMap;
1111
use std::ops::Deref;
12-
use twmq::redis::AsyncCommands;
13-
use twmq::redis::cluster_async::ClusterConnection;
12+
use twmq::redis::{AsyncCommands, aio::ConnectionManager};
1413

1514
mod atomic;
1615
mod borrowed;
@@ -99,7 +98,7 @@ pub struct TransactionData {
9998

10099
/// Transaction store focused on transaction_id operations and nonce indexing
101100
pub 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

339296
impl EoaExecutorStore {
340297
pub fn new(
341-
redis: ClusterConnection,
298+
redis: ConnectionManager,
342299
namespace: Option<String>,
343300
eoa: Address,
344301
chain_id: u64,

executors/src/eoa/store/pending.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
use std::collections::HashSet;
22

33
use alloy::{consensus::Transaction, primitives::Address};
4-
use twmq::redis::{AsyncCommands, Pipeline};
5-
use twmq::redis::cluster_async::ClusterConnection;
4+
use twmq::redis::{AsyncCommands, Pipeline, aio::ConnectionManager};
65

76
use crate::eoa::{
87
EoaExecutorStore,
@@ -47,7 +46,7 @@ impl SafeRedisTransaction for MovePendingToBorrowedWithIncrementedNonces<'_> {
4746

4847
async fn validation(
4948
&self,
50-
conn: &mut ClusterConnection,
49+
conn: &mut ConnectionManager,
5150
_store: &EoaExecutorStore,
5251
) -> Result<Self::ValidationData, TransactionStoreError> {
5352
if self.transactions.is_empty() {
@@ -182,7 +181,7 @@ impl SafeRedisTransaction for MovePendingToBorrowedWithRecycledNonces<'_> {
182181

183182
async fn validation(
184183
&self,
185-
conn: &mut ClusterConnection,
184+
conn: &mut ConnectionManager,
186185
_store: &EoaExecutorStore,
187186
) -> Result<Self::ValidationData, TransactionStoreError> {
188187
if self.transactions.is_empty() {

executors/src/eoa/store/submitted.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use std::{
55
};
66

77
use serde::{Deserialize, Serialize};
8-
use twmq::redis::{AsyncCommands, Pipeline};
9-
use twmq::redis::cluster_async::ClusterConnection;
8+
use twmq::redis::{AsyncCommands, Pipeline, aio::ConnectionManager};
109

1110
use crate::{
1211
TransactionCounts,
@@ -280,7 +279,7 @@ impl SafeRedisTransaction for CleanSubmittedTransactions<'_> {
280279

281280
async fn validation(
282281
&self,
283-
conn: &mut ClusterConnection,
282+
conn: &mut ConnectionManager,
284283
store: &EoaExecutorStore,
285284
) -> Result<Self::ValidationData, TransactionStoreError> {
286285
// Fetch transactions up to the latest confirmed nonce for replacements
@@ -593,7 +592,7 @@ impl SafeRedisTransaction for CleanAndGetRecycledNonces<'_> {
593592

594593
async fn validation(
595594
&self,
596-
conn: &mut ClusterConnection,
595+
conn: &mut ConnectionManager,
597596
_store: &EoaExecutorStore,
598597
) -> Result<Self::ValidationData, TransactionStoreError> {
599598
// get the highest submitted nonce

executors/src/eoa/worker/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use engine_eip7702_core::delegated_account::DelegatedAccount;
1111
use serde::{Deserialize, Serialize};
1212
use std::{sync::Arc, time::Duration};
1313
use twmq::Queue;
14-
use twmq::redis::cluster_async::ClusterConnection;
14+
use twmq::redis::aio::ConnectionManager;
1515
use twmq::{
1616
DurableExecution, FailHookData, NackHookData, SuccessHookData,
1717
hooks::TransactionContext,
@@ -114,7 +114,7 @@ where
114114
pub webhook_queue: Arc<Queue<WebhookJobHandler>>,
115115
pub authorization_cache: EoaAuthorizationCache,
116116

117-
pub redis: ClusterConnection,
117+
pub redis: ConnectionManager,
118118
pub namespace: Option<String>,
119119

120120
pub eoa_signer: Arc<EoaSigner>,

0 commit comments

Comments
 (0)