Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(p2p): implement P2PDependencies class [part 6/11] #1152

Open
wants to merge 5 commits into
base: refactor/p2p/pre-ipc-refactors
Choose a base branch
from

Conversation

glevco
Copy link
Contributor

@glevco glevco commented Oct 9, 2024

Depends on #1165

Motivation

The goal of this PR is to isolate the sync so all its dependencies to the rest of the full node are in a single class, P2PDependencies. This means that every method that the sync called in the storage, in indexes, in the vertex handler, etc, are moved to this new class.

Then, this class will serve as a proxy between the sync and the node. When the sync is moved to a subprocess, this class will serve as an interface to perform IPC or any other form of communication, and everything will be transparent to existing sync classes.

Acceptance Criteria

  • Create P2PDependencies class and respective protocols to abstract each dependency.
  • Change all P2P-related classes so they receive a P2PDependencies instance instead of individual dependencies.
  • Move capabilities from HathorManager to P2PDependencies.
  • Move whitelist_only from ConnnectionsManager to P2PDependencies.
  • The sync process does not set a tx_storage in vertices anymore.
  • No changes in behavior.

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

@glevco glevco added the refactor label Oct 9, 2024
@glevco glevco self-assigned this Oct 9, 2024
@glevco glevco force-pushed the refactor/p2p/simplify-factory branch from e5cdc20 to c57665b Compare October 9, 2024 21:07
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 055ee2b to 02f4846 Compare October 9, 2024 21:07
@glevco glevco force-pushed the refactor/p2p/simplify-factory branch from c57665b to 3967a8f Compare October 9, 2024 21:09
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 02f4846 to 717cff3 Compare October 9, 2024 21:11
@glevco glevco force-pushed the refactor/p2p/simplify-factory branch from 3967a8f to 48a4de4 Compare October 9, 2024 23:35
@glevco glevco force-pushed the refactor/p2p/dependencies branch 3 times, most recently from 841444b to 510a1f3 Compare October 10, 2024 00:49
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

Attention: Patch coverage is 90.47619% with 18 lines in your changes missing coverage. Please review.

Project coverage is 84.85%. Comparing base (97652fe) to head (1fff2ad).

Files with missing lines Patch % Lines
hathor/p2p/dependencies/protocols.py 36.84% 0 Missing and 12 partials ⚠️
hathor/p2p/states/peer_id.py 60.00% 1 Missing and 1 partial ⚠️
hathor/p2p/sync_v1/agent.py 93.10% 0 Missing and 2 partials ⚠️
hathor/p2p/states/hello.py 80.00% 0 Missing and 1 partial ⚠️
hathor/p2p/sync_v2/agent.py 96.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                        Coverage Diff                         @@
##           refactor/p2p/pre-ipc-refactors    #1152      +/-   ##
==================================================================
+ Coverage                           84.82%   84.85%   +0.03%     
==================================================================
  Files                                 317      320       +3     
  Lines                               24444    24462      +18     
  Branches                             3698     3709      +11     
==================================================================
+ Hits                                20734    20757      +23     
+ Misses                               3003     2990      -13     
- Partials                              707      715       +8     

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

