Skip to content

Commit

Permalink
Merge 564be3b into 1d41c2d
Browse files Browse the repository at this point in the history
  • Loading branch information
simonjiao authored May 23, 2024
2 parents 1d41c2d + 564be3b commit 405325a
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/example/proxima/genesis_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -527,5 +527,5 @@
},
"time_service_type": "RealTimeService",
"transaction_timeout": 86400,
"dag_effective_height": 0
"dag_effective_height": 1
}
6 changes: 4 additions & 2 deletions config/src/genesis_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,8 @@ pub static G_HALLEY_CONFIG: Lazy<GenesisConfig> = 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,
}
});

Expand Down Expand Up @@ -940,7 +941,8 @@ pub static G_PROXIMA_CONFIG: Lazy<GenesisConfig> = 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,
}
});

Expand Down
33 changes: 31 additions & 2 deletions executor/tests/executor_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand All @@ -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::{
Expand Down Expand Up @@ -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();
Expand Down
Binary file modified genesis/generated/halley/genesis
Binary file not shown.
Binary file modified genesis/generated/proxima/genesis
Binary file not shown.
3 changes: 2 additions & 1 deletion vm/transaction-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ pub fn create_signed_txn_with_association_account(
pub fn build_stdlib_package(net: &ChainNetwork, stdlib_option: StdLibOptions) -> Result<Package> {
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))
}
Expand Down

0 comments on commit 405325a

Please sign in to comment.