From ce36a37d68e31d1dfd86ea9ce27ce5df7afed9a3 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 21 Aug 2024 12:54:41 +1000 Subject: [PATCH 1/5] primitives: Test ordered feature We forgot to add the `ordered` feature to `test_vars.sh`. --- primitives/contrib/test_vars.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/primitives/contrib/test_vars.sh b/primitives/contrib/test_vars.sh index 8bb2847004..b814611615 100644 --- a/primitives/contrib/test_vars.sh +++ b/primitives/contrib/test_vars.sh @@ -5,10 +5,10 @@ # shellcheck disable=SC2034 # Test these features with "std" enabled. -FEATURES_WITH_STD="serde" +FEATURES_WITH_STD="ordered serde" # Test these features without "std" enabled. -FEATURES_WITHOUT_STD="alloc serde" +FEATURES_WITHOUT_STD="alloc ordered serde" # Run these examples. EXAMPLES="" From e1e02308272722d7efc9c5b922587335ccae2572 Mon Sep 17 00:00:00 2001 From: "Tobin C. Harding" Date: Wed, 21 Aug 2024 12:55:55 +1000 Subject: [PATCH 2/5] primitives: Enable alloc from serde Currently the `serde` feature requires an allocator, this is a hang over from code being written for the `bitcoin` crate. This was not found because we are not testing `primitives` correctly in CI (there is the `fuzz` bug and also `primitives` is not even in the CRATES list). --- primitives/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/primitives/Cargo.toml b/primitives/Cargo.toml index d4d760d877..9a293fdafe 100644 --- a/primitives/Cargo.toml +++ b/primitives/Cargo.toml @@ -18,7 +18,7 @@ exclude = ["tests", "contrib"] default = ["std"] std = ["alloc", "internals/std", "io/std", "units/std"] alloc = ["internals/alloc", "io/alloc", "units/alloc"] -serde = ["dep:serde", "internals/serde", "units/serde"] +serde = ["dep:serde", "internals/serde", "units/serde", "alloc"] [dependencies] internals = { package = "bitcoin-internals", version = "0.3.0" } From 30f6bd43a4b752030401959376013c8d5bb8fe93 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Thu, 22 Aug 2024 16:51:53 +0000 Subject: [PATCH 3/5] Add primitives to the CRATES list This should have been done when we introduced the `primitives` crate - epic fail. Intentionally put it before `fuzz` because of the known bug in the CI script where nothing after `fuzz` gets tested. --- contrib/crates.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/crates.sh b/contrib/crates.sh index c3d605eeea..1b98e5bbe8 100644 --- a/contrib/crates.sh +++ b/contrib/crates.sh @@ -5,4 +5,4 @@ # shellcheck disable=SC2034 # Crates in this workspace to test (note "fuzz" is only built not tested). -CRATES=("addresses" "base58" "bitcoin" "hashes" "internals" "io" "units" "fuzz") +CRATES=("addresses" "base58" "bitcoin" "primitives" "hashes" "internals" "io" "units" "fuzz") From d04b6aabe54be39016fe8d4fbf3687948da27ee3 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Thu, 22 Aug 2024 16:55:12 +0000 Subject: [PATCH 4/5] bitcoin: add a couple missing prelude imports These were accidentally removed in #2892 and not noticed because of gaps in all of our testing infrastructure. These gaps have been since fixed. --- bitcoin/src/blockdata/witness.rs | 2 +- bitcoin/src/serde_utils.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/bitcoin/src/blockdata/witness.rs b/bitcoin/src/blockdata/witness.rs index 29e2054eeb..105138884c 100644 --- a/bitcoin/src/blockdata/witness.rs +++ b/bitcoin/src/blockdata/witness.rs @@ -12,7 +12,7 @@ use io::{BufRead, Write}; use crate::consensus::encode::{Error, MAX_VEC_SIZE}; use crate::consensus::{Decodable, Encodable, WriteExt}; use crate::crypto::ecdsa; -use crate::prelude::Vec; +use crate::prelude::{Vec, String}; #[cfg(doc)] use crate::script::ScriptExt as _; use crate::taproot::{self, TAPROOT_ANNEX_PREFIX}; diff --git a/bitcoin/src/serde_utils.rs b/bitcoin/src/serde_utils.rs index 3891fa31e2..b824098b10 100644 --- a/bitcoin/src/serde_utils.rs +++ b/bitcoin/src/serde_utils.rs @@ -25,7 +25,7 @@ pub mod btreemap_byte_values { use hex::FromHex; - use crate::prelude::BTreeMap; + use crate::prelude::{BTreeMap, Vec}; pub fn serialize(v: &BTreeMap>, s: S) -> Result where @@ -162,7 +162,7 @@ pub mod btreemap_as_seq_byte_values { // NOTE: This module can be exactly copied to use with HashMap. - use crate::prelude::BTreeMap; + use crate::prelude::{BTreeMap, Vec}; /// A custom key-value pair type that serialized the bytes as hex. #[derive(Debug, Deserialize)] From d03e5456a3e2064f3c14d0e8727c820dfee406be Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Thu, 22 Aug 2024 17:19:08 +0000 Subject: [PATCH 5/5] ci: fix `rev` to be `ref` when pinning bitcoin-maintainer-tools Apparently the `checkout` action will just grab random shit in the case that you configure it with an unknown key. There is a warning in the middle of the CI output so ok, I guess there's that. This commit does not change the pinned version of rust-bitcoin-maintainer-tools, though we do want to update the pin, because I want to make sure that the pin is actually working. --- .github/workflows/rust.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 3e5c3af114..9291bdbbf3 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -34,7 +34,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@stable @@ -58,7 +58,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@v1 @@ -83,7 +83,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@stable @@ -109,7 +109,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@v1 @@ -136,7 +136,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@stable @@ -160,7 +160,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@v1 @@ -186,7 +186,7 @@ jobs: uses: actions/checkout@v4 with: repository: rust-bitcoin/rust-bitcoin-maintainer-tools - rev: b2ac115 + ref: b2ac11556708cd0fb82c8139ff38b1be8d4a62e1 path: maintainer-tools - name: "Select toolchain" uses: dtolnay/rust-toolchain@v1