@glevco glevco force-pushed the refactor/p2p/dependencies branch from 510a1f3 to 72b2f79 Compare October 10, 2024 15:18
@glevco glevco changed the base branch from refactor/p2p/simplify-factory to refactor/move-can-validate-full October 10, 2024 15:18
@glevco glevco changed the base branch from refactor/move-can-validate-full to refactor/vertex-handler/remove-p2p-manager October 10, 2024 16:13
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 72b2f79 to 0518c0a Compare October 10, 2024 16:16
@glevco glevco force-pushed the refactor/vertex-handler/remove-p2p-manager branch from 10cad94 to 4da7ddb Compare October 10, 2024 16:56
@glevco glevco force-pushed the refactor/p2p/dependencies branch 3 times, most recently from 50b73f2 to a6a9480 Compare October 10, 2024 18:18
@glevco glevco force-pushed the refactor/vertex-handler/remove-p2p-manager branch from 4da7ddb to bb13031 Compare October 10, 2024 20:01
@glevco glevco force-pushed the refactor/p2p/dependencies branch 4 times, most recently from 375eee0 to 77d2710 Compare October 10, 2024 20:28
@glevco glevco force-pushed the refactor/vertex-handler/remove-p2p-manager branch from bb13031 to 3c767f7 Compare October 10, 2024 20:34
@glevco glevco force-pushed the refactor/p2p/dependencies branch 2 times, most recently from 6b742bc to e5478b7 Compare October 10, 2024 20:38
@glevco glevco changed the title p2p dependencies refactor(p2p): implement P2PDependencies class Oct 10, 2024
@glevco glevco marked this pull request as ready for review October 10, 2024 20:50
@glevco glevco requested a review from jansegre as a code owner October 10, 2024 20:50
@glevco glevco changed the base branch from feat/reactor-process-socket to refactor/remove-vertex-storage-protocol October 23, 2024 00:35
@glevco glevco force-pushed the refactor/remove-vertex-storage-protocol branch from 69d0842 to a36b0c6 Compare October 23, 2024 00:42
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 6e13bb7 to 0b86412 Compare October 23, 2024 00:44
@glevco glevco force-pushed the refactor/remove-vertex-storage-protocol branch from a36b0c6 to 5234061 Compare October 23, 2024 03:59
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 0b86412 to 81565b1 Compare October 23, 2024 04:00
@glevco glevco changed the title refactor(p2p): implement P2PDependencies class [part 6/8] refactor(p2p): implement P2PDependencies class [part 7/8] Oct 23, 2024
@glevco glevco changed the base branch from refactor/remove-vertex-storage-protocol to refactor/p2p/pre-ipc-refactors October 23, 2024 16:26
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 81565b1 to e7a4cf1 Compare October 23, 2024 16:30
@glevco glevco changed the title refactor(p2p): implement P2PDependencies class [part 7/8] refactor(p2p): implement P2PDependencies class [part 5/8] Oct 23, 2024
@glevco glevco force-pushed the refactor/p2p/dependencies branch 3 times, most recently from afffb92 to e0fb633 Compare October 23, 2024 17:22
@glevco glevco force-pushed the refactor/p2p/pre-ipc-refactors branch from dfa95ea to bcab3c6 Compare October 27, 2024 21:25
@glevco glevco force-pushed the refactor/p2p/pre-ipc-refactors branch from bcab3c6 to b8a851b Compare November 5, 2024 18:10
@glevco glevco changed the base branch from refactor/p2p/pre-ipc-refactors to working-master/p2p-165+1165 November 5, 2024 18:34
@glevco glevco force-pushed the refactor/p2p/dependencies branch from e0fb633 to d12e8b0 Compare November 5, 2024 18:39
@glevco glevco changed the title refactor(p2p): implement P2PDependencies class [part 5/8] refactor(p2p): implement P2PDependencies class [part 6/10] Nov 6, 2024
@glevco glevco changed the base branch from working-master/p2p-165+1165 to refactor/p2p/pre-ipc-refactors November 6, 2024 15:27
@glevco glevco force-pushed the refactor/p2p/dependencies branch from d12e8b0 to 8e22ef6 Compare November 6, 2024 15:28
@glevco glevco force-pushed the refactor/p2p/pre-ipc-refactors branch from 901e292 to 3b27e43 Compare November 7, 2024 01:58
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 8e22ef6 to 56993b9 Compare November 7, 2024 01:58
@glevco glevco changed the title refactor(p2p): implement P2PDependencies class [part 6/10] refactor(p2p): implement P2PDependencies class [part 6/11] Nov 7, 2024
@glevco glevco force-pushed the refactor/p2p/pre-ipc-refactors branch from 3b27e43 to 97652fe Compare November 8, 2024 15:45
@glevco glevco force-pushed the refactor/p2p/dependencies branch from 56993b9 to 1fff2ad Compare November 8, 2024 15:45
@glevco glevco force-pushed the refactor/p2p/pre-ipc-refactors branch from 97652fe to 5f45ef6 Compare November 25, 2024 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

1 participant