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

Verifies accounts lt hash at startup #3145

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

brooksprumo
Copy link

@brooksprumo brooksprumo commented Oct 11, 2024

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).

@brooksprumo brooksprumo self-assigned this Oct 11, 2024
@brooksprumo brooksprumo marked this pull request as ready for review October 11, 2024 23:17
jeffwashington
jeffwashington previously approved these changes Oct 14, 2024
Copy link

@jeffwashington jeffwashington left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link

@HaoranYi HaoranYi left a 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() {

Choose a reason for hiding this comment

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

+1 nice test!

@brooksprumo
Copy link
Author

I had to rebase and force push to address merge conflicts. No code was changed.

@jeffwashington jeffwashington self-requested a review October 14, 2024 15:49
Copy link

@jeffwashington jeffwashington left a comment

Choose a reason for hiding this comment

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

lgtm

@brooksprumo brooksprumo merged commit a66b023 into anza-xyz:master Oct 14, 2024
40 checks passed
@brooksprumo brooksprumo deleted the lthash/verify branch October 14, 2024 16:16
ray-kast pushed a commit to abklabs/agave that referenced this pull request Nov 27, 2024
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.

3 participants