Skip to content

Commit

Permalink
Tests for slice metadata, rename module
Browse files Browse the repository at this point in the history
  • Loading branch information
georgemitenkov committed Nov 14, 2024
1 parent 0292a2e commit 9d0662e
Show file tree
Hide file tree
Showing 30 changed files with 214 additions and 148 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

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

2 changes: 1 addition & 1 deletion aptos-move/aptos-debugger/src/aptos_debugger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use aptos_types::{
account_address::AccountAddress,
block_executor::{
config::{BlockExecutorConfig, BlockExecutorConfigFromOnchain, BlockExecutorLocalConfig},
execution_state::TransactionSliceMetadata,
transaction_slice_metadata::TransactionSliceMetadata,
},
contract_event::ContractEvent,
state_store::TStateView,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ use aptos_language_e2e_tests::{
use aptos_types::{
block_executor::{
config::{BlockExecutorConfig, BlockExecutorConfigFromOnchain},
execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
block_metadata::BlockMetadata,
on_chain_config::{OnChainConfig, ValidatorSet},
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-vm-environment/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ once_cell = { workspace = true }
sha3 = { workspace = true }

[dev-dependencies]
aptos-language-e2e-tests = { workspace = true }
aptos-types = { workspace = true, features = ["testing"] }
4 changes: 2 additions & 2 deletions aptos-move/aptos-vm-environment/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,12 @@ fn fetch_config_and_update_hash<T: OnChainConfig>(
#[cfg(test)]
pub mod test {
use super::*;
use aptos_language_e2e_tests::data_store::FakeDataStore;
use aptos_types::state_store::MockStateView;

#[test]
fn test_new_environment() {
// This creates an empty state.
let state_view = FakeDataStore::default();
let state_view = MockStateView::empty();
let env = Environment::new(&state_view, false, None);

// Check default values.
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/aptos-vm/src/aptos_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ use aptos_types::{
BlockExecutorConfig, BlockExecutorConfigFromOnchain, BlockExecutorLocalConfig,
BlockExecutorModuleCacheLocalConfig,
},
execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
block_metadata::BlockMetadata,
block_metadata_ext::{BlockMetadataExt, BlockMetadataWithRandomness},
Expand Down
4 changes: 3 additions & 1 deletion aptos-move/aptos-vm/src/block_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ use aptos_block_executor::{
};
use aptos_infallible::Mutex;
use aptos_types::{
block_executor::{config::BlockExecutorConfig, execution_state::TransactionSliceMetadata},
block_executor::{
config::BlockExecutorConfig, transaction_slice_metadata::TransactionSliceMetadata,
},
contract_event::ContractEvent,
error::PanicError,
executable::ExecutableTestType,
Expand Down
4 changes: 2 additions & 2 deletions aptos-move/aptos-vm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ pub use crate::aptos_vm::{AptosSimulationVM, AptosVM};
use crate::sharded_block_executor::{executor_client::ExecutorClient, ShardedBlockExecutor};
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
config::BlockExecutorConfigFromOnchain, partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
state_store::StateView,
transaction::{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use aptos_logger::{info, trace};
use aptos_types::{
block_executor::{
config::{BlockExecutorConfig, BlockExecutorLocalConfig},
execution_state::TransactionSliceMetadata,
partitioner::{ShardId, SubBlock, SubBlocksForShard, TransactionWithDependencies},
transaction_slice_metadata::TransactionSliceMetadata,
},
state_store::StateView,
transaction::{
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/block-executor/src/code_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

use crate::{
captured_reads::CacheRead,
counters::GLOBAL_MODULE_CACHE_NUM_MISSES_PER_BLOCK,
view::{LatestView, ViewState},
};
use ambassador::delegate_to_methods;
Expand All @@ -28,7 +29,6 @@ use move_vm_types::code::{
WithBytes,
};
use std::sync::Arc;
use crate::counters::GLOBAL_MODULE_CACHE_NUM_MISSES_PER_BLOCK;

impl<'a, T: Transaction, S: TStateView<Key = T::Key>, X: Executable> WithRuntimeEnvironment
for LatestView<'a, T, S, X>
Expand Down
6 changes: 3 additions & 3 deletions aptos-move/block-executor/src/code_cache_global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ where
for (key, module) in modules {
if let Occupied(entry) = self.module_cache.entry(key.clone()) {
if entry.get().is_not_overridden() {
self.size -= entry.get().module_code().extension().size_in_bytes();
entry.remove();
} else {
return Err(PanicError::CodeInvariantError(
"Should never replace a non-overridden module".to_string(),
));
} else {
self.size -= entry.get().module_code().extension().size_in_bytes();
entry.remove();
}
}

Expand Down
3 changes: 2 additions & 1 deletion aptos-move/block-executor/src/code_cache_global_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use crate::{
};
use aptos_types::{
block_executor::{
config::BlockExecutorModuleCacheLocalConfig, execution_state::TransactionSliceMetadata,
config::BlockExecutorModuleCacheLocalConfig,
transaction_slice_metadata::TransactionSliceMetadata,
},
error::PanicError,
state_store::StateView,
Expand Down
3 changes: 1 addition & 2 deletions aptos-move/block-executor/src/counters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,10 +356,9 @@ pub static GLOBAL_MODULE_CACHE_NUM_MISSES_PER_BLOCK: Lazy<IntCounter> = Lazy::ne
"global_module_cache_num_misses_per_block",
"Number of global module cache misses in parallel execution (per-block)"
)
.unwrap()
.unwrap()
});


pub static STRUCT_NAME_INDEX_MAP_NUM_ENTRIES: Lazy<IntGauge> = Lazy::new(|| {
register_int_gauge!(
"struct_name_index_map_num_entries",
Expand Down
7 changes: 3 additions & 4 deletions aptos-move/block-executor/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use crate::{
code_cache_global::GlobalModuleCache,
code_cache_global_manager::AptosModuleCacheManagerGuard,
counters::{
self, BLOCK_EXECUTOR_INNER_EXECUTE_BLOCK, PARALLEL_EXECUTION_SECONDS,
RAYON_EXECUTION_SECONDS, TASK_EXECUTE_SECONDS, TASK_VALIDATE_SECONDS, VM_INIT_SECONDS,
WORK_WITH_TASK_SECONDS,
self, BLOCK_EXECUTOR_INNER_EXECUTE_BLOCK, GLOBAL_MODULE_CACHE_NUM_MISSES_PER_BLOCK,
PARALLEL_EXECUTION_SECONDS, RAYON_EXECUTION_SECONDS, TASK_EXECUTE_SECONDS,
TASK_VALIDATE_SECONDS, VM_INIT_SECONDS, WORK_WITH_TASK_SECONDS,
},
errors::*,
executor_utilities::*,
Expand Down Expand Up @@ -70,7 +70,6 @@ use std::{
Arc,
},
};
use crate::counters::GLOBAL_MODULE_CACHE_NUM_MISSES_PER_BLOCK;

pub struct BlockExecutor<T, E, S, L, X> {
// Number of active concurrent tasks, corresponding to the maximum number of rayon
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/e2e-tests/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ use aptos_types::{
BlockExecutorConfig, BlockExecutorConfigFromOnchain, BlockExecutorLocalConfig,
BlockExecutorModuleCacheLocalConfig,
},
execution_state::TransactionSliceMetadata,
transaction_slice_metadata::TransactionSliceMetadata,
},
block_metadata::BlockMetadata,
chain_id::ChainId,
Expand Down
4 changes: 2 additions & 2 deletions execution/executor-benchmark/src/native_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ use aptos_types::{
account_address::AccountAddress,
account_config::{DepositEvent, WithdrawEvent},
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
config::BlockExecutorConfigFromOnchain, partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
contract_event::ContractEvent,
event::EventKey,
Expand Down
4 changes: 2 additions & 2 deletions execution/executor/src/block_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ use aptos_storage_interface::{
};
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
partitioner::ExecutableBlock,
config::BlockExecutorConfigFromOnchain, partitioner::ExecutableBlock,
transaction_slice_metadata::TransactionSliceMetadata,
},
ledger_info::LedgerInfoWithSignatures,
state_store::StateViewId,
Expand Down
3 changes: 2 additions & 1 deletion execution/executor/src/chunk_executor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ use aptos_storage_interface::{
};
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
config::BlockExecutorConfigFromOnchain,
transaction_slice_metadata::TransactionSliceMetadata,
},
contract_event::ContractEvent,
ledger_info::LedgerInfoWithSignatures,
Expand Down
3 changes: 2 additions & 1 deletion execution/executor/src/chunk_executor/transaction_chunk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ use aptos_metrics_core::TimerHelper;
use aptos_storage_interface::cached_state_view::CachedStateView;
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
config::BlockExecutorConfigFromOnchain,
transaction_slice_metadata::TransactionSliceMetadata,
},
transaction::{Transaction, TransactionOutput, Version},
};
Expand Down
3 changes: 2 additions & 1 deletion execution/executor/src/db_bootstrapper/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use aptos_types::{
account_config::CORE_CODE_ADDRESS,
aggregate_signature::AggregateSignature,
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
config::BlockExecutorConfigFromOnchain,
transaction_slice_metadata::TransactionSliceMetadata,
},
block_info::{BlockInfo, GENESIS_EPOCH, GENESIS_ROUND, GENESIS_TIMESTAMP_USECS},
ledger_info::{LedgerInfo, LedgerInfoWithSignatures},
Expand Down
4 changes: 2 additions & 2 deletions execution/executor/src/fuzzing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use aptos_executor_types::BlockExecutorTrait;
use aptos_storage_interface::{chunk_to_commit::ChunkToCommit, DbReader, DbReaderWriter, DbWriter};
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
config::BlockExecutorConfigFromOnchain, partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
ledger_info::LedgerInfoWithSignatures,
state_store::StateView,
Expand Down
4 changes: 2 additions & 2 deletions execution/executor/src/tests/mock_vm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use aptos_types::{
account_address::AccountAddress,
account_config::NEW_EPOCH_EVENT_V2_MOVE_TYPE_TAG,
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
config::BlockExecutorConfigFromOnchain, partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
bytes::NumToBytes,
chain_id::ChainId,
Expand Down
3 changes: 2 additions & 1 deletion execution/executor/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use aptos_types::{
account_address::AccountAddress,
aggregate_signature::AggregateSignature,
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
config::BlockExecutorConfigFromOnchain,
transaction_slice_metadata::TransactionSliceMetadata,
},
block_info::BlockInfo,
bytes::NumToBytes,
Expand Down
2 changes: 1 addition & 1 deletion execution/executor/src/workflow/do_get_execution_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ use aptos_storage_interface::cached_state_view::{CachedStateView, StateCache};
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain,
execution_state::TransactionSliceMetadata,
partitioner::{ExecutableTransactions, PartitionedTransactions},
transaction_slice_metadata::TransactionSliceMetadata,
},
contract_event::ContractEvent,
epoch_state::EpochState,
Expand Down
4 changes: 2 additions & 2 deletions experimental/execution/ptx-executor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ use aptos_infallible::Mutex;
use aptos_metrics_core::TimerHelper;
use aptos_types::{
block_executor::{
config::BlockExecutorConfigFromOnchain, execution_state::TransactionSliceMetadata,
partitioner::PartitionedTransactions,
config::BlockExecutorConfigFromOnchain, partitioner::PartitionedTransactions,
transaction_slice_metadata::TransactionSliceMetadata,
},
state_store::StateView,
transaction::{
Expand Down
2 changes: 1 addition & 1 deletion types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ url = { workspace = true }

[features]
default = []
testing = []
testing = ["aptos-crypto/fuzzing"]
fuzzing = ["proptest", "proptest-derive", "aptos-crypto/fuzzing", "move-core-types/fuzzing", "arbitrary"]

[[bench]]
Expand Down
107 changes: 0 additions & 107 deletions types/src/block_executor/execution_state.rs

This file was deleted.

Loading

0 comments on commit 9d0662e

Please sign in to comment.