Skip to content

Commit

Permalink
[parallel] remove legacy configs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidiw authored and chrisdevop1 committed May 6, 2022
1 parent e922939 commit 893886c
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 162 deletions.
12 changes: 0 additions & 12 deletions aptos-move/e2e-tests/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,22 +200,10 @@ impl FakeExecutor {
genesis_modules,
publishing_options,
validator_accounts,
false,
);
Self::from_genesis(genesis.0.write_set())
}

pub fn parallel_genesis() -> Self {
let genesis = vm_genesis::generate_test_genesis(
cached_framework_packages::module_blobs(),
VMPublishingOption::open(),
None,
true,
)
.0;
FakeExecutor::from_genesis(genesis.write_set())
}

/// Create one instance of [`AccountData`] without saving it to data store.
pub fn create_raw_account(&mut self) -> Account {
Account::new_from_seed(&mut self.rng)
Expand Down
33 changes: 2 additions & 31 deletions aptos-move/vm-genesis/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ use aptos_types::{
chain_id::ChainId,
contract_event::ContractEvent,
on_chain_config::{
ConsensusConfigV1, OnChainConsensusConfig, ReadWriteSetAnalysis, VMPublishingOption,
APTOS_MAX_KNOWN_VERSION,
ConsensusConfigV1, OnChainConsensusConfig, VMPublishingOption, APTOS_MAX_KNOWN_VERSION,
},
transaction::{authenticator::AuthenticationKey, ChangeSet, Transaction, WriteSetPayload},
};
Expand Down Expand Up @@ -57,7 +56,6 @@ pub fn encode_genesis_transaction(
vm_publishing_option: Option<VMPublishingOption>,
consensus_config: OnChainConsensusConfig,
chain_id: ChainId,
enable_parallel_execution: bool,
min_price_per_gas_unit: u64,
) -> Transaction {
Transaction::GenesisTransaction(WriteSetPayload::Direct(encode_genesis_change_set(
Expand All @@ -67,7 +65,6 @@ pub fn encode_genesis_transaction(
vm_publishing_option.unwrap_or_else(VMPublishingOption::open),
consensus_config,
chain_id,
enable_parallel_execution,
min_price_per_gas_unit,
)))
}
Expand All @@ -79,7 +76,6 @@ pub fn encode_genesis_change_set(
vm_publishing_option: VMPublishingOption,
consensus_config: OnChainConsensusConfig,
chain_id: ChainId,
enable_parallel_execution: bool,
min_price_per_gas_unit: u64,
) -> ChangeSet {
let mut stdlib_modules = Vec::new();
Expand Down Expand Up @@ -108,28 +104,6 @@ pub fn encode_genesis_change_set(
create_and_initialize_validators(&mut session, validators);
reconfigure(&mut session);

if enable_parallel_execution {
let payload = bcs::to_bytes(&ReadWriteSetAnalysis::V1(
read_write_set::analyze(&stdlib_modules)
.expect("Failed to get ReadWriteSet for current Aptos Framework")
.normalize_all_scripts(aptos_vm::read_write_set_analysis::add_on_functions_list())
.trim()
.into_inner(),
))
.expect("Failed to serialize analyze result");

exec_function(
&mut session,
"ParallelExecutionConfig",
"enable_parallel_execution_with_config",
vec![],
serialize_values(&vec![
MoveValue::Signer(account_config::aptos_root_address()),
MoveValue::vector_u8(payload),
]),
)
}

let (mut changeset1, mut events1, _) = session.finish().unwrap().unpack();

let state_view = GenesisStateView::new();
Expand Down Expand Up @@ -350,7 +324,7 @@ pub fn generate_genesis_change_set_for_testing(genesis_options: GenesisOptions)
GenesisOptions::Fresh => framework::aptos::module_blobs(),
};

generate_test_genesis(&modules, VMPublishingOption::open(), None, false).0
generate_test_genesis(&modules, VMPublishingOption::open(), None).0
}

pub fn test_genesis_transaction() -> Transaction {
Expand All @@ -365,7 +339,6 @@ pub fn test_genesis_change_set_and_validators(
cached_framework_packages::module_blobs(),
VMPublishingOption::open(),
count,
false,
)
}

Expand Down Expand Up @@ -436,7 +409,6 @@ pub fn generate_test_genesis(
stdlib_modules: &[Vec<u8>],
vm_publishing_option: VMPublishingOption,
count: Option<usize>,
enable_parallel_execution: bool,
) -> (ChangeSet, Vec<TestValidator>) {
let test_validators = TestValidator::new_test_set(count);
let validators_: Vec<Validator> = test_validators.iter().map(|t| t.data.clone()).collect();
Expand All @@ -449,7 +421,6 @@ pub fn generate_test_genesis(
vm_publishing_option,
OnChainConsensusConfig::V1(ConsensusConfigV1 { two_chain: true }),
ChainId::test(),
enable_parallel_execution,
0,
);
(genesis, test_validators)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@ use anyhow::Result;
use aptos_types::{
account_address::AccountAddress,
account_config::aptos_root_address,
on_chain_config::ReadWriteSetAnalysis,
transaction::{Script, WriteSetPayload},
};
use handlebars::Handlebars;
use move_compiler::{compiled_unit::AnnotatedCompiledUnit, Compiler, Flags};
use move_core_types::transaction_argument::TransactionArgument;
use read_write_set::analyze;
use serde::Serialize;
use std::{collections::HashMap, io::Write, path::PathBuf};
use tempfile::NamedTempFile;
Expand Down Expand Up @@ -107,53 +104,3 @@ pub fn encode_halt_network_payload() -> WriteSetPayload {
execute_as: aptos_root_address(),
}
}

pub fn encode_initialize_parallel_execution() -> WriteSetPayload {
let mut script = template_path();
script.push("initialize_parallel_execution.move");

WriteSetPayload::Script {
script: Script::new(
compile_script(script.to_str().unwrap().to_owned()),
vec![],
vec![],
),
execute_as: aptos_root_address(),
}
}

pub fn encode_disable_parallel_execution() -> WriteSetPayload {
let mut script = template_path();
script.push("disable_parallel_execution.move");

WriteSetPayload::Script {
script: Script::new(
compile_script(script.to_str().unwrap().to_owned()),
vec![],
vec![],
),
execute_as: aptos_root_address(),
}
}

pub fn encode_enable_parallel_execution_with_config() -> WriteSetPayload {
let payload = bcs::to_bytes(&ReadWriteSetAnalysis::V1(
analyze(cached_framework_packages::modules())
.expect("Failed to get ReadWriteSet for current Framework")
.normalize_all_scripts(aptos_vm::read_write_set_analysis::add_on_functions_list())
.trim()
.into_inner(),
))
.expect("Failed to serialize analyze result");

let mut script = template_path();
script.push("update_parallel_execution_config.move");
WriteSetPayload::Script {
script: Script::new(
compile_script(script.to_str().unwrap().to_owned()),
vec![],
vec![TransactionArgument::U8Vector(payload)],
),
execute_as: aptos_root_address(),
}
}
4 changes: 1 addition & 3 deletions aptos-move/writeset-transaction-generator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ mod admin_script_builder;
mod writeset_builder;

pub use admin_script_builder::{
encode_custom_script, encode_disable_parallel_execution,
encode_enable_parallel_execution_with_config, encode_halt_network_payload,
encode_initialize_parallel_execution, encode_remove_validators_payload,
encode_custom_script, encode_halt_network_payload, encode_remove_validators_payload,
};

pub use writeset_builder::{build_changeset, GenesisSession};
2 changes: 0 additions & 2 deletions config/management/genesis/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,6 @@ impl<S: KVStorage> GenesisBuilder<S> {
publishing_option,
consensus_config,
chain_id,
// TODO: Make this flag configurable via cli command.
false,
min_price_per_gas_unit,
);

Expand Down
2 changes: 0 additions & 2 deletions types/src/on_chain_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ use std::{collections::HashMap, fmt, sync::Arc};

mod aptos_version;
mod consensus_config;
mod parallel_execution_config;
mod registered_currencies;
mod validator_set;
mod vm_config;
Expand All @@ -30,7 +29,6 @@ pub use self::{
Version, APTOS_MAX_KNOWN_VERSION, APTOS_VERSION_2, APTOS_VERSION_3, APTOS_VERSION_4,
},
consensus_config::{ConsensusConfigV1, ConsensusConfigV2, OnChainConsensusConfig},
parallel_execution_config::{ParallelExecutionConfig, ReadWriteSetAnalysis},
registered_currencies::RegisteredCurrencies,
validator_set::ValidatorSet,
vm_config::VMConfig,
Expand Down
59 changes: 0 additions & 59 deletions types/src/on_chain_config/parallel_execution_config.rs

This file was deleted.

0 comments on commit 893886c

Please sign in to comment.