-
Notifications
You must be signed in to change notification settings - Fork 24
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(sync-v2): implement P2PStorage and P2PVertexHandler [part 9/12] #1024
base: refactor/verification-dependencies-8
Are you sure you want to change the base?
refactor(sync-v2): implement P2PStorage and P2PVertexHandler [part 9/12] #1024
Conversation
all_valid = False | ||
if meta.validation.is_invalid(): | ||
# or any of them is invalid (which would make this one invalid too) | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we return False
here?
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
0f41024
to
ee62d62
Compare
ee62d62
to
8aa59d5
Compare
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
TransactionStorage
and removed from the agent-specific memory storage.This PR introduces the
P2PStorage
class, 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 theP2PVertexHandler
class. It is a single point of contact for Sync-v2 when handling new vertices.Acceptance Criteria
P2PStorage
, an abstraction overTransactionStorage
and indices to be used in Sync-v2.P2PVertexHandler
, and abstraction overVertexHandler
to be used in Sync-v2.P2PStorage
method.BaseTransaction.can_validate_full
to the storage.traversal
module so it can receive the more genericVertexStorageProtocol
instead of aTransactionStorage
.Checklist
master
, confirm this code is production-ready and can be included in future releases as soon as it gets merged