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 HistoryTree into NonEmptyHistoryTree and HistoryTree #2582

Merged
merged 4 commits into from
Aug 10, 2021

Conversation

conradoplg
Copy link
Collaborator

@conradoplg conradoplg commented Aug 6, 2021

Motivation

While working on #2135 I had to use Option<HistoryTree> in a lot of places since the history tree is only created in the Heartwood activation block. I also had to add the same logic in multiple places to create the tree when that block is reached.

Specifications

N/A

Designs

N/A

Solution

This renames HistoryTree into NonEmptyHistoryTree and adds a HistoryTree which is basically a Option<HistoryTree>, and adds a method to push a block and create the tree when needed.

Review

This will block the upcoming #2135 PR.

@teor2345 and @dconnolly will be more familiar with the code being refactored.

Reviewer Checklist

  • Code implements Specs and Designs
  • Tests for Expected Behaviour
  • Tests for Errors

Follow Up Work

Will be used by the upcoming #2135 PR.


This change is Reviewable

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.

I have some questions, and some suggestions for follow-up refactors.

But I can't see anything blocking.

zebra-chain/src/history_tree.rs Outdated Show resolved Hide resolved
zebra-chain/src/history_tree.rs Show resolved Hide resolved
zebra-chain/src/history_tree.rs Outdated Show resolved Hide resolved
zebra-state/src/service/finalized_state.rs Show resolved Hide resolved
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.

All my questions got answered, fixed, or have open tickets for follow up.

@conradoplg conradoplg merged commit 9fc4982 into main Aug 10, 2021
@conradoplg conradoplg deleted the history-tree-refactor branch August 10, 2021 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants