diff --git a/consensus/src/execution_pipeline.rs b/consensus/src/execution_pipeline.rs index ee11b60e12a5e8..c3bbb9c2f7cfbd 100644 --- a/consensus/src/execution_pipeline.rs +++ b/consensus/src/execution_pipeline.rs @@ -13,8 +13,7 @@ use crate::{ use aptos_consensus_types::{block::Block, pipeline_execution_result::PipelineExecutionResult}; use aptos_crypto::HashValue; use aptos_executor_types::{ - state_checkpoint_output::StateCheckpointOutput, state_compute_result::StateComputeResult, - BlockExecutorTrait, ExecutorError, ExecutorResult, + state_compute_result::StateComputeResult, BlockExecutorTrait, ExecutorError, ExecutorResult, }; use aptos_experimental_runtimes::thread_manager::optimal_min_len; use aptos_logger::{debug, warn}; @@ -213,7 +212,7 @@ impl ExecutionPipeline { let block_id = block.block_id; debug!("execute_stage received block {}.", block_id); let executor = executor.clone(); - let state_checkpoint_output = monitor!( + let execution_time = monitor!( "execute_block", tokio::task::spawn_blocking(move || { fail_point!("consensus::compute", |_| { @@ -228,7 +227,7 @@ impl ExecutionPipeline { parent_block_id, block_executor_onchain_config, ) - .map(|output| (output, start.elapsed())) + .map(|_| start.elapsed()) }) .await ) @@ -239,7 +238,7 @@ impl ExecutionPipeline { input_txns, block_id, parent_block_id, - state_checkpoint_output, + execution_time, pre_commit_hook, result_tx, command_creation_time: Instant::now(), @@ -260,7 +259,7 @@ impl ExecutionPipeline { input_txns, block_id, parent_block_id, - state_checkpoint_output: execution_result, + execution_time, pre_commit_hook, result_tx, command_creation_time, @@ -270,12 +269,12 @@ impl ExecutionPipeline { counters::APPLY_LEDGER_WAIT_TIME.observe_duration(command_creation_time.elapsed()); debug!("ledger_apply stage received block {}.", block_id); let res = async { - let (state_checkpoint_output, execution_duration) = execution_result?; + let execution_duration = execution_time?; let executor = executor.clone(); monitor!( "ledger_apply", tokio::task::spawn_blocking(move || { - executor.ledger_update(block_id, parent_block_id, state_checkpoint_output) + executor.ledger_update(block_id, parent_block_id) }) .await ) @@ -389,7 +388,7 @@ struct LedgerApplyCommand { input_txns: Vec, block_id: HashValue, parent_block_id: HashValue, - state_checkpoint_output: ExecutorResult<(StateCheckpointOutput, Duration)>, + execution_time: ExecutorResult, pre_commit_hook: PreCommitHook, result_tx: oneshot::Sender>, command_creation_time: Instant, diff --git a/consensus/src/state_computer.rs b/consensus/src/state_computer.rs index 4dea793e652e7b..f63bc70e77e7aa 100644 --- a/consensus/src/state_computer.rs +++ b/consensus/src/state_computer.rs @@ -466,7 +466,6 @@ async fn test_commit_sync_race() { }; use aptos_config::config::transaction_filter_type::Filter; use aptos_consensus_notifications::Error; - use aptos_executor_types::state_checkpoint_output::StateCheckpointOutput; use aptos_infallible::Mutex; use aptos_types::{ aggregate_signature::AggregateSignature, @@ -505,7 +504,7 @@ async fn test_commit_sync_race() { _block: ExecutableBlock, _parent_block_id: HashValue, _onchain_config: BlockExecutorConfigFromOnchain, - ) -> ExecutorResult { + ) -> ExecutorResult<()> { todo!() } @@ -513,7 +512,6 @@ async fn test_commit_sync_race() { &self, _block_id: HashValue, _parent_block_id: HashValue, - _state_checkpoint_output: StateCheckpointOutput, ) -> ExecutorResult { todo!() } diff --git a/consensus/src/state_computer_tests.rs b/consensus/src/state_computer_tests.rs index f9979f99410244..96af0cf89a6f6b 100644 --- a/consensus/src/state_computer_tests.rs +++ b/consensus/src/state_computer_tests.rs @@ -12,8 +12,7 @@ use aptos_consensus_notifications::{ConsensusNotificationSender, Error}; use aptos_consensus_types::{block::Block, block_data::BlockData}; use aptos_crypto::HashValue; use aptos_executor_types::{ - state_checkpoint_output::StateCheckpointOutput, state_compute_result::StateComputeResult, - BlockExecutorTrait, ExecutorResult, + state_compute_result::StateComputeResult, BlockExecutorTrait, ExecutorResult, }; use aptos_infallible::Mutex; use aptos_types::{ @@ -118,16 +117,15 @@ impl BlockExecutorTrait for DummyBlockExecutor { block: ExecutableBlock, _parent_block_id: HashValue, _onchain_config: BlockExecutorConfigFromOnchain, - ) -> ExecutorResult { + ) -> ExecutorResult<()> { self.blocks_received.lock().push(block); - Ok(StateCheckpointOutput::default()) + Ok(()) } fn ledger_update( &self, _block_id: HashValue, _parent_block_id: HashValue, - _state_checkpoint_output: StateCheckpointOutput, ) -> ExecutorResult { let txns = self .blocks_received diff --git a/execution/executor-benchmark/src/ledger_update_stage.rs b/execution/executor-benchmark/src/ledger_update_stage.rs index 785e87ceab3f73..b0cc3033eeeadb 100644 --- a/execution/executor-benchmark/src/ledger_update_stage.rs +++ b/execution/executor-benchmark/src/ledger_update_stage.rs @@ -52,12 +52,11 @@ where block_id, parent_block_id, num_input_txns, - state_checkpoint_output, } = ledger_update_message; let output = self .executor - .ledger_update(block_id, parent_block_id, state_checkpoint_output.clone()) + .ledger_update(block_id, parent_block_id) .unwrap(); output.execution_output.check_aborts_discards_retries( self.allow_aborts, diff --git a/execution/executor-benchmark/src/pipeline.rs b/execution/executor-benchmark/src/pipeline.rs index 5763c19567c726..c61fd79dfecbf6 100644 --- a/execution/executor-benchmark/src/pipeline.rs +++ b/execution/executor-benchmark/src/pipeline.rs @@ -10,10 +10,7 @@ use crate::{ use aptos_block_partitioner::v2::config::PartitionerV2Config; use aptos_crypto::HashValue; use aptos_executor::block_executor::{BlockExecutor, TransactionBlockExecutor}; -use aptos_executor_types::{ - state_checkpoint_output::StateCheckpointOutput, state_compute_result::StateComputeResult, - BlockExecutorTrait, -}; +use aptos_executor_types::{state_compute_result::StateComputeResult, BlockExecutorTrait}; use aptos_logger::info; use aptos_types::{ block_executor::partitioner::ExecutableBlock, @@ -270,7 +267,6 @@ pub struct LedgerUpdateMessage { pub block_id: HashValue, pub parent_block_id: HashValue, pub num_input_txns: usize, - pub state_checkpoint_output: StateCheckpointOutput, } /// Message from execution stage to commit stage. diff --git a/execution/executor-benchmark/src/transaction_executor.rs b/execution/executor-benchmark/src/transaction_executor.rs index da6fbbd4563871..2d4079a3db848b 100644 --- a/execution/executor-benchmark/src/transaction_executor.rs +++ b/execution/executor-benchmark/src/transaction_executor.rs @@ -60,8 +60,7 @@ where self.num_blocks_processed, block_id ); let num_input_txns = executable_block.transactions.num_transactions(); - let state_checkpoint_output = self - .executor + self.executor .execute_and_state_checkpoint( executable_block, self.parent_block_id, @@ -77,7 +76,6 @@ where block_id, parent_block_id: self.parent_block_id, num_input_txns, - state_checkpoint_output, }; self.ledger_update_sender.send(msg).unwrap(); self.parent_block_id = block_id; diff --git a/execution/executor-types/src/lib.rs b/execution/executor-types/src/lib.rs index de01305f82646e..e56cd4e0acefec 100644 --- a/execution/executor-types/src/lib.rs +++ b/execution/executor-types/src/lib.rs @@ -3,7 +3,6 @@ // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] -use crate::state_checkpoint_output::StateCheckpointOutput; use anyhow::Result; use aptos_crypto::HashValue; use aptos_scratchpad::{ProofRead, SparseMerkleTree}; @@ -135,9 +134,8 @@ pub trait BlockExecutorTrait: Send + Sync { onchain_config: BlockExecutorConfigFromOnchain, ) -> ExecutorResult { let block_id = block.block_id; - let state_checkpoint_output = - self.execute_and_state_checkpoint(block, parent_block_id, onchain_config)?; - self.ledger_update(block_id, parent_block_id, state_checkpoint_output) + self.execute_and_state_checkpoint(block, parent_block_id, onchain_config)?; + self.ledger_update(block_id, parent_block_id) } /// Executes a block and returns the state checkpoint output. @@ -146,13 +144,12 @@ pub trait BlockExecutorTrait: Send + Sync { block: ExecutableBlock, parent_block_id: HashValue, onchain_config: BlockExecutorConfigFromOnchain, - ) -> ExecutorResult; + ) -> ExecutorResult<()>; fn ledger_update( &self, block_id: HashValue, parent_block_id: HashValue, - state_checkpoint_output: StateCheckpointOutput, ) -> ExecutorResult; #[cfg(any(test, feature = "fuzzing"))] diff --git a/execution/executor/src/block_executor/mod.rs b/execution/executor/src/block_executor/mod.rs index 35fbe0c0393faa..21cc0c094386f4 100644 --- a/execution/executor/src/block_executor/mod.rs +++ b/execution/executor/src/block_executor/mod.rs @@ -19,8 +19,8 @@ use crate::{ use anyhow::Result; use aptos_crypto::HashValue; use aptos_executor_types::{ - execution_output::ExecutionOutput, state_checkpoint_output::StateCheckpointOutput, - state_compute_result::StateComputeResult, BlockExecutorTrait, ExecutorError, ExecutorResult, + execution_output::ExecutionOutput, state_compute_result::StateComputeResult, + BlockExecutorTrait, ExecutorError, ExecutorResult, }; use aptos_experimental_runtimes::thread_manager::THREAD_MANAGER; use aptos_infallible::RwLock; @@ -120,7 +120,7 @@ where block: ExecutableBlock, parent_block_id: HashValue, onchain_config: BlockExecutorConfigFromOnchain, - ) -> ExecutorResult { + ) -> ExecutorResult<()> { let _guard = CONCURRENCY_GAUGE.concurrency_with(&["block", "execute_and_state_checkpoint"]); self.maybe_initialize()?; @@ -135,7 +135,6 @@ where &self, block_id: HashValue, parent_block_id: HashValue, - state_checkpoint_output: StateCheckpointOutput, ) -> ExecutorResult { let _guard = CONCURRENCY_GAUGE.concurrency_with(&["block", "ledger_update"]); @@ -144,7 +143,7 @@ where .read() .as_ref() .expect("BlockExecutor is not reset") - .ledger_update(block_id, parent_block_id, state_checkpoint_output) + .ledger_update(block_id, parent_block_id) } fn pre_commit_block(&self, block_id: HashValue) -> ExecutorResult<()> { @@ -207,7 +206,7 @@ where block: ExecutableBlock, parent_block_id: HashValue, onchain_config: BlockExecutorConfigFromOnchain, - ) -> ExecutorResult { + ) -> ExecutorResult<()> { let _timer = EXECUTE_BLOCK.start_timer(); let ExecutableBlock { block_id, @@ -287,19 +286,18 @@ where (execution_output, state_checkpoint_output) }; let output = PartialStateComputeResult::new(execution_output); - output.set_state_checkpoint_output(state_checkpoint_output.clone()); + output.set_state_checkpoint_output(state_checkpoint_output); let _ = self .block_tree .add_block(parent_block_id, block_id, output)?; - Ok(state_checkpoint_output) + Ok(()) } fn ledger_update( &self, block_id: HashValue, parent_block_id: HashValue, - _state_checkpoint_output: StateCheckpointOutput, ) -> ExecutorResult { let _timer = UPDATE_LEDGER.start_timer(); info!(