diff --git a/api/src/tests/test_context.rs b/api/src/tests/test_context.rs index 4cb63090b1ad2..4dbac60fdcefb 100644 --- a/api/src/tests/test_context.rs +++ b/api/src/tests/test_context.rs @@ -26,7 +26,6 @@ use aptos_types::{ block_metadata::BlockMetadata, chain_id::ChainId, ledger_info::{LedgerInfo, LedgerInfoWithSignatures}, - on_chain_config::VMPublishingOption, transaction::{Transaction, TransactionStatus}, }; use aptos_vm::AptosVM; @@ -54,7 +53,6 @@ pub fn new_test_context(test_name: &'static str) -> TestContext { let mut rng = ::rand::rngs::StdRng::from_seed([0u8; 32]); let builder = ValidatorBuilder::new(&tmp_dir, cached_framework_packages::module_blobs().to_vec()) - .publishing_option(VMPublishingOption::open()) .min_price_per_gas_unit(0) .randomize_first_validator_ports(false); diff --git a/aptos-move/vm-genesis/src/lib.rs b/aptos-move/vm-genesis/src/lib.rs index 86df70b893dfb..c48cd5d0b0103 100644 --- a/aptos-move/vm-genesis/src/lib.rs +++ b/aptos-move/vm-genesis/src/lib.rs @@ -15,7 +15,8 @@ use aptos_types::{ chain_id::ChainId, contract_event::ContractEvent, on_chain_config::{ - ConsensusConfigV1, OnChainConsensusConfig, VMPublishingOption, APTOS_MAX_KNOWN_VERSION, + ConsensusConfigV1, ConsensusConfigV2, OnChainConsensusConfig, VMPublishingOption, + APTOS_MAX_KNOWN_VERSION, }, transaction::{authenticator::AuthenticationKey, ChangeSet, Transaction, WriteSetPayload}, }; @@ -53,16 +54,21 @@ pub fn encode_genesis_transaction( aptos_root_key: Ed25519PublicKey, validators: &[Validator], stdlib_module_bytes: &[Vec], - vm_publishing_option: Option, - consensus_config: OnChainConsensusConfig, chain_id: ChainId, min_price_per_gas_unit: u64, ) -> Transaction { + let consensus_config = OnChainConsensusConfig::V2(ConsensusConfigV2 { + two_chain: true, + decoupled_execution: true, + back_pressure_limit: 10, + exclude_round: 20, + }); + Transaction::GenesisTransaction(WriteSetPayload::Direct(encode_genesis_change_set( &aptos_root_key, validators, stdlib_module_bytes, - vm_publishing_option.unwrap_or_else(VMPublishingOption::open), + VMPublishingOption::open(), consensus_config, chain_id, min_price_per_gas_unit, diff --git a/aptos-node/src/lib.rs b/aptos-node/src/lib.rs index 631beba651123..f4bb455a181af 100644 --- a/aptos-node/src/lib.rs +++ b/aptos-node/src/lib.rs @@ -21,12 +21,8 @@ use aptos_telemetry::{ }; use aptos_time_service::TimeService; use aptos_types::{ - account_config::aptos_root_address, - account_view::AccountView, - chain_id::ChainId, - move_resource::MoveStorage, - on_chain_config::{VMPublishingOption, ON_CHAIN_CONFIG_REGISTRY}, - waypoint::Waypoint, + account_config::aptos_root_address, account_view::AccountView, chain_id::ChainId, + move_resource::MoveStorage, on_chain_config::ON_CHAIN_CONFIG_REGISTRY, waypoint::Waypoint, }; use aptos_vm::AptosVM; use aptosdb::AptosDB; @@ -129,7 +125,6 @@ pub fn load_test_environment( config_path: Option, random_ports: bool, lazy: bool, - publishing_option: Option, genesis_modules: Vec>, rng: R, ) where @@ -173,15 +168,13 @@ pub fn load_test_environment( template.consensus.mempool_poll_count = u64::MAX; } - let mut builder = aptos_genesis_tool::validator_builder::ValidatorBuilder::new( + let builder = aptos_genesis_tool::validator_builder::ValidatorBuilder::new( &config_path, genesis_modules, ) .template(template) .randomize_first_validator_ports(random_ports); - if let Some(publishing_option) = publishing_option { - builder = builder.publishing_option(publishing_option); - } + let (root_keys, _genesis, genesis_waypoint, validators) = builder.build(rng).unwrap(); let serialized_keys = bcs::to_bytes(&root_keys.root_key).unwrap(); diff --git a/aptos-node/src/main.rs b/aptos-node/src/main.rs index ac26aeeb5e784..6a87036694fbc 100644 --- a/aptos-node/src/main.rs +++ b/aptos-node/src/main.rs @@ -3,7 +3,6 @@ #![forbid(unsafe_code)] use aptos_config::config::NodeConfig; -use aptos_types::on_chain_config::VMPublishingOption; use hex::FromHex; use rand::{rngs::StdRng, SeedableRng}; use std::path::PathBuf; @@ -30,13 +29,6 @@ struct Args { )] seed: Option<[u8; 32]>, - #[structopt( - long, - help = "Enable open publishing when starting single validator testnet", - requires("test") - )] - open_publishing: bool, - #[structopt(long, help = "Enabling random ports for testnet", requires("test"))] random_ports: bool, @@ -67,11 +59,6 @@ fn main() { .seed .map(StdRng::from_seed) .unwrap_or_else(StdRng::from_entropy); - let publishing_option = if args.open_publishing { - Some(VMPublishingOption::open()) - } else { - None - }; let genesis_modules = if let Some(module_paths) = args.genesis_modules { framework::load_modules_from_paths(&module_paths) } else { @@ -81,7 +68,6 @@ fn main() { args.config, args.random_ports, args.lazy, - publishing_option, genesis_modules, rng, ); diff --git a/config/management/genesis/src/builder.rs b/config/management/genesis/src/builder.rs index 263b0814a110a..0508d5b775fb7 100644 --- a/config/management/genesis/src/builder.rs +++ b/config/management/genesis/src/builder.rs @@ -11,7 +11,6 @@ use aptos_management::constants::{self, VALIDATOR_CONFIG, VALIDATOR_OPERATOR}; use aptos_secure_storage::{KVStorage, Namespaced}; use aptos_types::{ chain_id::ChainId, - on_chain_config::{OnChainConsensusConfig, VMPublishingOption}, transaction::{ authenticator::AuthenticationKey, ScriptFunction, Transaction, TransactionPayload, }, @@ -206,12 +205,7 @@ impl GenesisBuilder { .map_err(Into::into) } - pub fn build( - &self, - chain_id: ChainId, - publishing_option: Option, - consensus_config: OnChainConsensusConfig, - ) -> Result { + pub fn build(&self, chain_id: ChainId) -> Result { let aptos_root_key = self.root_key()?; let validators = self.validators()?; let move_modules = self.move_modules()?; @@ -221,8 +215,6 @@ impl GenesisBuilder { aptos_root_key, &validators, &move_modules, - publishing_option, - consensus_config, chain_id, min_price_per_gas_unit, ); diff --git a/config/management/genesis/src/genesis.rs b/config/management/genesis/src/genesis.rs index 72b0e6c9d44a2..a247d6ba4bf7e 100644 --- a/config/management/genesis/src/genesis.rs +++ b/config/management/genesis/src/genesis.rs @@ -4,11 +4,7 @@ use crate::builder::GenesisBuilder; use aptos_management::{config::ConfigPath, error::Error, secure_backend::SharedBackend}; use aptos_secure_storage::Storage; -use aptos_types::{ - chain_id::ChainId, - on_chain_config::{ConsensusConfigV2, OnChainConsensusConfig, VMPublishingOption}, - transaction::Transaction, -}; +use aptos_types::{chain_id::ChainId, transaction::Transaction}; use std::{fs::File, io::Write, path::PathBuf}; use structopt::StructOpt; @@ -39,16 +35,7 @@ impl Genesis { let chain_id = config.chain_id; let storage = Storage::from(&config.shared_backend); let genesis = GenesisBuilder::new(storage) - .build( - chain_id, - Some(VMPublishingOption::open()), - OnChainConsensusConfig::V2(ConsensusConfigV2 { - two_chain: true, - decoupled_execution: true, - back_pressure_limit: 10, - exclude_round: 20, - }), - ) + .build(chain_id) .map_err(|e| Error::UnexpectedError(e.to_string()))?; if let Some(path) = self.path { diff --git a/config/management/genesis/src/validator_builder.rs b/config/management/genesis/src/validator_builder.rs index a7e126e632d9e..280d72ebca22c 100644 --- a/config/management/genesis/src/validator_builder.rs +++ b/config/management/genesis/src/validator_builder.rs @@ -27,7 +27,6 @@ use aptos_management::{ use aptos_secure_storage::{CryptoStorage, KVStorage, OnDiskStorage, Storage}; use aptos_types::{ chain_id::ChainId, - on_chain_config::{ConsensusConfigV2, OnChainConsensusConfig, VMPublishingOption}, transaction::{authenticator::AuthenticationKey, Transaction}, waypoint::Waypoint, }; @@ -147,7 +146,6 @@ pub struct ValidatorBuilder { move_modules: Vec>, num_validators: NonZeroUsize, randomize_first_validator_ports: bool, - publishing_option: Option, template: NodeConfig, min_price_per_gas_unit: u64, } @@ -159,7 +157,6 @@ impl ValidatorBuilder { move_modules, num_validators: NonZeroUsize::new(1).unwrap(), randomize_first_validator_ports: true, - publishing_option: Some(VMPublishingOption::open()), template: NodeConfig::default_for_validator(), min_price_per_gas_unit: 1, } @@ -175,11 +172,6 @@ impl ValidatorBuilder { self } - pub fn publishing_option(mut self, publishing_option: VMPublishingOption) -> Self { - self.publishing_option = Some(publishing_option); - self - } - pub fn template(mut self, template: NodeConfig) -> Self { self.template = template; self @@ -215,7 +207,6 @@ impl ValidatorBuilder { &mut genesis_storage, &root_keys, &validators, - self.publishing_option, self.move_modules, self.min_price_per_gas_unit, )?; @@ -368,7 +359,6 @@ impl ValidatorBuilder { genesis_storage: &mut OnDiskStorage, root_keys: &RootKeys, validators: &[ValidatorConfig], - publishing_option: Option, move_modules: Vec>, min_price_per_gas_unit: u64, ) -> Result<(Transaction, Waypoint)> { @@ -417,16 +407,7 @@ impl ValidatorBuilder { genesis_builder.set_min_price_per_gas_unit(min_price_per_gas_unit)?; // Create Genesis and Genesis Waypoint - let genesis = genesis_builder.build( - ChainId::test(), - publishing_option, - OnChainConsensusConfig::V2(ConsensusConfigV2 { - two_chain: true, - decoupled_execution: true, - back_pressure_limit: 10, - exclude_round: 20, - }), - )?; + let genesis = genesis_builder.build(ChainId::test())?; let waypoint = create_genesis_waypoint(&genesis)?; Ok((genesis, waypoint)) diff --git a/crates/aptos/src/genesis/mod.rs b/crates/aptos/src/genesis/mod.rs index 127c529bc0631..0811290a17824 100644 --- a/crates/aptos/src/genesis/mod.rs +++ b/crates/aptos/src/genesis/mod.rs @@ -14,10 +14,7 @@ use crate::{ CliCommand, CliResult, }; use aptos_crypto::ed25519::Ed25519PublicKey; -use aptos_types::{ - chain_id::ChainId, - on_chain_config::{ConsensusConfigV2, OnChainConsensusConfig, VMPublishingOption}, -}; +use aptos_types::chain_id::ChainId; use async_trait::async_trait; use clap::Parser; use vm_genesis::Validator; @@ -61,19 +58,10 @@ impl CliCommand<()> for GenerateGenesis { async fn execute(self) -> CliTypedResult<()> { let genesis_info = fetch_genesis_info(self.github_options)?; - let consensus_config = OnChainConsensusConfig::V2(ConsensusConfigV2 { - two_chain: true, - decoupled_execution: true, - back_pressure_limit: 10, - exclude_round: 20, - }); - vm_genesis::encode_genesis_transaction( genesis_info.root_key.clone(), &genesis_info.validators, &genesis_info.modules, - Some(VMPublishingOption::open()), // TODO: Remove - consensus_config, // TODO: Remove genesis_info.chain_id, MIN_PRICE_PER_GAS_UNIT, );