fix(chain,core): prevent serde from implicitly leaking std into no_std environments#2227
fix(chain,core): prevent serde from implicitly leaking std into no_std environments#2227EliteCoder18 wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2227 +/- ##
=======================================
Coverage 78.65% 78.65%
=======================================
Files 30 30
Lines 5909 5909
Branches 279 279
=======================================
Hits 4648 4648
Misses 1185 1185
Partials 76 76
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
notmandatory
left a comment
There was a problem hiding this comment.
ACK cc4cef4
Good catch finding that rc isn't needed for bdk_core.
oleonardolima
left a comment
There was a problem hiding this comment.
utACK cc4cef4
I merged the update of rustc, so you'll need to rebase it run with the latest CI.
| [features] | ||
| default = ["std", "miniscript"] | ||
| std = ["bitcoin/std", "miniscript?/std", "bdk_core/std"] | ||
| std = ["bitcoin/std", "miniscript?/std", "bdk_core/std", "serde?/std"] |
There was a problem hiding this comment.
nit: do we need this, as it's already being brought by bdk_core/std and bdk_core/serde below ?
There was a problem hiding this comment.
You're right, removed. Since both crates are in the same repo the transitive path through bdk_core/std is guaranteed. Thanks!
cc4cef4 to
f70adb5
Compare
f70adb5 to
29d1f5b
Compare
Description
Fix silent
serde/stdleak inbdk_coreandbdk_chainboth crates declared theirserdeoptional dependency withoutdefault features = false, causing serde's std feature to activate unconditionally even in no_std builds.bdk_core: addeddefault-features = false+serde?/stdin std feature.rcthe only two serde-derived types (BlockId,ConfirmationBlockTime) are pure scalars needing neitherserde/rcnorserde/alloc.bdk_chain: addeddefault-features = falseand explicitly enabledallocandrcdirectly on theserde dep+serde?/stdin std. Both are required becausetx_graph::ChangeSetholdsBTreeSet<Arc<Transaction>>andserdegatesArc<T>: Serializebehindall(feature = "rc", any(feature = "std", feature = "alloc")).This fix was identified while working on (bitcoindevkit/bdk_wallet#494).
Notes to the reviewers
The
allocandrcfeatures are placed on the serde dependency directly rather than behind a separate feature flag becausebdk_chainunconditionally requiresallocanyway.Changelog notice
Checklists
All Submissions: