Skip to content

Commit 0097548

Browse files
committed
finish twmq durable execution: simple
1 parent a3af8be commit 0097548

File tree

19 files changed

+2595
-67
lines changed

19 files changed

+2595
-67
lines changed

Cargo.lock

Lines changed: 86 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

aa-core/src/userop/builder.rs

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ impl<'a, C: Chain> UserOpBuilder<'a, C> {
4646
EntrypointVersion::V0_7 => UserOpBuilderV0_7::new(&self.config).build().await?,
4747
};
4848

49+
tracing::debug!("UserOp built, proceeding with signing");
50+
4951
let signature = self
5052
.config
5153
.signer
@@ -60,13 +62,15 @@ impl<'a, C: Chain> UserOpBuilder<'a, C> {
6062

6163
match &mut userop {
6264
UserOpVersion::V0_6(userop) => {
63-
userop.signature = signature.into();
65+
userop.signature = signature;
6466
}
6567
UserOpVersion::V0_7(userop) => {
66-
userop.signature = signature.into();
68+
userop.signature = signature;
6769
}
6870
}
6971

72+
tracing::debug!("UserOp signed succcessfully");
73+
7074
Ok(userop)
7175
}
7276
}
@@ -118,7 +122,7 @@ impl<'a, C: Chain> UserOpBuilderV0_6<'a, C> {
118122
.await
119123
.map_err(|err| err.to_engine_error(self.chain))?;
120124

121-
tracing::info!("Gas prices determined");
125+
tracing::debug!("Gas prices determined");
122126

123127
self.userop.max_fee_per_gas = U256::from(prices.max_fee_per_gas);
124128
self.userop.max_priority_fee_per_gas = U256::from(prices.max_priority_fee_per_gas);
@@ -130,7 +134,7 @@ impl<'a, C: Chain> UserOpBuilderV0_6<'a, C> {
130134
.await
131135
.map_err(|err| err.to_engine_paymaster_error(self.chain))?;
132136

133-
tracing::info!("Deployment status determined");
137+
tracing::debug!("v6 Userop paymaster and data determined");
134138

135139
self.userop.paymaster_and_data = pm_response.paymaster_and_data;
136140

@@ -143,6 +147,8 @@ impl<'a, C: Chain> UserOpBuilderV0_6<'a, C> {
143147
(call_gas_limit, verification_gas_limit, pre_verification_gas)
144148
}
145149
_ => {
150+
tracing::debug!("No paymaster provided gas limits, getting from bundler");
151+
146152
let bundler_response = self
147153
.chain
148154
.bundler_client()
@@ -235,7 +241,7 @@ impl<'a, C: Chain> UserOpBuilderV0_7<'a, C> {
235241
.await
236242
.map_err(|err| err.to_engine_paymaster_error(self.chain))?;
237243

238-
tracing::info!("v7 Userop paymaster and data determined");
244+
tracing::debug!("v7 Userop paymaster and data determined");
239245

240246
// Apply paymaster data
241247
self.userop.paymaster = Some(pm_response.paymaster);
@@ -260,6 +266,8 @@ impl<'a, C: Chain> UserOpBuilderV0_7<'a, C> {
260266
}
261267
_ => {
262268
// If paymaster didn't provide all gas limits, get them from the bundler
269+
tracing::debug!("No paymaster provided gas limits, getting from bundler");
270+
263271
let bundler_response = self
264272
.chain
265273
.bundler_client()
@@ -283,7 +291,7 @@ impl<'a, C: Chain> UserOpBuilderV0_7<'a, C> {
283291
}
284292
};
285293

286-
tracing::info!("Gas limits determined");
294+
tracing::debug!("Gas limits determined");
287295

288296
// Set gas limits
289297
self.userop.call_gas_limit = call_gas_limit;

cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
[workspace]
22
resolver = "2"
3-
members = [ "aa-core", "core","server"]
3+
members = [ "aa-core", "core","server", "twmq"]

core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ vault-types = { version = "0.1.0", git = "ssh://git@github.com/thirdweb-dev/vaul
1414
vault-sdk = { version = "0.1.0", git = "ssh://git@github.com/thirdweb-dev/vault.git", branch = "main" }
1515
tower = "0.5.2"
1616
tracing = "0.1.41"
17+
async-nats = "0.40.0"

core/src/executor/mod.rs

Whitespace-only changes.

core/src/rpc_clients/bundler.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ use std::collections::HashMap;
77

88
use crate::userop::UserOpVersion;
99

10-
use super::empty_params::JsonTransformerLayer;
11-
12-
/// Gas buffer added for managed account factories (matches TypeScript)
10+
// Gas buffer added for managed account factories (matches TypeScript)
1311
pub const MANAGED_ACCOUNT_GAS_BUFFER: U256 = U256::from_limbs([21_000, 0, 0, 0]);
1412

1513
/// A JSON-RPC client for interacting with an ERC-4337 bundler and paymaster

core/src/rpc_clients/empty_params.rs

Lines changed: 0 additions & 54 deletions
This file was deleted.

core/src/rpc_clients/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
mod bundler;
22
mod paymaster;
33

4-
pub(crate) mod empty_params;
54
pub use bundler::*;
65
pub use paymaster::*;

twmq/Cargo.toml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
[package]
2+
name = "twmq"
3+
version = "0.1.0"
4+
edition = "2024"
5+
6+
[dependencies]
7+
redis = { version = "0.31.0", features = ["tokio-comp", "connection-manager"] }
8+
nanoid = "0.4.0"
9+
serde = { version = "1.0.219", features = ["derive"] }
10+
serde_json = "1.0.140"
11+
tokio = "1.45.0"
12+
thiserror = "2.0.12"
13+
tracing = "0.1.41"
14+
tracing-subscriber = { version = "0.3.19", features = ["env-filter", "fmt"] }
15+
16+
[dev-dependencies]
17+
tokio = { version = "1.45.0", features = ["full"] }

twmq/src/error.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#[derive(thiserror::Error, Debug)]
2+
pub enum TwmqError {
3+
#[error("Redis error: {0}")]
4+
RedisError(#[from] redis::RedisError),
5+
6+
#[error("JSON Serialization error: {0}")]
7+
JsonError(#[from] serde_json::Error),
8+
}

0 commit comments

Comments
 (0)