Skip to content

refactor(p2p): use Entrypoint type instead of str#1086

Merged
jansegre merged 1 commit intomasterfrom
refactor/entrypoint-type
Jul 18, 2024
Merged

refactor(p2p): use Entrypoint type instead of str#1086
jansegre merged 1 commit intomasterfrom
refactor/entrypoint-type

Conversation

@jansegre
Copy link
Member

Motivation

Using a str is not ideal.

Acceptance Criteria

  • introduce new Entrypoint class that can be parsed from and converted back to the tcp://hostname:port format, optionally allowing a peer-id (this was already supported): tcp://hostname:port/?id=peer-id
  • introduce Hash class that works as a bytes with fixed length of 32, to be used as base for PeerId class that Entrypoint uses for storing peer-ids (this Hash class can be slowly used in more places in the future)
  • replace every instance of str used as an endpoint description with Entrypoint

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@jansegre jansegre requested review from glevco and msbrogli July 18, 2024 16:08
@jansegre jansegre self-assigned this Jul 18, 2024
@jansegre jansegre force-pushed the refactor/entrypoint-type branch from 7d1ae72 to 53e8b8d Compare July 18, 2024 16:10
@jansegre jansegre force-pushed the refactor/entrypoint-type branch from 53e8b8d to c6cce1d Compare July 18, 2024 16:32
@codecov
Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 77.14286% with 40 lines in your changes missing coverage. Please review.

Project coverage is 85.06%. Comparing base (b3f3d3e) to head (c6cce1d).

Files Patch % Lines
hathor/p2p/manager.py 46.66% 13 Missing and 3 partials ⚠️
hathor/p2p/peer_discovery/dns.py 26.31% 14 Missing ⚠️
hathor/p2p/peer_id.py 62.50% 4 Missing and 2 partials ⚠️
hathor/p2p/resources/add_peers.py 76.92% 2 Missing and 1 partial ⚠️
hathor/p2p/entrypoint.py 98.30% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1086      +/-   ##
==========================================
- Coverage   85.08%   85.06%   -0.03%     
==========================================
  Files         309      310       +1     
  Lines       23396    23468      +72     
  Branches     3529     3544      +15     
==========================================
+ Hits        19906    19962      +56     
- Misses       2790     2806      +16     
  Partials      700      700              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jansegre jansegre force-pushed the refactor/entrypoint-type branch from c6cce1d to 2cf1908 Compare July 18, 2024 19:37
@jansegre jansegre merged commit a77deb3 into master Jul 18, 2024
@jansegre jansegre deleted the refactor/entrypoint-type branch July 18, 2024 19:42
@jansegre jansegre mentioned this pull request Aug 1, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

3 participants