Skip to content

Commit

Permalink
Address PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
manolisliolios committed Jul 29, 2024
1 parent 5f279be commit 5d951a7
Show file tree
Hide file tree
Showing 15 changed files with 444 additions and 423 deletions.
4 changes: 2 additions & 2 deletions crates/sui-cluster-test/src/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::net::SocketAddr;
use std::path::Path;
use sui_config::Config;
use sui_config::{PersistedConfig, SUI_KEYSTORE_FILENAME, SUI_NETWORK_CONFIG};
use sui_graphql_rpc::config::ConnectionConfig;
use sui_graphql_rpc::config::{ConnectionConfig, ServiceConfig};
use sui_graphql_rpc::test_infra::cluster::start_graphql_server_with_fn_rpc;
use sui_indexer::test_utils::{start_test_indexer, ReaderWriterConfig};
use sui_keys::keystore::{AccountKeystore, FileBasedKeystore, Keystore};
Expand Down Expand Up @@ -260,7 +260,7 @@ impl Cluster for LocalNewCluster {
graphql_connection_config.clone(),
Some(fullnode_url.clone()),
/* cancellation_token */ None,
None,
ServiceConfig::test_defaults(),
)
.await;
}
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-graphql-rpc/schema/current_progress_schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -1256,9 +1256,9 @@ enum Feature {
"""
SYSTEM_STATE
"""
DotMove Service
Named packages service (utilizing dotmove package registry).
"""
DOT_MOVE_SERVICE
MOVE_REGISTRY
}


Expand Down
8 changes: 4 additions & 4 deletions crates/sui-graphql-rpc/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use crate::types::big_int::BigInt;
use crate::types::dot_move::config::ResolutionType;
use crate::{functional_group::FunctionalGroup, types::dot_move::config::DotMoveConfig};
use crate::{functional_group::FunctionalGroup, types::dot_move::config::MoveRegistryConfig};
use async_graphql::*;
use fastcrypto_zkp::bn254::zk_login_api::ZkLoginEnv;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -103,7 +103,7 @@ pub struct ServiceConfig {
pub(crate) zklogin: ZkLoginConfig,

#[serde(default)]
pub(crate) dot_move: DotMoveConfig,
pub(crate) move_registry: MoveRegistryConfig,
}

#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)]
Expand Down Expand Up @@ -432,13 +432,13 @@ impl ServiceConfig {
page_limit: Option<u16>,
) -> Self {
Self {
dot_move: DotMoveConfig {
move_registry: MoveRegistryConfig {
resolution_type: if external {
ResolutionType::External
} else {
ResolutionType::Internal
},
mainnet_api_url: endpoint,
external_api_url: endpoint,
package_address: pkg_address.unwrap_or_default(),
registry_id: object_id.unwrap_or(ObjectID::random()),
page_limit: page_limit.unwrap_or(50),
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-graphql-rpc/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use async_graphql_axum::GraphQLResponse;
use sui_indexer::errors::IndexerError;
use sui_json_rpc::name_service::NameServiceError;

use crate::types::dot_move::config::DotMoveServiceError;
use crate::types::dot_move::error::MoveRegistryError;

/// Error codes for the `extensions.code` field of a GraphQL error that originates from outside
/// GraphQL.
Expand Down Expand Up @@ -79,14 +79,14 @@ pub enum Error {
#[error("Internal error occurred while processing request: {0}")]
Internal(String),
#[error(transparent)]
DotMove(#[from] DotMoveServiceError),
MoveNameRegistry(#[from] MoveRegistryError),
}

impl ErrorExtensions for Error {
fn extend(&self) -> async_graphql::Error {
async_graphql::Error::new(format!("{}", self)).extend_with(|_err, e| match self {
Error::NameService(_)
| Error::DotMove(_)
| Error::MoveNameRegistry(_)
| Error::CursorNoFirstLast
| Error::PageTooLarge(_, _)
| Error::ProtocolVersionUnsupported(_, _)
Expand Down
8 changes: 4 additions & 4 deletions crates/sui-graphql-rpc/src/functional_group.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ pub(crate) enum FunctionalGroup {
/// validators either directly, or through system transactions.
SystemState,

/// DotMove Service
DotMoveService,
/// Named packages service (utilizing dotmove package registry).
MoveRegistry,
}

impl FunctionalGroup {
Expand All @@ -54,7 +54,7 @@ impl FunctionalGroup {
G::NameService,
G::Subscriptions,
G::SystemState,
G::DotMoveService,
G::MoveRegistry,
];
ALL
}
Expand Down Expand Up @@ -100,7 +100,7 @@ fn functional_groups() -> &'static BTreeMap<(&'static str, &'static str), Functi
(("Query", "networkMetrics"), G::Analytics),
(("Query", "protocolConfig"), G::SystemState),
(("Query", "resolveSuinsAddress"), G::NameService),
(("Query", "packageByName"), G::DotMoveService),
(("Query", "packageByName"), G::MoveRegistry),
(("Subscription", "events"), G::Subscriptions),
(("Subscription", "transactions"), G::Subscriptions),
(("SystemStateSummary", "safeMode"), G::SystemState),
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-graphql-rpc/src/server/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ impl ServerBuilder {
let mut builder = ServerBuilder::new(state);

let name_service_config = config.service.name_service.clone();
let dot_move_config = config.service.dot_move.clone();
let dot_move_config = config.service.move_registry.clone();
let zklogin_config = config.service.zklogin.clone();
let reader = PgManager::reader_with_config(
config.connection.db_url.clone(),
Expand Down
14 changes: 7 additions & 7 deletions crates/sui-graphql-rpc/src/test_infra/cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ pub struct NetworkCluster {
pub async fn start_cluster(
graphql_connection_config: ConnectionConfig,
internal_data_source_rpc_port: Option<u16>,
service_config: Option<ServiceConfig>,
service_config: ServiceConfig,
) -> Cluster {
let network_cluster = start_network_cluster(
graphql_connection_config.clone(),
Expand Down Expand Up @@ -99,8 +99,8 @@ pub async fn start_cluster(
}
}

/// Starts a validator, fullnode, indexer (with gql ingestion). Re-using `gql's` ConnectionConfig for convenience.
/// This does not start any GraphQl services, only the network cluster. You can start a graphql service
/// Starts a validator, fullnode, indexer (using data ingestion). Re-using GraphQL's ConnectionConfig for convenience.
/// This does not start any GraphQL services, only the network cluster. You can start a GraphQL service
/// calling `start_graphql_server`.
pub async fn start_network_cluster(
graphql_connection_config: ConnectionConfig,
Expand Down Expand Up @@ -175,7 +175,7 @@ pub async fn serve_executor(
let graphql_server_handle = start_graphql_server(
graphql_connection_config.clone(),
cancellation_token.clone(),
None,
ServiceConfig::test_defaults(),
)
.await;

Expand Down Expand Up @@ -203,7 +203,7 @@ pub async fn serve_executor(
pub async fn start_graphql_server(
graphql_connection_config: ConnectionConfig,
cancellation_token: CancellationToken,
service_config: Option<ServiceConfig>,
service_config: ServiceConfig,
) -> JoinHandle<()> {
start_graphql_server_with_fn_rpc(
graphql_connection_config,
Expand All @@ -218,12 +218,12 @@ pub async fn start_graphql_server_with_fn_rpc(
graphql_connection_config: ConnectionConfig,
fn_rpc_url: Option<String>,
cancellation_token: Option<CancellationToken>,
service_config: Option<ServiceConfig>,
service_config: ServiceConfig,
) -> JoinHandle<()> {
let cancellation_token = cancellation_token.unwrap_or_default();
let mut server_config = ServerConfig {
connection: graphql_connection_config,
service: service_config.unwrap_or(ServiceConfig::test_defaults()),
service: service_config,
..ServerConfig::default()
};
if let Some(fn_rpc_url) = fn_rpc_url {
Expand Down
Loading

0 comments on commit 5d951a7

Please sign in to comment.