diff --git a/crates/sui-indexer/src/apis/extended_api.rs b/crates/sui-indexer/src/apis/extended_api.rs index 02cf5c13ebccf..79ece25e74fcd 100644 --- a/crates/sui-indexer/src/apis/extended_api.rs +++ b/crates/sui-indexer/src/apis/extended_api.rs @@ -6,8 +6,7 @@ use jsonrpsee::{core::RpcResult, RpcModule}; use sui_json_rpc::SuiRpcModule; use sui_json_rpc_api::{validate_limit, ExtendedApiServer, QUERY_MAX_RESULT_LIMIT_CHECKPOINTS}; use sui_json_rpc_types::{ - AddressMetrics, CheckpointedObjectID, EpochInfo, EpochMetrics, EpochMetricsPage, EpochPage, - MoveCallMetrics, NetworkMetrics, Page, QueryObjectsPage, SuiObjectResponseQuery, + CheckpointedObjectID, EpochInfo, EpochPage, Page, QueryObjectsPage, SuiObjectResponseQuery, }; use sui_open_rpc::Module; use sui_types::sui_serde::BigInt; @@ -52,45 +51,6 @@ impl ExtendedApiServer for ExtendedApi { }) } - async fn get_epoch_metrics( - &self, - cursor: Option>, - limit: Option, - descending_order: Option, - ) -> RpcResult { - let limit = validate_limit(limit, QUERY_MAX_RESULT_LIMIT_CHECKPOINTS)?; - let epochs = self - .inner - .spawn_blocking(move |this| { - this.get_epochs( - cursor.map(|x| *x), - limit + 1, - descending_order.unwrap_or(false), - ) - }) - .await?; - - let mut epoch_metrics = epochs - .into_iter() - .map(|e| EpochMetrics { - epoch: e.epoch, - epoch_total_transactions: e.epoch_total_transactions, - first_checkpoint_id: e.first_checkpoint_id, - epoch_start_timestamp: e.epoch_start_timestamp, - end_of_epoch_info: e.end_of_epoch_info, - }) - .collect::>(); - - let has_next_page = epoch_metrics.len() > limit; - epoch_metrics.truncate(limit); - let next_cursor = epoch_metrics.last().map(|e| e.epoch); - Ok(Page { - data: epoch_metrics, - next_cursor: next_cursor.map(|id| id.into()), - has_next_page, - }) - } - async fn get_current_epoch(&self) -> RpcResult { let stored_epoch = self .inner @@ -111,44 +71,6 @@ impl ExtendedApiServer for ExtendedApi { .into()) } - async fn get_network_metrics(&self) -> RpcResult { - Err(jsonrpsee::types::error::CallError::Custom( - jsonrpsee::types::error::ErrorCode::MethodNotFound.into(), - ) - .into()) - } - - async fn get_move_call_metrics(&self) -> RpcResult { - Err(jsonrpsee::types::error::CallError::Custom( - jsonrpsee::types::error::ErrorCode::MethodNotFound.into(), - ) - .into()) - } - - async fn get_latest_address_metrics(&self) -> RpcResult { - Err(jsonrpsee::types::error::CallError::Custom( - jsonrpsee::types::error::ErrorCode::MethodNotFound.into(), - ) - .into()) - } - - async fn get_checkpoint_address_metrics(&self, _checkpoint: u64) -> RpcResult { - Err(jsonrpsee::types::error::CallError::Custom( - jsonrpsee::types::error::ErrorCode::MethodNotFound.into(), - ) - .into()) - } - - async fn get_all_epoch_address_metrics( - &self, - _descending_order: Option, - ) -> RpcResult> { - Err(jsonrpsee::types::error::CallError::Custom( - jsonrpsee::types::error::ErrorCode::MethodNotFound.into(), - ) - .into()) - } - async fn get_total_transactions(&self) -> RpcResult> { let latest_checkpoint = self .inner diff --git a/crates/sui-json-rpc-api/src/extended.rs b/crates/sui-json-rpc-api/src/extended.rs index f28003cf86536..ff6f73b760a80 100644 --- a/crates/sui-json-rpc-api/src/extended.rs +++ b/crates/sui-json-rpc-api/src/extended.rs @@ -5,8 +5,7 @@ use jsonrpsee::core::RpcResult; use jsonrpsee::proc_macros::rpc; use sui_json_rpc_types::{ - AddressMetrics, CheckpointedObjectID, EpochInfo, EpochMetricsPage, EpochPage, MoveCallMetrics, - NetworkMetrics, QueryObjectsPage, SuiObjectResponseQuery, + CheckpointedObjectID, EpochInfo, EpochPage, QueryObjectsPage, SuiObjectResponseQuery, }; use sui_open_rpc_macros::open_rpc; use sui_types::sui_serde::BigInt; @@ -26,18 +25,6 @@ pub trait ExtendedApi { descending_order: Option, ) -> RpcResult; - /// Return a list of epoch metrics, which is a subset of epoch info - #[method(name = "getEpochMetrics")] - async fn get_epoch_metrics( - &self, - /// optional paging cursor - cursor: Option>, - /// maximum number of items per page - limit: Option, - /// flag to return results in descending order - descending_order: Option, - ) -> RpcResult; - /// Return current epoch info #[method(name = "getCurrentEpoch")] async fn get_current_epoch(&self) -> RpcResult; @@ -54,25 +41,6 @@ pub trait ExtendedApi { limit: Option, ) -> RpcResult; - /// Return Network metrics - #[method(name = "getNetworkMetrics")] - async fn get_network_metrics(&self) -> RpcResult; - - /// Return Network metrics - #[method(name = "getMoveCallMetrics")] - async fn get_move_call_metrics(&self) -> RpcResult; - - /// Address related metrics - #[method(name = "getLatestAddressMetrics")] - async fn get_latest_address_metrics(&self) -> RpcResult; - #[method(name = "getCheckpointAddressMetrics")] - async fn get_checkpoint_address_metrics(&self, checkpoint: u64) -> RpcResult; - #[method(name = "getAllEpochAddressMetrics")] - async fn get_all_epoch_address_metrics( - &self, - descending_order: Option, - ) -> RpcResult>; - #[method(name = "getTotalTransactions")] async fn get_total_transactions(&self) -> RpcResult>; } diff --git a/crates/sui-json-rpc-types/src/sui_extended.rs b/crates/sui-json-rpc-types/src/sui_extended.rs index c26f120f3583e..08f049f59c79f 100644 --- a/crates/sui-json-rpc-types/src/sui_extended.rs +++ b/crates/sui-json-rpc-types/src/sui_extended.rs @@ -21,7 +21,6 @@ use sui_types::sui_system_state::sui_system_state_summary::SuiValidatorSummary; use crate::Page; pub type EpochPage = Page>; -pub type EpochMetricsPage = Page>; #[serde_as] #[derive(Serialize, Deserialize, Debug, JsonSchema)] @@ -59,26 +58,6 @@ impl EpochInfo { } } -/// a light-weight version of `EpochInfo` for faster loading -#[serde_as] -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase")] -pub struct EpochMetrics { - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub epoch: EpochId, - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub epoch_total_transactions: u64, - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub first_checkpoint_id: CheckpointSequenceNumber, - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub epoch_start_timestamp: u64, - pub end_of_epoch_info: Option, -} - #[serde_as] #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] @@ -125,51 +104,6 @@ pub struct EndOfEpochInfo { pub leftover_storage_fund_inflow: u64, } -#[serde_as] -#[derive(Serialize, Deserialize, Debug, JsonSchema, Clone)] -#[serde(rename_all = "camelCase")] -pub struct NetworkMetrics { - /// Current TPS - Transaction Blocks per Second. - pub current_tps: f64, - /// Peak TPS in the past 30 days - pub tps_30_days: f64, - /// Total number of packages published in the network - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub total_packages: u64, - /// Total number of addresses seen in the network - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub total_addresses: u64, - /// Total number of live objects in the network - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub total_objects: u64, - /// Current epoch number - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub current_epoch: u64, - /// Current checkpoint number - #[schemars(with = "BigInt")] - #[serde_as(as = "BigInt")] - pub current_checkpoint: u64, -} - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase")] -pub struct MoveCallMetrics { - #[schemars(with = "Vec<(MoveFunctionName, BigInt)>")] - #[serde_as(as = "Vec<(_, BigInt)>")] - pub rank_3_days: Vec<(MoveFunctionName, usize)>, - #[schemars(with = "Vec<(MoveFunctionName, BigInt)>")] - #[serde_as(as = "Vec<(_, BigInt)>")] - pub rank_7_days: Vec<(MoveFunctionName, usize)>, - #[schemars(with = "Vec<(MoveFunctionName, BigInt)>")] - #[serde_as(as = "Vec<(_, BigInt)>")] - pub rank_30_days: Vec<(MoveFunctionName, usize)>, -} - #[serde_as] #[derive(Serialize, Deserialize, Debug, JsonSchema)] #[serde(rename_all = "camelCase")] @@ -182,15 +116,3 @@ pub struct MoveFunctionName { #[serde_as(as = "DisplayFromStr")] pub function: Identifier, } - -#[serde_as] -#[derive(Serialize, Deserialize, Debug, JsonSchema)] -#[serde(rename_all = "camelCase")] -pub struct AddressMetrics { - pub checkpoint: u64, - pub epoch: u64, - pub timestamp_ms: u64, - pub cumulative_addresses: u64, - pub cumulative_active_addresses: u64, - pub daily_active_addresses: u64, -}