Skip to content

Commit

Permalink
Delete tier1_network_info RPC endpoint (#9403)
Browse files Browse the repository at this point in the history
This endpoint was added mistakenly (by me) in #8181.

It returns a response completely identical to the one given by the `network_info` endpoint and adds no functionality.

Also, @telezhnaya pulled numbers from the last 6 months and `tier1_network_info` was used 0 times.
  • Loading branch information
saketh-are authored Aug 9, 2023
1 parent 63170aa commit 988039b
Showing 1 changed file with 0 additions and 29 deletions.
29 changes: 0 additions & 29 deletions chain/jsonrpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,6 @@ impl JsonRpcHandler {
process_method_call(request, |params| self.next_light_client_block(params)).await
}
"network_info" => process_method_call(request, |_params: ()| self.network_info()).await,
"tier1_network_info" => {
process_method_call(request, |_params: ()| self.tier1_network_info()).await
}
"query" => {
let params = RpcRequest::parse(request.params)?;
let query_response = self.query(params).await;
Expand Down Expand Up @@ -1024,16 +1021,6 @@ impl JsonRpcHandler {
Ok(network_info.rpc_into())
}

async fn tier1_network_info(
&self,
) -> Result<
near_jsonrpc_primitives::types::network_info::RpcNetworkInfoResponse,
near_jsonrpc_primitives::types::network_info::RpcNetworkInfoError,
> {
let network_info = self.client_send(GetNetworkInfo {}).await?;
Ok(network_info.rpc_into())
}

async fn gas_price(
&self,
request_data: near_jsonrpc_primitives::types::gas_price::RpcGasPriceRequest,
Expand Down Expand Up @@ -1423,18 +1410,6 @@ fn network_info_handler(
response.boxed()
}

fn tier1_network_info_handler(
handler: web::Data<JsonRpcHandler>,
) -> impl Future<Output = Result<HttpResponse, HttpError>> {
let response = async move {
match handler.tier1_network_info().await {
Ok(value) => Ok(HttpResponse::Ok().json(&value)),
Err(_) => Ok(HttpResponse::ServiceUnavailable().finish()),
}
};
response.boxed()
}

pub async fn prometheus_handler() -> Result<HttpResponse, HttpError> {
metrics::PROMETHEUS_REQUEST_COUNT.inc();

Expand Down Expand Up @@ -1576,10 +1551,6 @@ pub fn start_http(
.route(web::head().to(health_handler)),
)
.service(web::resource("/network_info").route(web::get().to(network_info_handler)))
.service(
web::resource("/tier1_network_info")
.route(web::get().to(tier1_network_info_handler)),
)
.service(web::resource("/metrics").route(web::get().to(prometheus_handler)))
.service(web::resource("/debug/api/entity").route(web::post().to(handle_entity_debug)))
.service(web::resource("/debug/api/{api}").route(web::get().to(debug_handler)))
Expand Down

0 comments on commit 988039b

Please sign in to comment.