@@ -1188,6 +1188,10 @@ fn signer_vote_if_needed(
1188
1188
btc_regtest_controller. get_burnchain ( ) . first_block_height ,
1189
1189
reward_cycle,
1190
1190
) ;
1191
+ let epochs = btc_regtest_controller. get_stacks_epochs ( ) ;
1192
+ let is_naka_epoch = epochs[ StacksEpoch :: find_epoch ( & epochs, block_height) . unwrap ( ) ]
1193
+ . epoch_id
1194
+ . uses_nakamoto_blocks ( ) ;
1191
1195
1192
1196
if block_height >= prepare_phase_start {
1193
1197
// If the key is already set, do nothing.
@@ -1210,6 +1214,7 @@ fn signer_vote_if_needed(
1210
1214
clarity:: vm:: Value :: buff_from ( aggregate_key. compress ( ) . data . to_vec ( ) )
1211
1215
. expect ( "Failed to serialize aggregate public key" ) ;
1212
1216
1217
+ let mut expected_nonces = vec ! [ ] ;
1213
1218
for ( i, signer_sk) in signer_sks. iter ( ) . enumerate ( ) {
1214
1219
let signer_nonce = get_account ( & http_origin, & to_addr ( signer_sk) ) . nonce ;
1215
1220
@@ -1228,8 +1233,19 @@ fn signer_vote_if_needed(
1228
1233
clarity:: vm:: Value :: UInt ( reward_cycle as u128 + 1 ) ,
1229
1234
] ,
1230
1235
) ;
1236
+ expected_nonces. push ( ( to_addr ( signer_sk) , signer_nonce + 1 ) ) ;
1231
1237
submit_tx ( & http_origin, & voting_tx) ;
1232
1238
}
1239
+
1240
+ if is_naka_epoch {
1241
+ wait_for ( 30 , || {
1242
+ let all_bumped = expected_nonces. iter ( ) . all ( |( addr, expected_nonce) | {
1243
+ get_account ( & http_origin, addr) . nonce >= * expected_nonce
1244
+ } ) ;
1245
+ Ok ( all_bumped)
1246
+ } )
1247
+ . expect ( "Timed out waiting for an interim nakamoto block to process our transactions" ) ;
1248
+ }
1233
1249
}
1234
1250
}
1235
1251
@@ -1465,7 +1481,7 @@ fn simple_neon_integration() {
1465
1481
let ( mut naka_conf, _miner_account) = naka_neon_integration_conf ( None ) ;
1466
1482
let prom_bind = format ! ( "{}:{}" , "127.0.0.1" , 6000 ) ;
1467
1483
naka_conf. node . prometheus_bind = Some ( prom_bind. clone ( ) ) ;
1468
- naka_conf. miner . wait_on_interim_blocks = Duration :: from_secs ( 1000 ) ;
1484
+ naka_conf. miner . wait_on_interim_blocks = Duration :: from_secs ( 5 ) ;
1469
1485
let sender_sk = Secp256k1PrivateKey :: new ( ) ;
1470
1486
// setup sender + recipient for a test stx transfer
1471
1487
let sender_addr = tests:: to_addr ( & sender_sk) ;
@@ -1601,6 +1617,19 @@ fn simple_neon_integration() {
1601
1617
)
1602
1618
. unwrap ( ) ;
1603
1619
1620
+ wait_for ( 30 , || {
1621
+ let transfer_tx_included = test_observer:: get_blocks ( ) . into_iter ( ) . any ( |block_json| {
1622
+ block_json[ "transactions" ]
1623
+ . as_array ( )
1624
+ . unwrap ( )
1625
+ . iter ( )
1626
+ . find ( |tx_json| tx_json[ "raw_tx" ] . as_str ( ) == Some ( & transfer_tx_hex) )
1627
+ . is_some ( )
1628
+ } ) ;
1629
+ Ok ( transfer_tx_included)
1630
+ } )
1631
+ . expect ( "Timed out waiting for submitted transaction to be included in a block" ) ;
1632
+
1604
1633
// Mine 15 more nakamoto tenures
1605
1634
for _i in 0 ..15 {
1606
1635
next_block_and_mine_commit (
@@ -2416,7 +2445,7 @@ fn correct_burn_outs() {
2416
2445
epochs[ epoch_30_ix] . start_height = 225 ;
2417
2446
}
2418
2447
2419
- naka_conf. miner . wait_on_interim_blocks = Duration :: from_secs ( 1000 ) ;
2448
+ naka_conf. miner . wait_on_interim_blocks = Duration :: from_secs ( 1 ) ;
2420
2449
naka_conf. initial_balances . clear ( ) ;
2421
2450
let accounts: Vec < _ > = ( 0 ..8 )
2422
2451
. map ( |ix| {
@@ -5183,6 +5212,15 @@ fn check_block_heights() {
5183
5212
next_block_and_process_new_stacks_block ( & mut btc_regtest_controller, 60 , & coord_channel)
5184
5213
. unwrap ( ) ;
5185
5214
5215
+ // in the first tenure, make sure that the contracts are published
5216
+ if tenure_ix == 0 {
5217
+ wait_for ( 30 , || {
5218
+ let cur_sender_nonce = get_account ( & http_origin, & to_addr ( & sender_sk) ) . nonce ;
5219
+ Ok ( cur_sender_nonce >= sender_nonce)
5220
+ } )
5221
+ . expect ( "Timed out waiting for contracts to publish" ) ;
5222
+ }
5223
+
5186
5224
let heights1_value = call_read_only (
5187
5225
& naka_conf,
5188
5226
& sender_addr,
@@ -5247,9 +5285,15 @@ fn check_block_heights() {
5247
5285
. clone ( )
5248
5286
. expect_u128 ( )
5249
5287
. unwrap ( ) ;
5288
+ let expected_height = if tenure_ix == 0 {
5289
+ // tenure 0 will include an interim block at this point because of the contract publish
5290
+ // txs
5291
+ last_stacks_block_height + 2
5292
+ } else {
5293
+ last_stacks_block_height + 1
5294
+ } ;
5250
5295
assert_eq ! (
5251
- sbh,
5252
- last_stacks_block_height + 1 ,
5296
+ sbh, expected_height,
5253
5297
"Stacks block heights should have incremented"
5254
5298
) ;
5255
5299
last_stacks_block_height = sbh;
@@ -5373,8 +5417,8 @@ fn check_block_heights() {
5373
5417
assert ! ( tip. anchored_header. as_stacks_nakamoto( ) . is_some( ) ) ;
5374
5418
assert_eq ! (
5375
5419
tip. stacks_block_height,
5376
- block_height_pre_3_0 + ( ( inter_blocks_per_tenure + 1 ) * tenure_count) ,
5377
- "Should have mined (1 + interim_blocks_per_tenure) * tenure_count nakamoto blocks"
5420
+ block_height_pre_3_0 + 1 + ( ( inter_blocks_per_tenure + 1 ) * tenure_count) ,
5421
+ "Should have mined 1 + (1 + interim_blocks_per_tenure) * tenure_count nakamoto blocks"
5378
5422
) ;
5379
5423
5380
5424
coord_channel
0 commit comments