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

change(state): Refactor format upgrades into trait #9263

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

arya2
Copy link
Contributor

@arya2 arya2 commented Feb 18, 2025

Motivation

This PR organizes Zebra's disk format upgrades into trait implementations to make them more maintainable as more upgrades are gradually added.

Closes #7932

Solution

  • Add a new DiskFormatUpgrade trait
  • Implement the trait for each existing disk format upgrade (except for the indexer upgrade which is handled outside the usual db format upgrade process)

Tests

This change should be covered by existing tests for applying db format upgrades.

Follow-up Work

The bundle of db format changes needed to match zcashd's RPC outputs.

PR Author's Checklist

  • The PR name will make sense to users.
  • The PR provides a CHANGELOG summary.
  • The solution is tested.
  • The documentation is up to date.
  • The PR has a priority label.

PR Reviewer's Checklist

  • The PR Author's checklist is complete.
  • The PR resolves the issue.

@arya2 arya2 added C-cleanup Category: This is a cleanup A-state Area: State / database changes C-tech-debt Category: Code maintainability issues P-Medium ⚡ labels Feb 18, 2025
@arya2 arya2 self-assigned this Feb 18, 2025
@arya2 arya2 requested a review from a team as a code owner February 18, 2025 02:59
@arya2 arya2 requested review from conradoplg and removed request for a team February 18, 2025 02:59
fn description(&self) -> &'static str;

/// Runs disk format upgrade.
fn run(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

run_migration() may be a better name for this method.

Comment on lines +55 to +58
///
/// # Panics
///
/// If the state has not been upgraded to this format correctly.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Suggested change
///
/// # Panics
///
/// If the state has not been upgraded to this format correctly.

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 C-tech-debt Category: Code maintainability issues P-Medium ⚡
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat(zebra-db): Refactor format upgrades into a trait
1 participant