refactor(sync-v2): implement P2PStorage and P2PVertexHandler [part 9/12]#1024
Open
glevco wants to merge 1 commit intorefactor/verification-dependencies-8from
Open
refactor(sync-v2): implement P2PStorage and P2PVertexHandler [part 9/12]#1024glevco wants to merge 1 commit intorefactor/verification-dependencies-8from
glevco wants to merge 1 commit intorefactor/verification-dependencies-8from
Conversation
1 task
glevco
commented
May 6, 2024
| all_valid = False | ||
| if meta.validation.is_invalid(): | ||
| # or any of them is invalid (which would make this one invalid too) | ||
| return True |
Contributor
Author
There was a problem hiding this comment.
Shouldn't we return False here?
1 task
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## refactor/verification-dependencies-8 #1024 +/- ##
========================================================================
+ Coverage 84.66% 84.67% +0.01%
========================================================================
Files 302 304 +2
Lines 23146 23184 +38
Branches 3515 3515
========================================================================
+ Hits 19596 19631 +35
- Misses 2865 2868 +3
Partials 685 685 ☔ View full report in Codecov by Sentry. |
326d107 to
aad0eab
Compare
c35d431 to
98c0ab6
Compare
aad0eab to
f28c610
Compare
98c0ab6 to
197c056
Compare
f28c610 to
5811a89
Compare
2c96d59 to
380b917
Compare
5811a89 to
3d42e7a
Compare
380b917 to
df7d74e
Compare
3d42e7a to
8416913
Compare
df7d74e to
bfc28b4
Compare
8416913 to
62be7c0
Compare
bfc28b4 to
0f41024
Compare
b5ecc17 to
7c88858
Compare
ee62d62 to
8aa59d5
Compare
7c88858 to
b79c048
Compare
8aa59d5 to
2fda7b7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #1023
Motivation
This PR begins a refactor in Sync-v2 that will allow it to work asynchronously, meaning it can receive and download vertices from other peers even if previously received vertices have not been verified, through the consensus, and saved yet. This is necessary for the Multiprocess Verification project.
In order to do this, each agent saves received vertices in a memory storage local to only that agent. After a vertex completes the pipeline, it is saved in the persisted
TransactionStorageand removed from the agent-specific memory storage.This PR introduces the
P2PStorageclass, which is an abstraction layer over theTransactionStorage, and in the next PR an async version of this class will be implemented with in-memory capabilities. This is done by providing two method versions for each storage method that is used by Sync-v2: one "local" and one "non-local". Generally speaking, when downloading vertices, an agent uses "local" methods — meaning it can use its in-memory data to advance the sync. Conversely, when uploading vertices, the agent uses "non-local" methods, which are simply a forward to the persisted storage.A similar abstraction is introduced for
VertexHandler, by theP2PVertexHandlerclass. It is a single point of contact for Sync-v2 when handling new vertices.Acceptance Criteria
P2PStorage, an abstraction overTransactionStorageand indices to be used in Sync-v2.P2PVertexHandler, and abstraction overVertexHandlerto be used in Sync-v2.P2PStoragemethod.BaseTransaction.can_validate_fullto the storage.traversalmodule so it can receive the more genericVertexStorageProtocolinstead of aTransactionStorage.Checklist
master, confirm this code is production-ready and can be included in future releases as soon as it gets merged