mirror of
https://github.com/alexgo-io/stacks-puppet-node.git
synced 2026-05-25 10:12:40 +08:00
fix: debug! instead of info! for a commonly-emitted line
This commit is contained in:
@@ -406,7 +406,7 @@ impl Config {
|
||||
}
|
||||
|
||||
if let Some(v1_unlock_height) = self.burnchain.pox_2_activation {
|
||||
info!(
|
||||
debug!(
|
||||
"Override v1_unlock_height from {} to {}",
|
||||
burnchain.pox_constants.v1_unlock_height, v1_unlock_height
|
||||
);
|
||||
@@ -414,7 +414,7 @@ impl Config {
|
||||
}
|
||||
|
||||
if let Some(sunset_start) = self.burnchain.sunset_start {
|
||||
info!(
|
||||
debug!(
|
||||
"Override sunset_start from {} to {}",
|
||||
burnchain.pox_constants.sunset_start, sunset_start
|
||||
);
|
||||
@@ -422,7 +422,7 @@ impl Config {
|
||||
}
|
||||
|
||||
if let Some(sunset_end) = self.burnchain.sunset_end {
|
||||
info!(
|
||||
debug!(
|
||||
"Override sunset_end from {} to {}",
|
||||
burnchain.pox_constants.sunset_end, sunset_end
|
||||
);
|
||||
|
||||
@@ -1933,3 +1933,179 @@ fn transition_empty_blocks() {
|
||||
|
||||
channel.stop_chains_coordinator();
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore]
|
||||
// fails with NoSuchContract: epoch_21 = 215, v1_unlock_height = 216
|
||||
// fails with NoSuchContract: epoch_21 = 214, v1_unlock_height = 215
|
||||
// fails with NoSuchContract: epoch_21 = 213, v1_unlock_height = 214
|
||||
// works: epoch_21 = 212, v1_unlock_height = 213
|
||||
// works: epoch_21 = 211, v1_unlock_height = 212
|
||||
// fails with NoSuchContract: epoch_21 = 211, v1_unlock_height = 211
|
||||
// fails with NoSuchContract: epoch_21 = 210, v1_unlock_height = 211
|
||||
// fails with NoSuchContract: epoch_21 = 209, v1_unlock_height = 211
|
||||
//
|
||||
// works: epoch_21 = 209, v1_unlock_height = 212
|
||||
// works: epoch_21 = 209, v1_unlock_height = 214
|
||||
// works: epoch_21 = 210, v1_unlock_height = 212
|
||||
// works: epoch_21 = 211, v1_unlock_height = 216
|
||||
// works: epoch_21 = 211, v1_unlock_height = 218
|
||||
// works: epoch_21 = 213, v1_unlock_height = 218
|
||||
// works: epoch_21 = 214, v1_unlock_height = 218
|
||||
fn test_v1_unlock_height() {
|
||||
if env::var("BITCOIND_TEST") != Ok("1".into()) {
|
||||
return;
|
||||
}
|
||||
|
||||
let reward_cycle_len = 5;
|
||||
let prepare_phase_len = 3;
|
||||
let epoch_2_05 = 205;
|
||||
let epoch_2_1 = 210;
|
||||
let v1_unlock_height = 212;
|
||||
|
||||
let stacked = 100_000_000_000 * (core::MICROSTACKS_PER_STACKS as u64);
|
||||
|
||||
let spender_sk = StacksPrivateKey::new();
|
||||
let spender_addr: PrincipalData = to_addr(&spender_sk).into();
|
||||
let mut initial_balances = vec![];
|
||||
|
||||
initial_balances.push(InitialBalance {
|
||||
address: spender_addr.clone(),
|
||||
amount: stacked + 100_000,
|
||||
});
|
||||
|
||||
let pox_pubkey = Secp256k1PublicKey::from_hex(
|
||||
"02f006a09b59979e2cb8449f58076152af6b124aa29b948a3714b8d5f15aa94ede",
|
||||
)
|
||||
.unwrap();
|
||||
let pox_pubkey_hash = bytes_to_hex(
|
||||
&Hash160::from_node_public_key(&pox_pubkey)
|
||||
.to_bytes()
|
||||
.to_vec(),
|
||||
);
|
||||
|
||||
let (mut conf, _) = neon_integration_test_conf();
|
||||
|
||||
// we'll manually post a forked stream to the node
|
||||
conf.node.mine_microblocks = false;
|
||||
conf.burnchain.max_rbf = 1000000;
|
||||
conf.node.wait_time_for_microblocks = 0;
|
||||
conf.node.microblock_frequency = 1_000;
|
||||
conf.miner.first_attempt_time_ms = 2_000;
|
||||
conf.miner.subsequent_attempt_time_ms = 5_000;
|
||||
conf.node.wait_time_for_blocks = 1_000;
|
||||
conf.miner.wait_for_block_download = false;
|
||||
|
||||
conf.miner.min_tx_fee = 1;
|
||||
conf.miner.first_attempt_time_ms = i64::max_value() as u64;
|
||||
conf.miner.subsequent_attempt_time_ms = i64::max_value() as u64;
|
||||
|
||||
test_observer::spawn();
|
||||
|
||||
conf.events_observers.push(EventObserverConfig {
|
||||
endpoint: format!("localhost:{}", test_observer::EVENT_OBSERVER_PORT),
|
||||
events_keys: vec![EventKeyType::AnyEvent],
|
||||
});
|
||||
conf.initial_balances.append(&mut initial_balances);
|
||||
|
||||
let mut epochs = core::STACKS_EPOCHS_REGTEST.to_vec();
|
||||
epochs[1].end_height = epoch_2_05;
|
||||
epochs[2].start_height = epoch_2_05;
|
||||
epochs[2].end_height = epoch_2_1;
|
||||
epochs[3].start_height = epoch_2_1;
|
||||
conf.burnchain.epochs = Some(epochs);
|
||||
|
||||
let mut burnchain_config = Burnchain::regtest(&conf.get_burn_db_path());
|
||||
|
||||
let pox_constants = PoxConstants::new(
|
||||
reward_cycle_len,
|
||||
prepare_phase_len,
|
||||
4 * prepare_phase_len / 5,
|
||||
5,
|
||||
15,
|
||||
u64::max_value() - 2,
|
||||
u64::max_value() - 1,
|
||||
v1_unlock_height as u32,
|
||||
);
|
||||
burnchain_config.pox_constants = pox_constants.clone();
|
||||
|
||||
let mut btcd_controller = BitcoinCoreController::new(conf.clone());
|
||||
btcd_controller
|
||||
.start_bitcoind()
|
||||
.map_err(|_e| ())
|
||||
.expect("Failed starting bitcoind");
|
||||
|
||||
let mut btc_regtest_controller = BitcoinRegtestController::with_burnchain(
|
||||
conf.clone(),
|
||||
None,
|
||||
Some(burnchain_config.clone()),
|
||||
None,
|
||||
);
|
||||
let http_origin = format!("http://{}", &conf.node.rpc_bind);
|
||||
|
||||
btc_regtest_controller.bootstrap_chain(201);
|
||||
|
||||
eprintln!("Chain bootstrapped...");
|
||||
|
||||
let mut run_loop = neon::RunLoop::new(conf.clone());
|
||||
let runloop_burnchain = burnchain_config.clone();
|
||||
|
||||
let blocks_processed = run_loop.get_blocks_processed_arc();
|
||||
let miner_status = run_loop.get_miner_status();
|
||||
|
||||
let channel = run_loop.get_coordinator_channel().unwrap();
|
||||
|
||||
thread::spawn(move || run_loop.start(Some(runloop_burnchain), 0));
|
||||
|
||||
// give the run loop some time to start up!
|
||||
wait_for_runloop(&blocks_processed);
|
||||
|
||||
// first block wakes up the run loop
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
// first block will hold our VRF registration
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
// second block will be the first mined Stacks block
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
|
||||
loop {
|
||||
let tip_info = get_chain_info(&conf);
|
||||
if tip_info.stacks_tip_height >= epoch_2_1 {
|
||||
break;
|
||||
}
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
}
|
||||
|
||||
let sort_height = channel.get_sortitions_processed();
|
||||
let pox_addr_tuple = execute(
|
||||
&format!("{{ hashbytes: 0x{}, version: 0x00 }}", pox_pubkey_hash,),
|
||||
ClarityVersion::Clarity2,
|
||||
)
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
let tx = make_contract_call(
|
||||
&spender_sk,
|
||||
0,
|
||||
3000,
|
||||
&StacksAddress::from_string("ST000000000000000000002AMW42H").unwrap(),
|
||||
"pox-2",
|
||||
"stack-stx",
|
||||
&[
|
||||
Value::UInt(stacked.into()),
|
||||
pox_addr_tuple.clone(),
|
||||
Value::UInt(sort_height as u128),
|
||||
Value::UInt(12),
|
||||
],
|
||||
);
|
||||
|
||||
eprintln!("Submit tx to {:?}", &http_origin);
|
||||
submit_tx(&http_origin, &tx);
|
||||
|
||||
for i in 0..20 {
|
||||
next_block_and_wait(&mut btc_regtest_controller, &blocks_processed);
|
||||
}
|
||||
|
||||
test_observer::clear();
|
||||
channel.stop_chains_coordinator();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user