Skip to content

Add local live sync harness: Bitcoin, Liquid, and Boltz chain-swaps#50

Open
tobomobo wants to merge 2 commits into
mainfrom
codex/live-sync-regtest-fixtures
Open

Add local live sync harness: Bitcoin, Liquid, and Boltz chain-swaps#50
tobomobo wants to merge 2 commits into
mainfrom
codex/live-sync-regtest-fixtures

Conversation

@tobomobo
Copy link
Copy Markdown
Contributor

@tobomobo tobomobo commented Apr 23, 2026

Summary

  • add opt-in live sync tests for Bitcoin Core regtest and a seamless local Liquid (Elements + electrs-liquid) regtest stack — the Liquid path is no longer user-parameterized, it brings up its own daemons
  • introduce a session-scoped live-sync harness package (tests/live_sync/) so each test module reuses one bitcoind / one elementsd + electrs-liquid stack, with randomized RPC creds, rpcallowip scoped to the Docker bridge (172.16.0.0/12), loopback-only host port binds, and docker logs auto-captured to stderr on failure
  • add deterministic fake BTC/LBTC wallet fixtures with self-transfer, peg-in, peg-out, spend coverage, swap tags, and review notes
  • add a Boltz BTC ↔ LBTC chain-swap fixture (forward + reverse, with the service-fee spread baked into the amounts) and chain-swap as a new TRANSFER_PAIR_KIND distinct from federation pegs and Lightning submarine swaps; both legs paired via --kind chain-swap --policy taxable and asserted end-to-end through the CLI in tests/test_boltz_swap_fixture.py
  • document the testing/privacy workflow as a three-layer model (fixtures, live regtest, manual compat) in docs/reference/testing.md, link it from AGENTS.md, and wire the sync + Boltz fixture checks into the quality gate
  • add --require-bitcoin-regtest and --require-liquid-regtest so local Docker runs can fail instead of silently skipping when the daemon/image is unavailable
  • add a GitHub Actions workflow that runs both the Bitcoin and Liquid regtest stacks daily at 05:00 UTC and on manual dispatch with a suite selector (bitcoin / liquid / all); two parallel jobs so failures stay independent, with a concurrency group to prevent pile-ups

Validation

  • uv run python -m unittest tests.test_fake_wallet_fixture -v
  • uv run python -m unittest tests.test_boltz_swap_fixture -v
  • scripts/live-sync-tests.sh --suite bitcoin
  • scripts/live-sync-tests.sh --suite bitcoin --require-bitcoin-regtest (expected failure when no Docker daemon is reachable)
  • scripts/live-sync-tests.sh --suite liquid --require-liquid-regtest (same caveat; first real run should be the new daily live-sync workflow)
  • ./scripts/quality-gate.sh

@tobomobo tobomobo force-pushed the codex/live-sync-regtest-fixtures branch 3 times, most recently from e48ab57 to 9476881 Compare April 23, 2026 20:43
@tobomobo tobomobo force-pushed the codex/live-sync-regtest-fixtures branch from 9476881 to 09c3d6a Compare April 23, 2026 20:49
… coverage

Layers a senior-dev-grade live-sync test bed over the initial Bitcoin
regtest work in PR #50:

* tests/live_sync/ — session-scoped harness package. Bitcoin and Liquid
  stacks each start once per test module (setUpModule / tearDownModule);
  every test method gets a fresh Kassiber --data-root but reuses the
  chain. RPC creds are randomized per session, container ports bind to
  127.0.0.1 only, and rpcallowip is scoped to the Docker bridge range
  (172.16.0.0/12) instead of 0.0.0.0/0.
* tests/test_live_sync_bitcoin.py — refactored Bitcoin test on top of
  the new harness, with idempotency assertion folded in and docker logs
  auto-captured to stderr on failure.
* tests/test_live_sync_liquid.py — new live Liquid test driving
  elementsd + electrs-liquid (Vulpem images by default, env-overridable)
  with a real ct(slip77(...), elwpkh(...)) descriptor wallet exported
  from elementsd. Handles both unified <0;1> and legacy split
  descriptors, and fetches the elementsregtest policy asset id at
  runtime so LBTC labeling does not depend on a hardcoded genesis.
* tests/test_live_sync_regtest.py removed — superseded by the two split
  files above; the user-parameterized Liquid backend path goes away
  because the regtest harness is now seamless.
* kassiber/cli/handlers.py — TRANSFER_PAIR_KINDS gains 'chain-swap'
  for Boltz-style BTC <-> LBTC atomic swaps (distinct from Liquid
  federation pegs and from Lightning submarine swaps).
* tests/fixtures/fake_wallets/boltz_*.csv + scripts/seed-boltz-swaps.sh
  + tests/test_boltz_swap_fixture.py — deterministic fixture covering a
  full Boltz chain-swap round trip (forward BTC -> LBTC and reverse
  LBTC -> BTC) with the Boltz service-fee spread baked in, paired with
  --kind chain-swap --policy taxable, plus end-to-end CLI-level
  assertions on the resulting reports.summary and
  journals.transfers.list envelopes.
* .github/workflows/live-sync.yml — daily cron (05:00 UTC) plus manual
  dispatch with a suite selector (bitcoin / liquid / all). Two parallel
  jobs so Bitcoin and Liquid failures stay independent. Concurrency
  group prevents pile-ups.
* scripts/live-sync-tests.sh — gains --suite {bitcoin,liquid,all} and
  --require-liquid-regtest; runs the new split test modules.
* scripts/quality-gate.sh — adds tests.test_boltz_swap_fixture and
  swaps the disabled-import check to the new module names.
* docs/reference/testing.md — three-layer model (fixtures / live
  regtest / manual compat), Boltz section, privacy posture.
* AGENTS.md, README.md, docs/reference/tax.md, skills/kassiber/* —
  cross-link testing.md and add chain-swap alongside the existing
  swap kinds wherever they are listed.
* TODO.md — checks off completed items, adds tracked follow-ups for
  reorg/gap-limit/zero-conf live tests, descriptor-type matrix,
  digest-pinned images, and a future real Boltz backend integration.

Verified locally with ./scripts/quality-gate.sh (full pass) and
KASSIBER_LIVE_SYNC_TESTS=0 import-only checks for both new live modules.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@tobomobo tobomobo changed the title [codex] Add local live sync testing harness Add local live sync harness: Bitcoin, Liquid, and Boltz chain-swaps Apr 24, 2026
@tobomobo tobomobo marked this pull request as ready for review April 24, 2026 07:44
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.

1 participant