Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -403,3 +403,19 @@ jobs:
run: ./scripts/execution_layer.py cut for_ci_test
- name: Check execution builds
run: cargo build -p sui-execution

check-protos:
runs-on: [ ubuntu-ghcloud ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # Pin v4.1.1
with:
ref: ${{ github.event.inputs.sui_repo_ref || github.ref }}
# Install buf
- name: Install buf
uses: bufbuild/buf-setup-action@v1.24.0
with:
version: 1.47.2
- name: lint protos
run: cd crates/sui-rpc-api && buf lint
- name: format protos
run: cd crates/sui-rpc-api && buf format --diff --exit-code
6 changes: 3 additions & 3 deletions crates/sui-e2e-tests/tests/rpc/checkpoints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use sui_macros::sim_test;
use sui_rpc_api::client::sdk::Client;
use sui_rpc_api::client::Client as CoreClient;
use sui_rpc_api::proto::node::node_client::NodeClient;
use sui_rpc_api::proto::node::node_service_client::NodeServiceClient;
use sui_rpc_api::proto::node::{
FullCheckpointObject, FullCheckpointTransaction, GetCheckpointOptions, GetCheckpointRequest,
GetCheckpointResponse, GetFullCheckpointOptions, GetFullCheckpointRequest,
Expand Down Expand Up @@ -50,7 +50,7 @@ async fn get_checkpoint() {
.await
.unwrap();

let mut grpc_client = NodeClient::connect(test_cluster.rpc_url().to_owned())
let mut grpc_client = NodeServiceClient::connect(test_cluster.rpc_url().to_owned())
.await
.unwrap();

Expand Down Expand Up @@ -177,7 +177,7 @@ async fn get_full_checkpoint() {
.await
.unwrap();

let mut grpc_client = NodeClient::connect(test_cluster.rpc_url().to_owned())
let mut grpc_client = NodeServiceClient::connect(test_cluster.rpc_url().to_owned())
.await
.unwrap();

Expand Down
4 changes: 2 additions & 2 deletions crates/sui-e2e-tests/tests/rpc/committee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use sui_macros::sim_test;
use sui_rpc_api::client::sdk::Client;
use sui_rpc_api::proto::node::node_client::NodeClient;
use sui_rpc_api::proto::node::node_service_client::NodeServiceClient;
use sui_rpc_api::proto::node::GetCommitteeRequest;
use test_cluster::TestClusterBuilder;

Expand All @@ -12,7 +12,7 @@ async fn get_committee() {
let test_cluster = TestClusterBuilder::new().build().await;

let client = Client::new(test_cluster.rpc_url()).unwrap();
let mut grpc_client = NodeClient::connect(test_cluster.rpc_url().to_owned())
let mut grpc_client = NodeServiceClient::connect(test_cluster.rpc_url().to_owned())
.await
.unwrap();

Expand Down
11 changes: 8 additions & 3 deletions crates/sui-e2e-tests/tests/rpc/node_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,16 @@
// SPDX-License-Identifier: Apache-2.0

use sui_macros::sim_test;
use sui_rpc_api::proto::node::node_client::NodeClient;
use sui_rpc_api::proto::node::node_service_client::NodeServiceClient;
use sui_rpc_api::proto::node::GetNodeInfoRequest;
use sui_rpc_api::proto::node::GetNodeInfoResponse;
use test_cluster::TestClusterBuilder;

#[sim_test]
async fn get_node_info() {
let test_cluster = TestClusterBuilder::new().build().await;

let mut grpc_client = NodeClient::connect(test_cluster.rpc_url().to_owned())
let mut grpc_client = NodeServiceClient::connect(test_cluster.rpc_url().to_owned())
.await
.unwrap();

Expand All @@ -23,7 +24,11 @@ async fn get_node_info() {
lowest_available_checkpoint,
lowest_available_checkpoint_objects,
software_version,
} = grpc_client.get_node_info(()).await.unwrap().into_inner();
} = grpc_client
.get_node_info(GetNodeInfoRequest {})
.await
.unwrap()
.into_inner();

assert!(chain_id.is_some());
assert!(chain.is_some());
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-e2e-tests/tests/rpc/objects.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use sui_macros::sim_test;
use sui_rpc_api::client::sdk::Client;
use sui_rpc_api::client::Client as CoreClient;
use sui_rpc_api::proto::node::node_client::NodeClient;
use sui_rpc_api::proto::node::node_service_client::NodeServiceClient;
use sui_rpc_api::proto::node::GetObjectOptions;
use sui_rpc_api::proto::node::GetObjectRequest;
use sui_rpc_api::proto::node::GetObjectResponse;
Expand All @@ -19,7 +19,7 @@ async fn get_object() {

let client = Client::new(test_cluster.rpc_url()).unwrap();
let core_client = CoreClient::new(test_cluster.rpc_url()).unwrap();
let mut grpc_client = NodeClient::connect(test_cluster.rpc_url().to_owned())
let mut grpc_client = NodeServiceClient::connect(test_cluster.rpc_url().to_owned())
.await
.unwrap();

Expand Down
4 changes: 2 additions & 2 deletions crates/sui-e2e-tests/tests/rpc/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

use sui_macros::sim_test;
use sui_rpc_api::client::sdk::Client;
use sui_rpc_api::proto::node::node_client::NodeClient;
use sui_rpc_api::proto::node::node_service_client::NodeServiceClient;
use sui_rpc_api::proto::node::{
GetTransactionOptions, GetTransactionRequest, GetTransactionResponse,
};
Expand All @@ -22,7 +22,7 @@ async fn get_transaction() {

let _transaction = client.get_transaction(&transaction_digest).await.unwrap();

let mut grpc_client = NodeClient::connect(test_cluster.rpc_url().to_owned())
let mut grpc_client = NodeServiceClient::connect(test_cluster.rpc_url().to_owned())
.await
.unwrap();

Expand Down
32 changes: 32 additions & 0 deletions crates/sui-rpc-api/buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: v2

modules:
- path: proto
excludes:
- proto/google
lint:
use:
- STANDARD
ignore_only:
PACKAGE_VERSION_SUFFIX:
- proto/sui.types.proto
DIRECTORY_SAME_PACKAGE:
- proto/sui.types.proto
- proto/sui.node.v2.proto
PACKAGE_DIRECTORY_MATCH:
- proto/sui.types.proto
- proto/sui.node.v2.proto
PACKAGE_SAME_DIRECTORY:
- proto/sui.types.proto
- proto/sui.node.v2.proto
FILE_LOWER_SNAKE_CASE:
- proto/sui.types.proto
- proto/sui.node.v2.proto

disallow_comment_ignores: false
enum_zero_value_suffix: _UNKNOWN
rpc_allow_same_request_response: false
rpc_allow_google_protobuf_empty_requests: false
rpc_allow_google_protobuf_empty_responses: false
service_suffix: Service
disable_builtin: false
21 changes: 21 additions & 0 deletions crates/sui-rpc-api/generate-grpc-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Copyright (c) Mysten Labs, Inc.
# SPDX-License-Identifier: Apache-2.0

set -x
set -e

SCRIPT_PATH=$(realpath "$0")
SCRIPT_DIR=$(dirname "$SCRIPT_PATH")

PROTO_FILES=(
proto/sui.node.v2.proto
proto/sui.types.proto
proto/google/protobuf/empty.proto
proto/google/protobuf/timestamp.proto
)

# requires that protoc as well as the protoc-gen-doc plugin is installed and
# available on $PATH. See https://github.com/pseudomuto/protoc-gen-doc for more
# info
cd "$SCRIPT_DIR" && protoc --doc_out=proto/ --doc_opt=markdown,documentation.md ${PROTO_FILES[@]} --proto_path=proto/
Loading
Loading