Skip to content

Commit

Permalink
[cluster-test] Fix cluster test gas budget calculations (#10274)
Browse files Browse the repository at this point in the history
Fixes some gas budget calculations in cluster test
  • Loading branch information
tzakian authored Apr 1, 2023
1 parent b630ab5 commit 6fdee68
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 8 deletions.
15 changes: 12 additions & 3 deletions crates/sui-cluster-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use sui_json_rpc_types::{
use sui_types::base_types::TransactionDigest;
use sui_types::messages::ExecuteTransactionRequestType;
use sui_types::object::Owner;
use test_utils::messages::make_transactions_with_wallet_context_and_rgp;
use test_utils::messages::make_transactions_with_wallet_context_and_budget;

use shared_crypto::intent::Intent;
use sui_sdk::SuiClient;
Expand Down Expand Up @@ -117,8 +117,17 @@ impl TestContext {

/// See `make_transactions_with_wallet_context` for potential caveats
/// of this helper function.
pub async fn make_transactions(&mut self, max_txn_num: usize) -> Vec<VerifiedTransaction> {
make_transactions_with_wallet_context_and_rgp(self.get_wallet_mut(), max_txn_num).await
pub async fn make_transactions(
&mut self,
max_txn_num: usize,
gas_budget: u64,
) -> Vec<VerifiedTransaction> {
make_transactions_with_wallet_context_and_budget(
self.get_wallet_mut(),
max_txn_num,
gas_budget,
)
.await
}

pub async fn build_transaction_remotely(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ impl TestCaseImpl for FullNodeBuildPublishTransactionTest {
compiled_package.get_package_base64(/* with_unpublished_deps */ false);
let dependencies = compiled_package.get_dependency_original_package_ids();

let gas_price = ctx.get_reference_gas_price().await;
let params = rpc_params![
ctx.get_wallet_address(),
all_module_bytes,
dependencies,
None::<ObjectID>,
50_000_000 * gas_price
// Doesn't need to be scaled by RGP since most of the cost is storage
50_000_000
];

let data = ctx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ impl TestCaseImpl for FullNodeExecuteTransactionTest {
async fn run(&self, ctx: &mut TestContext) -> Result<(), anyhow::Error> {
let txn_count = 4;
ctx.get_sui_from_faucet(Some(txn_count)).await;
let gas_price = ctx.get_reference_gas_price().await;

let mut txns = ctx.make_transactions(txn_count).await;
let mut txns = ctx
.make_transactions(txn_count, 2_000_000 * gas_price)
.await;
assert!(
txns.len() >= txn_count,
"Expect at least {} txns, but only got {}. Do we generate enough gas objects during genesis?",
Expand Down
5 changes: 3 additions & 2 deletions crates/test-utils/src/messages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,10 @@ pub async fn make_transactions_with_wallet_context(
res
}

pub async fn make_transactions_with_wallet_context_and_rgp(
pub async fn make_transactions_with_wallet_context_and_budget(
context: &mut WalletContext,
max_txn_num: usize,
gas_budget: u64,
) -> Vec<VerifiedTransaction> {
let recipient = get_key_pair::<AuthorityKeyPair>().0;
let accounts_and_objs = get_account_and_gas_objects(context).await;
Expand All @@ -201,7 +202,7 @@ pub async fn make_transactions_with_wallet_context_and_rgp(
.into_object()
.expect("Gas coin could not be converted to object ref.")
.object_ref(),
MAX_GAS * gas_price,
gas_budget,
gas_price,
);
let tx = to_sender_signed_transaction(
Expand Down

1 comment on commit 6fdee68

@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          | 500 | 500 | 0      | 16            | 34            | 52            | 266,705,208,000       | 16,002,312,480,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 18  | 28  |

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          | 496 | 496 | 0      | 18            | 391           | 655           | 345,532,192,200       | 20,731,931,532,000         |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 20  | 29  |

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          | 150 | 150 | 0      | 28            | 77            | 115           | 80,088,270,000        | 4,805,296,200,000          |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 40  | 55  |

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          | 48  | 48  | 0      | 173           | 526           | 758           | 34,007,134,200        | 2,040,428,052,000          |
Stress Performance Report:
+-----------+-----+-----+
| metric    | p50 | p99 |
+=======================+
| cpu usage | 27  | 41  |

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: 2 ms
 	Request vote outbound avg latency: 0 ms
 Certificate commit avg latency: 847 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.