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(storage): create StorageProtocol #922

Merged
merged 1 commit into from
Jan 19, 2024
Merged

Conversation

glevco
Copy link
Contributor

@glevco glevco commented Jan 12, 2024

Motivation

To externalize storage dependencies from the verification process, we need to inject a storage into some methods used in verification, so it can either receive a TransactionStorage (rocksdb), or a simple memory storage that will be implemented in next PRs. To unify both of them in a single interface, a Python protocol is introduced, StorageProtocol.

Acceptance Criteria

  • Create StorageProtocol, a protocol for unifying a subset of storage methods.
  • Add methods to TransactionStorage so it conforms to the StorageProtocol.
  • Update DAA so its calculation depends on a StorageProtocol, and update usages accordingly.
  • Update Reward Lock Transaction methods so they depend on a StorageProtocol, and update usages accordingly.

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 self-assigned this Jan 12, 2024
@glevco glevco marked this pull request as ready for review January 12, 2024 15:43
Copy link

codecov bot commented Jan 12, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (master@a653335). Click here to learn what that means.

Files Patch % Lines
hathor/manager.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #922   +/-   ##
=========================================
  Coverage          ?   85.38%           
=========================================
  Files             ?      288           
  Lines             ?    22392           
  Branches          ?     3372           
=========================================
  Hits              ?    19119           
  Misses            ?     2604           
  Partials          ?      669           

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

jansegre
jansegre previously approved these changes Jan 12, 2024
hathor/transaction/storage/storage_protocol.py Outdated Show resolved Hide resolved
hathor/transaction/storage/storage_protocol.py Outdated Show resolved Hide resolved
hathor/transaction/transaction.py Outdated Show resolved Hide resolved
@glevco glevco force-pushed the refactor/storage-protocol branch from b00ac06 to 0babd4f Compare January 15, 2024 19:19
jansegre
jansegre previously approved these changes Jan 16, 2024
msbrogli
msbrogli previously approved these changes Jan 19, 2024
@glevco glevco force-pushed the refactor/storage-protocol branch from edcaf56 to 2044574 Compare January 19, 2024 15:28
@glevco glevco dismissed stale reviews from jansegre and msbrogli via 6151b38 January 19, 2024 15:39
@glevco glevco force-pushed the refactor/storage-protocol branch 2 times, most recently from 6151b38 to 79dbc63 Compare January 19, 2024 17:25
@glevco glevco force-pushed the refactor/storage-protocol branch from 79dbc63 to 30c055b Compare January 19, 2024 19:01
@glevco glevco merged commit 9d042eb into master Jan 19, 2024
12 checks passed
@glevco glevco deleted the refactor/storage-protocol branch January 19, 2024 20:42
@jansegre jansegre mentioned this pull request Jan 30, 2024
2 tasks
@jansegre jansegre mentioned this pull request Feb 26, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants