Skip to content
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ and this project adheres to the versioning scheme outlined in the [README.md](RE
- Functions that include a `signer-key` parameter also include a `signer-sig` parameter to demonstrate that the owner of `signer-key` is approving that particular Stacking operation. For more details, refer to the `verify-signer-key-sig` method in the `pox-4` contract.
- Signer key authorizations can be added via `set-signer-key-authorization` to omit the need for `signer-key` signatures
- A `max-amount` field is a field in signer key authorizations and defines the maximum amount of STX that can be locked in a single transaction.
- Added configuration parameters to customize the burn block at which to start processing Stacks blocks, when running on testnet or regtest.
```
[burnchain]
first_burn_block_height = 2582526
first_burn_block_timestamp = 1710780828
first_burn_block_hash = "000000000000001a17c68d43cb577d62074b63a09805e4a07e829ee717507f66"
```

### Modified

Expand Down
25 changes: 25 additions & 0 deletions stackslib/src/chainstate/coordinator/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,7 @@ pub fn get_chainstate(path: &str) -> StacksChainState {
}

fn make_genesis_block(
burnchain: &Burnchain,
sort_db: &SortitionDB,
state: &mut StacksChainState,
parent_block: &BlockHeaderHash,
Expand All @@ -610,6 +611,7 @@ fn make_genesis_block(
key_index: u32,
) -> (BlockstackOperationType, StacksBlock) {
make_genesis_block_with_recipients(
burnchain,
sort_db,
state,
parent_block,
Expand All @@ -624,6 +626,7 @@ fn make_genesis_block(
/// build a stacks block with just the coinbase off of
/// parent_block, in the canonical sortition fork.
fn make_genesis_block_with_recipients(
burnchain: &Burnchain,
sort_db: &SortitionDB,
state: &mut StacksChainState,
parent_block: &BlockHeaderHash,
Expand Down Expand Up @@ -654,6 +657,7 @@ fn make_genesis_block_with_recipients(
let proof = VRF::prove(vrf_key, sortition_tip.sortition_hash.as_bytes());

let mut builder = StacksBlockBuilder::make_regtest_block_builder(
burnchain,
&parent_stacks_header,
proof.clone(),
0,
Expand Down Expand Up @@ -919,6 +923,7 @@ fn make_stacks_block_with_input(
let iconn = sort_db.index_conn();

let mut builder = StacksBlockBuilder::make_regtest_block_builder(
burnchain,
&parent_stacks_header,
proof.clone(),
total_burn,
Expand Down Expand Up @@ -1131,6 +1136,7 @@ fn missed_block_commits_2_05() {

let (mut good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -1459,6 +1465,7 @@ fn missed_block_commits_2_1() {

let (mut good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -1801,6 +1808,7 @@ fn late_block_commits_2_1() {

let (mut good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -2064,6 +2072,7 @@ fn test_simple_setup() {

let (op, block) = if ix == 0 {
make_genesis_block(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -2331,6 +2340,7 @@ fn test_sortition_with_reward_set() {
let b = get_burnchain(path, None);
let (good_op, mut block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -2600,6 +2610,7 @@ fn test_sortition_with_burner_reward_set() {
let b = get_burnchain(path, None);
let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -2843,6 +2854,7 @@ fn test_pox_btc_ops() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -3126,6 +3138,7 @@ fn test_stx_transfer_btc_ops() {
let b = get_burnchain(path, pox_consts.clone());
let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -3543,6 +3556,7 @@ fn test_delegate_stx_btc_ops() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -3877,6 +3891,7 @@ fn test_initial_coinbase_reward_distributions() {
let b = get_burnchain(path, pox_consts.clone());
let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -4072,6 +4087,7 @@ fn test_epoch_switch_cost_contract_instantiation() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -4275,6 +4291,7 @@ fn test_epoch_switch_pox_2_contract_instantiation() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -4480,6 +4497,7 @@ fn test_epoch_switch_pox_3_contract_instantiation() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -4768,6 +4786,7 @@ fn atlas_stop_start() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -5021,6 +5040,7 @@ fn test_epoch_verify_active_pox_contract() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -5384,6 +5404,7 @@ fn test_sortition_with_sunset() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -5722,6 +5743,7 @@ fn test_sortition_with_sunset_and_epoch_switch() {

let (good_op, block) = if ix == 0 {
make_genesis_block_with_recipients(
&b,
&sort_db,
&mut chainstate,
&parent,
Expand Down Expand Up @@ -5952,6 +5974,7 @@ fn test_pox_processable_block_in_different_pox_forks() {
eprintln!("Making block {}", ix);
let (op, block) = if ix == 0 {
make_genesis_block(
&b,
&sort_db,
&mut chainstate,
&BlockHeaderHash([0; 32]),
Expand Down Expand Up @@ -6237,6 +6260,7 @@ fn test_pox_no_anchor_selected() {
eprintln!("Making block {}", ix);
let (op, block) = if ix == 0 {
make_genesis_block(
&b,
&sort_db,
&mut chainstate,
&BlockHeaderHash([0; 32]),
Expand Down Expand Up @@ -6451,6 +6475,7 @@ fn test_pox_fork_out_of_order() {
eprintln!("Making block {}", ix);
let (op, block) = if ix == 0 {
make_genesis_block(
&b,
&sort_db,
&mut chainstate,
&BlockHeaderHash([0; 32]),
Expand Down
22 changes: 19 additions & 3 deletions stackslib/src/chainstate/stacks/boot/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2661,6 +2661,7 @@ pub mod test {
let block_txs = vec![coinbase_tx];

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -2697,6 +2698,10 @@ pub mod test {

#[test]
fn test_lockups() {
let burnchain = Burnchain::default_unittest(
0,
&BurnchainHeaderHash::from_hex(BITCOIN_REGTEST_FIRST_BLOCK_HASH).unwrap(),
);
let mut peer_config = TestPeerConfig::new(function_name!(), 2000, 2001);
let alice = StacksAddress::from_string("STVK1K405H6SK9NKJAP32GHYHDJ98MMNP8Y6Z9N0").unwrap();
let bob = StacksAddress::from_string("ST76D2FMXZ7D2719PNE4N71KPSX84XCCNCMYC940").unwrap();
Expand Down Expand Up @@ -2783,6 +2788,7 @@ pub mod test {
let block_txs = vec![coinbase_tx];

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -2877,7 +2883,8 @@ pub mod test {
block_txs.push(tx);
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(&parent_tip, vrf_proof, tip.total_burn, microblock_pubkeyhash).unwrap();
let block_builder = StacksBlockBuilder::make_regtest_block_builder(&burnchain,
&parent_tip, vrf_proof, tip.total_burn, microblock_pubkeyhash).unwrap();
let (anchored_block, _size, _cost) = StacksBlockBuilder::make_anchored_block_from_txs(block_builder, chainstate, &sortdb.index_conn(), block_txs).unwrap();
(anchored_block, vec![])
});
Expand Down Expand Up @@ -2973,6 +2980,7 @@ pub mod test {
let block_txs = vec![coinbase_tx, burn_tx];

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -3083,6 +3091,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -3299,6 +3308,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_block_builder(
&burnchain,
false,
&parent_tip,
vrf_proof,
Expand Down Expand Up @@ -3557,6 +3567,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -3831,6 +3842,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -4083,7 +4095,8 @@ pub mod test {
block_txs.push(charlie_test_tx);
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(&parent_tip, vrf_proof, tip.total_burn, microblock_pubkeyhash).unwrap();
let block_builder = StacksBlockBuilder::make_regtest_block_builder(&burnchain,
&parent_tip, vrf_proof, tip.total_burn, microblock_pubkeyhash).unwrap();
let (anchored_block, _size, _cost) = StacksBlockBuilder::make_anchored_block_from_txs(block_builder, chainstate, &sortdb.index_conn(), block_txs).unwrap();
(anchored_block, vec![])
});
Expand Down Expand Up @@ -4246,6 +4259,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -4544,6 +4558,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -5124,6 +5139,7 @@ pub mod test {
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(
&burnchain,
&parent_tip,
vrf_proof,
tip.total_burn,
Expand Down Expand Up @@ -5502,7 +5518,7 @@ pub mod test {
block_txs.push(charlie_reject);
}

let block_builder = StacksBlockBuilder::make_regtest_block_builder(&parent_tip, vrf_proof, tip.total_burn, microblock_pubkeyhash).unwrap();
let block_builder = StacksBlockBuilder::make_regtest_block_builder(&burnchain, &parent_tip, vrf_proof, tip.total_burn, microblock_pubkeyhash).unwrap();
let (anchored_block, _size, _cost) = StacksBlockBuilder::make_anchored_block_from_txs(block_builder, chainstate, &sortdb.index_conn(), block_txs).unwrap();

if tenure_id == 2 {
Expand Down
2 changes: 2 additions & 0 deletions stackslib/src/chainstate/stacks/boot/pox_2_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3782,6 +3782,7 @@ fn test_get_pox_addrs() {
}

let block_builder = StacksBlockBuilder::make_block_builder(
&burnchain,
false,
&parent_tip,
vrf_proof,
Expand Down Expand Up @@ -4078,6 +4079,7 @@ fn test_stack_with_segwit() {
}

let block_builder = StacksBlockBuilder::make_block_builder(
&burnchain,
false,
&parent_tip,
vrf_proof,
Expand Down
Loading