`PeerId::from_bytes` should be const
Open
Nobody has claimed this yet.
help wanted
- Dominant language
- Rust
- Stars
- 5.6k
- Forks
- 1.3k
- Avg merge
- 8h 47m
- Merged PRs (30d)
- 19
Description
Description
There's currently no way to create a PeerId in a const context.
Motivation
I'm writing unit tests, and I need a global PeerId shared between tests. A const peer id would be great for this.
Current Implementation
My work around is just to call PeerId::from_bytes every time using the same bytes.
Are you planning to do it yourself in a pull request?
No
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 locating the implementation of PeerId::from_bytes and inspect its validation and dependencies. Check whether the existing tests cover constructing a PeerId from fixed bytes, then add coverage for const-context construction. Done means the same API can be used to define a global PeerId without repeated runtime calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100