diff --git a/Cargo.toml b/Cargo.toml index 08e8fa83e47..17e3a92d699 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -418,7 +418,7 @@ iota-rest-api = { path = "crates/iota-rest-api" } iota-rosetta = { path = "crates/iota-rosetta" } iota-rpc-loadgen = { path = "crates/iota-rpc-loadgen" } iota-sdk = { path = "crates/iota-sdk" } -# core-types with json format for REST api +# core-types with json format for REST API iota-sdk2 = { package = "iota-rust-sdk", git = "ssh://git@github.com/iotaledger/iota-rust-sdk.git", rev = "ed6173d434c77604ddc93aaa1550168fdbe97b09", features = ["hash", "serde", "schemars"] } iota-simulator = { path = "crates/iota-simulator" } iota-snapshot = { path = "crates/iota-snapshot" } diff --git a/crates/iota-bridge/src/error.rs b/crates/iota-bridge/src/error.rs index 928bf74b8b0..de290334a58 100644 --- a/crates/iota-bridge/src/error.rs +++ b/crates/iota-bridge/src/error.rs @@ -66,7 +66,7 @@ pub enum BridgeError { ZeroValueBridgeTransfer(String), // Storage Error Storage(String), - // Rest API Error + // REST API Error RestAPI(String), // Uncategorized error Generic(String), diff --git a/crates/iota-config/src/node.rs b/crates/iota-config/src/node.rs index 3821e0d4261..ddf63329504 100644 --- a/crates/iota-config/src/node.rs +++ b/crates/iota-config/src/node.rs @@ -75,10 +75,10 @@ pub struct NodeConfig { #[serde(default = "default_json_rpc_address")] pub json_rpc_address: SocketAddr, - /// Flag to enable the experimental REST API under `/rest` + /// Flag to enable the REST API under `/api/v1` /// endpoint on the same interface as `json` `rpc` server. #[serde(default)] - pub enable_experimental_rest_api: bool, + pub enable_rest_api: bool, /// The address for Prometheus metrics. #[serde(default = "default_metrics_address")] diff --git a/crates/iota-data-ingestion-core/src/reader.rs b/crates/iota-data-ingestion-core/src/reader.rs index 0a3e388c312..52d48539cb1 100644 --- a/crates/iota-data-ingestion-core/src/reader.rs +++ b/crates/iota-data-ingestion-core/src/reader.rs @@ -185,7 +185,7 @@ impl CheckpointReader { ) .expect("failed to create remote store client"); RemoteStore::Hybrid(object_store, iota_rest_api::Client::new(fn_url)) - } else if url.ends_with("/rest") { + } else if url.ends_with("/api/v1") { RemoteStore::Rest(iota_rest_api::Client::new(url)) } else { let object_store = create_remote_store_client( diff --git a/crates/iota-indexer/README.md b/crates/iota-indexer/README.md index 9be0c5185bc..d59cb3e2183 100644 --- a/crates/iota-indexer/README.md +++ b/crates/iota-indexer/README.md @@ -6,7 +6,7 @@ IOTA Indexer is an off-fullnode service to serve data from the IOTA protocol, in > [!NOTE] > -> - Indexer sync workers require the `NodeConfig::enable_experimental_rest_api` flag set to `true` in the node +> - Indexer sync workers require the `NodeConfig::enable_rest_api` flag set to `true` in the node > - Fullnodes expose read and transaction execution JSON-RPC APIs. Hence, transactions can be executed through fullnodes. > - Validators expose only read-only JSON-RPC APIs. > - Indexer instances expose read, write and extended JSON-RPC APIs. diff --git a/crates/iota-indexer/src/main.rs b/crates/iota-indexer/src/main.rs index 6336bc67602..791b16a5469 100644 --- a/crates/iota-indexer/src/main.rs +++ b/crates/iota-indexer/src/main.rs @@ -19,7 +19,7 @@ async fn main() -> Result<(), IndexerError> { let mut indexer_config = IndexerConfig::parse(); // TODO: Explore other options as in upstream. // For the moment we only use the fullnode for fetching checkpoints - indexer_config.remote_store_url = Some(format!("{}/rest", indexer_config.rpc_client_url)); + indexer_config.remote_store_url = Some(format!("{}/api/v1", indexer_config.rpc_client_url)); info!("Parsed indexer config: {:#?}", indexer_config); let (_registry_service, registry) = start_prometheus_server( // NOTE: this parses the input host addr and port number for socket addr, diff --git a/crates/iota-node/src/lib.rs b/crates/iota-node/src/lib.rs index 005e687902c..4f576913840 100644 --- a/crates/iota-node/src/lib.rs +++ b/crates/iota-node/src/lib.rs @@ -579,9 +579,7 @@ impl IotaNode { None }; - let rest_index = if is_full_node - && config.enable_experimental_rest_api - && config.enable_index_processing + let rest_index = if is_full_node && config.enable_rest_api && config.enable_index_processing { Some(Arc::new(RestIndexStore::new( config.db_path().join("rest_index"), @@ -1967,7 +1965,7 @@ fn build_kv_store( ))) } -/// Builds and starts the HTTP server for the Iota node, exposing JSON-RPC and +/// Builds and starts the HTTP server for the IOTA node, exposing JSON-RPC and /// REST APIs based on the node's configuration. /// /// This function performs the following tasks: @@ -1980,7 +1978,7 @@ fn build_kv_store( /// TransactionBuilderApi, GovernanceApi, TransactionExecutionApi, and /// IndexerApi. /// 4. Optionally, if the REST API is enabled, nests the REST API router under -/// the `/rest` path. +/// the `/api/v1` path. /// 5. Binds the server to the specified JSON-RPC address and starts listening /// for incoming connections. pub async fn build_http_server( @@ -2053,7 +2051,7 @@ pub async fn build_http_server( router = router.merge(json_rpc_router); - if config.enable_experimental_rest_api { + if config.enable_rest_api { let mut rest_service = iota_rest_api::RestService::new( Arc::new(RestReadStore::new(state, store)), software_version, diff --git a/crates/iota-rest-api/openapi/elements.html b/crates/iota-rest-api/openapi/elements.html index 7beb2f44231..437d3c8be38 100644 --- a/crates/iota-rest-api/openapi/elements.html +++ b/crates/iota-rest-api/openapi/elements.html @@ -3,7 +3,7 @@ - Iota Node Api + IOTA Node API diff --git a/crates/iota-rest-api/openapi/openapi.json b/crates/iota-rest-api/openapi/openapi.json index 96c8711cd78..96c9665ab63 100644 --- a/crates/iota-rest-api/openapi/openapi.json +++ b/crates/iota-rest-api/openapi/openapi.json @@ -1,8 +1,8 @@ { "openapi": "3.1.0", "info": { - "title": "Iota Node Api", - "description": "REST Api for interacting with the Iota Blockchain", + "title": "IOTA Node API", + "description": "REST API for interacting with the IOTA Blockchain", "contact": { "name": "IOTA Foundation", "url": "https://github.com/iotaledger/iota" @@ -15,7 +15,7 @@ }, "servers": [ { - "url": "/v2" + "url": "/api/v1" } ], "paths": { diff --git a/crates/iota-rest-api/src/client/sdk.rs b/crates/iota-rest-api/src/client/sdk.rs index 939eeb968e5..89ae4df822a 100644 --- a/crates/iota-rest-api/src/client/sdk.rs +++ b/crates/iota-rest-api/src/client/sdk.rs @@ -50,7 +50,7 @@ impl Client { ))); } - url.set_path("/v2/"); + url.set_path("/api/v1/"); let inner = reqwest::ClientBuilder::new() .user_agent(USER_AGENT) diff --git a/crates/iota-rest-api/src/lib.rs b/crates/iota-rest-api/src/lib.rs index 016e843b980..aecf9ccccbb 100644 --- a/crates/iota-rest-api/src/lib.rs +++ b/crates/iota-rest-api/src/lib.rs @@ -149,13 +149,8 @@ impl RestService { api.register_endpoints(ENDPOINTS.to_owned()); Router::new() - .nest("/v2/", api.to_router().with_state(self.clone())) - .route("/v2", get(|| async { Redirect::permanent("/v2/") })) - // Previously the service used to be hosted at `/rest`. In an effort to migrate folks - // to the new versioned route, we'll issue redirects from `/rest` -> `/v2`. - .route("/rest/*path", axum::routing::method_routing::any(redirect)) - .route("/rest", get(|| async { Redirect::permanent("/v2/") })) - .route("/rest/", get(|| async { Redirect::permanent("/v2/") })) + .nest("/api/v1/", api.to_router().with_state(self.clone())) + .route("/api/v1", get(|| async { Redirect::permanent("/api/v1/") })) .layer(axum::middleware::map_response_with_state( self, response::append_info_headers, @@ -181,8 +176,8 @@ fn info() -> openapiv3::v3_1::Info { use openapiv3::v3_1::{Contact, License}; openapiv3::v3_1::Info { - title: "Iota Node Api".to_owned(), - description: Some("REST Api for interacting with the Iota Blockchain".to_owned()), + title: "IOTA Node API".to_owned(), + description: Some("REST API for interacting with the IOTA Blockchain".to_owned()), contact: Some(Contact { name: Some("IOTA Foundation".to_owned()), url: Some("https://github.com/iotaledger/iota".to_owned()), @@ -198,10 +193,6 @@ fn info() -> openapiv3::v3_1::Info { } } -async fn redirect(axum::extract::Path(path): axum::extract::Path) -> Redirect { - Redirect::permanent(&format!("/v2/{path}")) -} - mod _schemars { use schemars::{ JsonSchema, diff --git a/crates/iota-rest-api/src/openapi.rs b/crates/iota-rest-api/src/openapi.rs index af95b803feb..f8840098856 100644 --- a/crates/iota-rest-api/src/openapi.rs +++ b/crates/iota-rest-api/src/openapi.rs @@ -166,7 +166,7 @@ impl<'a, S> Api<'a, S> { openapi.tags.sort_by(|a, b| a.name.cmp(&b.name)); openapi.servers = vec![openapiv3::v3_1::Server { - url: "/v2".into(), + url: "/api/v1".into(), ..Default::default() }]; diff --git a/crates/iota-single-node-benchmark/README.md b/crates/iota-single-node-benchmark/README.md index 78725d03b19..94500b283a2 100644 --- a/crates/iota-single-node-benchmark/README.md +++ b/crates/iota-single-node-benchmark/README.md @@ -1,6 +1,6 @@ # Iota Single Node Benchmark -This crate contains a binary for performance benchmarking a single Iota node. +This crate contains a binary for performance benchmarking a single IOTA node. Upon running the binary, the node will instantiate a standalone `AuthorityState`, and submit executable transactions to it in parallel. We then measure the time it takes for it to finish executing all the transactions. diff --git a/crates/iota-swarm-config/src/node_config_builder.rs b/crates/iota-swarm-config/src/node_config_builder.rs index c95486df704..1e2c422b1eb 100644 --- a/crates/iota-swarm-config/src/node_config_builder.rs +++ b/crates/iota-swarm-config/src/node_config_builder.rs @@ -207,7 +207,7 @@ impl ValidatorConfigBuilder { indexer_max_subscriptions: Default::default(), transaction_kv_store_read_config: Default::default(), transaction_kv_store_write_config: None, - enable_experimental_rest_api: true, + enable_rest_api: true, jwk_fetch_interval_seconds: self .jwk_fetch_interval .map(|i| i.as_secs()) @@ -497,7 +497,7 @@ impl FullnodeConfigBuilder { indexer_max_subscriptions: Default::default(), transaction_kv_store_read_config: Default::default(), transaction_kv_store_write_config: Default::default(), - enable_experimental_rest_api: true, + enable_rest_api: true, // note: not used by fullnodes. jwk_fetch_interval_seconds: 3600, zklogin_oauth_providers: default_zklogin_oauth_providers(), diff --git a/crates/iota-swarm-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap b/crates/iota-swarm-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap index bbf1ad8c93f..4725bfb9ffa 100644 --- a/crates/iota-swarm-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap +++ b/crates/iota-swarm-config/tests/snapshots/snapshot_tests__network_config_snapshot_matches.snap @@ -14,7 +14,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: @@ -134,7 +134,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: @@ -254,7 +254,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: @@ -374,7 +374,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: @@ -494,7 +494,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: @@ -614,7 +614,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: @@ -734,7 +734,7 @@ validator_configs: db-path: /tmp/foo/ network-address: "" json-rpc-address: "0.0.0.0:1" - enable-experimental-rest-api: true + enable-rest-api: true metrics-address: "0.0.0.0:1" admin-interface-port: 8888 consensus-config: diff --git a/crates/iota-tool/src/db_tool/db_dump.rs b/crates/iota-tool/src/db_tool/db_dump.rs index 5fc0af5bf66..c1ddfd489c8 100644 --- a/crates/iota-tool/src/db_tool/db_dump.rs +++ b/crates/iota-tool/src/db_tool/db_dump.rs @@ -43,7 +43,6 @@ pub enum StoreName { Validator, Index, Epoch, - // TODO: Add the new checkpoint v2 tables. } impl std::fmt::Display for StoreName { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { diff --git a/docker/pg-services-local/docker-compose.yaml b/docker/pg-services-local/docker-compose.yaml index 413de506ecd..fe8e31ab08a 100644 --- a/docker/pg-services-local/docker-compose.yaml +++ b/docker/pg-services-local/docker-compose.yaml @@ -29,7 +29,7 @@ services: - "127.0.0.1:9000:9000" - "127.0.0.1:9123:9123" healthcheck: - test: "curl -f http://local-network:9000/rest/" + test: "curl -f http://local-network:9000/api/v1/" interval: 1s start_period: 5s timeout: 2s