deviant/test/regtest
walerikus 518a3ce174 chore: initial project baseline — full Deviant codebase under version control
Brings the whole project into git (previously only the on-ramp feature and
a few parallel files were tracked). Includes: wallet core (src/), CashScript
contracts/, the Capacitor shell (shells/), scripts/, tests, and the docs
corpus (wiki/, snapshots/, Parameters/, Archive/, KnowledgeBase text).

Excluded via .gitignore: node_modules/, dist/, .env (secrets), testnet WIF
key files (.chipnet-*.json, devWallets.ts), KnowledgeBase/RAW media (~9.6 GB),
transcripts/ (session logs), and machine-local config (.claude/*.local,
*.lock). Secret-scanned before commit — no credentials in the tree.

Note: src/swapMath.ts, src/swapBuilder.ts, contracts/OpenMintToken.cash are
legacy (OP_RETURN era) but still imported; committed as-is, flagged for a
separate removal once de-referenced.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 20:38:07 +02:00
..
claim.test.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
errors.test.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
escalation.test.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
helpers.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
README.md chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
redeem.test.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
setup.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
swap.test.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00
verify.test.ts chore: initial project baseline — full Deviant codebase under version control 2026-06-13 20:38:07 +02:00

Regtest harness (Stage 1)

Network-dependent test suite covering the 10 Stage 1 cases from wiki/testing-strategy.md. See snapshot 0003-regtest-harness.md for the design notes and the rationale behind the chosen provider.

Status

Code complete; awaiting execution. All 10 cases are implemented. npm install and npm run compile:contracts must run first (the contract artifact at contracts/dist/OpenMintToken.json is loaded by setup.ts at test time and is the gating prerequisite).

Files

  • setup.ts — provider (MockNetworkProvider), wallet/funding helpers, contract loader.
  • helpers.ts — composition helpers (token world, OP_RETURN output builder, UTXO queries).
  • mint.test.ts — case #1
  • redeem.test.ts — case #2 and #2b (with founder fee)
  • swap.test.ts — cases #3, #4, #5
  • dust.test.ts — case #6a (off-chain) and #6b (on-chain)
  • errors.test.ts — cases #7, #8, #9
  • escalation.test.ts — case #10

Running

npm install
npm run compile:contracts
npm run test:regtest

Why these tests gate Stages 2 and 3

The contract enforces the math the wallet computes off-chain. If swapMath.computeSwap() and the contract's redeem() disagree by even one satoshi, transactions will either fail to broadcast (mempool reject) or, worse, lock funds in an unspendable state. Regtest is the cheapest environment in which to catch that divergence.

Per ADR-0002 and user directive: theoretical verification is insufficient. These tests must actually run.

Why MockNetworkProvider (not a real regtest node) for Stage 1

Stage 1 is contract-semantics gating. MockNetworkProvider executes the same libauth VM that mainnet uses — bytecode-level fidelity for the script paths we care about. Stage 2 (chipnet) is where relay / mempool policy / standardness gets exercised, deliberately. Detailed in wiki/testing-strategy.md and snapshots/0003-regtest-harness.md.