rust-bitcoin / rust-bitcoin/rust-bitcoin
Consistent naming of things such as `as_slice`, `as_array`...
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 2.7k
- Forks
- 1k
- Avg merge
- 4d 39m
- Merged PRs (30d)
- 86
Description
When writing code using bitcoin, bitcoin_hashes and secp256k1 I repeatedly hit the issue when I couldn't remember the names of conversion methods for particular type such as from_bytes or from_slice. E.g. Script has from_bytes and secp256k1::schnorr::Signature has from_slice despite it being byte slice and also statically known length.
It'd be great to have some specific naming rules one could remember and then not have to look up the docs. This also includes having all relevant AsRef, From... conversions. In case of fixed-sized-types we should support arrays, especially for infallible cases.
Somewhat related is we have consensus_encode and consensus::encode::serialize_hex and Encodable trait which goes against the convention of using a verb as trait name (so does serde::Serializer but IDK if that's a sufficient excuse).
One cool thing about std is I can often guess correctly the name even when I'm not sure if a function actually exists. If we could replicate this experience that'd be awesome.
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 inventorying the conversion methods and traits named in the issue across bitcoin, bitcoin_hashes, and secp256k1, including Script and secp256k1::schnorr::Signature. Done means agreeing on consistent naming rules for byte conversions, fixed-size arrays, AsRef and From conversions, and the consensus encoding terminology.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend-api-design, developer-experience
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100