Skip to content

feat: implement bitcoin-regtest-up runtime installer#9212

Open
ulissesferreira wants to merge 2 commits into
add-bitcoin-regtest-up-package-scaffoldfrom
add-bitcoin-regtest-up-package-impl
Open

feat: implement bitcoin-regtest-up runtime installer#9212
ulissesferreira wants to merge 2 commits into
add-bitcoin-regtest-up-package-scaffoldfrom
add-bitcoin-regtest-up-package-impl

Conversation

@ulissesferreira

@ulissesferreira ulissesferreira commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR is the second of two PRs splitting #8827, stacked on top of:

It contains only the real implementation of the Bitcoin Core regtest runtime installer, with no unrelated monorepo changes.

What's included (delta vs scaffold PR)

  • src/install.ts — core Bitcoin Core download, SHA-256 checksum verification, extraction, and install logic (pinned to Bitcoin Core 30.2)
  • src/bin/bitcoin-regtest-up.ts — CLI entry point (registered as bin in package.json)
  • src/index.ts — updated exports
  • src/install.test.ts — Jest tests for the installer (11 tests covering download, verify, cache reuse, alternate binary layouts, cache clean)
  • src/index.test.ts — removed (replaced by install tests)
  • package.json — adds bin field + version bump to 0.1.0
  • CHANGELOG.md — changelog entry for the initial implementation
  • README.md — full usage documentation
  • jest.config.js — updated for the new test structure (relaxed coverage thresholds, CLI entry excluded)
  • yarn.lock — updated for any new deps

What's NOT included

No knip.config.ts changes, no CODEOWNERS/teams.json churn (those are in the scaffold PR), no unrelated monorepo changes.

Replaces

Together with #9211, this replaces #8827 with two clean, reviewable PRs based on current origin/main.

Verification

yarn workspace @metamask/bitcoin-regtest-up run build
yarn workspace @metamask/bitcoin-regtest-up run test
yarn eslint packages/bitcoin-regtest-up
yarn constraints
yarn workspace @metamask/bitcoin-regtest-up run changelog:validate
yarn dedupe --check

All passed ✓


Note

Low Risk
New dev/CI tooling package with checksum-verified downloads and no changes to production wallet or auth paths; main risk is supply-chain or cache corruption, which tests and checksum checks mitigate.

Overview
Replaces the scaffold placeholder with a runtime-only installer for pinned Bitcoin Core 30.2 (darwin/linux, arm64/x64), modeled on @metamask/foundryup: download tarball, verify SHA-256, extract to .metamask/cache (or ~/.cache/metamask when Yarn global cache is on), and drop bitcoind / bitcoin-cli wrappers under node_modules/.bin. Test harnesses still own starting the node, regtest config, and seeding.

install.ts drives install/cache clean, optional overrides from root package.json (bitcoinRegtestUp and aliases) and CLI flags, cache reuse with a runnable-daemon sanity check, and support for archives that ship bitcoind, bitcoin-node, or the bitcoin launcher. bitcoin-regtest-up CLI exposes default install, cache clean, and --help.

Docs/changelog describe usage; package.json registers the CLI bin; Jest adds broad install.test.ts coverage and relaxes thresholds while excluding the CLI entry from coverage.

Reviewed by Cursor Bugbot for commit ec59f62. Bugbot is set up for automated code reviews on this repo. Configure here.

Replaces the scaffold placeholder with a foundryup-style installer that pins Bitcoin Core 30.2, downloads platform release archives, verifies SHA-256 checksums, and writes bitcoind/bitcoin-cli wrappers under node_modules/.bin.
@ulissesferreira ulissesferreira requested review from a team as code owners June 19, 2026 13:09

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 72cd7ec. Configure here.

const yarnRc = readFileSync(yarnRcPath, 'utf8');
if (/^\s*enableGlobalCache:\s*true\s*$/mu.test(yarnRc)) {
return join(homeDirectory, '.cache', 'metamask');
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Global cache YAML parsing mismatch

Medium Severity

getBitcoinRegtestCacheDirectory treats global cache as enabled only when a whole-line regex matches enableGlobalCache: true, while @metamask/foundryup parses .yarnrc.yml with YAML. Valid settings such as quoted booleans or inline comments can enable global cache for foundryup but keep this installer on a per-repo .metamask/cache path, splitting artifacts and breaking the documented parity.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 72cd7ec. Configure here.

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