From f317dcfb71357097d00ff48a4ea77110b81ea692 Mon Sep 17 00:00:00 2001 From: George Mitenkov Date: Tue, 12 Nov 2024 08:09:59 +0000 Subject: [PATCH] [cleanup] Set execute_no_limit to always use Nones for block IDs --- .../aptos-e2e-comparison-testing/src/data_collection.rs | 2 +- .../src/aptos_test_harness.rs | 8 ++------ aptos-move/aptos-vm-profiling/src/bins/run_aptos_p2p.rs | 3 +-- aptos-move/aptos-vm/src/lib.rs | 7 +++---- aptos-move/aptos-vm/tests/sharded_block_executor.rs | 6 +++--- execution/executor-service/src/test_utils.rs | 4 ++-- execution/executor/src/tests/mock_vm/mock_vm_test.rs | 6 ------ storage/db-tool/src/replay_on_archive.rs | 2 -- 8 files changed, 12 insertions(+), 26 deletions(-) diff --git a/aptos-move/aptos-e2e-comparison-testing/src/data_collection.rs b/aptos-move/aptos-e2e-comparison-testing/src/data_collection.rs index 6276683e8fd18..c5c3e3b153ab0 100644 --- a/aptos-move/aptos-e2e-comparison-testing/src/data_collection.rs +++ b/aptos-move/aptos-e2e-comparison-testing/src/data_collection.rs @@ -93,7 +93,7 @@ impl DataCollection { let val = debugger_state_view.get_state_value(TOTAL_SUPPLY_STATE_KEY.deref()); assert!(val.is_ok() && val.unwrap().is_some()); AptosVMBlockExecutor::new() - .execute_block_no_limit(&sig_verified_txns, debugger_state_view, None, None) + .execute_block_no_limit(&sig_verified_txns, debugger_state_view) .map_err(|err| format_err!("Unexpected VM Error: {:?}", err)) } diff --git a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs index 811a000248bc5..a96506db49b47 100644 --- a/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs +++ b/aptos-move/aptos-transactional-test-harness/src/aptos_test_harness.rs @@ -515,12 +515,8 @@ impl<'a> AptosTestAdapter<'a> { fn run_transaction(&mut self, txn: Transaction) -> Result { let txn_block = vec![txn]; let sig_verified_block = into_signature_verified_block(txn_block); - let mut outputs = AptosVMBlockExecutor::new().execute_block_no_limit( - &sig_verified_block, - &self.storage.clone(), - None, - None, - )?; + let mut outputs = AptosVMBlockExecutor::new() + .execute_block_no_limit(&sig_verified_block, &self.storage.clone())?; assert_eq!(outputs.len(), 1); diff --git a/aptos-move/aptos-vm-profiling/src/bins/run_aptos_p2p.rs b/aptos-move/aptos-vm-profiling/src/bins/run_aptos_p2p.rs index 282156b481881..02a5ed3c37a8c 100644 --- a/aptos-move/aptos-vm-profiling/src/bins/run_aptos_p2p.rs +++ b/aptos-move/aptos-vm-profiling/src/bins/run_aptos_p2p.rs @@ -48,8 +48,7 @@ fn main() -> Result<()> { }) .collect(); - let outputs = - AptosVMBlockExecutor::new().execute_block_no_limit(&txns, &state_store, None, None)?; + let outputs = AptosVMBlockExecutor::new().execute_block_no_limit(&txns, &state_store)?; for i in 0..NUM_TXNS { assert!(outputs[i as usize].status().status().unwrap().is_success()); } diff --git a/aptos-move/aptos-vm/src/lib.rs b/aptos-move/aptos-vm/src/lib.rs index 34b1c8085d1bf..25f807a499f95 100644 --- a/aptos-move/aptos-vm/src/lib.rs +++ b/aptos-move/aptos-vm/src/lib.rs @@ -177,15 +177,14 @@ pub trait VMBlockExecutor: Send + Sync { &self, transactions: &[SignatureVerifiedTransaction], state_view: &(impl StateView + Sync), - parent_block: Option<&HashValue>, - current_block: Option, ) -> Result, VMStatus> { self.execute_block( transactions, state_view, BlockExecutorConfigFromOnchain::new_no_block_limit(), - parent_block, - current_block, + // For all use cases, we run on an unknown state. Hence, defaulting to None here. + None, + None, ) .map(BlockOutput::into_transaction_outputs_forced) } diff --git a/aptos-move/aptos-vm/tests/sharded_block_executor.rs b/aptos-move/aptos-vm/tests/sharded_block_executor.rs index bbe6862f99163..5968d0a495ab9 100644 --- a/aptos-move/aptos-vm/tests/sharded_block_executor.rs +++ b/aptos-move/aptos-vm/tests/sharded_block_executor.rs @@ -309,7 +309,7 @@ mod test_utils { .map(|t| t.into_txn()) .collect(); let unsharded_txn_output = AptosVMBlockExecutor::new() - .execute_block_no_limit(&ordered_txns, executor.data_store(), None, None) + .execute_block_no_limit(&ordered_txns, executor.data_store()) .unwrap(); compare_txn_outputs(unsharded_txn_output, sharded_txn_output); } @@ -359,7 +359,7 @@ mod test_utils { .unwrap(); let unsharded_txn_output = AptosVMBlockExecutor::new() - .execute_block_no_limit(&execution_ordered_txns, executor.data_store(), None, None) + .execute_block_no_limit(&execution_ordered_txns, executor.data_store()) .unwrap(); compare_txn_outputs(unsharded_txn_output, sharded_txn_output); } @@ -413,7 +413,7 @@ mod test_utils { .unwrap(); let unsharded_txn_output = AptosVMBlockExecutor::new() - .execute_block_no_limit(&execution_ordered_txns, executor.data_store(), None, None) + .execute_block_no_limit(&execution_ordered_txns, executor.data_store()) .unwrap(); compare_txn_outputs(unsharded_txn_output, sharded_txn_output); } diff --git a/execution/executor-service/src/test_utils.rs b/execution/executor-service/src/test_utils.rs index 15e7e3ea10761..a1d6e8673290d 100644 --- a/execution/executor-service/src/test_utils.rs +++ b/execution/executor-service/src/test_utils.rs @@ -138,7 +138,7 @@ pub fn test_sharded_block_executor_no_conflict> .map(|t| t.into_txn()) .collect(); let unsharded_txn_output = AptosVMBlockExecutor::new() - .execute_block_no_limit(&txns, executor.data_store(), None, None) + .execute_block_no_limit(&txns, executor.data_store()) .unwrap(); compare_txn_outputs(unsharded_txn_output, sharded_txn_output); sharded_block_executor.shutdown(); @@ -193,7 +193,7 @@ pub fn sharded_block_executor_with_conflict>( .unwrap(); let unsharded_txn_output = AptosVMBlockExecutor::new() - .execute_block_no_limit(&execution_ordered_txns, executor.data_store(), None, None) + .execute_block_no_limit(&execution_ordered_txns, executor.data_store()) .unwrap(); compare_txn_outputs(unsharded_txn_output, sharded_txn_output); sharded_block_executor.shutdown(); diff --git a/execution/executor/src/tests/mock_vm/mock_vm_test.rs b/execution/executor/src/tests/mock_vm/mock_vm_test.rs index 427897e3c9e52..4df0ef06d0665 100644 --- a/execution/executor/src/tests/mock_vm/mock_vm_test.rs +++ b/execution/executor/src/tests/mock_vm/mock_vm_test.rs @@ -29,8 +29,6 @@ fn test_mock_vm_different_senders() { .execute_block_no_limit( &into_signature_verified_block(txns.clone()), &MockStateView::empty(), - None, - None, ) .expect("MockVM should not fail to start"); @@ -71,8 +69,6 @@ fn test_mock_vm_same_sender() { .execute_block_no_limit( &into_signature_verified_block(txns), &MockStateView::empty(), - None, - None, ) .expect("MockVM should not fail to start"); @@ -111,8 +107,6 @@ fn test_mock_vm_payment() { .execute_block_no_limit( &into_signature_verified_block(txns), &MockStateView::empty(), - None, - None, ) .expect("MockVM should not fail to start"); diff --git a/storage/db-tool/src/replay_on_archive.rs b/storage/db-tool/src/replay_on_archive.rs index a5df5787a20f2..5bc13308bee98 100644 --- a/storage/db-tool/src/replay_on_archive.rs +++ b/storage/db-tool/src/replay_on_archive.rs @@ -300,8 +300,6 @@ impl Verifier { &self .arc_db .state_view_at_version(start_version.checked_sub(1))?, - None, - None, )?; let mut failed_txns = Vec::new();