Repository navigation
Conversation
The SQLite store's tests only ever read databases they wrote themselves, and neither covered zero-length or multi-megabyte values, a schema migration failing halfway through, nor contention with a second connection. These are the paths most likely to change behavior when the underlying SQLite wrapper is touched. Add tests asserting that values of any length are stored as BLOBs, that a database written by LDK Node v0.7 is migrated and remains usable, that a failed migration leaves the database untouched, and that writes wait for a lock held by another connection. Co-Authored-By: HAL 9000
As libsqlite3-sys may only be linked once per build and every rusqlite release pins a single version of it, LDK Node and any application using SQLite themselves had to agree on a rusqlite release. Our MSRV furthermore kept us from admitting recent releases, leaving downstream users unable to pick up newer bundled SQLite versions. Access SQLite through sqlite-thin instead, which declares the C API itself and hence accepts any libsqlite3-sys release from 0.28 on, leaving the choice to the application. It mirrors the subset of rusqlite's API we use, so the store's logic remains unchanged. As the crate is not released yet, we for now pin the revision proposed in cashubtc/cdk#2963. Co-Authored-By: HAL 9000
|
👋 Hi! This PR is now in draft status. |
tnull
marked this pull request as draft
November 24, 2026 09:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
libsqlite3-sysmay only be linked once per build and everyrusqliterelease pins exactly one version of it, so LDK Node and any application using
SQLite have to agree on a
rusqliterelease. Our MSRV additionally keeps usfrom admitting recent releases, which keeps downstream users from picking up
newer bundled SQLite versions.
This switches
SqliteStoretosqlite-thin, a small wrapper that declares theSQLite C API itself and accepts any
libsqlite3-sysrelease from 0.28 on,leaving the version choice to the application. It mirrors the subset of
rusqlite's API we use, so the change is an import rename and the on-diskformat is unchanged.
For downstream users this drops 6 crates from the tree (
rusqlite,hashlink,hashbrown,foldhash,fallible-iterator,fallible-streaming-iterator) andadds 1 (
sqlite-thin).The first commit adds tests for the paths most likely to be affected (empty and
large values, upgrading a database written by LDK Node v0.7, a failed migration
rolling back, and lock contention). They pass both before and after the switch.
Still open:
sqlite-thinneeds a crates.io release before this can be merged,and since it doesn't cap
libsqlite3-sys, a downstream build without its ownrusqliteresolves to 0.40.0, which requires Rust 1.88 (our MSRV is 1.85).