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

STR-949 chainstate manager v2 and minor chainstate restructures #633

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

Conversation

delbonis
Copy link
Contributor

Description

This is a second attempt at doing the chainstate manager now with some better idea of the context, plus some additional types to support work in the other PR. I expect some more things will be copied over that are related and minimally invasive.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature/Enhancement (non-breaking change which adds functionality or enhances an existing one)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Refactor
  • New or updated tests
  • Dependency Update

Notes to Reviewers

Checklist

  • I have performed a self-review of my code.
  • I have commented my code where necessary.
  • I have updated the documentation if needed.
  • My changes do not introduce new warnings.
  • I have added tests that prove my changes are effective or that my feature works.
  • New and existing tests pass with my changes.

Related Issues

@delbonis delbonis requested review from a team as code owners January 23, 2025 23:27
Comment on lines 83 to 94
/// Checks if the epoch is sane.
///
/// Ie. if the terminal blkid is zero then the last slot and epoch number
/// are also zero.
fn sanity_check(&self) -> bool {
if self.is_null() {
self.last_slot == 0 && self.epoch == 0
} else {
self.last_slot != 0
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not include this check in the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe I should just get rid of the sanity check altogether. This special casing isn't well-defined at the moment since it's not actually used in this context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would it work to avoid the sentinel value and use an Option instead? Or does that screw up the commitment call...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It'd be nice to always have a well-defined finalized block so that we don't have to do special casing just for the genesis. Maybe we can rework the interfaces/definitions around this.

@delbonis delbonis requested review from a team as code owners January 24, 2025 19:33
@delbonis
Copy link
Contributor Author

Really happy with the general refactoring I did to the CSM logic, this will hopefully make it simpler to make work when rebasing the changes in the other branch.

@delbonis delbonis requested review from a team as code owners January 24, 2025 20:36
@delbonis
Copy link
Contributor Author

delbonis commented Jan 24, 2025

Still have to simplify the actual db impls to remove the now-unnecessary chainstate tables/fields.

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