@@ -12892,10 +12892,6 @@ fn test_sip_031_activation() {
12892
12892
if burn_block_height
12893
12893
== naka_conf. burnchain . epochs . clone ( ) . unwrap ( ) [ StacksEpochId :: Epoch32 ] . start_height
12894
12894
{
12895
- println ! (
12896
- "\n \n OOPS {:?}\n \n " ,
12897
- block. get( "transactions" ) . unwrap( ) . as_array( ) . unwrap( )
12898
- ) ;
12899
12895
// the first transaction is the coinbase
12900
12896
coinbase_txid = Some (
12901
12897
block
@@ -13131,7 +13127,7 @@ fn test_sip_031_last_phase() {
13131
13127
) ;
13132
13128
13133
13129
// get current liquidity
13134
- let _sip_031_current_liquid_ustx = chainstate
13130
+ let sip_031_current_liquid_ustx_before = chainstate
13135
13131
. with_read_only_clarity_tx (
13136
13132
& sortdb
13137
13133
. index_handle_at_block ( & chainstate, & latest_stacks_block_id)
@@ -13141,7 +13137,7 @@ fn test_sip_031_last_phase() {
13141
13137
)
13142
13138
. unwrap ( ) ;
13143
13139
13144
- // 50 more tenures...
13140
+ // 50 more tenures (each one with 3 stacks blocks)
13145
13141
for _ in 0 ..50 {
13146
13142
let commits_before = commits_submitted. load ( Ordering :: SeqCst ) ;
13147
13143
next_block_and_process_new_stacks_blocks (
@@ -13168,17 +13164,41 @@ fn test_sip_031_last_phase() {
13168
13164
naka_conf. is_mainnet ( ) ,
13169
13165
) ;
13170
13166
13167
+ // check for mint events for the SIP-031 boot contract (excluding the activation one)
13171
13168
let events = block. get ( "events" ) . unwrap ( ) . as_array ( ) . unwrap ( ) ;
13172
13169
for event in events {
13173
13170
if let Some ( mint_event) = event. get ( "stx_mint_event" ) {
13174
- let minted_amount =
13175
- u128:: try_from ( mint_event. get ( "amount" ) . unwrap ( ) . as_u64 ( ) . unwrap ( ) ) . unwrap ( ) ;
13176
- assert_eq ! ( sip_031_mint_and_transfer_amount, minted_amount) ;
13177
- total_minted_and_transferred += minted_amount;
13178
- break ;
13171
+ if mint_event. get ( "recipient" ) . unwrap ( ) . as_str ( ) . unwrap ( )
13172
+ == boot_code_id ( SIP_031_NAME , naka_conf. is_mainnet ( ) ) . to_string ( )
13173
+ && burn_block_height != epoch32_start_height
13174
+ {
13175
+ let minted_amount = mint_event
13176
+ . get ( "amount" )
13177
+ . unwrap ( )
13178
+ . as_str ( )
13179
+ . unwrap ( )
13180
+ . parse :: < u128 > ( )
13181
+ . unwrap ( ) ;
13182
+ assert_eq ! ( sip_031_mint_and_transfer_amount, minted_amount) ;
13183
+ total_minted_and_transferred += minted_amount;
13184
+
13185
+ let coinbase_txid = block
13186
+ . get ( "transactions" )
13187
+ . unwrap ( )
13188
+ . as_array ( )
13189
+ . unwrap ( )
13190
+ . get ( 1 )
13191
+ . unwrap ( )
13192
+ . get ( "txid" )
13193
+ . unwrap ( )
13194
+ . as_str ( )
13195
+ . unwrap ( ) ;
13196
+
13197
+ // check the event txid is mapped to the coinbase
13198
+ assert_eq ! ( event. get( "txid" ) . unwrap( ) . as_str( ) . unwrap( ) , coinbase_txid) ;
13199
+ }
13179
13200
}
13180
13201
}
13181
- total_minted_and_transferred += sip_031_mint_and_transfer_amount;
13182
13202
}
13183
13203
13184
13204
// (100_000 + 200_000 + 300_000) * 5
@@ -13212,6 +13232,23 @@ fn test_sip_031_last_phase() {
13212
13232
} ) )
13213
13233
) ;
13214
13234
13235
+ // get current liquidity
13236
+ let sip_031_current_liquid_ustx = chainstate
13237
+ . with_read_only_clarity_tx (
13238
+ & sortdb
13239
+ . index_handle_at_block ( & chainstate, & latest_stacks_block_id)
13240
+ . unwrap ( ) ,
13241
+ & latest_stacks_block_id,
13242
+ |conn| conn. with_clarity_db_readonly ( |db| db. get_total_liquid_ustx ( ) . unwrap ( ) ) ,
13243
+ )
13244
+ . unwrap ( ) ;
13245
+
13246
+ // check liquidity has been updated accordingly
13247
+ assert ! (
13248
+ sip_031_current_liquid_ustx - sip_031_current_liquid_ustx_before
13249
+ >= total_minted_and_transferred
13250
+ ) ;
13251
+
13215
13252
set_test_sip_031_emission_schedule ( None ) ;
13216
13253
13217
13254
coord_channel
0 commit comments