Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 77 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 24 additions & 13 deletions bin/tips-ingress-rpc/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,18 +73,27 @@ async fn main() -> anyhow::Result<()> {
let (audit_tx, audit_rx) = mpsc::unbounded_channel::<BundleEvent>();
connect_audit_to_publisher(audit_rx, audit_publisher);

let user_op_properties_file = &config.user_operation_consumer_properties;

let mempool_engine = create_mempool_engine(
user_op_properties_file,
&config.user_operation_topic,
&config.user_operation_consumer_group_id,
None,
)?;

let mempool_engine_handle = {
let engine = mempool_engine.clone();
tokio::spawn(async move { engine.run().await })
let (mempool_engine, mempool_engine_handle) = if let Some(user_op_properties_file) =
&config.user_operation_consumer_properties
{
let engine = create_mempool_engine(
user_op_properties_file,
&config.user_operation_topic,
&config.user_operation_consumer_group_id,
None,
)?;

let handle = {
let engine_clone = engine.clone();
tokio::spawn(async move { engine_clone.run().await })
};

(Some(engine), Some(handle))
} else {
info!(
"User operation consumer properties not provided, skipping mempool engine initialization"
);
(None, None)
};

let (builder_tx, _) =
Expand Down Expand Up @@ -126,7 +135,9 @@ async fn main() -> anyhow::Result<()> {

handle.stopped().await;
health_handle.abort();
mempool_engine_handle.abort();
if let Some(engine_handle) = mempool_engine_handle {
engine_handle.abort();
}

Ok(())
}
2 changes: 1 addition & 1 deletion crates/account-abstraction-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true, features = ["std"] }
anyhow = { workspace = true, features = ["std"] }
serde_json = { workspace = true, features = ["std"] }
rdkafka = { workspace = true, features = ["tokio", "libz"] }
rdkafka = { workspace = true, features = ["tokio", "libz", "zstd", "ssl-vendored"] }
alloy-rpc-types = { workspace = true, features = ["eth"] }
jsonrpsee = { workspace = true, features = ["server", "macros"] }
alloy-provider = { workspace = true, features = ["reqwest"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/audit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ uuid = { workspace = true, features = ["v4", "serde"] }
tracing = { workspace = true, features = ["std"] }
anyhow = { workspace = true, features = ["std"] }
serde_json = { workspace = true, features = ["std"] }
rdkafka = { workspace = true, features = ["tokio", "libz"] }
rdkafka = { workspace = true, features = ["tokio", "libz", "zstd", "ssl-vendored"] }
alloy-consensus = { workspace = true, features = ["std"] }
alloy-primitives = { workspace = true, features = ["map-foldhash", "serde"] }
aws-sdk-s3 = { workspace = true, features = ["rustls", "default-https-client", "rt-tokio"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/ingress-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ tokio = { workspace = true, features = ["full"] }
tracing = { workspace = true, features = ["std"] }
anyhow = { workspace = true, features = ["std"] }
serde_json = { workspace = true, features = ["std"] }
rdkafka = { workspace = true, features = ["tokio", "libz"] }
rdkafka = { workspace = true, features = ["tokio", "libz", "zstd", "ssl-vendored"] }
alloy-consensus = { workspace = true, features = ["std"] }
alloy-provider = { workspace = true, features = ["reqwest"] }
jsonrpsee = { workspace = true, features = ["server", "macros"] }
Expand Down
2 changes: 1 addition & 1 deletion crates/ingress-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ pub struct Config {
long,
env = "TIPS_INGRESS_KAFKA_USER_OPERATION_CONSUMER_PROPERTIES_FILE"
)]
pub user_operation_consumer_properties: String,
pub user_operation_consumer_properties: Option<String>,

/// Consumer group id for user operation topic (set uniquely per deployment)
#[arg(
Expand Down
23 changes: 13 additions & 10 deletions crates/ingress-rpc/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ pub struct IngressService<Q: MessageQueue, M: Mempool> {
tx_submission_method: TxSubmissionMethod,
bundle_queue_publisher: BundleQueuePublisher<Q>,
user_op_queue_publisher: UserOpQueuePublisher<Q>,
reputation_service: Arc<ReputationServiceImpl<M>>,
reputation_service: Option<Arc<ReputationServiceImpl<M>>>,
audit_channel: mpsc::UnboundedSender<BundleEvent>,
send_transaction_default_lifetime_seconds: u64,
metrics: Metrics,
Expand All @@ -93,9 +93,10 @@ impl<Q: MessageQueue, M: Mempool> IngressService<Q, M> {
audit_channel: mpsc::UnboundedSender<BundleEvent>,
builder_tx: broadcast::Sender<MeterBundleResponse>,
builder_backrun_tx: broadcast::Sender<AcceptedBundle>,
mempool_engine: Arc<MempoolEngine<M>>,
mempool_engine: impl Into<Option<Arc<MempoolEngine<M>>>>,
config: Config,
) -> Self {
let mempool_engine = mempool_engine.into();
let mempool_provider = Arc::new(providers.mempool);
let simulation_provider = Arc::new(providers.simulation);
let raw_tx_forward_provider = providers.raw_tx_forward.map(Arc::new);
Expand All @@ -104,7 +105,9 @@ impl<Q: MessageQueue, M: Mempool> IngressService<Q, M> {
config.validate_user_operation_timeout_ms,
);
let queue_connection = Arc::new(queue);
let reputation_service = ReputationServiceImpl::new(mempool_engine.get_mempool());
let reputation_service = mempool_engine
.as_ref()
.map(|engine| Arc::new(ReputationServiceImpl::new(engine.get_mempool())));
Self {
mempool_provider,
simulation_provider,
Expand All @@ -119,7 +122,7 @@ impl<Q: MessageQueue, M: Mempool> IngressService<Q, M> {
queue_connection.clone(),
config.ingress_topic,
),
reputation_service: Arc::new(reputation_service),
reputation_service,
audit_channel,
send_transaction_default_lifetime_seconds: config
.send_transaction_default_lifetime_seconds,
Expand Down Expand Up @@ -384,11 +387,11 @@ impl<Q: MessageQueue + 'static, M: Mempool + 'static> IngressApiServer for Ingre
chain_id: 1,
};

// DO Nothing with reputation at the moment as this is scafolding
let _ = self
.reputation_service
.get_reputation(&request.user_operation.sender())
.await;
if let Some(reputation_service) = &self.reputation_service {
let _ = reputation_service
.get_reputation(&request.user_operation.sender())
.await;
}

let user_op_hash = request.hash().map_err(|e| {
warn!(message = "Failed to hash user operation", error = %e);
Expand Down Expand Up @@ -592,7 +595,7 @@ mod tests {
ingress_topic: String::new(),
audit_kafka_properties: String::new(),
audit_topic: String::new(),
user_operation_consumer_properties: String::new(),
user_operation_consumer_properties: Some(String::new()),
user_operation_consumer_group_id: "tips-user-operation".to_string(),
log_level: String::from("info"),
log_format: tips_core::logger::LogFormat::Pretty,
Expand Down
2 changes: 1 addition & 1 deletion crates/system-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ anyhow = { workspace = true, features = ["std"] }
uuid = { workspace = true, features = ["v4", "serde"] }
serde_json = { workspace = true, features = ["std"] }
reqwest = { version = "0.12.12", features = ["json"] }
rdkafka = { workspace = true, features = ["tokio", "libz"] }
rdkafka = { workspace = true, features = ["tokio", "libz", "zstd", "ssl-vendored"] }
alloy-consensus = { workspace = true, features = ["std"] }
alloy-provider = { workspace = true, features = ["reqwest"] }
jsonrpsee = { workspace = true, features = ["server", "macros"] }
Expand Down