Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[block-executor] Remove unused executable type #15601

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ members = [
"storage/backup/backup-cli",
"storage/backup/backup-service",
"storage/db-tool",
"storage/executable-store",
"storage/indexer",
"storage/indexer_schemas",
"storage/jellyfish-merkle",
Expand Down Expand Up @@ -330,7 +329,6 @@ aptos-dkg = { path = "crates/aptos-dkg" }
aptos-dkg-runtime = { path = "dkg" }
aptos-drop-helper = { path = "crates/aptos-drop-helper" }
aptos-event-notifications = { path = "state-sync/inter-component/event-notifications" }
aptos-executable-store = { path = "storage/executable-store" }
aptos-executor = { path = "execution/executor" }
aptos-block-partitioner = { path = "execution/block-partitioner" }
aptos-enum-conversion-derive = { path = "crates/aptos-enum-conversion-derive" }
Expand Down
12 changes: 5 additions & 7 deletions aptos-move/aptos-vm/src/block_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ use aptos_types::{
},
contract_event::ContractEvent,
error::PanicError,
executable::ExecutableTestType,
fee_statement::FeeStatement,
state_store::{state_key::StateKey, state_value::StateValueMetadata, StateView, StateViewId},
transaction::{
Expand Down Expand Up @@ -438,12 +437,11 @@ impl<
transaction_slice_metadata,
)?;

let executor =
BlockExecutor::<SignatureVerifiedTransaction, E, S, L, ExecutableTestType, TP>::new(
config,
executor_thread_pool,
transaction_commit_listener,
);
let executor = BlockExecutor::<SignatureVerifiedTransaction, E, S, L, TP>::new(
config,
executor_thread_pool,
transaction_commit_listener,
);

let ret = executor.execute_block(
signature_verified_block,
Expand Down
13 changes: 4 additions & 9 deletions aptos-move/block-executor/src/captured_reads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use aptos_mvhashmap::{
};
use aptos_types::{
error::{code_invariant_error, PanicError, PanicOr},
executable::{Executable, ModulePath},
executable::ModulePath,
state_store::{state_value::StateValueMetadata, TStateView},
transaction::BlockExecutableTransaction as Transaction,
write_set::TransactionWrite,
Expand Down Expand Up @@ -359,12 +359,9 @@ where
S: WithSize,
{
// Return an iterator over the captured reads.
pub(crate) fn get_read_values_with_delayed_fields<
SV: TStateView<Key = T::Key>,
X: Executable,
>(
pub(crate) fn get_read_values_with_delayed_fields<SV: TStateView<Key = T::Key>>(
&self,
view: &LatestView<T, SV, X>,
view: &LatestView<T, SV>,
delayed_write_set_ids: &HashSet<DelayedFieldID>,
skip: &HashSet<T::Key>,
) -> Result<BTreeMap<T::Key, (StateValueMetadata, u64, Arc<MoveTypeLayout>)>, PanicError> {
Expand Down Expand Up @@ -879,7 +876,6 @@ mod test {
proptest_types::types::{raw_metadata, KeyType, MockEvent, ValueType},
};
use aptos_mvhashmap::{types::StorageVersion, MVHashMap};
use aptos_types::executable::ExecutableTestType;
use claims::{
assert_err, assert_gt, assert_matches, assert_none, assert_ok, assert_ok_eq, assert_some_eq,
};
Expand Down Expand Up @@ -1458,8 +1454,7 @@ mod test {
assert!(captured_reads.non_delayed_field_speculative_failure);
assert!(!captured_reads.delayed_field_speculative_failure);

let mvhashmap =
MVHashMap::<KeyType<u32>, u32, ValueType, ExecutableTestType, DelayedFieldID>::new();
let mvhashmap = MVHashMap::<KeyType<u32>, u32, ValueType, DelayedFieldID>::new();

captured_reads.non_delayed_field_speculative_failure = false;
captured_reads.delayed_field_speculative_failure = false;
Expand Down
20 changes: 7 additions & 13 deletions aptos-move/block-executor/src/code_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use crate::{
use ambassador::delegate_to_methods;
use aptos_mvhashmap::types::TxnIndex;
use aptos_types::{
executable::{Executable, ModulePath},
executable::ModulePath,
state_store::{state_value::StateValueMetadata, TStateView},
transaction::BlockExecutableTransaction as Transaction,
vm::modules::AptosModuleExtension,
Expand All @@ -30,17 +30,15 @@ use move_vm_types::code::{
};
use std::sync::Arc;

impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> WithRuntimeEnvironment
for LatestView<'a, T, S, X>
impl<'a, T: Transaction, S: TStateView<Key = T::Key>> WithRuntimeEnvironment
for LatestView<'a, T, S>
{
fn runtime_environment(&self) -> &RuntimeEnvironment {
self.runtime_environment
}
}

impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> ModuleCodeBuilder
for LatestView<'a, T, S, X>
{
impl<'a, T: Transaction, S: TStateView<Key = T::Key>> ModuleCodeBuilder for LatestView<'a, T, S> {
type Deserialized = CompiledModule;
type Extension = AptosModuleExtension;
type Key = ModuleId;
Expand All @@ -64,9 +62,7 @@ impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> ModuleCodeB
}
}

impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> ModuleCache
for LatestView<'a, T, S, X>
{
impl<'a, T: Transaction, S: TStateView<Key = T::Key>> ModuleCache for LatestView<'a, T, S> {
type Deserialized = CompiledModule;
type Extension = AptosModuleExtension;
type Key = ModuleId;
Expand Down Expand Up @@ -187,9 +183,7 @@ impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> ModuleCache
}
}

impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> AptosModuleStorage
for LatestView<'a, T, S, X>
{
impl<'a, T: Transaction, S: TStateView<Key = T::Key>> AptosModuleStorage for LatestView<'a, T, S> {
fn fetch_state_value_metadata(
&self,
address: &AccountAddress,
Expand All @@ -206,7 +200,7 @@ impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> AptosModule

#[delegate_to_methods]
#[delegate(ScriptCache, target_ref = "as_script_cache")]
impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> LatestView<'a, T, S, X> {
impl<'a, T: Transaction, S: TStateView<Key = T::Key>> LatestView<'a, T, S> {
/// Returns the script cache.
fn as_script_cache(
&self,
Expand Down
34 changes: 16 additions & 18 deletions aptos-move/block-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ use aptos_mvhashmap::{
use aptos_types::{
block_executor::config::BlockExecutorConfig,
error::{code_invariant_error, expect_ok, PanicError, PanicOr},
executable::Executable,
on_chain_config::BlockGasLimitType,
state_store::{state_value::StateValue, TStateView},
transaction::{
Expand Down Expand Up @@ -72,22 +71,21 @@ use std::{
},
};

pub struct BlockExecutor<T, E, S, L, X, TP> {
pub struct BlockExecutor<T, E, S, L, TP> {
// Number of active concurrent tasks, corresponding to the maximum number of rayon
// threads that may be concurrently participating in parallel execution.
config: BlockExecutorConfig,
executor_thread_pool: Arc<rayon::ThreadPool>,
transaction_commit_hook: Option<L>,
phantom: PhantomData<(T, E, S, L, X, TP)>,
phantom: PhantomData<(T, E, S, L, TP)>,
}

impl<T, E, S, L, X, TP> BlockExecutor<T, E, S, L, X, TP>
impl<T, E, S, L, TP> BlockExecutor<T, E, S, L, TP>
where
T: Transaction,
E: ExecutorTask<Txn = T>,
S: TStateView<Key = T::Key> + Sync,
L: TransactionCommitHook<Output = E::Output>,
X: Executable + 'static,
TP: TxnProvider<T> + Sync,
{
/// The caller needs to ensure that concurrency_level > 1 (0 is illegal and 1 should
Expand Down Expand Up @@ -115,7 +113,7 @@ where
incarnation: Incarnation,
signature_verified_block: &TP,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
executor: &E,
base_view: &S,
global_module_cache: &GlobalModuleCache<
Expand All @@ -125,7 +123,7 @@ where
AptosModuleExtension,
>,
runtime_environment: &RuntimeEnvironment,
parallel_state: ParallelState<T, X>,
parallel_state: ParallelState<T>,
) -> Result<bool, PanicOr<ParallelBlockExecutionError>> {
let _timer = TASK_EXECUTE_SECONDS.start_timer();
let txn = signature_verified_block.get_txn(idx_to_execute);
Expand Down Expand Up @@ -406,7 +404,7 @@ where
Module,
AptosModuleExtension,
>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
scheduler: &Scheduler,
) -> bool {
let _timer = TASK_VALIDATE_SECONDS.start_timer();
Expand Down Expand Up @@ -436,7 +434,7 @@ where
fn update_transaction_on_abort(
txn_idx: TxnIndex,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
runtime_environment: &RuntimeEnvironment,
) {
counters::SPECULATIVE_ABORT_COUNT.inc();
Expand Down Expand Up @@ -490,7 +488,7 @@ where
valid: bool,
validation_wave: Wave,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
scheduler: &Scheduler,
runtime_environment: &RuntimeEnvironment,
) -> Result<SchedulerTask, PanicError> {
Expand Down Expand Up @@ -520,7 +518,7 @@ where
/// returns false (indicating that transaction needs to be re-executed).
fn validate_and_commit_delayed_fields(
txn_idx: TxnIndex,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
) -> Result<bool, PanicError> {
let read_set = last_input_output
Expand Down Expand Up @@ -563,7 +561,7 @@ where
&self,
block_gas_limit_type: &BlockGasLimitType,
scheduler: &Scheduler,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
scheduler_task: &mut SchedulerTask,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
shared_commit_state: &ExplicitSyncWrapper<BlockGasLimitProcessor<T>>,
Expand Down Expand Up @@ -766,7 +764,7 @@ where
Module,
AptosModuleExtension,
>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
scheduler: &Scheduler,
runtime_environment: &RuntimeEnvironment,
) -> Result<(), PanicError> {
Expand All @@ -788,7 +786,7 @@ where
fn materialize_aggregator_v1_delta_writes(
txn_idx: TxnIndex,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
base_view: &S,
) -> Vec<(T::Key, WriteOp)> {
// Materialize all the aggregator v1 deltas.
Expand Down Expand Up @@ -840,7 +838,7 @@ where
fn materialize_txn_commit(
&self,
txn_idx: TxnIndex,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
scheduler: &Scheduler,
start_shared_counter: u32,
shared_counter: &AtomicU32,
Expand All @@ -855,7 +853,7 @@ where
runtime_environment: &RuntimeEnvironment,
final_results: &ExplicitSyncWrapper<Vec<E::Output>>,
) -> Result<(), PanicError> {
let parallel_state = ParallelState::<T, X>::new(
let parallel_state = ParallelState::<T>::new(
versioned_cache,
scheduler,
start_shared_counter,
Expand Down Expand Up @@ -953,7 +951,7 @@ where
environment: &AptosEnvironment,
block: &TP,
last_input_output: &TxnLastInputOutput<T, E::Output, E::Error>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, X, DelayedFieldID>,
versioned_cache: &MVHashMap<T::Key, T::Tag, T::Value, DelayedFieldID>,
scheduler: &Scheduler,
// TODO: should not need to pass base view.
base_view: &S,
Expand Down Expand Up @@ -1386,7 +1384,7 @@ where

for idx in 0..num_txns {
let txn = signature_verified_block.get_txn(idx as TxnIndex);
let latest_view = LatestView::<T, S, X>::new(
let latest_view = LatestView::<T, S>::new(
base_view,
module_cache_manager_guard.module_cache(),
runtime_environment,
Expand Down
30 changes: 8 additions & 22 deletions aptos-move/block-executor/src/executor_utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use aptos_mvhashmap::types::ValueWithLayout;
use aptos_types::{
contract_event::TransactionEvent,
error::{code_invariant_error, PanicError},
executable::Executable,
state_store::TStateView,
transaction::BlockExecutableTransaction as Transaction,
write_set::TransactionWrite,
Expand Down Expand Up @@ -199,15 +198,14 @@ pub(crate) fn gen_id_start_value(sequential: bool) -> u32 {
pub(crate) fn map_id_to_values_in_group_writes<
T: Transaction,
S: TStateView<Key = T::Key> + Sync,
X: Executable + 'static,
>(
finalized_groups: Vec<(
T::Key,
T::Value,
Vec<(T::Tag, ValueWithLayout<T::Value>)>,
ResourceGroupSize,
)>,
latest_view: &LatestView<T, S, X>,
latest_view: &LatestView<T, S>,
) -> Result<
Vec<(
T::Key,
Expand Down Expand Up @@ -242,13 +240,9 @@ pub(crate) fn map_id_to_values_in_group_writes<

// For each delayed field in resource write set, replace the identifiers with values
// (ignoring other writes). Currently also checks the keys are unique.
pub(crate) fn map_id_to_values_in_write_set<
T: Transaction,
S: TStateView<Key = T::Key> + Sync,
X: Executable + 'static,
>(
pub(crate) fn map_id_to_values_in_write_set<T: Transaction, S: TStateView<Key = T::Key> + Sync>(
resource_write_set: Vec<(T::Key, Arc<T::Value>, Arc<MoveTypeLayout>)>,
latest_view: &LatestView<T, S, X>,
latest_view: &LatestView<T, S>,
) -> Result<Vec<(T::Key, T::Value)>, PanicError> {
resource_write_set
.into_iter()
Expand All @@ -262,13 +256,9 @@ pub(crate) fn map_id_to_values_in_write_set<
}

// For each delayed field in the event, replace delayed field identifier with value.
pub(crate) fn map_id_to_values_events<
T: Transaction,
S: TStateView<Key = T::Key> + Sync,
X: Executable + 'static,
>(
pub(crate) fn map_id_to_values_events<T: Transaction, S: TStateView<Key = T::Key> + Sync>(
events: Box<dyn Iterator<Item = (T::Event, Option<MoveTypeLayout>)>>,
latest_view: &LatestView<T, S, X>,
latest_view: &LatestView<T, S>,
) -> Result<Vec<T::Event>, PanicError> {
events
.map(|(event, layout)| {
Expand All @@ -291,18 +281,14 @@ pub(crate) fn map_id_to_values_events<
Ok(event)
}
})
.collect::<std::result::Result<Vec<_>, PanicError>>()
.collect::<Result<Vec<_>, PanicError>>()
}

// Parse the input `value` and replace delayed field identifiers with corresponding values
fn replace_ids_with_values<
T: Transaction,
S: TStateView<Key = T::Key> + Sync,
X: Executable + 'static,
>(
fn replace_ids_with_values<T: Transaction, S: TStateView<Key = T::Key> + Sync>(
value: &Arc<T::Value>,
layout: &MoveTypeLayout,
latest_view: &LatestView<T, S, X>,
latest_view: &LatestView<T, S>,
) -> Result<T::Value, PanicError> {
let mut value = (**value).clone();

Expand Down
Loading
Loading