Skip to content

Fix order of 'got' and 'want' fields when populating InvalidLength error#88

Merged
apoelstra merged 1 commit intorust-bitcoin:0.1.xfrom
jirijakes:fix-invalid-length
May 13, 2024
Merged

Fix order of 'got' and 'want' fields when populating InvalidLength error#88
apoelstra merged 1 commit intorust-bitcoin:0.1.xfrom
jirijakes:fix-invalid-length

Conversation

@jirijakes
Copy link
Copy Markdown

Error HexToArrayError::InvalidLength has two numeric fields 'got' and 'want' (in this order), however the two fields were populated in the opposite order. This patch fixes it and thus fixes #87.

To crosscheck the order of fields:

/// Hex decoding error.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum HexToArrayError {
/// Conversion error while parsing hex string.
Conversion(HexToBytesError),
/// Tried to parse fixed-length hash from a string with the wrong length (got, want).
InvalidLength(usize, usize),
}

Error `HexToArrayError::InvalidLength` has two numeric fields 'got'
and 'want' (in this order), however the two fields were populated in
the opposite order. This patch fixes it.
Copy link
Copy Markdown
Member

@tcharding tcharding left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK bba0a6c

@tcharding
Copy link
Copy Markdown
Member

The two failing CI jobs are ok and unrelated to this PR, its because the target branch is old. @apoelstra will also verify my claims when he runs his local CI before merging. Thanks for the PR @jirijakes.

FTR this PR has a few more lines in the diff than I would have done myself but it does the job 100% and is only going to exist on the 0.1.x release branch since master has moved on already.

Copy link
Copy Markdown
Member

@apoelstra apoelstra left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK bba0a6c

@apoelstra apoelstra merged commit 23cab64 into rust-bitcoin:0.1.x May 13, 2024
@apoelstra
Copy link
Copy Markdown
Member

Looks good! Note that we need a separate PR to bump the version number if we want to release this.

@tcharding
Copy link
Copy Markdown
Member

Done in #89

apoelstra added a commit that referenced this pull request May 14, 2024
0db5d68 Bump version to 0.2.1 (Tobin C. Harding)
a009e25 fuzz: Remove explicit crate version (Tobin C. Harding)

Pull request description:

  Two patches in preparation for doing a point release to release the bug fix in #88.

  - Patch 1: Remove the version number from `fuzz` manifest.
  - Patch 2: Add changelog and bump version.

ACKs for top commit:
  apoelstra:
    ACK 0db5d68

Tree-SHA512: 68e70f54bac091ad2fc463ec0a32978269a9a9cace193d9283443f8a078d537286cc211f1504e2cefe6e7e3903943f29a062de5d9f5047d7a5e249d80c488db4
@jirijakes jirijakes deleted the fix-invalid-length branch May 14, 2024 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants