Skip to content

Commit e8d0b77

Browse files
committed
Merge remote-tracking branch 'core/release/3.2.0.0.0-rc1' into feat/sip31-boot-contract-tests
2 parents 0bb3564 + eb39f47 commit e8d0b77

File tree

2 files changed

+43
-8
lines changed

2 files changed

+43
-8
lines changed

stacks-node/src/tests/nakamoto_integrations.rs

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12639,7 +12639,7 @@ fn write_signer_update(
1263912639
/// Test SIP-031 activation
1264012640
///
1264112641
/// - check epoch 3.2 is active
12642-
/// - check sip031 boot contract has a balance of 200_000_000 STX (TODO)
12642+
/// - check sip031 boot contract has a balance of 200_000_000 STX
1264312643
#[test]
1264412644
#[ignore]
1264512645
fn test_sip_031_activation() {
@@ -12721,7 +12721,29 @@ fn test_sip_031_activation() {
1272112721

1272212722
wait_for_first_naka_block_commit(60, &commits_submitted);
1272312723

12724-
// mine until epooch 3.2 height
12724+
// retrieve current liquidity
12725+
let last_block_id = StacksBlockId::from_hex(
12726+
&test_observer::get_blocks()
12727+
.last()
12728+
.unwrap()
12729+
.get("index_block_hash")
12730+
.unwrap()
12731+
.as_str()
12732+
.unwrap()[2..],
12733+
)
12734+
.unwrap();
12735+
12736+
let sip_031_initial_total_liquid_ustx = chainstate
12737+
.with_read_only_clarity_tx(
12738+
&sortdb
12739+
.index_handle_at_block(&chainstate, &last_block_id)
12740+
.unwrap(),
12741+
&last_block_id,
12742+
|conn| conn.with_clarity_db_readonly(|db| db.get_total_liquid_ustx().unwrap()),
12743+
)
12744+
.unwrap();
12745+
12746+
// mine until epoch 3.2 height
1272512747
loop {
1272612748
let commits_before = commits_submitted.load(Ordering::SeqCst);
1272712749
next_block_and_process_new_stacks_block(&mut btc_regtest_controller, 60, &coord_channel)
@@ -12798,6 +12820,19 @@ fn test_sip_031_activation() {
1279812820
}))
1279912821
);
1280012822

12823+
// check liquidity has been updated accordingly
12824+
let sip_031_total_liquid_ustx = chainstate
12825+
.with_read_only_clarity_tx(
12826+
&sortdb
12827+
.index_handle_at_block(&chainstate, &latest_stacks_block_id)
12828+
.unwrap(),
12829+
&latest_stacks_block_id,
12830+
|conn| conn.with_clarity_db_readonly(|db| db.get_total_liquid_ustx().unwrap()),
12831+
)
12832+
.unwrap();
12833+
12834+
assert!(sip_031_total_liquid_ustx - sip_031_initial_total_liquid_ustx >= SIP_031_INITIAL_MINT);
12835+
1280112836
// check if the coinbase activation block receipt has the mint event
1280212837
let mut mint_event_found: Option<serde_json::Value> = None;
1280312838
let mut coinbase_txid: Option<String> = None;
@@ -12846,7 +12881,7 @@ fn test_sip_031_activation() {
1284612881
.unwrap()
1284712882
.as_str()
1284812883
.unwrap(),
12849-
"200000000000000"
12884+
SIP_031_INITIAL_MINT.to_string()
1285012885
);
1285112886

1285212887
// check the recipient

stackslib/src/clarity_vm/clarity.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,7 +1635,7 @@ impl<'a> ClarityBlockConnection<'a, '_> {
16351635
};
16361636

16371637
let boot_code_address = boot_code_addr(mainnet);
1638-
let boot_code_auth = boot_code_tx_auth(boot_code_address.clone());
1638+
let boot_code_auth = boot_code_tx_auth(boot_code_address);
16391639

16401640
// SIP-031 setup (deploy of the boot contract, minting and transfer to the boot contract)
16411641
let sip_031_contract_id = boot_code_id(SIP_031_NAME, mainnet);
@@ -1654,28 +1654,28 @@ impl<'a> ClarityBlockConnection<'a, '_> {
16541654

16551655
let mut sip_031_initialization_receipt = self.as_transaction(|tx_conn| {
16561656
// initialize with a synthetic transaction
1657-
debug!("Instantiate {} contract", &sip_031_contract_id);
1657+
info!("Instantiate {} contract", &sip_031_contract_id);
16581658
let receipt = StacksChainState::process_transaction_payload(
16591659
tx_conn,
16601660
&sip_031_contract_tx,
16611661
&boot_code_account,
16621662
ASTRules::PrecheckSize,
16631663
None,
16641664
)
1665-
.expect("FATAL: Failed to process .sip031 contract initialization");
1665+
.expect("FATAL: Failed to process .sip-031 contract initialization");
16661666
receipt
16671667
});
16681668

16691669
if sip_031_initialization_receipt.result != Value::okay_true()
16701670
|| sip_031_initialization_receipt.post_condition_aborted
16711671
{
16721672
panic!(
1673-
"FATAL: Failure processing sip031 contract initialization: {:#?}",
1673+
"FATAL: Failure processing sip-031 contract initialization: {:#?}",
16741674
&sip_031_initialization_receipt
16751675
);
16761676
}
16771677

1678-
let recipient = PrincipalData::Contract(boot_code_id(SIP_031_NAME, mainnet));
1678+
let recipient = PrincipalData::Contract(sip_031_contract_id);
16791679

16801680
self.as_transaction(|tx_conn| {
16811681
tx_conn

0 commit comments

Comments
 (0)