Skip to content

Remove the Boltz swap module #189

Open

Description

@coreyphillips

Motivation

The Boltz swap service has been shut down, so the boltz module can no longer complete a swap. Remove it from bitkit-core completely: the Rust code, the UniFFI surface, the boltz-client dependency, the generated iOS interface, and the docs.

Current behavior (verified on master at 98b0791)

  • src/modules/boltz/ holds about 3,100 lines across 14 files: api.rs, claim.rs, client.rs, db.rs, errors.rs, guard.rs, listener.rs, models.rs, refund.rs, tests.rs, types.rs, validation.rs, mod.rs and README.md. It is registered in src/modules/mod.rs:3.
  • src/lib.rs:
    • Imports at lines 41-44.
    • Public re-export pub use modules::boltz as boltz_swaps; at line 93.
    • boltz_db: Option<Arc<BoltzDB>> field on AsyncDatabaseConnections at line 121.
    • init_db creates {base_path}/boltz.db and stores the handle (lines 506, 516, 530).
    • The "Boltz swaps" section (about lines 3476-3741) holds the helpers get_boltz_db and boltz_runtime_err, plus 11 #[uniffi::export] functions: boltz_get_submarine_limits, boltz_get_reverse_limits, boltz_create_submarine_swap, boltz_create_reverse_swap, boltz_list_swaps, boltz_list_pending_swaps, boltz_get_swap, boltz_claim_reverse_swap, boltz_refund_submarine_swap, boltz_start_swap_updates, boltz_stop_swap_updates.
  • src/modules/activity/types.rs imports BoltzError (line 3). DbError has a DbBoltzError { error_details: BoltzError } variant (lines 311-312) and an impl From<BoltzError> for DbError (lines 334-340). The From impl exists so init_db can use ? on BoltzDB::new.
  • Exported UniFFI types: BoltzNetwork, BoltzSwapType, BoltzSwapStatus, BoltzPairInfo, SubmarineSwapResponse, ReverseSwapResponse, BoltzSwap, BoltzSwapEvent, BoltzError, and the foreign trait BoltzEventListener.
  • Cargo.toml:41 depends on boltz-client = { version = "0.4.1", ... }. No code outside src/modules/boltz/ uses boltz_client.
  • bindings/ios/bitkitcore.swift and bindings/ios/bitkitcoreFFI.h are committed, and both contain the Boltz API. The Android Kotlin bindings are not tracked (they are generated by gradle-publish.yml), and no other tracked binding or test references Boltz.
  • CLAUDE.md and AGENTS.md (lines 23 and 38) list boltz among the modules.
  • CHANGELOG.md has Boltz entries under 0.5.0 through 0.5.4.

Requested change

Delete the module and everything that exists only to serve it. Behavior of every other module stays the same.

In scope

  • Delete src/modules/boltz/ and its pub mod boltz; line in src/modules/mod.rs.
  • In src/lib.rs, remove the Boltz imports, the boltz_swaps re-export, the boltz_db field, the Boltz lines in init_db, and the whole "Boltz swaps" section.
  • In src/modules/activity/types.rs, remove the BoltzError import, the DbError::DbBoltzError variant, and impl From<BoltzError> for DbError.
  • Remove boltz-client from Cargo.toml. Rebuild so Cargo.lock drops it and its now-unused transitive crates. CI runs cargo metadata --locked, so the lockfile must be committed in sync.
  • Regenerate the iOS interface with ./build_ios.sh (or ./build.sh ios) and commit bindings/ios/bitkitcore.swift and bindings/ios/bitkitcoreFFI.h. Restore Package.swift unless this is a release, as the ios-bindgen.yml stale-files check expects.
  • Remove boltz from the module lists in CLAUDE.md and AGENTS.md.
  • Add an ## Unreleased entry to CHANGELOG.md. It should say the Boltz module and all boltz* functions and types are removed. It should also say that removing the DbError.DbBoltzError case is source-breaking for exhaustive Swift switch and Kotlin when over DbError (the 0.5.15 Jade entry is the precedent for this wording). Leave the historical 0.5.x entries as they are.

Out of scope

  • Deleting boltz.db from existing installs (see open questions).
  • Other remote branches that build on Boltz (origin/feat/pubky-swap-boltz, origin/feat/pubky-swaps-route). They will need to be rebased or closed separately.
  • Unrelated dependency or module cleanup.
  • Version bump and release. If the maintainer wants it in the same PR, use ./build.sh -r so Cargo.toml, Package.swift and bindings/android/gradle.properties stay in sync.

Implementation notes

  • After the boltz_db field is gone, AsyncDatabaseConnections holds only blocktank_db. Keep the struct rather than restructuring ASYNC_DB.
  • init_db should stop creating boltz.db. It should also not open, migrate or delete an existing one.
  • The boltz.db schema (src/modules/boltz/models.rs) stores swap_index and create_response_json for each swap. Combined with the wallet seed, that is what a manual script-path refund of a locked submarine swap would need. This is why the issue recommends leaving the file on disk.

Acceptance criteria

  • src/modules/boltz/ no longer exists, and src/modules/mod.rs does not declare it.
  • grep -rni boltz src Cargo.toml bindings CLAUDE.md AGENTS.md returns nothing.
  • Cargo.lock has no boltz-client or boltz-client-macros entries, and cargo metadata --locked --format-version 1 succeeds.
  • DbError has no DbBoltzError variant, and no From<BoltzError> impl remains.
  • init_db creates only activity.db and blocktank.db. An existing boltz.db in base_path is left untouched, and init_db still succeeds.
  • The committed bindings/ios/bitkitcore.swift and bitkitcoreFFI.h match a fresh ./build_ios.sh run and contain no Boltz symbols.
  • CHANGELOG.md has an Unreleased entry covering the removal and the DbError source break.
  • cargo build, cargo clippy and cargo test pass with no new warnings.

Test plan

  • Run cargo build, cargo clippy and cargo test. The Boltz tests are deleted along with the module. Every other module's tests must still pass, including test_exported_scoped_getters_preserve_wallet_id in src/lib.rs, which calls init_db.
  • Add a small test (or extend the src/lib.rs test above) covering both init_db cases:
    • On a fresh temp directory, no boltz.db is created.
    • On a directory with a pre-existing boltz.db, init_db succeeds and the file's bytes are unchanged.
  • Run ./build_ios.sh and confirm git diff is clean for the three files in bindings/ios/. Check that the iOS Bindgen and Bindgen Validation workflows pass on the PR.
  • Optionally run ./build.sh android locally (not alongside another build, since it edits Cargo.toml in place). Check that the generated Kotlin has no Boltz symbols. Otherwise rely on gradle-publish.yml.

Assumptions and open questions

  • Assumption: the Boltz service shutdown comes from the request. I have not checked it independently.
  • Open: has any shipped Bitkit release called the boltz* functions, and could users still have pending swaps on disk? If so, the app needs a plan for them before it adopts this build, because bitkit-core will no longer be able to read boltz.db.
  • Open: should a later change delete leftover boltz.db files? This issue recommends leaving them, since deleting user data cannot be undone.
  • Open: which version should ship the removal? It is a breaking change for Swift and Kotlin consumers.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions