Closed realeinherjar closed 1 year ago
I did a quick check and looks like core2
didn't get vendored?
09:24:32 /tmp/nix-build-crates-deps-0.1.0.drv-0/source🔒 🦀v1.73.0 ❄️ r u > cat .cargo-home/config.toml
[source.nix-sources-c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0]
directory = "/nix/store/yfbswavryrlhq35v7xpmb2dsm0ik0aan-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0"
[source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index"
replace-with = "nix-sources-c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0"
> ls /nix/store/yfbswavryrlhq35v7xpmb2dsm0ik0aan-vendor-cargo-deps/c19b7c6f923b580ac259164a89f2577984ad5ab09ee9d583b888f934adbbe8d0 | grep core
bitcoincore-rpc-0.17.0
bitcoincore-rpc-json-0.17.0
core-foundation-0.9.3
core-foundation-sys-0.8.4
futures-core-0.3.28
parking_lot_core-0.8.6
rand_core-0.4.2
rand_core-0.6.4
tracing-core-0.1.32
This is fixed by adding core2
to bdk
's Cargo.toml
, since it is used in no-std
builds of rust-bitcoin
.
Don't know why in a devShell running the cargo check --release --locked --target wasm32-unknown-unknown -p bdk --no-default-features --features bitcoin/no-std,miniscript/no-std,bdk_chain/hashbrown,dev-getrandom-wasm
is not modifying Cargo.lock
It looks like Cargo.lock
does not contain core2
, (which is a conditional dependency of bitcoin
, and no matter what is behing called cargo update
, etc. cargo
will just not add it there, yet things are working fine. It's only when building in crane where this missing Cargo.lock
entry causes core2
not being vendored.
I don't understand that cargo's behavior. Bug? Or that's how it works?
I don't understand that cargo's behavior. Bug? Or that's how it works?
I'm pretty surprised by this behavior, I'd consider this a cargo bug (Cargo.lock already contains all possible deps across targets, it should be containing it for all possible features too)
I'm not entirely sure if --features bitcoin/no-std
is a "supported" way of toggling downstream features or if its a happenstance that it works. I think the "correct" way to solve this is to add a
[target.'cfg(target = "wasm32-unknown-unknown').dependencies]
bitcoin = { version = "...", features = ["no-std"] }
which should convince cargo to add it to the Cargo.lock.
Don't think there's anything for us to do here since we cannot vendor dependencies if they don't show up in Cargo.lock (but at least you have a workaround at least!)
Thank you, this works :)
I am trying to setup some CI checks in https://github.com/bitcoindevkit/bdk/pull/1165. Here's the important
flake.nix
parts:then I get an erroar while building
#ci.WASM.bdk
:However the
WASM
devShell
executing the same command works: