inverted fields in `hex::Error::InvalidLength`

Open
#189 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
rust
Domain
backend

Research direction

Start at src/hex.rs around line 33 and inspect the InvalidLength comment, Display implementation, and macro impl. Reproduce the downstream asset-id parse case for "aaaa" and compare the expected error wording; done means the actual and expected lengths are reported in the intended order and the comment matches.

Written by the indexing model from the issue text.

Description

I am testing https://github.com/ElementsProject/rust-elements/pull/188 in a downstream lib

https://github.com/ElementsProject/rust-elements/blob/613204f38eeb8f4fcc767042197fd763965f057a/src/hex.rs#L33

I think the expected, got comment is wrong and the values used in the Display implementation are inverted.

I say so by looking at the macro impl after in a downstream lib I have this test failing to parse "aaaa" as asset id with

  left: "bad hex string length 64 (expected 4)"
 right: "bad hex string length 4 (expected 64)"

(the test was working with add54c80ba1821a16b88af59de16009f28379853)

Dominant language
Rust
Stars
57
Forks
40
Avg merge
11h 58m
Merged PRs (30d)
1

Contributor guide

No contributing guide indexed for this repository

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 ElementsProject/rust-elements

All issues in ElementsProject/rust-elements

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.