Skip to content

0.32.xxx: Bump consensus_encoding to 1.1 and use prefixed encoders#6550

Draft
mpbagot wants to merge 5 commits into
rust-bitcoin:0.32.xxxfrom
mpbagot:feature/use-consensus-1.1
Draft

0.32.xxx: Bump consensus_encoding to 1.1 and use prefixed encoders#6550
mpbagot wants to merge 5 commits into
rust-bitcoin:0.32.xxxfrom
mpbagot:feature/use-consensus-1.1

Conversation

@mpbagot

@mpbagot mpbagot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

With the release of consensus_encoding 1.1.0, the prefixed encoders changes on master can now be backported. As some of the types are not present on 0.32.xxx, this is a subset of the master changes, paired with a bump to the consensus_encoding dep version.

  • Patch 1 updates the serde dependency versions.
  • Patch 2 updates the API files.
  • Patch 3 bumps the consensus_encoding dep versions to 1.1.0.
  • Patch 4 replaces uses of Encoder2<CompactSizeEncoder, Bytes/SliceEncoder> with the corresponding prefixed encoder type.
  • Patch 5 updates the API files.

@github-actions github-actions Bot added the C-bitcoin PRs modifying the bitcoin crate label Jul 15, 2026
@mpbagot

mpbagot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Oh, this lockfile is going to be a pain to fix. just ulf snags on version conflicts. If anyone has any advice, I'd appreciate it. Otherwise, I'll just close and leave it for someone else.

@nyonson

nyonson commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

It looks like what is needed to get the lockfiles to resolve is 1. update the rest of the optional bitcoin-concensus-encoding dependencies in the workspace and 2. bump the minimum version of serde to match the version coming from the upstream bitcoin-concensus-encoding@1.1.

With that said, pulling in the new optional deps of 1.1 definitely causes some dependency changes in the lockfile. I haven't fully thought them through.

06:04:30 ~/grd/rust-bitcoin > jj diff --git --context 1
diff --git a/bitcoin/Cargo.toml b/bitcoin/Cargo.toml
index a632aabb3e..2cfd440df4 100644
--- a/bitcoin/Cargo.toml
+++ b/bitcoin/Cargo.toml
@@ -52,3 +52,3 @@
 # Do NOT use this as a feature! Use the `serde` feature instead.
-actual-serde = { package = "serde", version = "1.0.130", default-features = false, features = [ "derive", "alloc" ], optional = true }
+actual-serde = { package = "serde", version = "1.0.195", default-features = false, features = [ "derive", "alloc" ], optional = true }
 
diff --git a/hashes/Cargo.toml b/hashes/Cargo.toml
index e117bbf264..a9b7ab35f4 100644
--- a/hashes/Cargo.toml
+++ b/hashes/Cargo.toml
@@ -38,3 +38,3 @@
 actual-schemars = { package = "schemars", version = "0.8.3", default-features = false, optional = true }
-serde = { version = "1.0.130", default-features = false, optional = true }
+serde = { version = "1.0.195", default-features = false, optional = true }
 
diff --git a/hashes/extended_tests/schemars/Cargo.toml b/hashes/extended_tests/schemars/Cargo.toml
index aab48ea589..e4391f8ba8 100644
--- a/hashes/extended_tests/schemars/Cargo.toml
+++ b/hashes/extended_tests/schemars/Cargo.toml
@@ -16,3 +16,3 @@
 jsonschema-valid = "0.4.0"
-serde = { version = "1.0", default-features = false}
+serde = { version = "1.0.195", default-features = false}
 schemars = "0.8.3"
diff --git a/io/Cargo.toml b/io/Cargo.toml
index 80cf1f96bf..0a2f7ab0be 100644
--- a/io/Cargo.toml
+++ b/io/Cargo.toml
@@ -24,3 +24,3 @@
 [dependencies]
-encoding = { package = "bitcoin-consensus-encoding", version = "1.0", default-features = false, optional = true }
+encoding = { package = "bitcoin-consensus-encoding", version = "1.1", default-features = false, optional = true }
 
diff --git a/units/Cargo.toml b/units/Cargo.toml
index b409605a6c..7b1e7abb00 100644
--- a/units/Cargo.toml
+++ b/units/Cargo.toml
@@ -28,4 +28,4 @@
 arbitrary = { version = "1.0.1", optional = true }
-encoding = { package = "bitcoin-consensus-encoding", version = "1.0", default-features = false, optional = true }
-serde = { version = "1.0.130", default-features = false, features = ["derive"], optional = true }
+encoding = { package = "bitcoin-consensus-encoding", version = "1.1", default-features = false, optional = true }
+serde = { version = "1.0.195", default-features = false, features = ["derive"], optional = true }

@nyonson

nyonson commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

We discussed the serde bump here, but looks like we didn't merge it: #6294

@mpbagot mpbagot force-pushed the feature/use-consensus-1.1 branch from 0a64cd0 to 6e8a095 Compare July 15, 2026 15:30
@github-actions github-actions Bot added C-hashes PRs modifying the hashes crate C-units PRs modifying the units crate C-io PRs modifying the io crate labels Jul 15, 2026
tcharding and others added 5 commits July 16, 2026 01:31
Now that we have bumped the MSRV we can update `serde`.

Found while trying to add a dependency on one of the soon-to-be-stable
crates.
With the release of consensus_encoding 1.1.0, the prefixed encoders
change can now be backported to 0.32.xxx, as it is on master. First,
the version needs to be bumped in the manifest.

Bump consensus_encoding dep version to 1.1 in bitcoin.
Throughout the code, there are myriad instances of
Encoder2<CompactSizeEncoder, Bytes/SliceEncoder> used to encode a length
prefixed element vector or byte slice. With the new prefixed encoders
these can all be replaced with the PrefixedBytes/SliceEncoder types.

Replace uses of Encoder2<CompactSizeEncoder, Bytes/SliceEncoder> with
the corresponding PrefixedBytes/SliceEncoder type.
@mpbagot mpbagot force-pushed the feature/use-consensus-1.1 branch from 6e8a095 to 295b94c Compare July 15, 2026 15:34
@mpbagot

mpbagot commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

That did it. Thanks heaps, @nyonson.
FTR, I've cherry-picked Tobin's commits from #6294, but I'm not sure whether that PR should just be re-opened and re-targeted first.

@mpbagot mpbagot marked this pull request as ready for review July 15, 2026 15:38
@nyonson

nyonson commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Ooof, I didn't check the MSRVs due to the bumps. I'll poke around a bit there.

EDIT: have a proposal for the MSRV issue: #6552

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

Labels

C-bitcoin PRs modifying the bitcoin crate C-hashes PRs modifying the hashes crate C-io PRs modifying the io crate C-units PRs modifying the units crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants