libp2p / libp2p/py-libp2p

Implement Protocol code constants usage instead of magic numbers

Open
#1,202 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
624
Forks
256
Avg merge
1d 34m
Merged PRs (30d)
47

Description

Description

To use Protocol code constants instead of magic numbers, some code use protocol name as strings, protocol codes are available but not used consistently.

Tasks

  • Replace the protocol names usage with Protocol code which will be type safe, better performance as integer comparison vs string
  • This will prevents typos, IDE autocomplete support and better code readability.

Are you planning to do it yourself in a pull request ?

Yes, @seetadev @acul71. Pls review it and let me know

Contributor guide

Open the contributing guide

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.

Research direction

The issue names no files, tests, or entry points. Search the Python codebase for protocol-name string comparisons and identify the corresponding Protocol constants; done means the relevant protocol checks consistently use those constants and the existing test suite passes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.