-
Notifications
You must be signed in to change notification settings - Fork 106
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
Make sure scanner database is accessed using the correct types #8112
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
teor2345
added
C-cleanup
Category: This is a cleanup
P-Medium ⚡
A-state
Area: State / database changes
A-blockchain-scanner
Area: Blockchain scanner of shielded transactions
labels
Dec 15, 2023
github-actions
bot
added
the
C-trivial
Category: A trivial change that is not worth mentioning in the CHANGELOG
label
Dec 15, 2023
This was referenced Dec 15, 2023
teor2345
removed
the
C-trivial
Category: A trivial change that is not worth mentioning in the CHANGELOG
label
Dec 16, 2023
github-actions
bot
added
the
C-trivial
Category: A trivial change that is not worth mentioning in the CHANGELOG
label
Dec 17, 2023
upbqdn
approved these changes
Dec 18, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK.
Looks great!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-blockchain-scanner
Area: Blockchain scanner of shielded transactions
A-state
Area: State / database changes
C-cleanup
Category: This is a cleanup
C-trivial
Category: A trivial change that is not worth mentioning in the CHANGELOG
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
During the scanner MVP, it was easy to change the column family's types, but forget to update the code everywhere. There were at least two bugs like this, from two different developers.
Instead, we can make each column family strongly typed, so it can only be accessed using the correct types.
Preparation for #7833, let's document the easier way this PR implements.
PR Author Checklist
Check before marking the PR as ready for review:
If a checkbox isn't relevant to the PR, mark it as done.
API & Rust Reference
https://docs.rs/rocksdb/latest/rocksdb/struct.WriteBatchWithTransaction.html
https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html
https://doc.rust-lang.org/std/marker/struct.PhantomData.html
Complex Code or Requirements
Solution
Production:
Docs & debugging:
Unrelated cleanups:
We can't make the column family name string constant part of the type, because Rust doesn't support String const generics yet.
Testing
This PR is well covered by existing tests, which pass.
Review
This is a routine cleanup/internal enhancement.
Reviewer Checklist
Check before approving the PR:
PR blockers can be dealt with in new tickets or PRs.
And check the PR Author checklist is complete.
Follow Up Work
Use the new
TypedColumnFamily
andWriteTypedBatch
for existing state column families. We might discover some bugs this way.Document how to set up a new column family using these types - #7833