Make `DecodeFixedLengthBytesError` semver-trickable back to 0.2.x and 0.3.x

Open
#254 21 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust

Research direction

Start by comparing the 1.x DecodeFixedLengthBytesError variants with the 0.2.x and 0.3.x HexToArrayError API, then inspect the decode_to_array method and <[u8; LEN]>::from_hex entry point. Done means the deprecated invalid_char method and non-exhaustive InvalidLengthError fields are available with compatible behavior, with the compatibility path covered by tests.

Written by the indexing model from the issue text.

Description

There are very few changes we need to make to the 1.x DecodeFixedLengthBytesError type to make it semver-compatible with the HexToArrayError type from 0.2.x and 0.3.x.

In particular, each of its two variants has suffered a small API break that we could revert in a new 1.3.0 release:

  • We would need to put back InvalidCharError::invalid_char() (though we should deprecated it; see https://github.com/rust-bitcoin/hex-conservative/issues/100 which proposes deprecating it)
  • We would need to re-expose the expected and invalid fields of InvalidLengthError; the original struct was #[non_exhaustive] so we would retain that, and the ability to later add more fields. Meanwhile, these fields have sensible names and it's hard to imagine us ever wanting to remove them.

These changes both seem pretty reasonable, and it would mean that we could release a 0.2.3 which re-exported DecodeFixedLengthBytesError as HexToArrayError. (We would need to replace the body of <[u8; LEN]>::from_hex with a passthrough to the new decode_to_array method but that's it.)

This in turn would make all the hash types in bitcoin_hashes 0.14 semver-compatible with the hash types in 1.0, which in turn would make rust-miniscript 12.x/13.x/14.x kinda-compatible with hashes 1.0.

Dominant language
Rust
Stars
11
Forks
16
Avg merge
4d 11h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-bitcoin/hex-conservative

All issues in rust-bitcoin/hex-conservative

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.