Skip to content

feat(core): add durable mint swap orchestration foundation - #402

Open
igbopharaoh wants to merge 10 commits into
cashubtc:masterfrom
igbopharaoh:feat/mint-swap-orchestration-foundation
Open

feat(core): add durable mint swap orchestration foundation#402
igbopharaoh wants to merge 10 commits into
cashubtc:masterfrom
igbopharaoh:feat/mint-swap-orchestration-foundation

Conversation

@igbopharaoh

@igbopharaoh igbopharaoh commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Slice 2 of 6 — orchestration foundation

Summary

  • define the durable Mint Swap parent model, exact accounting invariants, prepared-plan
    fingerprint, fenced preparation lease, CAS contract, and operation-event outbox
  • add parent-owned mint and melt commands that commit authorization before remote I/O and apply
    results atomically afterward
  • split swap-then-melt execution into durable pre-swap and melt authorization phases
  • add an optional Mint Swap repository capability with rollback-safe, concurrency-safe memory
    transactions
  • add shared adapter contracts for capability absence, CAS, ownership, rollback, due ordering,
    outbox idempotency, and concurrent root writes
  • expose the Mint Swap and outbox predicates required by downstream persistent adapters

Current status

  • Slice 1 (feat(core): add protocol and secure BOLT11 foundations #400) is merged, and this branch has been realigned with its protocol/security
    foundations
  • destination preparation uses the locked quote's persisted NUT-20 key and canonical quote
    accounting
  • parent-owned child invariants and legal execution-phase combinations are enforced by shared
    contracts
  • the restricted owned-mint remote context preserves custom-handler compatibility
  • the latest commit consolidates the adapter predicate exports and makes the polling cadence test
    tolerant of CI runner contention without weakening its cadence assertion
  • all current GitHub Actions checks pass

Dependencies and rollout order

The prerequisite for this slice is satisfied by merged PR #400.

The remaining draft slices intentionally target master while retaining an ordered dependency
chain:

  1. this PR — Slice 2: orchestration foundation
  2. feat(storage): persist mint swap operations #417 — Slice 3: persistent adapters
  3. feat(core): coordinate recoverable mint swaps #418 — Slice 4: coordinator and recovery
  4. feat(core): add mint swap runtime consumers #419 — Slice 5: runtime consumers
  5. feat: activate mint swap v1 #420 — Slice 6: public activation and acceptance

Each downstream PR documents its dependency and should be rebased after the preceding slice merges.

Scope boundaries

  • Mint Swap remains dormant in this slice: no Manager/API activation, scheduler, processor,
    history projection, or React surface is added
  • persistent SQL and IndexedDB implementations remain in Slice 3
  • coordinator and restart recovery remain in Slice 4
  • runtime consumers remain in Slice 5
  • public activation and acceptance coverage remain in Slice 6
  • local research, implementation specifications, acceptance notes, and the architecture
    walkthrough are intentionally excluded from this PR

Verification

  • bun run --filter='@cashu/coco-core' typecheck
  • bun run --filter='@cashu/coco-adapter-tests' typecheck
  • bun run --filter='@cashu/coco-core' build
  • bun run --filter='@cashu/coco-adapter-tests' build
  • bun run --filter='@cashu/coco-core' test:unit
  • bun run test:coverage:core — 1,284 passed
  • bun test ./src/test/contract.test.ts from packages/sqlite-bun
  • current GitHub Actions: all checks passing

No changeset is included because release metadata is assigned to the final rollout slice.

Closes #366.

@changeset-bot

changeset-bot Bot commented Jul 30, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 12a6371

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@igbopharaoh
igbopharaoh force-pushed the feat/mint-swap-orchestration-foundation branch 2 times, most recently from 0ec30e2 to a303f26 Compare August 5, 2026 12:31
@igbopharaoh
igbopharaoh force-pushed the feat/mint-swap-orchestration-foundation branch from 9690a47 to 12a6371 Compare August 10, 2026 15:00
@igbopharaoh
igbopharaoh marked this pull request as ready for review August 10, 2026 21:11
@igbopharaoh

Copy link
Copy Markdown
Contributor Author

@codex kindly review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🚀

Reviewed commit: 12a637183e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

feat(core): add durable mint-swap orchestration foundations

1 participant