diff --git a/crates/sui-core/src/authority_server.rs b/crates/sui-core/src/authority_server.rs index 82657614bc0ef4..cac6ec29236c0f 100644 --- a/crates/sui-core/src/authority_server.rs +++ b/crates/sui-core/src/authority_server.rs @@ -248,6 +248,16 @@ impl ValidatorService { .into_inner() } + pub async fn handle_transaction_for_testing( + &self, + transaction: Transaction, + ) -> HandleTransactionResponse { + self.transaction(tonic::Request::new(transaction)) + .await + .unwrap() + .into_inner() + } + async fn handle_transaction( self, request: tonic::Request, diff --git a/crates/sui-single-node-benchmark/src/benchmark_context.rs b/crates/sui-single-node-benchmark/src/benchmark_context.rs index b7820f2b12956e..5e53447a067323 100644 --- a/crates/sui-single-node-benchmark/src/benchmark_context.rs +++ b/crates/sui-single-node-benchmark/src/benchmark_context.rs @@ -12,6 +12,7 @@ use std::sync::Arc; use sui_types::base_types::{ObjectID, ObjectRef, SuiAddress, SUI_ADDRESS_LENGTH}; use sui_types::crypto::{get_account_key_pair, AccountKeyPair}; use sui_types::effects::TransactionEffects; +use sui_types::messages_grpc::HandleTransactionResponse; use sui_types::object::Object; use sui_types::transaction::{CertifiedTransaction, SignedTransaction, Transaction}; use tracing::info; @@ -228,7 +229,10 @@ impl BenchmarkContext { } } - pub(crate) async fn validator_sign_transactions(&self, transactions: Vec) { + pub(crate) async fn validator_sign_transactions( + &self, + transactions: Vec, + ) -> Vec { info!( "Started signing {} transactions. You can now attach a profiler", transactions.len(), @@ -240,6 +244,7 @@ impl BenchmarkContext { tokio::spawn(async move { validator.sign_transaction(tx).await }) }) .collect(); - let _results: Vec<_> = tasks.collect().await; + let results: Vec<_> = tasks.collect().await; + results.into_iter().map(|r| r.unwrap()).collect() } } diff --git a/crates/sui-single-node-benchmark/src/execution.rs b/crates/sui-single-node-benchmark/src/execution.rs index d989e733297ee7..654ea530468387 100644 --- a/crates/sui-single-node-benchmark/src/execution.rs +++ b/crates/sui-single-node-benchmark/src/execution.rs @@ -155,8 +155,8 @@ async fn benchmark_transaction_signing(ctx: &BenchmarkContext, transactions: Vec ctx.validator_sign_transactions(transactions).await; let elapsed = start_time.elapsed().as_millis() as f64 / 1000f64; info!( - "Transaction signing finished in {}s, TPS={}", + "Transaction signing finished in {}s, TPS={}.", elapsed, - tx_count as f64 / elapsed + tx_count as f64 / elapsed, ); } diff --git a/crates/sui-single-node-benchmark/src/single_node.rs b/crates/sui-single-node-benchmark/src/single_node.rs index 9177242b006ea2..cdf1c26cd3d526 100644 --- a/crates/sui-single-node-benchmark/src/single_node.rs +++ b/crates/sui-single-node-benchmark/src/single_node.rs @@ -165,14 +165,8 @@ impl SingleValidator { } pub async fn sign_transaction(&self, transaction: Transaction) -> HandleTransactionResponse { - let result = self - .get_validator() - .handle_transaction( - &self.epoch_store, - VerifiedTransaction::new_unchecked(transaction), - ) + self.validator_service + .handle_transaction_for_testing(transaction) .await - .unwrap(); - result } }