rust-bitcoin / rust-bitcoin/rust-bech32
Add const generic to `Hrp` to reduce its size
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 100
- Forks
- 74
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 9
Description
Hrp right now stores an array with 83 bytes and a size on top of that. On 64-bit platform that is 91 byte to carry around, which is unfortunate since in most cases human-readable part is just a few characters.
The size can be changed to just u8 and be sufficient, but I think the bigger problem is max allocation for the buffer upfront. It'd be nice to try and make the size of the buffer const generic, but I'm not yet sure how wide the implications for that will be in terms of API changes.
Originally suggested in https://github.com/rust-bitcoin/rust-bech32/issues/216#issuecomment-2870007981
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the Hrp definition and tracing its constructors, storage, and public API usages. Assess the implications of making the buffer size const-generic, including the existing size representation, then verify that encoding and decoding behavior and the affected API tests remain correct.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100