Skip to content

Commit 2f11948

Browse files
workspace: migrate hyper to 1.x PART 11
1 parent 58bc7b5 commit 2f11948

File tree

26 files changed

+82
-101
lines changed

26 files changed

+82
-101
lines changed

Cargo.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,7 @@ async-recursion = "1.1.0"
218218
async-stream = "0.3.3"
219219
async-trait = "0.1.79"
220220
asynchronous-codec = "0.7.0"
221-
axum_08 = { package = "axum", version = "0.8" }
222-
# TODO(victork): finalise migration to hyper 1.x
221+
axum = "0.8"
223222
base64 = "0.13.0"
224223
bench_tools.path = "crates/bench_tools"
225224
bitvec = "1.0.1"
@@ -264,13 +263,11 @@ futures-util = "0.3.21"
264263
glob = "0.3.1"
265264
google-cloud-storage = "0.22.1"
266265
hex = "0.4.3"
267-
http = "0.2.8"
268-
http-body = "0.4.5"
266+
http = "1.1"
269267
http-body-util = "0.1"
270-
http_1 = { package = "http", version = "1.1" }
271268
human_bytes = "0.4.3"
269+
hyper = "1.8"
272270
hyper-util = "0.1.19"
273-
hyper_1 = { package = "hyper", version = "1.8" }
274271
indexmap = "2.1.0"
275272
indoc = "2.0.5"
276273
insta = "1.29.0"
@@ -375,8 +372,7 @@ tokio-test = "0.4.4"
375372
tokio-util = "0.7.13"
376373
toml = "0.8"
377374
toml_test_utils.path = "toml_test_utils"
378-
tower = { package = "tower", version = "0.4.13" }
379-
tower_05 = { package = "tower", version = "0.5.2" }
375+
tower = "0.5.2"
380376
tracing = "0.1.37"
381377
tracing-subscriber = "0.3.16"
382378
tracing-test = "0.2"

crates/apollo_batcher_types/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ thiserror.workspace = true
3232
[dev-dependencies]
3333
apollo_infra_utils = { workspace = true, features = ["testing"] }
3434
apollo_storage = { workspace = true, features = ["testing"] }
35-
axum_08.workspace = true
35+
axum.workspace = true
3636
mockall.workspace = true
3737
serde_json.workspace = true
3838
starknet_api = { workspace = true, features = ["testing"] }
3939
tokio = { workspace = true, features = ["full", "test-util"] }
40-
tower_05.workspace = true
40+
tower.workspace = true

crates/apollo_http_server/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ apollo_infra_utils.workspace = true
2828
apollo_metrics.workspace = true
2929
apollo_proc_macros.workspace = true
3030
async-trait.workspace = true
31-
axum_08.workspace = true
31+
axum.workspace = true
3232
blockifier_reexecution.workspace = true
3333
blockifier_test_utils = { workspace = true, optional = true }
3434
futures.workspace = true

crates/apollo_http_server/src/errors.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@ use apollo_gateway_types::deprecated_gateway_error::{
88
StarknetErrorCode,
99
};
1010
use apollo_gateway_types::errors::GatewayError;
11-
// TODO(victork): finalise migration to hyper 1.x
12-
use axum_08::http::StatusCode;
13-
use axum_08::response::{IntoResponse, Response};
11+
use axum::http::StatusCode;
12+
use axum::response::{IntoResponse, Response};
1413
use regex::Regex;
1514
use starknet_api::compression_utils::CompressionError;
1615
use thiserror::Error;

crates/apollo_http_server/src/http_server.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ use apollo_infra::component_definitions::ComponentStarter;
2121
use apollo_infra_utils::type_name::short_type_name;
2222
use apollo_proc_macros::sequencer_latency_histogram;
2323
use async_trait::async_trait;
24-
// TODO(victork): finalise migration to hyper 1.x
25-
use axum_08::http::HeaderMap;
26-
use axum_08::routing::{get, post};
27-
use axum_08::{Extension, Json, Router};
24+
use axum::http::HeaderMap;
25+
use axum::routing::{get, post};
26+
use axum::{serve, Extension, Json, Router};
2827
use blockifier_reexecution::serde_utils::deserialize_transaction_json_to_starknet_api_tx;
2928
use serde::de::Error;
3029
use starknet_api::rpc_transaction::RpcTransaction;
@@ -112,7 +111,7 @@ impl HttpServer {
112111

113112
// Create a server that runs forever.
114113
let listener = TcpListener::bind(&addr).await?;
115-
Ok(axum_08::serve(listener, app).await?)
114+
Ok(serve(listener, app).await?)
116115
}
117116

118117
// TODO(Yael): consider supporting both formats in the same endpoint if possible.

