-
Notifications
You must be signed in to change notification settings - Fork 259
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
Verifies accounts lt hash at startup #3145
Conversation
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.
lgtm
14b166d
to
56b6974
Compare
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.
lgtm.
let actual = calculated_accounts_lt_hash.0.checksum(); | ||
assert_eq!(expected, actual, "expected: {expected}, actual: {actual}"); | ||
#[test] | ||
fn test_calculate_accounts_lt_hash_at_startup_from_storages() { |
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.
+1 nice test!
I had to rebase and force push to address merge conflicts. No code was changed. |
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.
lgtm
Problem
Eventually, the accounts lt hash will not be recalculated at startup. Instead, we'll get the initial accounts lt hash from the snapshot (or equivalent). When that happens, we will still want to verify the accounts, and we'll want that to happen in the background, similar to today with the full accounts hash calculation. Currently there is not a way to verify the accounts lt hash that is suitable for running in the background.
Summary of Changes
Add a function to calculate the accounts lt hash from storages. Use that to verify the accounts lt hash at startup in the background.
Additional Testing
In addition to the tests in the PR, I ran this code against mnb on a dev box. This calculates the accounts lt hash from the index first, then verifies from storages second. This was successful (hashes matched). The verification step took approximately the same amount of time as the normal accounts hash verification (full + incremental).