Skip to content

Commit

Permalink
add features
Browse files Browse the repository at this point in the history
  • Loading branch information
rahxephon89 committed Dec 11, 2024
1 parent 580a5e6 commit 40ab844
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions aptos-move/aptos-e2e-comparison-testing/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ serde = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true }
url = { workspace = true }
aptos-replay-benchmark = { workspace = true }
10 changes: 6 additions & 4 deletions aptos-move/aptos-e2e-comparison-testing/src/data_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ use aptos_framework::natives::code::PackageMetadata;
use aptos_language_e2e_tests::data_store::FakeDataStore;
use aptos_rest_client::Client;
use aptos_types::{
state_store::{state_key::StateKey, state_value::StateValue, TStateView},
transaction::{
on_chain_config::{Features, FeatureFlag}, state_store::{state_key::StateKey, state_value::StateValue, TStateView}, transaction::{
signature_verified_transaction::SignatureVerifiedTransaction, Transaction,
TransactionOutput, Version,
},
write_set::TOTAL_SUPPLY_STATE_KEY,
}, write_set::TOTAL_SUPPLY_STATE_KEY
};
use aptos_validator_interface::{AptosValidatorInterface, FilterCondition, RestDebuggerInterface};
use aptos_vm::{aptos_vm::AptosVMBlockExecutor, VMBlockExecutor};
Expand Down Expand Up @@ -222,6 +220,8 @@ impl DataCollection {
let index = index_writer.clone();

let mut data_state = FakeDataStore::default();
let mut features_to_enable = vec![FeatureFlag::VM_BINARY_FORMAT_V7, FeatureFlag::NATIVE_MEMORY_OPERATIONS];

let cache_v1 = compilation_cache
.lock()
.unwrap()
Expand All @@ -232,6 +232,8 @@ impl DataCollection {
self.debugger.clone(),
version,
data_state,
features_to_enable,
vec![]
);

let txn_execution_thread = tokio::task::spawn_blocking(move || {
Expand Down
22 changes: 18 additions & 4 deletions aptos-move/aptos-e2e-comparison-testing/src/data_state_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@

use aptos_language_e2e_tests::data_store::FakeDataStore;
use aptos_types::{
state_store::{
on_chain_config::FeatureFlag, state_store::{
state_key::StateKey, state_storage_usage::StateStorageUsage, state_value::StateValue,
StateViewResult, TStateView,
},
transaction::Version,
}, transaction::Version
};
use aptos_validator_interface::{AptosValidatorInterface, DebuggerStateView};
use std::{
collections::HashMap,
ops::DerefMut,
sync::{Arc, Mutex},
};
use aptos_replay_benchmark::overrides::OverrideConfig;

pub struct DataStateView {
debugger_view: DebuggerStateView,
code_data: Option<FakeDataStore>,
data_read_state_keys: Option<Arc<Mutex<HashMap<StateKey, StateValue>>>>,
config: Option<HashMap<StateKey, StateValue>>
}

impl DataStateView {
Expand All @@ -32,6 +33,7 @@ impl DataStateView {
debugger_view: DebuggerStateView::new(db, version),
code_data: Some(code_data),
data_read_state_keys: None,
config: None
}
}

Expand All @@ -43,18 +45,25 @@ impl DataStateView {
debugger_view: DebuggerStateView::new(db, version),
code_data: None,
data_read_state_keys: Some(Arc::new(Mutex::new(HashMap::new()))),
config: None
}
}

pub fn new_with_data_reads_and_code(
db: Arc<dyn AptosValidatorInterface + Send>,
version: Version,
code_data: FakeDataStore,
features_to_enable: Vec<FeatureFlag>,
features_to_disable: Vec<FeatureFlag>,
) -> Self {
let debugger_view = DebuggerStateView::new(db, version);
let config = OverrideConfig::new(features_to_enable, features_to_disable);
let features = config.get_state_override(&debugger_view);
Self {
debugger_view: DebuggerStateView::new(db, version),
debugger_view:debugger_view,
code_data: Some(code_data),
data_read_state_keys: Some(Arc::new(Mutex::new(HashMap::new()))),
config: Some(features)
}
}

Expand All @@ -72,6 +81,11 @@ impl TStateView for DataStateView {
return code.get_state_value(state_key).map_err(Into::into);
}
}
if let Some(config) = &self.config {
if config.contains_key(state_key) {
return Ok(config.get(state_key).cloned());
}
}
let ret = self.debugger_view.get_state_value(state_key);
if let Some(reads) = &self.data_read_state_keys {
if !state_key.is_aptos_code()
Expand Down
2 changes: 1 addition & 1 deletion aptos-move/replay-benchmark/src/overrides.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ impl OverrideConfig {
}
}

pub(crate) fn get_state_override(
pub fn get_state_override(
&self,
state_view: &impl StateView,
) -> HashMap<StateKey, StateValue> {
Expand Down

0 comments on commit 40ab844

Please sign in to comment.