crates/apollo_http_server/src/http_server_test.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ use apollo_gateway_types::gateway_types::{
1313
};
1414
use apollo_infra::component_client::ClientError;
1515
use apollo_proc_macros::unique_u16;
16-
// TODO(victork): finalise migration to hyper 1.x
17-
use axum_08::body::Bytes;
18-
use axum_08::http::StatusCode;
19-
use axum_08::response::{IntoResponse, Response};
20-
use axum_08::Json;
16+
use axum::body::Bytes;
17+
use axum::http::StatusCode;
18+
use axum::response::{IntoResponse, Response};
19+
use axum::Json;
2120
use http_body_util::BodyExt;
2221
use rstest::rstest;
2322
use serde_json::Value;

crates/apollo_infra/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ apollo_metrics.workspace = true
2020
async-trait.workspace = true
2121
bytes.workspace = true
2222
derive_more = { workspace = true, features = ["display", "from_str"] }
23+
http.workspace = true
2324
http-body-util.workspace = true
24-
http_1.workspace = true
25+
hyper = { workspace = true, features = ["server"] }
2526
hyper-util = { workspace = true, features = ["client-legacy", "server-auto", "tokio"] }
26-
hyper_1 = { workspace = true, features = ["server"] }
2727
metrics-exporter-prometheus.workspace = true
2828
rand.workspace = true
2929
rstest.workspace = true

crates/apollo_infra/src/component_client/definitions.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
// TODO(victork): finalise migration to hyper 1.x
2-
use http_1::StatusCode;
1+
use http::StatusCode;
32
use serde::de::DeserializeOwned;
43
use serde::Serialize;
54
use thiserror::Error;

crates/apollo_infra/src/component_client/remote_component_client.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ use std::time::Duration;
66
use apollo_config::dumping::{ser_param, SerializeConfig};
77
use apollo_config::{ParamPath, ParamPrivacyInput, SerializedParam};
88
use async_trait::async_trait;
9-
// TODO(victork): finalise migration to hyper 1.x
109
use bytes::Bytes;
11-
use http_1::header::CONTENT_TYPE;
12-
use http_1::{StatusCode, Uri};
10+
use http::header::CONTENT_TYPE;
11+
use http::{StatusCode, Uri};
1312
use http_body_util::{BodyExt, Full};
14-
use hyper_1::body::Body;
15-
use hyper_1::{Request as HyperRequest, Response as HyperResponse};
13+
use hyper::body::Body;
14+
use hyper::{Request as HyperRequest, Response as HyperResponse};
1615
use hyper_util::client::legacy::connect::HttpConnector;
1716
use hyper_util::client::legacy::Client;
1817
use hyper_util::rt::TokioExecutor;

crates/apollo_infra/src/component_server/remote_component_server.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,13 @@ use apollo_config::dumping::{ser_param, SerializeConfig};
77
use apollo_config::{ParamPath, ParamPrivacyInput, SerializedParam};
88
use apollo_infra_utils::type_name::short_type_name;
99
use async_trait::async_trait;
10-
// TODO(victork): finalise migration to hyper 1.x
1110
use bytes::Bytes;
12-
use http_1::header::CONTENT_TYPE;
13-
use http_1::StatusCode;
11+
use http::header::CONTENT_TYPE;
12+
use http::StatusCode;
1413
use http_body_util::{BodyExt, Full};
15-
use hyper_1::body::Incoming;
16-
use hyper_1::service::{service_fn, Service};
17-
use hyper_1::{Request as HyperRequest, Response as HyperResponse};
14+
use hyper::body::Incoming;
15+
use hyper::service::{service_fn, Service};
16+
use hyper::{Request as HyperRequest, Response as HyperResponse};
1817
use hyper_util::rt::{TokioExecutor, TokioIo};
1918
use hyper_util::server::conn::auto::Builder as ServerBuilder;
2019
use serde::de::DeserializeOwned;
@@ -134,7 +133,7 @@ where
134133
request_id: RequestId,
135134
local_client: LocalComponentClient<Request, Response>,
136135
metrics: &'static RemoteServerMetrics,
137-
) -> Result<HyperResponse<Full<Bytes>>, hyper_1::Error> {
136+
) -> Result<HyperResponse<Full<Bytes>>, hyper::Error> {
138137
trace!("Received HTTP request: {http_request:?}");
139138
let body_bytes = http_request.into_body().collect().await?.to_bytes();
140139
trace!("Extracted {} bytes from HTTP request body", body_bytes.len());
@@ -275,7 +274,7 @@ where
275274
// Error type ambiguity.
276275
let wrapped_response: Result<
277276
HyperResponse<Full<Bytes>>,
278-
hyper_1::Error,
277+
hyper::Error,
279278
> = Ok(response);
280279
wrapped_response
281280
});

0 commit comments

Comments
 (0)