feat(functional-tests): migrate btcio tests to new framework (STR-2090)#1451
feat(functional-tests): migrate btcio tests to new framework (STR-2090)#1451
Conversation
… (STR-2090) Migrate 3 of 6 btcio tests that are portable to the new strata binary: - test_l1_connected: verifies strata sees L1 blocks (replaces btcio_connect) - test_l1_tracking: mines blocks and checks strata picks them up (replaces btcio_read) - test_l1_reorg: invalidates blocks and checks strata handles reorg (replaces btcio_read_reorg) All tests use strata_getL1HeaderCommitment as the replacement for the removed strata_l1connected/strata_l1status/strata_getL1blockHash RPCs. Not ported (RPCs removed from new binary): - btcio_broadcast (strataadmin_broadcastRawTx) - btcio_inscriber (strataadmin_submitDABlob) - btcio_resubmit_checkpoint (prover infrastructure)
Codecov Report✅ All modified and coverable lines are covered by tests.
@@ Coverage Diff @@
## main #1451 +/- ##
==========================================
- Coverage 73.48% 65.01% -8.48%
==========================================
Files 780 798 +18
Lines 73148 74794 +1646
==========================================
- Hits 53755 48629 -5126
- Misses 19393 26165 +6772
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Commit: 8fc0b1e SP1 Execution Results
|
- Increase wait_until_with_value timeouts from 30s to 60s in test_l1_tracking and test_l1_reorg — strata needs more time in CI to process L1 blocks, especially with 110 pre-generated blocks - Run ruff format on both files to fix lint failures
delbonis
left a comment
There was a problem hiding this comment.
Generally we don't want the wait_until_ functions to be called in tests directly unless there's some really specific condition the test is looking for. We want to expose the high level operation through helpers that make it so that we can change the implementation (like if RPCs get reworked) without having to go and update every test. Here especially, a very similar pattern is repeated 5 times, so it makes sense to consolidate it.
| commitment = wait_until_with_value( | ||
| lambda: rpc.strata_getL1HeaderCommitment(check_height), | ||
| lambda v: v is not None, | ||
| timeout=30, | ||
| error_with=f"No L1 header commitment at height {check_height}", | ||
| ) |
There was a problem hiding this comment.
Can we use a dedicated waiter helper for this?
| # wait for strata to pick up the new chain; the commitment | ||
| # at invalidate_height must differ from the pre-reorg value | ||
| post_reorg_commitment = wait_until_with_value( | ||
| lambda: rpc.strata_getL1HeaderCommitment(invalidate_height), | ||
| lambda v: v is not None and v != pre_reorg_commitment, | ||
| timeout=60, | ||
| error_with=( | ||
| f"Strata did not update commitment at height {invalidate_height} after reorg" | ||
| ), | ||
| ) |
| # Wait for strata to have caught up to pre_tip | ||
| wait_until_with_value( | ||
| lambda: rpc.strata_getL1HeaderCommitment(pre_tip), | ||
| lambda v: v is not None, | ||
| timeout=60, | ||
| error_with=f"Strata not caught up to L1 height {pre_tip}", | ||
| ) |
| # wait for strata to have processed the block at this height | ||
| pre_reorg_commitment = wait_until_with_value( | ||
| lambda: rpc.strata_getL1HeaderCommitment(invalidate_height), | ||
| lambda v: v is not None, | ||
| timeout=60, | ||
| error_with=f"Strata not caught up to height {invalidate_height}", | ||
| ) |
| # Wait for strata to pick up the new blocks | ||
| commitment = wait_until_with_value( | ||
| lambda: rpc.strata_getL1HeaderCommitment(post_tip), | ||
| lambda v: v is not None, | ||
| timeout=60, | ||
| error_with=f"Strata did not track new L1 blocks up to height {post_tip}", | ||
| ) |
|
Agree with @delbonis comments in the |
Summary
functional-tests-newframeworkstrata_getL1HeaderCommitmentas the replacement for removed L1 RPCs (strata_l1connected,strata_l1status,strata_getL1blockHash)Migrated tests
test_l1_connectedbtcio_connecttest_l1_trackingbtcio_readtest_l1_reorgbtcio_read_reorgNot ported (RPCs removed from new binary)
btcio_broadcaststrataadmin_broadcastRawTxbtcio_inscriberstrataadmin_submitDABlobbtcio_resubmit_checkpointTest plan
cd functional-tests-new && uv run python entry.py -g btcioto verify all 3 tests pass