feat(metadata): create basic static metadata structures [part 1/12]#1013
Merged
feat(metadata): create basic static metadata structures [part 1/12]#1013
Conversation
3ba0032 to
ce2cc12
Compare
1 task
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1013 +/- ##
==========================================
- Coverage 84.85% 84.79% -0.06%
==========================================
Files 314 315 +1
Lines 23971 24059 +88
Branches 3627 3644 +17
==========================================
+ Hits 20341 20402 +61
- Misses 2916 2938 +22
- Partials 714 719 +5 ☔ View full report in Codecov by Sentry. |
ce2cc12 to
c7a3ff8
Compare
glevco
commented
May 2, 2024
This was referenced May 2, 2024
Merged
079afcc to
17e34da
Compare
17e34da to
3d51375
Compare
3d51375 to
def1db9
Compare
def1db9 to
0f25f2d
Compare
5fb970e to
c428b39
Compare
|
| Report | Wed, August 14, 2024 at 16:44:50 UTC |
| Project | hathor-core |
| Branch | feat/metadata/create-static-metadata-1 |
| Testbed | ubuntu-22.04 |
Click to view all benchmark results
| Benchmark | Latency | Latency Results nanoseconds (ns) | (Δ%) | Latency Lower Boundary nanoseconds (ns) | (%) | Latency Upper Boundary nanoseconds (ns) | (%) |
|---|---|---|---|---|
| sync-v2 (up to 20000 blocks) | ✅ (view plot) | 103,932,344,720.04 (-10.82%) | 93,228,797,009.22 (89.70%) | 139,843,195,513.82 (74.32%) |
Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help
msbrogli
previously approved these changes
Aug 9, 2024
msbrogli
approved these changes
Aug 13, 2024
jansegre
requested changes
Aug 13, 2024
jansegre
approved these changes
Aug 14, 2024
40494a3 to
794d520
Compare
794d520 to
ae9fe2d
Compare
2 tasks
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.
Motivation
This PR is the first one in a new series of PRs that will lead up to the implementation of the Multiprocess Verification project.
In order to implement that project, we need all verification dependencies to be pre-fetched before the verification is sent to another process, for it to be a pure function without side effects (access to the storage). Another complication factor is that we need Sync-V2 to work asynchronously, meaning it can keep retrieving new vertices before their dependencies have been completely verified, through the consensus, and saved.
Considering that verification dependencies include some metadata attributes, those two requirements impose that we must be able to calculate/retrieve those attributes before verification, and that we must do that without access to a storage (as not-yet-verified vertices will only exist in Sync-V2 memory). It is not trivial to implement this with the current metadata structure, as it heavily depends on access to a storage.
We've discussed multiple times that there are different types of metadata attributes mixed together in the current
TransactionMetadataclass, and that they should be separated. Not coincidentally, all metadata attributes that are used in verification are static attributes, meaning that they can be calculated with only the vertex itself and its dependencies, and once set, their values never change.Therefore, this PR introduces the concept of static metadata dataclasses, laying the necessary structure to move those static attributes from existing metadata to static metadata. This will allow us to easily calculate all verification dependencies with optional access to a storage, laying a fundamental change that is necessary for Multiprocess Verification. Also not coincidentally, this solves many other problems that we've faced in the past.
Acceptance Criteria
BaseTransactiontoGenericVertex, accepting a generic static metadata type.static_metadataproperty and initialization methods.VertexandBaseTransactiontype aliases for easiness of use and backwards compatibility.BlockandTransactionaccordingly._save_static_metadata()and_get_static_metadata()methods inTransactionStorageand its subclasses.TransacionStorageto theVerificationService(it's not used in this PR, but will be used in the next one).TransactionStorage.get_transaction_by_height()toget_block_by_height().Checklist
master, confirm this code is production-ready and can be included in future releases as soon as it gets merged