Skip to content

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

Open
EliteCoder18 wants to merge 1 commit into
bitcoindevkit:masterfrom
EliteCoder18:fix/serde-no-std
Open

fix(chain,core): prevent serde from implicitly leaking std into no_std environments#2227
EliteCoder18 wants to merge 1 commit into
bitcoindevkit:masterfrom
EliteCoder18:fix/serde-no-std

Conversation

@EliteCoder18

Copy link
Copy Markdown

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

  • bdk_core: serde dep was missing default-features = false, leaking serde/std into no_std builds and remove unnecessary rc feature .
  • bdk_chain: same leak fixed and serde/alloc and serde/rc now explicitly enabled on the dep .

Checklists

All Submissions:

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

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant