Seamless BTC + Liquid regtest harness, Boltz chain-swap coverage#51
Closed
tobomobo wants to merge 2 commits into
Closed
Seamless BTC + Liquid regtest harness, Boltz chain-swap coverage#51tobomobo wants to merge 2 commits into
tobomobo wants to merge 2 commits into
Conversation
… 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>
Contributor
Author
|
Superseded — folded the new commit into #50 instead. Closing this in favor of the single PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Layers a senior-dev-grade live-sync test bed over the initial Bitcoin regtest work in #50. Includes everything from PR #50 plus the additions described below — opening this as a separate PR so PR #50 stays untouched while this one supersedes it. Close whichever you don't want.
The base branch already contains @tobomobo's commit
Add local live sync testing harness; this PR adds one commit on top.What's new vs. PR #50
Three-layer testing model (
docs/reference/testing.md)seed-fake-wallets.shdemo plus a newseed-boltz-swaps.shBoltz round-trip. No infra.docker run, no docker-compose / Nigiri wrapper.Session-scoped harness (
tests/live_sync/)bitcoindand oneelementsd + electrs-liquidstack per test module instead of per test method. Each test still gets a fresh Kassiber--data-root.kassiber:kassiber).rpcallowipscoped to172.16.0.0/12(Docker bridge), not0.0.0.0/0.127.0.0.1::<container-port>.docker logsfrom every container in the stack are dumped to stderr along with the test id.Liquid regtest, seamless
tests/test_live_sync_liquid.pybrings upghcr.io/vulpemventures/elements+ghcr.io/vulpemventures/electrs-liquid(env-overridable) on a dedicated Docker bridge.ct(slip77(...), elwpkh(...))descriptor wallet via elementsd'screatewallet+listdescriptors. Handles both unified<0;1>and legacy split forms, splitting the unified one with freshgetdescriptorinfochecksums.elementsregtestpolicy asset id at runtime viadumpassetlabels, so LBTC labeling does not depend on a hardcoded genesis (Kassiber's hardcoded id assumes one specific config; ours uses different consensus params).Boltz BTC ↔ LBTC chain-swap coverage
chain-swapvalue inTRANSFER_PAIR_KINDSdistinct from federation pegs (peg-in/peg-out) and Lightning submarine swaps.--kind chain-swap --policy taxable.tests/test_boltz_swap_fixture.pyassertsreports.summaryandjournals.transfers.listshape end-to-end through the CLI (no engine-level shortcuts).CI topology
.github/workflows/live-sync.ymlbecomes daily at 05:00 UTC + manual dispatch with a suite selector (bitcoin/liquid/all).Bitcoin path hardening
rpcallowip.setUpper test.Docs + TODO
AGENTS.md,README.md,docs/reference/tax.md, and the kassiber skill bundle now mentionchain-swapalongside the existing swap kinds.TODO.mdchecks off the items this PR completes and adds tracked follow-ups: live-layer reorg, gap-limit, zero-conf, descriptor-type matrix, digest-pinned images, and a future real Boltz-backend integration (deferred — fixture-level coverage is sufficient until proven otherwise).Validation
./scripts/quality-gate.sh— full pass (compile, sync backends, liquid electrum sync, fake wallet, Boltz swap fixture, CLI smoke, review regressions, live-sync import-only check, CLI help smoke).uv run python -m unittest tests.test_boltz_swap_fixture -v— passes (~2s) end-to-end through the CLI.live-syncworkflow will iron out any first-run bugs in the elementsd / electrs-liquid CLI args; both daemons accept overrides viaKASSIBER_ELEMENTSD_EXTRA_ARGS/KASSIBER_ELECTRS_LIQUID_EXTRA_ARGS.Test plan
ciworkflow)live-syncworkflow manually withsuite=bitcoinand confirm greenlive-syncworkflow manually withsuite=liquidand confirm green (this is the first run of the new Liquid harness; expect to iron out Vulpem image specifics here)Notes for review
TODO.mdas the next hardening pass — easy follow-up once the workflow has run once and we have known-good digests.🤖 Generated with Claude Code