Skip to content

feat(functional-tests): migrate btcio tests to new framework (STR-2090)#1451

Open
voidash wants to merge 2 commits intomainfrom
STR-2090-migrate-btcio-tests
Open

feat(functional-tests): migrate btcio tests to new framework (STR-2090)#1451
voidash wants to merge 2 commits intomainfrom
STR-2090-migrate-btcio-tests

Conversation

@voidash
Copy link
Contributor

@voidash voidash commented Mar 3, 2026

Summary

  • Migrates 3 of 6 legacy btcio functional tests to the new functional-tests-new framework
  • All tests use strata_getL1HeaderCommitment as the replacement for removed L1 RPCs (strata_l1connected, strata_l1status, strata_getL1blockHash)

Migrated tests

New test Replaces What it does
test_l1_connected btcio_connect Verifies strata can see pre-existing L1 blocks
test_l1_tracking btcio_read Mines new blocks, checks strata picks them up
test_l1_reorg btcio_read_reorg Invalidates blocks, checks strata handles chain reorg

Not ported (RPCs removed from new binary)

Old test Missing RPC Notes
btcio_broadcast strataadmin_broadcastRawTx Broadcast removed from new binary
btcio_inscriber strataadmin_submitDABlob DA blob submission removed
btcio_resubmit_checkpoint prover infra Requires prover pipeline

Test plan

  • Run cd functional-tests-new && uv run python entry.py -g btcio to verify all 3 tests pass
  • Verify reorg test uses standalone env (does not share bitcoin node with other tests)

… (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
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.01%. Comparing base (5f17f99) to head (78a73f2).
⚠️ Report is 51 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (5f17f99) and HEAD (78a73f2). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (5f17f99) HEAD (78a73f2)
functional 1 0
@@            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     
Flag Coverage Δ
functional ?
unit 65.01% <ø> (+0.77%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 430 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 3, 2026

Commit: 8fc0b1e

SP1 Execution Results

program cycles success
EVM EE STF 1,320,914
Checkpoint 5,226
Checkpoint New 883,623

@voidash voidash marked this pull request as ready for review March 17, 2026 09:37
@voidash voidash requested a review from a team as a code owner March 17, 2026 09:37
- 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
Copy link
Contributor

@delbonis delbonis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +48 to +53
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}",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use a dedicated waiter helper for this?

Comment on lines +76 to +85
# 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"
),
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Comment on lines +40 to +46
# 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}",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And here

Comment on lines +47 to +53
# 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}",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

Comment on lines +57 to +63
# 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}",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here

@storopoli
Copy link
Member

Agree with @delbonis comments in the wait_until_value calls.
If it helps, you can see how I've did with a wait_for_non_empty_blob helper function in functional-tests-new/common/services/alpen_client.py in #1505 in this git commit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants