From 3d81f76400ad73abf6f259dfc1f60be07431b4c0 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Mon, 1 Jun 2026 23:07:31 +0200 Subject: [PATCH 1/4] Migrate regtest usage off nigiri (in-house Node CLI) arkade-regtest dropped nigiri/chopsticks/esplora for an in-house Docker Compose stack driven by a zero-dependency Node CLI (regtest.mjs). This migrates the solver's integration test harness onto it. - Add arkade-regtest as a git submodule at regtest/ (pinned to master; NOT bumped to the unmerged denigiri-regtest branch). - Makefile: setup/teardown-test-env now run `node regtest/regtest.mjs start|clean` instead of `nigiri start` / `nigiri stop --delete`; the arkd-funding loop uses `node regtest/regtest.mjs faucet ... --confirm`. - test/docker-compose.yml: ARKD_ESPLORA_URL chopsticks:3000 -> mempool_web/api; external network nigiri -> arkade-regtest_default. - test/e2e/utils_test.go: faucet() invokes the regtest CLI (resolved by repo-root-relative path) with --confirm so funding txs are mined. - CI (integration.yaml): checkout submodules recursively, setup-node, `node regtest/regtest.mjs start|clean` in place of the nigiri action. - README: document submodule init, new commands, network, and mining note. --- .github/workflows/integration.yaml | 14 ++++++++++++-- .gitmodules | 4 ++++ Makefile | 16 ++++++++-------- README.md | 16 +++++++++++----- regtest | 1 + test/docker-compose.yml | 8 ++++++-- test/e2e/utils_test.go | 15 ++++++++++++++- 7 files changed, 56 insertions(+), 18 deletions(-) create mode 100644 .gitmodules create mode 160000 regtest diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index c829e1d..d61dcac 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -15,14 +15,20 @@ jobs: timeout-minutes: 20 steps: - uses: actions/checkout@v4 + with: + submodules: recursive - uses: actions/setup-go@v6 with: go-version: '>=1.26.1' cache: true - - name: Run Nigiri - uses: vulpemventures/nigiri-github-action@v1 + - uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Run arkade-regtest + run: node regtest/regtest.mjs start - name: Run arkd stack run: make docker-run @@ -45,3 +51,7 @@ jobs: - name: Tear down if: always() run: make docker-stop + + - name: Stop arkade-regtest + if: always() + run: node regtest/regtest.mjs clean diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..4320baa --- /dev/null +++ b/.gitmodules @@ -0,0 +1,4 @@ +[submodule "regtest"] + path = regtest + url = https://github.com/ArkLabsHQ/arkade-regtest.git + branch = master diff --git a/Makefile b/Makefile index a058f9e..8d27aa2 100644 --- a/Makefile +++ b/Makefile @@ -88,7 +88,7 @@ test: @echo "Running unit tests..." @go test -v -race --count=1 $(shell go list ./... | grep -v /test/e2e) -## docker-run: start arkd stack and fund wallet (assumes nigiri is running) +## docker-run: start arkd stack and fund wallet (assumes arkade-regtest is running) docker-run: @echo "Starting arkd stack..." @docker compose -f test/docker-compose.yml up -d --build @@ -98,7 +98,7 @@ docker-run: @docker exec solverd-arkd arkd wallet create --password password || true @docker exec solverd-arkd arkd wallet unlock --password password || true @echo "Funding arkd..." - @for i in 1 2 3; do nigiri faucet $$(docker exec solverd-arkd arkd wallet address | tr -d '[:space:]') 1; done + @for i in 1 2 3; do node regtest/regtest.mjs faucet $$(docker exec solverd-arkd arkd wallet address | tr -d '[:space:]') 1 --confirm; done @sleep 5 @echo "Test environment ready." @@ -107,17 +107,17 @@ docker-stop: @echo "Stopping arkd stack..." @docker compose -f test/docker-compose.yml down -v --remove-orphans -## setup-test-env: start nigiri + arkd stack for integration tests +## setup-test-env: start arkade-regtest + arkd stack for integration tests setup-test-env: - @echo "Starting nigiri..." - @nigiri start + @echo "Starting arkade-regtest..." + @node regtest/regtest.mjs start @$(MAKE) docker-run -## teardown-test-env: stop arkd stack + nigiri +## teardown-test-env: stop arkd stack + arkade-regtest teardown-test-env: @$(MAKE) docker-stop - @echo "Stopping nigiri..." - @nigiri stop --delete + @echo "Stopping arkade-regtest..." + @node regtest/regtest.mjs clean ## integrationtest: run integration tests (requires setup-test-env) integrationtest: diff --git a/README.md b/README.md index 3b784d0..1bee90b 100644 --- a/README.md +++ b/README.md @@ -175,14 +175,20 @@ make test # unit tests ## Integration tests -End-to-end tests run against a local nigiri + arkd stack: +End-to-end tests run against a local [arkade-regtest](https://github.com/ArkLabsHQ/arkade-regtest) ++ arkd stack. arkade-regtest is vendored as a git submodule at `regtest/` and driven by its +zero-dependency Node CLI (`regtest.mjs`, requires Node >= 18). Make sure submodules are checked +out first: `git submodule update --init --recursive`. ```sh -make setup-test-env # boot nigiri + arkd + emulator, fund arkd wallet +make setup-test-env # boot arkade-regtest + arkd + emulator, fund arkd wallet make integrationtest # run ./test/e2e/... make teardown-test-env ``` -If nigiri is already running (e.g. in CI, where the `vulpemventures/nigiri-github-action` -sets it up), use `make docker-run` and `make docker-stop` instead — they bring up -the solverd-side stack and fund the arkd wallet without touching nigiri. +If arkade-regtest is already running, use `make docker-run` and `make docker-stop` instead — +they bring up the solverd-side stack (which joins arkade-regtest's `arkade-regtest_default` +network) and fund the arkd wallet without touching arkade-regtest itself. + +> Mining note: arkade-regtest's `faucet` does not auto-mine the way nigiri did. The funding +> and faucet helpers pass `--confirm` so the funding tx is mined into a block immediately. diff --git a/regtest b/regtest new file mode 160000 index 0000000..cd47313 --- /dev/null +++ b/regtest @@ -0,0 +1 @@ +Subproject commit cd473132e0fcdf82bc709534784abc94d3002163 diff --git a/test/docker-compose.yml b/test/docker-compose.yml index 8d89072..db3a66c 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -74,7 +74,7 @@ services: - ARKD_BOARDING_EXIT_DELAY=30 - ARKD_CHECKPOINT_EXIT_DELAY=10 - ARKD_WALLET_ADDR=solverd-arkd-wallet:6060 - - ARKD_ESPLORA_URL=http://chopsticks:3000 + - ARKD_ESPLORA_URL=http://mempool_web/api - ARKD_VTXO_MIN_AMOUNT=1 - ARKD_LIVE_STORE_TYPE=inmemory - ARKD_EVENT_DB_TYPE=badger @@ -102,6 +102,10 @@ services: target: /app/data networks: + # Join the arkade-regtest stack's network so this solverd-side stack can reach + # the shared bitcoin node + mempool esplora (`mempool_web/api`) by service name. + # `node regtest/regtest.mjs start` creates the compose project `arkade-regtest`, + # whose default network is `arkade-regtest_default`. default: - name: nigiri + name: arkade-regtest_default external: true diff --git a/test/e2e/utils_test.go b/test/e2e/utils_test.go index 46a0586..ad0f997 100644 --- a/test/e2e/utils_test.go +++ b/test/e2e/utils_test.go @@ -8,6 +8,8 @@ import ( "fmt" "net/http" "os/exec" + "path/filepath" + "runtime" "strings" "testing" "time" @@ -162,8 +164,19 @@ func runCommand(ctx context.Context, command string) (string, error) { return strings.TrimSpace(string(out)), nil } +// repoRoot resolves the solver repository root from this source file's location +// (test/e2e/), so the arkade-regtest CLI can be invoked by its repo-relative +// path regardless of `go test`'s working directory. +func repoRoot() string { + _, file, _, _ := runtime.Caller(0) + return filepath.Clean(filepath.Join(filepath.Dir(file), "..", "..")) +} + func faucet(ctx context.Context, address string, amount float64) error { - command := fmt.Sprintf("nigiri faucet %s %.8f", address, amount) + // --confirm mines a block immediately after the send so the tx confirms + // right away (arkade-regtest's faucet does not auto-mine like nigiri did). + regtest := filepath.Join(repoRoot(), "regtest", "regtest.mjs") + command := fmt.Sprintf("node %q faucet %s %.8f --confirm", regtest, address, amount) _, err := runCommand(ctx, command) return err } From 3c9e2ea935c010e834f9eb700dbb37d63833f4d3 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Wed, 3 Jun 2026 11:30:45 +0200 Subject: [PATCH 2/4] Bump regtest submodule to denigiri-regtest (regtest.mjs) Temporary: points at unmerged ArkLabsHQ/arkade-regtest#27 (commit 20c0851) so CI can find regtest.mjs and run integration. Re-point to master once #27 merges. --- regtest | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regtest b/regtest index cd47313..20c0851 160000 --- a/regtest +++ b/regtest @@ -1 +1 @@ -Subproject commit cd473132e0fcdf82bc709534784abc94d3002163 +Subproject commit 20c0851c7eb592d8a75711ce5c56b746312cc1e2 From a6685b8191d4cb2fa8b77b685c2facd56fb88910 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Wed, 3 Jun 2026 12:46:45 +0200 Subject: [PATCH 3/4] Fix solverd-arkd startup race + start only base profile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit solverd-arkd exited fatally ('failed to connect to wallet ... connection refused') because it started before solverd-arkd-wallet was listening, then crash-looped — and docker-run's fixed 'sleep 15' ran 'arkd wallet create' while it was still restarting. Poll for arkd readiness instead. Also start only the arkade-regtest base profile (solver runs its own arkd stack) with AUTOMINE_INTERVAL=0. --- .github/workflows/integration.yaml | 4 +++- Makefile | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.github/workflows/integration.yaml b/.github/workflows/integration.yaml index d61dcac..c0f9ee4 100644 --- a/.github/workflows/integration.yaml +++ b/.github/workflows/integration.yaml @@ -28,7 +28,9 @@ jobs: node-version: '20' - name: Run arkade-regtest - run: node regtest/regtest.mjs start + # solver only needs the base chain + esplora (it runs its own arkd stack), + # so start just the base profile. AUTOMINE_INTERVAL=0 keeps mining explicit. + run: REGTEST_PROFILES=base AUTOMINE_INTERVAL=0 node regtest/regtest.mjs start - name: Run arkd stack run: make docker-run diff --git a/Makefile b/Makefile index 8d27aa2..48cdafa 100644 --- a/Makefile +++ b/Makefile @@ -92,8 +92,13 @@ test: docker-run: @echo "Starting arkd stack..." @docker compose -f test/docker-compose.yml up -d --build - @echo "Waiting for services..." - @sleep 15 + @echo "Waiting for solverd-arkd to be ready..." + @# arkd exits fatally if arkd-wallet isn't listening yet, then restarts, so + @# poll (rather than a fixed sleep) until it's actually up and responding. + @for i in $$(seq 1 90); do \ + docker exec solverd-arkd arkd wallet status >/dev/null 2>&1 && { echo "solverd-arkd ready"; break; }; \ + sleep 2; \ + done @echo "Creating arkd wallet..." @docker exec solverd-arkd arkd wallet create --password password || true @docker exec solverd-arkd arkd wallet unlock --password password || true @@ -109,8 +114,8 @@ docker-stop: ## setup-test-env: start arkade-regtest + arkd stack for integration tests setup-test-env: - @echo "Starting arkade-regtest..." - @node regtest/regtest.mjs start + @echo "Starting arkade-regtest (base profile only)..." + @REGTEST_PROFILES=base AUTOMINE_INTERVAL=0 node regtest/regtest.mjs start @$(MAKE) docker-run ## teardown-test-env: stop arkd stack + arkade-regtest From 027ba722185223aa0b2147c5caffb73c57944031 Mon Sep 17 00:00:00 2001 From: Andrew Camilleri Date: Wed, 3 Jun 2026 14:47:04 +0200 Subject: [PATCH 4/4] Bump arkd stack to base versions (arkd v0.9.6, nbxplorer 2.6.7) Old nbxplorer 2.5.30 crash-loops against the base stack's Bitcoin Core 31 (indexer dies -> arkd-wallet can't init -> arkd fatal: failed to connect to wallet). Align with arkade-regtest's working base (arkd/arkd-wallet v0.9.6, nbxplorer 2.6.7). --- test/docker-compose.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/docker-compose.yml b/test/docker-compose.yml index db3a66c..a5c132f 100644 --- a/test/docker-compose.yml +++ b/test/docker-compose.yml @@ -17,7 +17,7 @@ services: nbxplorer: restart: unless-stopped container_name: solverd-nbxplorer - image: nicolasdorier/nbxplorer:2.5.30 + image: nicolasdorier/nbxplorer:2.6.7 environment: - NBXPLORER_NETWORK=regtest - NBXPLORER_CHAINS=btc @@ -41,7 +41,7 @@ services: arkd-wallet: restart: unless-stopped - image: ghcr.io/arkade-os/arkd-wallet:v0.9.3 + image: ghcr.io/arkade-os/arkd-wallet:v0.9.6 container_name: solverd-arkd-wallet depends_on: - nbxplorer @@ -57,7 +57,7 @@ services: target: /app/data arkd: - image: ghcr.io/arkade-os/arkd:v0.9.3 + image: ghcr.io/arkade-os/arkd:v0.9.6 container_name: solverd-arkd restart: unless-stopped depends_on: