From 961d767e0adc670f8da545aa9fe5b754b9938e8d Mon Sep 17 00:00:00 2001 From: codingp110 Date: Sat, 13 Jun 2026 15:18:21 +0530 Subject: [PATCH 1/4] build: bump redb version and MSRV Because of redb 4.1.0 requires at least rustc 1.89 --- .github/workflows/cont_integration.yml | 2 +- Cargo.toml | 14 +++++++------- clippy.toml | 1 - rust-version | 2 +- src/lib.rs | 15 +++++++-------- 5 files changed, 16 insertions(+), 18 deletions(-) delete mode 100644 clippy.toml diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index e034620..72c281b 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -31,7 +31,7 @@ jobs: rust: - version: ${{ needs.prepare.outputs.rust_version }} clippy: true - - version: 1.85.0 # Overall MSRV + - version: 1.89.0 # Overall MSRV features: - --no-default-features - --all-features diff --git a/Cargo.toml b/Cargo.toml index 537a364..d3c8004 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,28 +1,28 @@ [package] name = "bdk_redb" -version = "0.2.0" +version = "0.3.0" edition = "2024" license = "MIT OR Apache-2.0" description = "Persistence backend for bdk using redb" repository = "https://github.com/110CodingP/bdk_redb" readme = "README.md" -rust-version = "1.85.0" +rust-version = "1.89.0" [dependencies] bdk_wallet = {version = "3", optional = true} bdk_chain = {version = "0.23", features = ["serde"]} ciborium = "0.2.2" -redb = "2.5.0" -thiserror = "2.0.12" +redb = "4.1" +thiserror = "2.0" [features] default = ["wallet"] wallet = ["bdk_wallet"] [dev-dependencies] -anyhow = "1.0.98" +anyhow = "1.0" bdk_testenv = { version = "0.13.0" } -tempfile = "3.20.0" +tempfile = "3.20" [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] } \ No newline at end of file +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage,coverage_nightly)'] } diff --git a/clippy.toml b/clippy.toml deleted file mode 100644 index f3bd183..0000000 --- a/clippy.toml +++ /dev/null @@ -1 +0,0 @@ -msrv="1.85.0" \ No newline at end of file diff --git a/rust-version b/rust-version index 2db3303..a0f550d 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -1.85.0 \ No newline at end of file +1.89.0 \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index d4bc3c6..d054a60 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,10 +12,7 @@ //! //! ```toml //! [dependencies] -//! anyhow = "1.0.98" -//! bdk_redb = "0.1.1" -//! bdk_wallet = "2.0.0" -//! tempfile = "3.20.0" +//! bdk_redb = "0.3.0" //! ``` //! //! Now: @@ -27,6 +24,7 @@ //! use bdk_wallet::{KeychainKind, Wallet}; //! use std::sync::Arc; //! use tempfile::NamedTempFile; +//! use bdk_redb::{redb::Database, Store}; //! //! use anyhow::Result; //! @@ -38,13 +36,12 @@ //! fn main() -> Result<()> { //! let network = Network::Signet; //! let file_path = NamedTempFile::new()?; -//! let db = Arc::new(bdk_redb::redb::Database::create(file_path.path())?); -//! let mut store = bdk_redb::Store::new(db, "wallet1".to_string())?; +//! let db = Arc::new(Database::create(file_path.path())?); +//! let mut store = Store::new(db, "wallet1".to_string())?; //! //! let wallet_opt = Wallet::load() //! .descriptor(KeychainKind::External, Some(EXTERNAL_DESCRIPTOR)) //! .descriptor(KeychainKind::Internal, Some(INTERNAL_DESCRIPTOR)) -//! .extract_keys() //! .check_network(network) //! .load_wallet(&mut store)?; //! @@ -88,7 +85,9 @@ use bdk_chain::{BlockId, DescriptorId, keychain_txout, local_chain, tx_graph}; #[cfg(feature = "wallet")] use bdk_wallet::{ChangeSet, WalletPersister}; use error::StoreError; -use redb::{Database, ReadTransaction, ReadableTable, TableDefinition, WriteTransaction}; +use redb::{ + Database, ReadTransaction, ReadableDatabase, ReadableTable, TableDefinition, WriteTransaction, +}; use std::collections::{BTreeMap, BTreeSet}; use std::str::FromStr; use std::sync::Arc; From 1ef7cd895b2361566dc459a7586d1796e567dc81 Mon Sep 17 00:00:00 2001 From: codingp110 Date: Fri, 10 Jul 2026 00:28:43 +0530 Subject: [PATCH 2/4] fix(ci): update actions and check docs --- .github/workflows/cont_integration.yml | 121 +++++++++++++++---------- rust-toolchain.toml | 3 + rust-version | 1 - 3 files changed, 75 insertions(+), 50 deletions(-) create mode 100644 rust-toolchain.toml delete mode 100644 rust-version diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index 72c281b..50e3f63 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -1,58 +1,73 @@ on: [push, pull_request] +# Main continuous integration workflow that runs build, test, and code quality checks. +# Runs on every push and pull request, testing against both MSRV and stable Rust. +# Includes formatting validation, and clippy linting. + name: CI permissions: {} -jobs: +env: + CARGO_TERM_COLOR: always - prepare: - runs-on: ubuntu-latest - outputs: - rust_version: ${{ steps.read_toolchain.outputs.rust_version }} +jobs: + build-test-msrv: + name: Build & Test MSRV + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-latest + - ubuntu-24.04-arm + features: + - --no-default-features + - --all-features steps: - - name: "Checkout repo" - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v6 with: persist-credentials: false - - name: "Read rust version" - id: read_toolchain - run: echo "rust_version=$(cat rust-version)" >> $GITHUB_OUTPUT + - name: Read MSRV + id: msrv + uses: actions-rust-lang/msrv@b95a3a81b0efee6438b858b41a84aff627e01351 #v0.1.1 + # The 'toolchain' argument on this action overrides the Rust compiler version set in rust-toolchain.toml + # in order to test our MSRV. + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: ${{ steps.msrv.outputs.msrv }} + cache: true + - name: Build + Test + run: | + cargo build --all-targets ${{ matrix.features }} + cargo test ${{ matrix.features }} - build-test: - needs: prepare - name: Build & Test + build-test-stable: + name: Build & Test Rust Stable runs-on: ${{ matrix.os }} strategy: matrix: os: - ubuntu-latest - ubuntu-24.04-arm - rust: - - version: ${{ needs.prepare.outputs.rust_version }} - clippy: true - - version: 1.89.0 # Overall MSRV features: - --no-default-features - --all-features steps: - - name: checkout - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v6 with: persist-credentials: false + # This action will honor the Rust compiler version set in rust-toolchain.toml. We aim to keep it in sync with + # Rust stable. - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: ${{ matrix.rust.version }} - override: true - profile: minimal - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.8 + cache: true - name: Build + Test - env: - MATRIX_RUST_VERSION: ${{ matrix.rust.version }} run: | - cargo build ${{ matrix.features }} + cargo build --all-targets ${{ matrix.features }} cargo test ${{ matrix.features }} fmt: @@ -60,38 +75,46 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: nightly - override: true - profile: minimal - components: rustfmt + toolchain: nightly + cache: true + components: rustfmt - name: Check fmt - run: cargo fmt --check + run: cargo fmt --all --check clippy_check: - needs: prepare name: Rust clippy runs-on: ubuntu-latest - permissions: - checks: write steps: - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v6 with: persist-credentials: false - - uses: actions-rs/toolchain@v1 + # This action automatically reads and applies rust-toolchain.toml + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: ${{ needs.prepare.outputs.rust_version }} - components: clippy - override: true - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.8 - - uses: actions-rs/clippy-check@v1 + cache: true + - name: Clippy + run: cargo clippy --all-features --all-targets -- -D warnings + + docs_check: + name: Check cargo doc + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + persist-credentials: false + # This action automatically reads and applies rust-toolchain.toml + - name: Install Rust toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} - name: Clippy Results - args: --all-features --all-targets -- -D warnings \ No newline at end of file + cache: true + - name: Check docs + run: RUSTDOCFLAGS='-D warnings' cargo doc --all-features --no-deps diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..a42b911 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,3 @@ +[toolchain] +channel = "1.97.0" +components = ["clippy", "rustfmt"] diff --git a/rust-version b/rust-version deleted file mode 100644 index a0f550d..0000000 --- a/rust-version +++ /dev/null @@ -1 +0,0 @@ -1.89.0 \ No newline at end of file From 1ec2fd9c3a5588156ba367ae2b821c914c878e72 Mon Sep 17 00:00:00 2001 From: codingp110 Date: Sat, 11 Jul 2026 09:23:05 +0530 Subject: [PATCH 3/4] fix(ci): use Codecov and update actions --- .github/workflows/code_coverage.yml | 58 ++++++++++++++++------------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/.github/workflows/code_coverage.yml b/.github/workflows/code_coverage.yml index b915a20..d99d76d 100644 --- a/.github/workflows/code_coverage.yml +++ b/.github/workflows/code_coverage.yml @@ -1,43 +1,51 @@ -on: [push, pull_request] - name: Code Coverage -permissions: {} +# Generates code coverage reports using cargo-llvm-cov and uploads results to Codecov. +# Runs on every push and pull request to track test coverage metrics. +# Uploads coverage data to Codecov for tracking and produces an HTML report artifact for download. + +on: [push, pull_request] + +permissions: + contents: read + pull-requests: write jobs: - Codecov: + Coverage: name: Code Coverage runs-on: ubuntu-latest + steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false - - name: Install lcov tools - run: sudo apt-get install lcov -y - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 + uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: nightly - override: true - profile: minimal - components: llvm-tools-preview - - name: Rust Cache - uses: Swatinem/rust-cache@v2.7.8 + toolchain: nightly + components: llvm-tools-preview + cache: true - name: Install cargo-llvm-cov - run: if [[ ! -e ~/.cargo/bin/cargo-llvm-cov ]]; then cargo install cargo-llvm-cov; fi - - name: Make coverage directory - run: mkdir coverage - - name: Test and report coverage - run: cargo +nightly llvm-cov -q --doctests --branch --all-features --lcov --output-path ./coverage/lcov.info + run: cargo install cargo-llvm-cov + - name: Generate coverage data + run: cargo llvm-cov --all-features --branch --quiet --lcov --output-path lcov.info + env: + RUSTFLAGS: "--cfg coverage_nightly" - name: Generate HTML coverage report - run: genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info - - name: Coveralls upload - uses: coverallsapp/github-action@master + run: cargo llvm-cov --all-features --branch --quiet --html + env: + RUSTFLAGS: "--cfg coverage_nightly" + - name: Codecov upload + uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 with: - github-token: ${{ secrets.GITHUB_TOKEN }} + files: ./lcov.info + flags: rust + name: codecov-bdk-redb + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false - name: Upload artifact - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: name: coverage-report - path: coverage-report.html \ No newline at end of file + path: target/llvm-cov/html From 7673379d0ab3723b2d8146aa0cb8938bb4af72d9 Mon Sep 17 00:00:00 2001 From: codingp110 Date: Sat, 11 Jul 2026 10:59:19 +0530 Subject: [PATCH 4/4] fix(justfile): remove extraneous commands Modified code_cov recipe to use cargo-llvm-cov's flags to generate html. --- justfile | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/justfile b/justfile index a2fb5b3..0310227 100644 --- a/justfile +++ b/justfile @@ -9,8 +9,7 @@ default: # Build the project build: - cargo build - cargo build --no-default-features + cargo build --all-features # Check code: formatting, compilation, linting, and commit signature check: @@ -34,17 +33,11 @@ test: # Generate doc doc: cargo doc --open --all-features - cargo doc --open - cargo doc --open --no-default-features # Generate code coverage code_cov: - mkdir coverage - touch coverage/lcov.info - cargo +nightly llvm-cov -q --doctests --branch --all-features --lcov --output-path ./coverage/lcov.info - @genhtml -o coverage-report.html --ignore-errors unmapped ./coverage/lcov.info - open ./coverage-report.html/index.html - rm -rf coverage + cargo +nightly llvm-cov -q --doctests --branch --all-features --html + open target/llvm-cov/html/index.html # Run pre-push suite: format, check, and test -pre-push: fmt check test \ No newline at end of file +pre-push: fmt check test