Merge rust-bitcoin/rust-bitcoin#2233: Remove the "no-std" feature
b72f1d70e5
bitcoin: Add DO_FEATURE_MATRIX (Tobin C. Harding)48879e7ad9
Remove no-std feature (Tobin C. Harding)7d71fb9fdb
Re-order dependencies in manifest (Tobin C. Harding) Pull request description: Now we have the `io` crate we can remove the "no-std" feature. Do a few cleanups to the `bitcoin` manifest, then remove the "no-std" feature - BOOM! ACKs for top commit: Kixunil: ACKb72f1d70e5
apoelstra: ACKb72f1d70e5
Tree-SHA512: fb14f70e5ef7882437fefe059eafb112684ccb0077551114b7ae66fa3576cb01fec781a6fbaa24f57d66537109a5815037790df87d8665f97614d6615f49c6cb
This commit is contained in:
commit
7e40e1d059
|
@ -24,7 +24,6 @@ jobs:
|
||||||
DO_COV: true
|
DO_COV: true
|
||||||
DO_LINT: true
|
DO_LINT: true
|
||||||
AS_DEPENDENCY: false
|
AS_DEPENDENCY: false
|
||||||
DO_NO_STD: true
|
|
||||||
DO_DOCS: true
|
DO_DOCS: true
|
||||||
DO_FEATURE_MATRIX: true
|
DO_FEATURE_MATRIX: true
|
||||||
DO_SCHEMARS_TESTS: true # Currently only used in hashes crate.
|
DO_SCHEMARS_TESTS: true # Currently only used in hashes crate.
|
||||||
|
@ -43,7 +42,6 @@ jobs:
|
||||||
- name: Running test script
|
- name: Running test script
|
||||||
env:
|
env:
|
||||||
AS_DEPENDENCY: false
|
AS_DEPENDENCY: false
|
||||||
DO_NO_STD: true
|
|
||||||
run: ./contrib/test.sh
|
run: ./contrib/test.sh
|
||||||
|
|
||||||
Nightly:
|
Nightly:
|
||||||
|
@ -61,7 +59,6 @@ jobs:
|
||||||
DO_FMT: false
|
DO_FMT: false
|
||||||
DO_BENCH: true
|
DO_BENCH: true
|
||||||
AS_DEPENDENCY: false
|
AS_DEPENDENCY: false
|
||||||
DO_NO_STD: true
|
|
||||||
DO_DOCSRS: true
|
DO_DOCSRS: true
|
||||||
run: ./contrib/test.sh
|
run: ./contrib/test.sh
|
||||||
|
|
||||||
|
@ -80,7 +77,6 @@ jobs:
|
||||||
- name: Running test script
|
- name: Running test script
|
||||||
env:
|
env:
|
||||||
DO_FEATURE_MATRIX: true
|
DO_FEATURE_MATRIX: true
|
||||||
DO_NO_STD: true
|
|
||||||
run: ./contrib/test.sh
|
run: ./contrib/test.sh
|
||||||
|
|
||||||
Arch32bit:
|
Arch32bit:
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# unreleased
|
# unreleased
|
||||||
|
|
||||||
- Bump MSRV to Rust 1.56.1
|
- Bump MSRV to Rust 1.56.1
|
||||||
|
- Remove "no-std" feature
|
||||||
|
|
||||||
# 0.31.1 - 2023-10-18
|
# 0.31.1 - 2023-10-18
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ exclude = ["tests", "contrib"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = [ "std", "secp-recovery" ]
|
default = [ "std", "secp-recovery" ]
|
||||||
|
std = ["bech32/std", "hashes/std", "hex/std", "internals/std", "io/std", "secp256k1/std"]
|
||||||
rand-std = ["secp256k1/rand-std", "std"]
|
rand-std = ["secp256k1/rand-std", "std"]
|
||||||
rand = ["secp256k1/rand"]
|
rand = ["secp256k1/rand"]
|
||||||
serde = ["actual-serde", "hashes/serde", "secp256k1/serde", "internals/serde"]
|
serde = ["actual-serde", "hashes/serde", "secp256k1/serde", "internals/serde"]
|
||||||
|
@ -22,26 +23,18 @@ secp-lowmemory = ["secp256k1/lowmemory"]
|
||||||
secp-recovery = ["secp256k1/recovery"]
|
secp-recovery = ["secp256k1/recovery"]
|
||||||
bitcoinconsensus-std = ["bitcoinconsensus/std", "std"]
|
bitcoinconsensus-std = ["bitcoinconsensus/std", "std"]
|
||||||
|
|
||||||
# At least one of std, no-std must be enabled.
|
|
||||||
#
|
|
||||||
# The no-std feature doesn't disable std - you need to turn off the std feature for that by disabling default.
|
|
||||||
# Instead no-std enables additional features required for this crate to be usable without std.
|
|
||||||
# As a result, both can be enabled without conflict.
|
|
||||||
std = ["secp256k1/std", "io/std", "hashes/std", "bech32/std", "internals/std", "hex/std"]
|
|
||||||
no-std = ["hashes/alloc", "hashes/io", "io/alloc", "bech32/alloc", "secp256k1/alloc", "hex/alloc"]
|
|
||||||
|
|
||||||
[package.metadata.docs.rs]
|
[package.metadata.docs.rs]
|
||||||
all-features = true
|
all-features = true
|
||||||
rustdoc-args = ["--cfg", "docsrs"]
|
rustdoc-args = ["--cfg", "docsrs"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
internals = { package = "bitcoin-internals", version = "0.2.0" }
|
bech32 = { version = "0.10.0-beta", default-features = false, features = ["alloc"] }
|
||||||
hex = { package = "hex-conservative", version = "0.1.1", default-features = false }
|
hashes = { package = "bitcoin_hashes", version = "0.13.0", default-features = false, features = ["alloc", "io"] }
|
||||||
bech32 = { version = "0.10.0-beta", default-features = false }
|
hex = { package = "hex-conservative", version = "0.1.1", default-features = false, features = ["alloc"] }
|
||||||
hashes = { package = "bitcoin_hashes", version = "0.13.0", default-features = false }
|
|
||||||
secp256k1 = { version = "0.28.0", default-features = false, features = ["hashes"] }
|
|
||||||
io = { package = "bitcoin-io", version = "0.1", default-features = false }
|
|
||||||
hex_lit = "0.1.1"
|
hex_lit = "0.1.1"
|
||||||
|
internals = { package = "bitcoin-internals", version = "0.2.0" }
|
||||||
|
io = { package = "bitcoin-io", version = "0.1", default-features = false, features = ["alloc"] }
|
||||||
|
secp256k1 = { version = "0.28.0", default-features = false, features = ["hashes", "alloc"] }
|
||||||
|
|
||||||
base64 = { version = "0.21.3", optional = true }
|
base64 = { version = "0.21.3", optional = true }
|
||||||
# Only use this feature for no-std builds, otherwise use bitcoinconsensus-std.
|
# Only use this feature for no-std builds, otherwise use bitcoinconsensus-std.
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
FEATURES="base64 bitcoinconsensus serde rand secp-recovery"
|
FEATURES="std rand-std rand serde secp-recovery bitcoinconsensus-std base64 bitcoinconsensus"
|
||||||
|
|
||||||
if [ "$DO_COV" = true ]
|
if [ "$DO_COV" = true ]
|
||||||
then
|
then
|
||||||
|
@ -23,6 +23,13 @@ if cargo --version | grep beta; then
|
||||||
STABLE=false
|
STABLE=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Make all cargo invocations verbose
|
||||||
|
export CARGO_TERM_VERBOSE=true
|
||||||
|
|
||||||
|
# Defaults / sanity checks
|
||||||
|
cargo build
|
||||||
|
cargo test
|
||||||
|
|
||||||
if [ "$DO_LINT" = true ]
|
if [ "$DO_LINT" = true ]
|
||||||
then
|
then
|
||||||
cargo clippy --locked --all-features --all-targets -- -D warnings
|
cargo clippy --locked --all-features --all-targets -- -D warnings
|
||||||
|
@ -53,45 +60,28 @@ then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "********* Testing std *************"
|
if [ "$DO_FEATURE_MATRIX" = true ]; then
|
||||||
# Test without any features other than std first
|
cargo build --locked --no-default-features
|
||||||
cargo test --locked --verbose --no-default-features --features="std"
|
cargo test --locked --no-default-features
|
||||||
|
|
||||||
echo "********* Testing default *************"
|
# All features
|
||||||
# Then test with the default features
|
cargo build --locked --no-default-features --features="$FEATURES"
|
||||||
cargo test --verbose
|
cargo test --locked --no-default-features --features="$FEATURES"
|
||||||
|
# Single features
|
||||||
if [ "$DO_NO_STD" = true ]
|
|
||||||
then
|
|
||||||
echo "********* Testing no-std build *************"
|
|
||||||
# Build no_std, to make sure that cfg(test) doesn't hide any issues
|
|
||||||
cargo build --locked --verbose --features="no-std" --no-default-features
|
|
||||||
|
|
||||||
# Build std + no_std, to make sure they are not incompatible
|
|
||||||
cargo build --locked --verbose --features="no-std"
|
|
||||||
|
|
||||||
# Test no_std
|
|
||||||
cargo test --locked --verbose --features="no-std" --no-default-features
|
|
||||||
|
|
||||||
# Build all features
|
|
||||||
cargo build --locked --verbose --features="no-std $FEATURES" --no-default-features
|
|
||||||
|
|
||||||
# Build specific features
|
|
||||||
for feature in ${FEATURES}
|
for feature in ${FEATURES}
|
||||||
do
|
do
|
||||||
cargo build --locked --verbose --features="no-std $feature" --no-default-features
|
cargo build --locked --no-default-features --features="$feature"
|
||||||
|
cargo test --locked --no-default-features --features="$feature"
|
||||||
|
# All combos of two features
|
||||||
|
for featuretwo in ${FEATURES}; do
|
||||||
|
cargo build --locked --no-default-features --features="$feature $featuretwo"
|
||||||
|
cargo test --locked --no-default-features --features="$feature $featuretwo"
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
cargo run --locked --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd
|
|
||||||
cargo run --locked --no-default-features --features no-std --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Test each feature
|
cargo run --locked --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd
|
||||||
for feature in ${FEATURES}
|
cargo run --locked --no-default-features --example bip32 7934c09359b234e076b9fa5a1abfd38e3dc2a9939745b7cc3c22a48d831d14bd
|
||||||
do
|
|
||||||
echo "********* Testing $feature *************"
|
|
||||||
cargo test --locked --verbose --features="$feature"
|
|
||||||
done
|
|
||||||
|
|
||||||
cargo run --locked --example ecdsa-psbt --features=bitcoinconsensus
|
cargo run --locked --example ecdsa-psbt --features=bitcoinconsensus
|
||||||
cargo run --locked --example sign-tx-segwit-v0 --features=rand-std -- -D warnings
|
cargo run --locked --example sign-tx-segwit-v0 --features=rand-std -- -D warnings
|
||||||
|
|
|
@ -15,7 +15,7 @@ cortex-m-rt = "0.6.10"
|
||||||
cortex-m-semihosting = "0.3.3"
|
cortex-m-semihosting = "0.3.3"
|
||||||
panic-halt = "0.2.0"
|
panic-halt = "0.2.0"
|
||||||
alloc-cortex-m = "0.4.1"
|
alloc-cortex-m = "0.4.1"
|
||||||
bitcoin = { path="../", default-features = false, features = ["no-std", "secp-lowmemory"] }
|
bitcoin = { path="../", default-features = false, features = ["secp-lowmemory"] }
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "embedded"
|
name = "embedded"
|
||||||
|
|
|
@ -22,8 +22,6 @@
|
||||||
//! * `serde` - (dependency), implements `serde`-based serialization and
|
//! * `serde` - (dependency), implements `serde`-based serialization and
|
||||||
//! deserialization.
|
//! deserialization.
|
||||||
//! * `secp-lowmemory` - optimizations for low-memory devices.
|
//! * `secp-lowmemory` - optimizations for low-memory devices.
|
||||||
//! * `no-std` - enables additional features required for this crate to be usable
|
|
||||||
//! without std. Does **not** disable `std`.
|
|
||||||
//! * `bitcoinconsensus-std` - enables `std` in `bitcoinconsensus` and communicates it
|
//! * `bitcoinconsensus-std` - enables `std` in `bitcoinconsensus` and communicates it
|
||||||
//! to this crate so it knows how to implement
|
//! to this crate so it knows how to implement
|
||||||
//! `std::error::Error`. At this time there's a hack to
|
//! `std::error::Error`. At this time there's a hack to
|
||||||
|
@ -41,9 +39,6 @@
|
||||||
// Exclude clippy lints we don't think are valuable
|
// Exclude clippy lints we don't think are valuable
|
||||||
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
#![allow(clippy::needless_question_mark)] // https://github.com/rust-bitcoin/rust-bitcoin/pull/2134
|
||||||
|
|
||||||
#[cfg(not(any(feature = "std", feature = "no-std")))]
|
|
||||||
compile_error!("at least one of the `std` or `no-std` features must be enabled");
|
|
||||||
|
|
||||||
// Disable 16-bit support at least for now as we can't guarantee it yet.
|
// Disable 16-bit support at least for now as we can't guarantee it yet.
|
||||||
#[cfg(target_pointer_width = "16")]
|
#[cfg(target_pointer_width = "16")]
|
||||||
compile_error!(
|
compile_error!(
|
||||||
|
|
Loading…
Reference in New Issue