rust-bitcoin / rust-bitcoin/rust-miniscript
`checksum` module needs some love
Open
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 426
- Forks
- 200
- Avg merge
- 7d 17h
- Merged PRs (30d)
- 8
Description
After working on https://github.com/rust-bitcoin/rust-miniscript/pull/608 I noticed a few things:
- We seem to be using
fmt::Write::write_strwith the implied suggestion that we avoid allocation of a string but I think thatfmt::Argumenst::as_str()gets called and only avoids allocation for static strings (no uses of placeholders{}), since we always use{}I'm reasonably confident that this is allocating. - There are some optimisation possibilities by using iterator adapters instead of strings, ie take an iterarator of chars and yield the chars + # + the checksum.
- The public API is a bit messy:
checksum::Formattershould not be public because it is not really a general purpose formatter, it is specifically for writing a descriptor to a formatter and overriding the use ofalternateto control the addition of the checksum.descriptor::checksum::desc_checksumcould be better named as coulddescriptor::checksum::verify_checksumto use Rust naming convention (ie., users should be using a single path on functions sochecksum::verifyseems better, not sure about the other one.
- Error handling could be improved if/when we start to do errors elsewhere
Related:
- #323
- #554
Contributor guide
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 reading the checksum module and the discussion in related issues #323 and #554. The issue lists allocation, iterator, public API, naming, and error-handling concerns but does not identify files, tests, or an agreed subset of work. Confirm scope and completion criteria with maintainers before making changes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, performance
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100