Skip to content

test(integration): migrate to local regtest and replace sync with fullScan - #146

Open
Ugarba202 wants to merge 5 commits into
bitcoindevkit:mainfrom
Ugarba202:feat/regtest-fullscan-integration
Open

Ugarba202 wants to merge 5 commits into
bitcoindevkit:mainfrom
Ugarba202:feat/regtest-fullscan-integration

Conversation

@Ugarba202

Copy link
Copy Markdown
Contributor

Thanks for the direction, @Johnosezele!
This PR moves the integration coverage to a local Regtest environment and replaces the existing sync_() coverage with funded fullScan() coverage for both Electrum and Esplora.

What changed

  • Added a dedicated CI job using the same Regtest image already used by bdk-ffi.
  • Added a small HttpClient-based helper to fund test wallet addresses through Bitcoin Core RPC and mine two blocks.
  • Added funded fullScan() integration tests for both Electrum and Esplora using Network.regtest.
  • Added backend-specific polling so the tests wait for the transaction to be indexed instead of relying on fixed sleeps.
  • Kept the existing Testnet integration coverage unchanged.

Verification

Tested locally against the same Regtest image used by CI.

  • dart test --tags regtest ✅
  • just format ✅
  • just analyze ✅
  • just test ✅

Happy to make any adjustments based on reviews!

…lScan

- Adds an isolated CI job using the infinity-pro Regtest container.
- Uses dart:io HttpClient to implement deterministic Bitcoin Core Regtest funding.
- Adds local funded fullScan() integration tests for Electrum and Esplora.
- Updates dart_test.yaml and test tags to isolate regtest execution.
@reez

reez commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

@Ugarba202 @Johnosezele what’s the goal here? I tried chasing down reasoning all I could see was was about flaky public testnet servers, but CI doesn’t use them right? And the funded fullScan check seems to test BDK/electrs more than the Dart bindings, which bdk-ffi already covers. What does this catch that we don’t catch today?

@Ugarba202

Copy link
Copy Markdown
Contributor Author

@Ugarba202 @Johnosezele what’s the goal here? I tried chasing down reasoning all I could see was was about flaky public testnet servers, but CI doesn’t use them right? And the funded fullScan check seems to test BDK/electrs more than the Dart bindings, which bdk-ffi already covers. What does this catch that we don’t catch today?

Thanks for pointing this out, @reez You're right, CI wasn't using the public testnet servers, so my initial reasoning wasn't accurate. My goal was to test funded fullScan() through the Dart bindings, but I understand your point about the existing bdk-ffi coverage. I'll take another look at what this adds beyond those tests and adjust the PR if there's no clear gap.

@Johnosezele

Johnosezele commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

@reez my direction was in #133

The gap is in our generated bindings, not in BDK. bdk-android covers the Kotlin bindings, but lib/bdk.dart comes from a separate generator. The Dart code that converts transaction results (TxUnconfirmedWalletEvent, TxConfirmedWalletEvent, ConfirmationBlockTime, confirmed ChainPosition) only runs when a transaction comes back, and nothing in our CI does that today. A bug there, or in a bindings regeneration, would ship unnoticed.

That's why the plan on #133 was a sync_ foundation asserting those exact values, with funded fullScan as a follow up for @Ugarba202 . This PR jumped ahead of that, and balance > 0 doesn't check any of those values, so it doesn't close the gap either.

@Ugarba202

Copy link
Copy Markdown
Contributor Author

@reez my direction was in #133

The gap is in our generated bindings, not in BDK. bdk-android covers the Kotlin bindings, but lib/bdk.dart comes from a separate generator. The Dart code that converts transaction results (TxUnconfirmedWalletEvent, TxConfirmedWalletEvent, ConfirmationBlockTime, confirmed ChainPosition) only runs when a transaction comes back, and nothing in our CI does that today. A bug there, or in a bindings regeneration, would ship unnoticed.

That's why the plan on #133 was a sync_ foundation asserting those exact values, with funded fullScan as a follow up for @Ugarba202 . This PR jumped ahead of that, and balance > 0 doesn't check any of those values, so it doesn't close the gap either.

Thanks for clarifying, @reez and @Johnosezele. I misunderstood the CI setup when I opened the original issue.
I see the gap now. Checking balance > 0 isn't enough to verify the Dart binding conversions. I'll update the tests to check the actual transaction and confirmation data exposed by the Dart bindings, while keeping the Regtest setup where it helps.
Thanks for pointing me in the right direction!

@Ugarba202

Copy link
Copy Markdown
Contributor Author

Hi @Johnosezele and @reez,

Thanks for the earlier feedback. I've updated the tests in 2815be3 to cover both the unconfirmed and confirmed states of a transaction for Electrum and Esplora.
The tests now run fullScan() before mining to check the unconfirmed event and chain position, then mine blocks and scan again to verify the confirmed event and its block details.
I also split the Regtest funding helper so broadcasting a transaction and mining blocks can be done separately.
Hopefully, this addresses the concern about testing the Dart API behaviour beyond what is already covered by BDK/FFI. I'd appreciate your feedback when you get a chance to review it.

This branch has not been deployed

No deployments
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