diff --git a/CHANGELOG.md b/CHANGELOG.md index 7682a43978..c2c789b962 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -42,6 +42,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). #### Breaking +- [#1725](https://github.com/FuelLabs/fuel-core/pull/1725): All API endpoints now are prefixed with `/v1` version. New usage looks like: `/v1/playground`, `/v1/graphql`, `/v1/graphql-sub`, `/v1/metrics`, `/v1/health`. - [#1722](https://github.com/FuelLabs/fuel-core/pull/1722): Bugfix: Zero `predicate_gas_used` field during validation of the produced block. - [#1714](https://github.com/FuelLabs/fuel-core/pull/1714): The change bumps the `fuel-vm` to `0.47.1`. It breaks several breaking changes into the protocol: - All malleable fields are zero during the execution and unavailable through the GTF getters. Accessing them via the memory directly is still possible, but they are zero. diff --git a/README.md b/README.md index 73a7cb73c5..3ba43247d4 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,7 @@ The client functionality is available through a service endpoint that expect Gra The transaction executor currently performs instant block production. Changes are persisted to RocksDB by default. -- Service endpoint: `/graphql` +- Service endpoint: `/v1/graphql` - Schema (available after building): `crates/client/assets/schema.sdl` The service expects a mutation defined as `submit` that receives a [Transaction](https://github.com/FuelLabs/fuel-vm/tree/master/fuel-tx) in hex encoded binary format, as [specified here](https://github.com/FuelLabs/fuel-specs/blob/master/src/tx-format/transaction.md). diff --git a/crates/client/src/client.rs b/crates/client/src/client.rs index b0df84c7c9..05dd40c43e 100644 --- a/crates/client/src/client.rs +++ b/crates/client/src/client.rs @@ -146,7 +146,7 @@ impl FromStr for FuelClient { let mut url = reqwest::Url::parse(&raw_url) .map_err(anyhow::Error::msg) .with_context(|| format!("Invalid fuel-core URL: {str}"))?; - url.set_path("/graphql"); + url.set_path("/v1/graphql"); #[cfg(feature = "subscriptions")] { @@ -245,7 +245,7 @@ impl FuelClient { use hyper_rustls as _; use reqwest::cookie::CookieStore; let mut url = self.url.clone(); - url.set_path("/graphql-sub"); + url.set_path("/v1/graphql-sub"); let json_query = serde_json::to_string(&q)?; let mut client_builder = es::ClientBuilder::for_url(url.as_str()) .map_err(|e| { diff --git a/crates/fuel-core/src/graphql_api/api_service.rs b/crates/fuel-core/src/graphql_api/api_service.rs index 0a4ace7913..16f9522f59 100644 --- a/crates/fuel-core/src/graphql_api/api_service.rs +++ b/crates/fuel-core/src/graphql_api/api_service.rs @@ -198,14 +198,14 @@ where .finish(); let router = Router::new() - .route("/playground", get(graphql_playground)) - .route("/graphql", post(graphql_handler).options(ok)) + .route("/v1/playground", get(graphql_playground)) + .route("/v1/graphql", post(graphql_handler).options(ok)) .route( - "/graphql-sub", + "/v1/graphql-sub", post(graphql_subscription_handler).options(ok), ) - .route("/metrics", get(metrics)) - .route("/health", get(health)) + .route("/v1/metrics", get(metrics)) + .route("/v1/health", get(health)) .layer(Extension(schema)) .layer(TraceLayer::new_for_http()) .layer(TimeoutLayer::new(request_timeout)) @@ -235,7 +235,9 @@ where } async fn graphql_playground() -> impl IntoResponse { - Html(playground_source(GraphQLPlaygroundConfig::new("/graphql"))) + Html(playground_source(GraphQLPlaygroundConfig::new( + "/v1/graphql", + ))) } async fn health() -> Json { diff --git a/deployment/charts/templates/fuel-core-deploy.yaml b/deployment/charts/templates/fuel-core-deploy.yaml index d795b82c9f..59fa57a362 100644 --- a/deployment/charts/templates/fuel-core-deploy.yaml +++ b/deployment/charts/templates/fuel-core-deploy.yaml @@ -10,7 +10,7 @@ spec: matchLabels: app: {{ .Values.app.selector_name }} endpoints: - - path: /metrics + - path: /v1/metrics port: http {{- end }} --- @@ -271,7 +271,7 @@ spec: protocol: TCP livenessProbe: httpGet: - path: /health + path: /v1/health port: {{ .Values.app.target_port }} initialDelaySeconds: 300 periodSeconds: 5 diff --git a/tests/tests/metrics.rs b/tests/tests/metrics.rs index c7cc992ce6..5e8c29fcda 100644 --- a/tests/tests/metrics.rs +++ b/tests/tests/metrics.rs @@ -47,7 +47,7 @@ async fn test_metrics_endpoint() { .await .unwrap(); - let resp = reqwest::get(format!("http://{}/metrics", srv.bound_address)) + let resp = reqwest::get(format!("http://{}/v1/metrics", srv.bound_address)) .await .unwrap() .text()