Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
bc7d229
chore: update sui-sdk-types
bmwill Nov 20, 2024
5126b54
config: rename 'rest' config to 'rpc'
bmwill Nov 25, 2024
6b3870d
storage: rename RestStateReader to RpcStateReader
bmwill Nov 25, 2024
5401098
core: rename rest_index to rpc_index
bmwill Nov 25, 2024
7e313f2
rpc-indexes: separate out trait for accessing indexed data
bmwill Nov 25, 2024
c64b514
rest: move openapi tests to its own file
bmwill Nov 25, 2024
bcfdd98
rest: move config into its own module
bmwill Nov 25, 2024
b348cb8
rest: move rest infra into a module
bmwill Nov 25, 2024
6726bd8
metrics: rename RestMetrics to RpcMetrics
bmwill Nov 26, 2024
27a2dae
rename RestService to RpcService
bmwill Nov 26, 2024
9d8920e
rename sui-rest-api crate to sui-rpc-api
bmwill Nov 26, 2024
c0e93c8
rpc: add config for enabling new indexes instad of reusing the jsonrp…
bmwill Nov 26, 2024
acffae2
rpc: factor out logic for getting NodeInfo
bmwill Nov 26, 2024
a8c579e
rpc: factor out health check logic
bmwill Nov 26, 2024
6612e46
rpc: factor out get_committee logic
bmwill Nov 27, 2024
a4572d9
rpc: remove support for protobuf from rest endpoints
bmwill Nov 27, 2024
13549fe
rest: remove support for bcs response types from various endpoints
bmwill Nov 27, 2024
49f9d2b
rpc: rename RestError to RpcServiceError
bmwill Nov 27, 2024
fe93e81
rest: mark ListCheckpoints unstable till bcs return type is removed
bmwill Nov 27, 2024
e35372c
rpc: factor out get_object logic
bmwill Nov 27, 2024
149f585
rpc: factor out get_checkpoint logic
bmwill Nov 28, 2024
d53ec7c
rpc: factor out get_transaction logic
bmwill Nov 30, 2024
e488af9
rpc: factor out {execute, simulate}_transaction logic
bmwill Dec 1, 2024
583629e
rpc: introduce a get_full_checkpoint method on RpcService
bmwill Dec 1, 2024
5240554
rpc: introduce new protobuf definitions
bmwill Dec 2, 2024
a29e6eb
rpc: add grpc server implementation
bmwill Dec 3, 2024
6078eec
rpc: convert core client to use gRPC
bmwill Dec 3, 2024
00c2a87
rpc: add proptests for converting between rust and protobuf types
bmwill Dec 6, 2024
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
425 changes: 233 additions & 192 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ members = [
"crates/sui-protocol-config-macros",
"crates/sui-proxy",
"crates/sui-replay",
"crates/sui-rest-api",
"crates/sui-rosetta",
"crates/sui-rpc-api",
"crates/sui-rpc-loadgen",
"crates/sui-sdk",
"crates/sui-security-watchdog",
Expand Down Expand Up @@ -605,7 +605,7 @@ anemo-tower = { git = "https://github.com/mystenlabs/anemo.git", rev = "e609f769

# core-types with json format for REST api
# sui-sdk-types = { version = "0.0.1", features = ["hash", "serde", "schemars"] }
sui-sdk-types = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "31bd9da32a8057edc45da8f5e6a8f25b83919b93", features = ["hash", "serde", "schemars"] }
sui-sdk-types = { git = "https://github.com/MystenLabs/sui-rust-sdk.git", rev = "24c34933c421319e9aa1c48b3b7108c756e1422f", features = ["hash", "serde", "schemars"] }

### Workspace Members ###
anemo-benchmark = { path = "crates/anemo-benchmark" }
Expand Down Expand Up @@ -691,7 +691,7 @@ sui-telemetry = { path = "crates/sui-telemetry" }
sui-test-transaction-builder = { path = "crates/sui-test-transaction-builder" }
sui-test-validator = { path = "crates/sui-test-validator" }
sui-tls = { path = "crates/sui-tls" }
sui-rest-api = { path = "crates/sui-rest-api" }
sui-rpc-api = { path = "crates/sui-rpc-api" }
sui-tool = { path = "crates/sui-tool" }
sui-transaction-builder = { path = "crates/sui-transaction-builder" }
sui-transaction-checks = { path = "crates/sui-transaction-checks" }
Expand Down
48 changes: 4 additions & 44 deletions crates/simulacrum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ use std::sync::Arc;

use anyhow::{anyhow, Result};
use fastcrypto::traits::Signer;
use move_core_types::language_storage::StructTag;
use rand::rngs::OsRng;
use sui_config::verifier_signing_config::VerifierSigningConfig;
use sui_config::{genesis, transaction_deny_config::TransactionDenyConfig};
Expand All @@ -29,7 +28,7 @@ use sui_types::base_types::{AuthorityName, ObjectID, VersionNumber};
use sui_types::crypto::AuthoritySignature;
use sui_types::digests::ConsensusCommitDigest;
use sui_types::object::Object;
use sui_types::storage::{ObjectStore, ReadStore, RestStateReader};
use sui_types::storage::{ObjectStore, ReadStore, RpcStateReader};
use sui_types::sui_system_state::epoch_start_sui_system_state::EpochStartSystemState;
use sui_types::transaction::EndOfEpochTransactionKind;
use sui_types::{
Expand Down Expand Up @@ -549,16 +548,7 @@ impl<T, V: store::SimulatorStore> ReadStore for Simulacrum<T, V> {
}
}

impl<T: Send + Sync, V: store::SimulatorStore + Send + Sync> RestStateReader for Simulacrum<T, V> {
fn get_transaction_checkpoint(
&self,
_digest: &sui_types::digests::TransactionDigest,
) -> sui_types::storage::error::Result<
Option<sui_types::messages_checkpoint::CheckpointSequenceNumber>,
> {
todo!()
}

impl<T: Send + Sync, V: store::SimulatorStore + Send + Sync> RpcStateReader for Simulacrum<T, V> {
fn get_lowest_available_checkpoint_objects(
&self,
) -> sui_types::storage::error::Result<CheckpointSequenceNumber> {
Expand All @@ -577,38 +567,8 @@ impl<T: Send + Sync, V: store::SimulatorStore + Send + Sync> RestStateReader for
.into())
}

fn account_owned_objects_info_iter(
&self,
_owner: SuiAddress,
_cursor: Option<ObjectID>,
) -> sui_types::storage::error::Result<
Box<dyn Iterator<Item = sui_types::storage::AccountOwnedObjectInfo> + '_>,
> {
todo!()
}

fn dynamic_field_iter(
&self,
_parent: ObjectID,
_cursor: Option<ObjectID>,
) -> sui_types::storage::error::Result<
Box<
dyn Iterator<
Item = (
sui_types::storage::DynamicFieldKey,
sui_types::storage::DynamicFieldIndexInfo,
),
> + '_,
>,
> {
todo!()
}

fn get_coin_info(
&self,
_coin_type: &StructTag,
) -> sui_types::storage::error::Result<Option<sui_types::storage::CoinInfo>> {
todo!()
fn indexes(&self) -> Option<&dyn sui_types::storage::RpcIndexes> {
None
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/sui-analytics-indexer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ eyre.workspace = true
tempfile.workspace = true
sui-types.workspace = true
telemetry-subscribers.workspace = true
sui-rest-api.workspace = true
sui-rpc-api.workspace = true
sui-storage.workspace = true
sui-config.workspace = true
typed-store.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-analytics-indexer/src/analytics_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use tracing::{error, info};

use sui_config::object_storage_config::{ObjectStoreConfig, ObjectStoreType};
use sui_data_ingestion_core::Worker;
use sui_rest_api::CheckpointData;
use sui_rpc_api::CheckpointData;
use sui_storage::object_store::util::{copy_file, path_to_filesystem};
use sui_types::messages_checkpoint::CheckpointSequenceNumber;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use fastcrypto::traits::EncodeDecodeBase64;
use tokio::sync::Mutex;

use sui_data_ingestion_core::Worker;
use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_rpc_api::{CheckpointData, CheckpointTransaction};
use sui_types::effects::TransactionEffectsAPI;
use sui_types::messages_checkpoint::{CertifiedCheckpointSummary, CheckpointSummary};
use sui_types::transaction::TransactionDataAPI;
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-analytics-indexer/src/handlers/df_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use tracing::warn;
use sui_indexer::types::owner_to_owner_info;
use sui_json_rpc_types::SuiMoveValue;
use sui_package_resolver::Resolver;
use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_rpc_api::{CheckpointData, CheckpointTransaction};
use sui_types::base_types::ObjectID;
use sui_types::dynamic_field::visitor as DFV;
use sui_types::dynamic_field::{DynamicFieldName, DynamicFieldType};
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-analytics-indexer/src/handlers/event_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::tables::EventEntry;
use crate::FileType;
use sui_json_rpc_types::type_and_fields_from_move_event_data;
use sui_package_resolver::Resolver;
use sui_rest_api::CheckpointData;
use sui_rpc_api::CheckpointData;
use sui_types::digests::TransactionDigest;
use sui_types::effects::TransactionEvents;
use sui_types::event::Event;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::Result;
use sui_data_ingestion_core::Worker;
use tokio::sync::Mutex;

use sui_rest_api::CheckpointData;
use sui_rpc_api::CheckpointData;
use sui_types::base_types::ObjectID;
use sui_types::transaction::TransactionDataAPI;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use tokio::sync::Mutex;

use sui_json_rpc_types::SuiMoveStruct;
use sui_package_resolver::Resolver;
use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_rpc_api::{CheckpointData, CheckpointTransaction};
use sui_types::base_types::ObjectID;
use sui_types::effects::TransactionEffects;
use sui_types::object::Object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use anyhow::Result;
use fastcrypto::encoding::{Base64, Encoding};
use sui_data_ingestion_core::Worker;
use sui_rest_api::CheckpointData;
use sui_rpc_api::CheckpointData;
use sui_types::full_checkpoint_content::CheckpointTransaction;
use sui_types::object::Object;
use tokio::sync::Mutex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sui_data_ingestion_core::Worker;
use tokio::sync::Mutex;
use tracing::error;

use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_rpc_api::{CheckpointData, CheckpointTransaction};
use sui_types::effects::TransactionEffects;
use sui_types::effects::TransactionEffectsAPI;
use sui_types::transaction::{Command, TransactionDataAPI, TransactionKind};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use anyhow::Result;
use sui_data_ingestion_core::Worker;
use tokio::sync::Mutex;

use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_rpc_api::{CheckpointData, CheckpointTransaction};
use sui_types::base_types::ObjectID;
use sui_types::effects::TransactionEffects;
use sui_types::transaction::TransactionDataAPI;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use sui_types::SYSTEM_PACKAGE_ADDRESSES;
use tokio::sync::Mutex;

use sui_package_resolver::Resolver;
use sui_rest_api::{CheckpointData, CheckpointTransaction};
use sui_rpc_api::{CheckpointData, CheckpointTransaction};
use sui_types::object::Object;

use crate::handlers::{get_move_struct, parse_struct, AnalyticsHandler};
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-analytics-indexer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use tracing::info;

use sui_config::object_storage_config::ObjectStoreConfig;
use sui_data_ingestion_core::Worker;
use sui_rest_api::CheckpointData;
use sui_rpc_api::CheckpointData;
use sui_storage::object_store::util::{
find_all_dirs_with_epoch_prefix, find_all_files_with_epoch_prefix,
};
Expand Down
4 changes: 2 additions & 2 deletions crates/sui-analytics-indexer/src/package_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use move_core_types::account_address::AccountAddress;
use sui_package_resolver::{
error::Error as PackageResolverError, Package, PackageStore, PackageStoreWithLruCache, Result,
};
use sui_rest_api::Client;
use sui_rpc_api::Client;
use sui_types::base_types::ObjectID;
use sui_types::object::Object;
use thiserror::Error;
Expand Down Expand Up @@ -76,7 +76,7 @@ impl LocalDBPackageStore {
pub fn new(path: &Path, rest_url: &str) -> Self {
Self {
package_store_tables: PackageStoreTables::new(path),
fallback_client: Client::new(rest_url),
fallback_client: Client::new(rest_url).unwrap(),
}
}

Expand Down
2 changes: 1 addition & 1 deletion crates/sui-config/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ sui-keys.workspace = true
sui-protocol-config.workspace = true
sui-types.workspace = true
move-vm-config.workspace = true
sui-rest-api.workspace = true
sui-rpc-api.workspace = true
mysten-common.workspace = true

[dev-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion crates/sui-config/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub struct NodeConfig {
#[serde(default)]
pub enable_experimental_rest_api: bool,
#[serde(skip_serializing_if = "Option::is_none")]
pub rest: Option<sui_rest_api::Config>,
pub rpc: Option<sui_rpc_api::Config>,

#[serde(default = "default_metrics_address")]
pub metrics_address: SocketAddr,
Expand Down
12 changes: 6 additions & 6 deletions crates/sui-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::consensus_adapter::ConsensusOverloadChecker;
use crate::execution_cache::ExecutionCacheTraitPointers;
use crate::execution_cache::TransactionCacheRead;
use crate::jsonrpc_index::CoinIndexKey2;
use crate::rest_index::RestIndexStore;
use crate::rpc_index::RpcIndexStore;
use crate::transaction_outputs::TransactionOutputs;
use crate::verify_indexes::verify_indexes;
use anyhow::anyhow;
Expand Down Expand Up @@ -792,7 +792,7 @@ pub struct AuthorityState {
execution_lock: RwLock<EpochId>,

pub indexes: Option<Arc<IndexStore>>,
pub rest_index: Option<Arc<RestIndexStore>>,
pub rpc_index: Option<Arc<RpcIndexStore>>,

pub subscription_handler: Arc<SubscriptionHandler>,
checkpoint_store: Arc<CheckpointStore>,
Expand Down Expand Up @@ -2834,7 +2834,7 @@ impl AuthorityState {
epoch_store: Arc<AuthorityPerEpochStore>,
committee_store: Arc<CommitteeStore>,
indexes: Option<Arc<IndexStore>>,
rest_index: Option<Arc<RestIndexStore>>,
rpc_index: Option<Arc<RpcIndexStore>>,
checkpoint_store: Arc<CheckpointStore>,
prometheus_registry: &Registry,
genesis_objects: &[Object],
Expand Down Expand Up @@ -2866,7 +2866,7 @@ impl AuthorityState {
let _pruner = AuthorityStorePruner::new(
store.perpetual_tables.clone(),
checkpoint_store.clone(),
rest_index.clone(),
rpc_index.clone(),
store.objects_lock_table.clone(),
config.authority_store_pruning_config.clone(),
epoch_store.committee().authority_exists(&name),
Expand All @@ -2886,7 +2886,7 @@ impl AuthorityState {
input_loader,
execution_cache_trait_pointers,
indexes,
rest_index,
rpc_index,
subscription_handler: Arc::new(SubscriptionHandler::new(prometheus_registry)),
checkpoint_store,
committee_store,
Expand Down Expand Up @@ -2978,7 +2978,7 @@ impl AuthorityState {
AuthorityStorePruner::prune_checkpoints_for_eligible_epochs(
&self.database_for_testing().perpetual_tables,
&self.checkpoint_store,
self.rest_index.as_deref(),
self.rpc_index.as_deref(),
&self.database_for_testing().objects_lock_table,
config.authority_store_pruning_config,
metrics,
Expand Down
6 changes: 3 additions & 3 deletions crates/sui-core/src/authority/authority_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use crate::authority::authority_store_types::{
get_store_object_pair, ObjectContentDigest, StoreObject, StoreObjectPair, StoreObjectWrapper,
};
use crate::authority::epoch_start_configuration::{EpochFlag, EpochStartConfiguration};
use crate::rest_index::RestIndexStore;
use crate::rpc_index::RpcIndexStore;
use crate::state_accumulator::AccumulatorStore;
use crate::transaction_outputs::TransactionOutputs;
use either::Either;
Expand Down Expand Up @@ -1791,7 +1791,7 @@ impl AuthorityStore {
pub async fn prune_objects_and_compact_for_testing(
&self,
checkpoint_store: &Arc<CheckpointStore>,
rest_index: Option<&RestIndexStore>,
rpc_index: Option<&RpcIndexStore>,
) {
let pruning_config = AuthorityStorePruningConfig {
num_epochs_to_retain: 0,
Expand All @@ -1800,7 +1800,7 @@ impl AuthorityStore {
let _ = AuthorityStorePruner::prune_objects_for_eligible_epochs(
&self.perpetual_tables,
checkpoint_store,
rest_index,
rpc_index,
&self.objects_lock_table,
pruning_config,
AuthorityStorePruningMetrics::new_for_test(),
Expand Down
Loading
Loading