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

6. refactor(state): split database access into modules by Zebra types #3617

Merged
merged 1 commit into from
Feb 28, 2022

Conversation

teor2345
Copy link
Contributor

Motivation

As part of changing the database, we'll need to make sure all database accesses go through a well-defined API.

As the final step, we split reads and writes into modules by zebra_chain types.

This makes it easier to review changes, because the read and write formats are next to each other.

Solution

Code Movement:

  • split reading and writing into block, transparent, shielded, chain, and metrics modules

Related Cleanups:

  • split genesis note commitment trees from the genesis block check

Related Fixes:

  • only change metrics after we've fully validated the block

Part of ticket #3151.

Based on PR #3607, feel free to move this PR out of draft after it merges.

Review

@oxarbitrage can review this PR.

git diff --color-moved could make the review a lot easier.

Reviewer Checklist

  • Code moves are correct
  • Existing tests pass

Follow Up Work

  • add state snapshot tests - I'll get Janito to review my next PRs
  • start changing the state format

@teor2345 teor2345 added C-cleanup Category: This is a cleanup P-Medium ⚡ A-state Area: State / database changes labels Feb 23, 2022
@teor2345 teor2345 self-assigned this Feb 23, 2022
@codecov
Copy link

codecov bot commented Feb 23, 2022

Codecov Report

Merging #3617 (b990048) into main (4fc10e5) will increase coverage by 0.05%.
The diff coverage is 97.05%.

@@            Coverage Diff             @@
##             main    #3617      +/-   ##
==========================================
+ Coverage   79.94%   80.00%   +0.05%     
==========================================
  Files         281      285       +4     
  Lines       32722    32735      +13     
==========================================
+ Hits        26160    26190      +30     
+ Misses       6562     6545      -17     

@teor2345 teor2345 marked this pull request as draft February 23, 2022 05:42
@teor2345 teor2345 requested a review from oxarbitrage February 23, 2022 05:43
Base automatically changed from db-write-split to main February 25, 2022 08:14
Also split the genesis block check from the genesis note commitment trees.
@teor2345 teor2345 marked this pull request as ready for review February 25, 2022 19:25
@teor2345
Copy link
Contributor Author

@oxarbitrage this PR is ready for review now - it's the last refactor PR.

Thanks for sticking with this!

Copy link
Contributor

@oxarbitrage oxarbitrage left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice one

mergify bot added a commit that referenced this pull request Feb 28, 2022
@mergify mergify bot merged commit f8a4021 into main Feb 28, 2022
@mergify mergify bot deleted the db-area-split branch February 28, 2022 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-state Area: State / database changes C-cleanup Category: This is a cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants