Skip to content

Commit

Permalink
Clean up a few circular dependencies (#13052)
Browse files Browse the repository at this point in the history
## Description 

Clean up a few circular dependencies. Some are due to unused
dependencies, some are due to end-to-end tests embedded in the crate,
moving out the tests help.

## Test Plan 

CI

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
  • Loading branch information
lxfind authored Jul 19, 2023
1 parent bf7e088 commit 2f1edb7
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 50 deletions.
49 changes: 35 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ members = [
"crates/sui-indexer",
"crates/sui-json",
"crates/sui-json-rpc",
"crates/sui-json-rpc-tests",
"crates/sui-json-rpc-types",
"crates/sui-keys",
"crates/sui-macros",
Expand Down
File renamed without changes.
43 changes: 43 additions & 0 deletions crates/sui-json-rpc-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[package]
name = "sui-json-rpc-tests"
version = "0.0.0"
authors = ["Mysten Labs <[email protected]>"]
license = "Apache-2.0"
publish = false
edition = "2021"

[dependencies]
workspace-hack = { version = "0.1", path = "../workspace-hack" }

[dev-dependencies]
move-package.workspace = true
sui-config.workspace = true
sui-core.workspace = true
sui-keys.workspace = true
sui-move-build.workspace = true
sui-test-transaction-builder.workspace = true
sui-sdk.workspace = true
sui-macros.workspace = true
sui-simulator.workspace = true
sui-json.workspace = true
sui-json-rpc.workspace = true
sui-json-rpc-types.workspace = true
sui-open-rpc.workspace = true
sui-open-rpc-macros.workspace = true
sui-protocol-config.workspace = true
sui-swarm-config.workspace = true
sui-types.workspace = true
test-cluster.workspace = true

anyhow.workspace = true
async-trait.workspace = true
bcs.workspace = true
hyper.workspace = true
jsonrpsee.workspace = true
jsonrpsee-proc-macros.workspace = true
prometheus.workspace = true
rand.workspace = true
reqwest.workspace = true
tokio = { workspace = true, features = ["full"] }
tracing.workspace = true

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use std::path::Path;
use std::path::PathBuf;
use sui_move_build::{BuildConfig, SuiPackageHooks};
use sui_sdk::SuiClient;
use sui_types::programmable_transaction_builder::ProgrammableTransactionBuilder;
Expand All @@ -18,8 +18,9 @@ async fn test_dry_run_publish_with_mocked_coin() -> Result<(), anyhow::Error> {

// Publish test coin package
move_package::package_hooks::register_package_hooks(Box::new(SuiPackageHooks));
let compiled_package = BuildConfig::default()
.build(Path::new("src/unit_tests/data/dummy_modules_publish").to_path_buf())?;
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.extend(["tests", "data", "dummy_modules_publish"]);
let compiled_package = BuildConfig::default().build(path)?;
let compiled_modules_bytes = compiled_package
.get_package_base64(false)
.into_iter()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "Examples"
version = "0.0.1"

[dependencies]
Sui = { local = "../../../../../sui-framework/packages/sui-framework" }
Sui = { local = "../../../../sui-framework/packages/sui-framework" }

[addresses]
examples = "0x0"
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (c) Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0

use crate::api::{
CoinReadApiClient, GovernanceReadApiClient, IndexerApiClient, ReadApiClient,
TransactionBuilderClient, WriteApiClient,
};
use std::collections::BTreeMap;
use std::path::Path;
use std::path::{Path, PathBuf};
#[cfg(not(msim))]
use std::str::FromStr;
use std::time::Duration;
use sui_json::{call_args, type_args};
use sui_json_rpc::api::{
CoinReadApiClient, GovernanceReadApiClient, IndexerApiClient, ReadApiClient,
TransactionBuilderClient, WriteApiClient,
};
use sui_json_rpc_types::ObjectChange;
use sui_json_rpc_types::ObjectsPage;
use sui_json_rpc_types::{
Expand Down Expand Up @@ -446,8 +446,9 @@ async fn test_get_metadata() -> Result<(), anyhow::Error> {
let gas = objects.first().unwrap().object().unwrap();

// Publish test coin package
let compiled_package = BuildConfig::default()
.build(Path::new("src/unit_tests/data/dummy_modules_publish").to_path_buf())?;
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.extend(["tests", "data", "dummy_modules_publish"]);
let compiled_package = BuildConfig::new_for_testing().build(path)?;
let compiled_modules_bytes =
compiled_package.get_package_base64(/* with_unpublished_deps */ false);
let dependencies = compiled_package.get_dependency_original_package_ids();
Expand Down Expand Up @@ -529,8 +530,9 @@ async fn test_get_total_supply() -> Result<(), anyhow::Error> {
let gas = objects.first().unwrap().object().unwrap();

// Publish test coin package
let compiled_package = BuildConfig::new_for_testing()
.build(Path::new("src/unit_tests/data/dummy_modules_publish").to_path_buf())?;
let mut path = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
path.extend(["tests", "data", "dummy_modules_publish"]);
let compiled_package = BuildConfig::default().build(path)?;
let compiled_modules_bytes =
compiled_package.get_package_base64(/* with_unpublished_deps */ false);
let dependencies = compiled_package.get_dependency_original_package_ids();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use sui_types::quorum_driver_types::ExecuteTransactionRequestType;
use sui_types::transaction::SenderSignedData;
use test_cluster::TestClusterBuilder;

use crate::api::{IndexerApiClient, TransactionBuilderClient, WriteApiClient};
use sui_json_rpc::api::{IndexerApiClient, TransactionBuilderClient, WriteApiClient};

#[sim_test]
async fn test_get_transaction_block() -> Result<(), anyhow::Error> {
Expand Down
10 changes: 0 additions & 10 deletions crates/sui-json-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,5 @@ typed-store.workspace = true
cached.workspace = true

[dev-dependencies]
sui-config.workspace = true
sui-keys.workspace = true
sui-move-build.workspace = true
sui-test-transaction-builder.workspace = true
test-cluster.workspace = true
sui-sdk.workspace = true
rand.workspace = true
sui-macros.workspace = true
sui-simulator.workspace = true
reqwest.workspace = true
mockall.workspace = true
expect-test.workspace = true
7 changes: 0 additions & 7 deletions crates/sui-json-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ pub const APP_NAME_HEADER: &str = "app-name";

pub const MAX_REQUEST_SIZE: u32 = 2 << 30;

#[cfg(test)]
#[path = "unit_tests/rpc_server_tests.rs"]
mod rpc_server_test;
#[cfg(test)]
#[path = "unit_tests/transaction_tests.rs"]
mod transaction_tests;

pub struct JsonRpcServerBuilder {
module: RpcModule<()>,
rpc_doc: Project,
Expand Down
1 change: 0 additions & 1 deletion crates/sui-open-rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ clap.workspace = true
pretty_assertions.workspace = true
tokio = { workspace = true, features = ["full"] }
fastcrypto = { workspace = true }
sui.workspace = true
sui-core.workspace = true
sui-json-rpc.workspace = true
sui-json-rpc-types.workspace = true
Expand Down
2 changes: 0 additions & 2 deletions crates/sui-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ clap.workspace = true
dirs.workspace = true
async-recursion.workspace = true
tempfile.workspace = true
test-cluster.workspace = true
futures-core.workspace = true
futures.workspace = true
sui.workspace = true

[[example]]
name = "tic-tac-toe"
Expand Down
1 change: 0 additions & 1 deletion crates/sui-source-validation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@ tempfile.workspace = true
tokio = { workspace = true, features = ["macros", "test-util"] }
tracing.workspace = true

sui.workspace = true
sui-test-transaction-builder.workspace = true
test-cluster.workspace = true
1 change: 0 additions & 1 deletion crates/test-cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ prometheus.workspace = true
tokio = { workspace = true, features = ["full", "tracing", "test-util"] }
serde_json.workspace = true
rand.workspace = true
sui.workspace = true
sui-config.workspace = true
sui-core = { workspace = true, features = ["test-utils"] }
sui-framework.workspace = true
Expand Down

1 comment on commit 2f1edb7

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 Validators 500/s Owned Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 594 | 594 | 0      | 19            | 8279          | 8807          | 450,923,520,000       | 27,055,411,200,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 13  | 100 |

4 Validators 500/s Shared Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 487 | 487 | 0      | 18            | 9335          | 12807         | 437,147,330,400       | 26,228,839,824,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 12  | 100 |

20 Validators 50/s Owned Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 200 | 200 | 0      | 21            | 65            | 129           | 140,857,056,000       | 8,451,423,360,000          |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 26  | 51  |

20 Validators 50/s Shared Transactions Benchmark Results

Benchmark Report:
+-------------+-----+-----+--------+---------------+---------------+---------------+-----------------------+----------------------------+
| duration(s) | tps | cps | error% | latency (min) | latency (p50) | latency (p99) | gas used (MIST total) | gas used/hr (MIST approx.) |
+=======================================================================================================================================+
| 60          | 194 | 194 | 0      | 65            | 1413          | 2195          | 177,926,865,600       | 10,675,611,936,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 25  | 58  |

Narwhal Benchmark Results

 SUMMARY:
-----------------------------------------
 + CONFIG:
 Faults: 0 node(s)
 Committee size: 4 node(s)
 Worker(s) per node: 1 worker(s)
 Collocate primary and workers: True
 Input rate: 50,000 tx/s
 Transaction size: 512 B
 Execution time: 0 s

 Header number of batches threshold: 32 digests
 Header maximum number of batches: 1,000 digests
 Max header delay: 2,000 ms
 GC depth: 50 round(s)
 Sync retry delay: 10,000 ms
 Sync retry nodes: 3 node(s)
 batch size: 500,000 B
 Max batch delay: 200 ms
 Max concurrent requests: 500,000 

 + RESULTS:
 Batch creation avg latency: 202 ms
 Header creation avg latency: -1 ms
 	Batch to header avg latency: -1 ms
 Header to certificate avg latency: 1 ms
 	Request vote outbound avg latency: 0 ms
 Certificate commit avg latency: 745 ms

 Consensus TPS: 0 tx/s
 Consensus BPS: 0 B/s
 Consensus latency: 0 ms

 End-to-end TPS: 0 tx/s
 End-to-end BPS: 0 B/s
 End-to-end latency: 0 ms
-----------------------------------------

Please sign in to comment.