Skip to content

fix(chain,core): prevent serde from implicitly leaking std into no_std environments - #2227

Merged
notmandatory merged 1 commit into
bitcoindevkit:masterfrom
EliteCoder18:fix/serde-no-std
Sep 30, 2026
Merged

notmandatory merged 1 commit into
bitcoindevkit:masterfrom
EliteCoder18:fix/serde-no-std

Conversation

@EliteCoder18

@EliteCoder18 EliteCoder18 commented Jun 13, 2026 •

Copy link
Copy Markdown
Contributor

Description

Fix silent serde/std leak in bdk_core and bdk_chain both crates declared their serde optional dependency without default features = false, causing serde's std feature to activate unconditionally even in no_std builds.

  • bdk_core: added default-features = false + serde?/std in std feature.
  • Dropped rc the only two serde-derived types (BlockId, ConfirmationBlockTime) are pure scalars needing neither serde/rc nor serde/alloc.
  • bdk_chain: added default-features = false and explicitly enabledalloc and rc directly on the serde dep + serde?/std in std. Both are required because tx_graph::ChangeSet holds BTreeSet<Arc<Transaction>> and serde gates Arc<T>: Serialize behind all(feature = "rc", any(feature = "std", feature = "alloc")).

This fix was identified while working on (bitcoindevkit/bdk_wallet#494).

Notes to the reviewers

The alloc and rc features are placed on the serde dependency directly rather than behind a separate feature flag because bdk_chain unconditionally requires alloc anyway.

Changelog notice

### Fixed

- fix(core): serde dep was missing `default-features = false`, leaking `serde/std` into no_std builds and remove unnecessary `rc` feature .
- fix(chain): same leak fixed and `serde/alloc` and `serde/rc` now explicitly enabled on the dep .

Checklists

All Submissions:

@codecov

codecov Bot commented Jun 15, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.84%. Comparing base (081e038) to head (0790f04).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2227   +/-   ##
=======================================
  Coverage   78.84%   78.84%           
=======================================
  Files          31       31           
  Lines        6060     6060           
  Branches      288      288           
=======================================
  Hits         4778     4778           
  Misses       1203     1203           
  Partials       79       79           
Flag Coverage Δ
rust 78.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@notmandatory notmandatory left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK cc4cef4

Good catch finding that rc isn't needed for bdk_core.

@oleonardolima oleonardolima added the bug Something isn't working label Jun 15, 2026
@oleonardolima oleonardolima moved this to Needs Review in BDK Chain Jun 15, 2026
@oleonardolima oleonardolima added this to the Chain 0.24.0 milestone Jun 15, 2026

@oleonardolima oleonardolima left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK cc4cef4

I merged the update of rustc, so you'll need to rebase it run with the latest CI.

Comment thread crates/chain/Cargo.toml Outdated
@EliteCoder18
EliteCoder18 force-pushed the fix/serde-no-std branch 2 times, most recently from f70adb5 to 29d1f5b Compare June 15, 2026 20:08

@oleonardolima oleonardolima left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 29d1f5b

@evanlinjin evanlinjin left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK 29d1f5b

@notmandatory

Copy link
Copy Markdown
Member

@EliteCoder18 can you please rebase this one? that should fix the required CI checks. Then it looks like it's ready to merge. Thanks!

@EliteCoder18

Copy link
Copy Markdown
Contributor Author

@notmandatory Rebased onto the latest master.

@notmandatory
notmandatory merged commit 0790f04 into bitcoindevkit:master Sep 30, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants