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

Removes checks for bank_hash_stats in test #30480

Merged

Conversation

brooksprumo
Copy link
Contributor

Problem

AccountsDb::bank_hash_stats is a map of Slot -> BankHashStats. These stats are somewhat special, in that a default value is inserted into the map whenever a new bank is created (from parent). We also have a redundant insert-default whenever store() is called. And lastly new AccountsDb's will insert a default value at slot 0 too. This pre-usage insert-default-value behavior has one potential use: logging an error if a new bank was created with the same slot as a pre-existing one. To check for that case, bank_hash_stats is consulted. This case can happen in unusual forking, and is present in the local-cluster test_optimistic_confirmation_violation_detection test.

Looking up the bank_hash_stats is used in test_handle_dropped_roots_for_ancient() as a way to check if the slot is present or not. The test has other checks to see if the root is dropped, and the bank_hash_stats is not needed here. By using bank_hash_stats, it prevents removing the pre-usage insert-default-value behavior.

(The longer story is that these stats are also stored in snapshots, even though they aren't even used/needed, and I'd like to remove them there also. Incremental changes though!)

Summary of Changes

Remove the calls to get_bank_hash_stats() inside test_handle_dropped_roots_for_ancient(), which already has other way to assert its invariants.

@brooksprumo brooksprumo self-assigned this Feb 23, 2023
@brooksprumo brooksprumo marked this pull request as ready for review February 23, 2023 23:34
Copy link
Contributor

@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 e0abad4 into solana-labs:master Feb 24, 2023
@brooksprumo brooksprumo deleted the bank-hash-stats/test-ancient branch February 24, 2023 19:35
nickfrosty pushed a commit to nickfrosty/solana that referenced this pull request Mar 12, 2023
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