diff --git a/config/example/proxima/genesis_config.json b/config/example/proxima/genesis_config.json index 938b472b79..deded93b32 100644 --- a/config/example/proxima/genesis_config.json +++ b/config/example/proxima/genesis_config.json @@ -527,5 +527,5 @@ }, "time_service_type": "RealTimeService", "transaction_timeout": 86400, - "dag_effective_height": 0 + "dag_effective_height": 1 } diff --git a/config/src/genesis_config.rs b/config/src/genesis_config.rs index bdaebba503..562f08e61d 100644 --- a/config/src/genesis_config.rs +++ b/config/src/genesis_config.rs @@ -881,7 +881,8 @@ pub static G_HALLEY_CONFIG: Lazy = Lazy::new(|| { min_action_delay: 60 * 60 * 1000, // 1h }, transaction_timeout: ONE_DAY, - dag_effective_height: 0, + // todo: rollback it to zero and initialize BlockDag properly + dag_effective_height: 1u64, } }); @@ -940,7 +941,8 @@ pub static G_PROXIMA_CONFIG: Lazy = Lazy::new(|| { min_action_delay: 60 * 1000, // 1 minute }, transaction_timeout: ONE_DAY, - dag_effective_height: 0, + // todo: rollback it to zero and initialize BlockDag properly + dag_effective_height: 1u64, } }); diff --git a/executor/tests/executor_test.rs b/executor/tests/executor_test.rs index 1747d1f7a4..d45015e78f 100644 --- a/executor/tests/executor_test.rs +++ b/executor/tests/executor_test.rs @@ -3,6 +3,7 @@ use anyhow::anyhow; use anyhow::Result; +use starcoin_config::{BuiltinNetworkID, ChainNetwork}; use starcoin_executor::validate_transaction; use starcoin_logger::prelude::*; use starcoin_transaction_builder::{ @@ -28,8 +29,8 @@ use starcoin_vm_types::vm_status::KeptVMStatus; use starcoin_vm_types::{transaction::Package, vm_status::StatusCode}; use test_helper::executor::{ account_execute, account_execute_should_success, association_execute_should_success, - blockmeta_execute, build_raw_txn, current_block_number, TEST_MODULE, TEST_MODULE_1, - TEST_MODULE_2, + blockmeta_execute, build_raw_txn, current_block_number, prepare_customized_genesis, + TEST_MODULE, TEST_MODULE_1, TEST_MODULE_2, }; use test_helper::executor::{ @@ -111,6 +112,34 @@ fn test_flexidag_config_get() { assert_eq!(read_version, version); } +#[stest::test] +fn test_flexidag_config_get_for_halley() { + let chain_state = + prepare_customized_genesis(&ChainNetwork::new_builtin(BuiltinNetworkID::Halley)); + + let version = { + let mut vm = StarcoinVM::new(None); + vm.load_configs(&chain_state).unwrap(); + vm.get_flexidag_config().unwrap().effective_height + }; + + assert_eq!(version, 1); +} + +#[stest::test] +fn test_flexidag_config_get_for_proxima() { + let chain_state = + prepare_customized_genesis(&ChainNetwork::new_builtin(BuiltinNetworkID::Proxima)); + + let version = { + let mut vm = StarcoinVM::new(None); + vm.load_configs(&chain_state).unwrap(); + vm.get_flexidag_config().unwrap().effective_height + }; + + assert_eq!(version, 1); +} + #[stest::test] fn test_consensus_config_get() -> Result<()> { let (chain_state, _net) = prepare_genesis(); diff --git a/genesis/generated/halley/genesis b/genesis/generated/halley/genesis index b3476de34f..22cac4c47f 100644 Binary files a/genesis/generated/halley/genesis and b/genesis/generated/halley/genesis differ diff --git a/genesis/generated/proxima/genesis b/genesis/generated/proxima/genesis index 36c533eb04..663e4e5645 100644 Binary files a/genesis/generated/proxima/genesis and b/genesis/generated/proxima/genesis differ diff --git a/vm/transaction-builder/src/lib.rs b/vm/transaction-builder/src/lib.rs index 1cd7e0deb5..c2bc7ecbfc 100644 --- a/vm/transaction-builder/src/lib.rs +++ b/vm/transaction-builder/src/lib.rs @@ -350,7 +350,8 @@ pub fn create_signed_txn_with_association_account( pub fn build_stdlib_package(net: &ChainNetwork, stdlib_option: StdLibOptions) -> Result { let init_script = match net.genesis_config().stdlib_version { StdlibVersion::Version(1) => build_init_script_v1(net), - _ => build_init_script_v2(net), + version if version < StdlibVersion::Version(12) => build_init_script_v2(net), + _ => build_init_script_v3(net), }; stdlib_package(stdlib_option, Some(init_script)) }