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): Make the types for finalized blocks consistent #7923

Merged
merged 4 commits into from
Nov 8, 2023

Conversation

upbqdn
Copy link
Member

@upbqdn upbqdn commented Nov 8, 2023

Motivation

Close #7273. I initially wanted to summarize the discussion that the issue points to in the issue description, but I ended up fixing the code itself because I thought it was easier.

The issue was that we were using SemanticallyVerifiedBlock and SemanticallyVerifiedBlockWithTrees for blocks that the finalized state commits to its database. Doing so is not what we want because, as Teor said:

Also, I don't think we should be downgrading verification status from contextual or checkpoint to semantic, unless it's a quick downgrade using into(), and then calling a common verification function. Most of the time we've already done that verification on those types though!

PR Author Checklist

  • Will the PR name make sense to users?
  • Does the PR have a priority label?
  • Have you added or updated tests?
  • Is the documentation up to date?

Solution

  • Use a new structure called FinalizedBlock instead of SemanticallyVerifiedBlockWithTrees, and also use it when writing a finalized block into the database.
  • This PR doesn't really change any logic in the state. It is only a structural refactor.

Reviewer Checklist

Check before approving the PR:

  • Does the PR scope match the ticket?
  • Are there enough tests to make sure it works? Do the tests cover the PR motivation?
  • Are all the PR blockers dealt with?
    PR blockers can be dealt with in new tickets or PRs.

And check the PR Author checklist is complete.

@upbqdn upbqdn added A-rust Area: Updates to Rust code C-enhancement Category: This is an improvement P-Low ❄️ A-state Area: State / database changes C-tech-debt Category: Code maintainability issues labels Nov 8, 2023
@upbqdn upbqdn requested a review from teor2345 November 8, 2023 00:06
@upbqdn upbqdn self-assigned this Nov 8, 2023
@upbqdn upbqdn requested a review from a team as a code owner November 8, 2023 00:06
teor2345
teor2345 previously approved these changes Nov 8, 2023
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Thanks for this, I have some optional suggestions about standard trait derives (and documenting them).

zebra-chain/src/parallel/tree.rs Outdated Show resolved Hide resolved
zebra-state/src/request.rs Outdated Show resolved Hide resolved
Co-authored-by: teor <teor@riseup.net>
@teor2345
Copy link
Contributor

teor2345 commented Nov 8, 2023

I added the CI failure to ticket #7898 because it seemed very similar.

mergify bot added a commit that referenced this pull request Nov 8, 2023
@mergify mergify bot merged commit 2fad357 into main Nov 8, 2023
102 checks passed
@mergify mergify bot deleted the fix-SemanticallyVerifiedBlockWithTrees branch November 8, 2023 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rust Area: Updates to Rust code A-state Area: State / database changes C-enhancement Category: This is an improvement C-tech-debt Category: Code maintainability issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make the types for finalized blocks consistent
2 participants