From 3774f92f1a7ea31a2be847abbe2ce60b80499534 Mon Sep 17 00:00:00 2001 From: Gustavo Inacio Date: Mon, 12 Aug 2024 13:45:06 -0300 Subject: [PATCH] chore: cleanup dependencies Signed-off-by: Gustavo Inacio --- Cargo.toml | 9 +++++++ tap_aggregator/Cargo.toml | 35 +++++++++++++++++----------- tap_aggregator/src/api_versioning.rs | 2 +- tap_aggregator/src/metrics.rs | 9 +++++-- tap_core/Cargo.toml | 16 +++++-------- tap_integration_tests/Cargo.toml | 23 +++++++++--------- 6 files changed, 56 insertions(+), 38 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c67b1dba..ed80196a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,3 +7,12 @@ version = "0.1.0" edition = "2021" license = "Apache-2.0" repository = "https://github.com/semiotic-ai/timeline-aggregation-protocol" + +[workspace.dependencies] +alloy = { version = "0.2.1", features = ["full"] } +serde = { version = "1.0.163", features = ["derive"] } +rstest = "0.22.0" +anyhow = { version = "1.0.70", default-features = false } +tokio = { version = "1.27.0", features = ["macros", "signal"] } +rand = "0.8.5" +jsonrpsee = { version = "0.18.0", features = ["macros", "server"] } diff --git a/tap_aggregator/Cargo.toml b/tap_aggregator/Cargo.toml index 71208e0a..b71de945 100644 --- a/tap_aggregator/Cargo.toml +++ b/tap_aggregator/Cargo.toml @@ -12,24 +12,31 @@ name = "tap_aggregator" path = "src/main.rs" [dependencies] -anyhow = "1.0.70" -tokio = { version = "1.27.0", features = ["macros", "signal"] } -tap_core = { version = "1.0.0", path = "../tap_core" } -jsonrpsee = { version = "0.18.0", features = ["server", "macros"] } -clap = { version = "4.2.4", features = ["derive", "env"] } -serde = { version = "1.0.163", features = ["derive"] } -serde_json = { version = "1.0.96", features = ["raw_value"] } -strum = { version = "0.24.1", features = ["strum_macros", "derive"] } -tracing-subscriber = { version = "0.3.17" } +tap_core = { path = "../tap_core", version = "*" } +serde.workspace = true +alloy.workspace = true +anyhow.workspace = true +tokio.workspace = true +jsonrpsee = { workspace = true, features = ["server", "macros"] } +clap = { version = "4.5.15", features = ["derive", "env"] } +serde_json = { version = "1.0.124", features = ["raw_value"] } +strum = { version = "0.26.3", features = ["derive"] } +tracing-subscriber = "0.3.17" log = "0.4.19" prometheus = "0.13.3" -axum = "0.6.18" +axum = { version = "0.7.5", features = [ + "http1", + "json", + "matched-path", + "original-uri", + "query", + "tokio", +], default-features = false } futures-util = "0.3.28" lazy_static = "1.4.0" -alloy = { version = "0.2.0", features = ["full"] } ruint = "1.10.1" [dev-dependencies] -jsonrpsee = { version = "0.18.0", features = ["http-client", "jsonrpsee-core"] } -rand = "0.8.5" -rstest = "0.17.0" +jsonrpsee = { workspace = true, features = ["http-client", "jsonrpsee-core"] } +rand.workspace = true +rstest.workspace = true diff --git a/tap_aggregator/src/api_versioning.rs b/tap_aggregator/src/api_versioning.rs index 2fbb64e1..a2db5555 100644 --- a/tap_aggregator/src/api_versioning.rs +++ b/tap_aggregator/src/api_versioning.rs @@ -18,7 +18,7 @@ use strum::{self, IntoEnumIterator}; PartialEq, strum::Display, strum::EnumString, - strum::EnumVariantNames, + strum::VariantNames, strum::EnumIter, )] pub enum TapRpcApiVersion { diff --git a/tap_aggregator/src/metrics.rs b/tap_aggregator/src/metrics.rs index 1b1b14c0..1320dcfa 100644 --- a/tap_aggregator/src/metrics.rs +++ b/tap_aggregator/src/metrics.rs @@ -3,11 +3,12 @@ use std::{net::SocketAddr, panic}; -use axum::{http::StatusCode, response::IntoResponse, routing::get, Router, Server}; +use axum::{http::StatusCode, response::IntoResponse, routing::get, serve, Router}; use futures_util::FutureExt; use jsonrpsee::tracing::error; use log::{debug, info}; use prometheus::TextEncoder; +use tokio::net::TcpListener; async fn handler_metrics() -> (StatusCode, String) { let metric_families = prometheus::gather(); @@ -34,7 +35,11 @@ async fn _run_server(port: u16) { .route("/metrics", get(handler_metrics)) .fallback(handler_404); let addr = SocketAddr::from(([0, 0, 0, 0], port)); - let server = Server::bind(&addr).serve(app.into_make_service()); + let listener = TcpListener::bind(addr) + .await + .expect("Failed to bind to indexer-service port"); + + let server = serve(listener, app.into_make_service()); info!("Metrics server listening on {}", addr); diff --git a/tap_core/Cargo.toml b/tap_core/Cargo.toml index c5367604..4dd48f0d 100644 --- a/tap_core/Cargo.toml +++ b/tap_core/Cargo.toml @@ -8,21 +8,17 @@ readme = "README.md" description = "Core Timeline Aggregation Protocol library: a fast, efficient and trustless unidirectional micro-payments system." [dependencies] -rand_core = "0.6.4" -serde = { version = "1.0", features = ["derive", "rc"] } -rand = "0.8.5" +alloy.workspace = true +serde.workspace = true +tokio.workspace = true +anyhow.workspace = true +rand.workspace = true thiserror = "1.0.38" -rstest = "0.17.0" -anyhow = "1" -alloy = { version = "0.2.0", features = ["full"] } - -strum = "0.24.1" -strum_macros = "0.24.3" async-trait = "0.1.72" -tokio = { version = "1.29.1", features = ["macros", "rt-multi-thread"] } [dev-dependencies] criterion = { version = "0.5", features = ["async_std"] } +rstest.workspace = true [features] diff --git a/tap_integration_tests/Cargo.toml b/tap_integration_tests/Cargo.toml index 16674883..ec45e063 100644 --- a/tap_integration_tests/Cargo.toml +++ b/tap_integration_tests/Cargo.toml @@ -9,17 +9,18 @@ description = "Integration tests for the Timeline Aggregation Protocol." publish = false [dependencies] -tap_aggregator = { version = "0.3.1", path = "../tap_aggregator" } -tap_core = { version = "1.0.0", path = "../tap_core", features = ["in_memory"] } -jsonrpsee = { version = "0.18.0", features = ["http-client", "server"] } -clap = { version = "4.2.4", features = ["derive", "env"] } -rstest = "0.17.0" -rand = "0.8.5" -futures = "0.3.28" -anyhow = "1.0.71" -tokio = "1.28.2" -prometheus = "0.13.3" -alloy = { version = "0.2.0", features = ["full", "signer-mnemonic"] } +tap_aggregator = { path = "../tap_aggregator" } +tap_core = { path = "../tap_core", version = "*" } +rand.workspace = true +anyhow.workspace = true +tokio.workspace = true +alloy.workspace = true +jsonrpsee.workspace = true + + +[dev-dependencies] +rstest = "0.22.0" +alloy = { workspace = true, features = ["signer-mnemonic"] } [[test]] name = "integration_tests"